Lasertag: single core 328, dual core 328, arduino DUE

This will be a short story, but all are invited to read and shed opinion.

I have made an arduino powered Lasertag system. It works, it works nicely, the game is fun to play. It's made by a large group of people, who are learning how to solder and how to work metal. There is a wish for more goodies. I'm deliberating in what direction I want to take the project.

The current system

Runs on a single atmega328, has a 16x2 character LCD controlled through a 595 shift register. 10kHz 8bit mono wav files are played from a flash memory chip, connected through SPI. An SPI controlled DAC is necessary for the audio output, because all timers are taken: timer 0 for systemfunctions (millis() and such, starting the project I didn't dare to alter that), timer 1 for IR library, timer 2 for IR PWM output (36kHz). Then a lot of pins for leds and buttons, I pretty much use every pin. This runs fine.

Upgrades wishlist A better display, say (I) 128x64 monochrome OLED, or perhaps (II) 128x160 color TFT. Now (I) is easier, because monochrome takes less time to control than full color display. NRF24 radio connection, though preliminary tests show reception while playing is not terrific The use of micro sd flash cards to store sounds, so it's easier to change them Dump the DAC, it's fairly expensive, or replace it with SMD variant

Now I have tried to think of several ways to implement this all. There will be some sort of a tradoff between costs, easy programming, future proofness (English not being my native language allows me to create words ;) ), and level of hobbyness (the amount of which you actually build stuff yourself versus buying it). So my three main options.

Single core with one 595 shift register I try and jam it all into a single core. I hijack timer 0 for audio PWM, will have to convince all other parts how to use millis() again. Or use another external DAC for audio output, but that will be an extra module, it will cost (a bit). Then I have to read a WAV file @ 10kHz from an SD card. All my playing around with SD card libraries tell me reading will take a fair amount of time, and I'm still not sure whether reading from an SD card takes 512 bytes of memory (or if it's only the writing that needs a block). This might work. Then there has to be enough CPU time left for all the other stuff to run. Driving the (I) OLED will take more time than my 16x2 character display, but I guesstimate that will be okay.

Dual core, sort offish Someone on the forums already mentioned: a small pro mini clone is less than $3. I can't even buy a 28 DIP atmega328 for that money. I outsource the WAV playing to the extra pro mini board, which reads from an SD card and uses a PWM pin for audio playback. It's controlled through SPI. No DAC needed. As an extra, I can use the pro mini as a 595 shift register simulator to get some extra pins. So my 595 disappears from the equation as well. I tested this: it works. I thought about letting the pro mini drive my display as well, but since I use the HW pins to talk to the pro minim the pro mini has to use SW pins to control the SD card and the OLED. The OLED might work, but the full color TFT is slow. So basically: $3 to make the programming easier, and free up the primary core. Minus the costs for DAC and 595, which at the moment exceed $3.

Arduino DUE I ordered a board, just to play with it. It will probably solve all problems, being 84 MHz and having tons of memory and flash space. It just seems a bit of an overkill, and you can't really... make it yourself? Granted, buying the pro mini is also not buying it yourself, but the students building the project are brought up with arduinos (atmega328), so it seems more fitting to use that, even if it's two instead of one. Powering a DUE board... haven't figured out how once it is included in a lasertagger. Color TFT's are easily implemented with this bigger processor, so I have to forego these I think when using atmega328.

Finally: there is just so much we can add to the system. It's finite. As soon as we start thinking about GPS and such it might be more beneficial to make a BT connection with a smartphone and start running programs on that. So not being able to drive a 40" TV with the lasertag system: so be it.

I don't expect any specific guidance, but am very interested on your takes on a project like this and the choice I will make in the near future.



It seems rather odd that you would post about your project and not post any code or schematics and then ask for opinions. If you want to post your project in the Exhibition Gallery I am sure it would be welcome, but if you come here asking for opinions you should post the schematic and code. Without that , I don't know what kind of feedback you could expect to get.

I don't know what to expect either. I do have a question, and I couldn't actually find a better category to place it under, perhaps it should be under Gallery. My question comes largely down to: Is upgrading to DUE worth the hassle/money if you can accomplish the same with two atmega328's?

By ATmega328s you mean the chips, right? You do realize that there is no point in posting in the Gallery WITHOUT the code & schematic , right?

Yes, I mean the chips.

I do, exactly the reason why I haven't yet, seeing that it is not presentable yet. If I stick to one or two atmega328 chips I'll clean up code, clean up schematics and post, if I switch over to DUE I will have to rewrite code a bit and make entirely new schematics :P