Some time ago I had an idea to create electronic fireworks. This is a somewhat similar idea; it is a small little project to fire off laser diodes by a simple program. I use an avr and a couple of laser diodes, a small power board and a battery. Since I'm a very lazy person, this will not involve charlyplexing. The code is dirty and is not actually really random or fancy and can be improved upon; it just gets the job done of firing diodes in certain patterns.
I've put the thing together, and it still works. I've added a 9v battery and a small power board set for 4.85v :)
For anyone trying to do this, please note: this is not the proper way to do this. Stressing parts over their limits makes them break, even if the parts are so good they can take it. I guess this will not last a long time.
Currently I am looking into getting some randomness into the tiny system. I quickly found out that the randomness I used in the program wasn't that at all.
Of course it is very logical that a system that is designed to specifically do a finite type of things, and -not something else- just indeed does the finite type of things and that's it. In that way you won't get bugs, it is designed to be static, so it will be static, very handy. To make a static system do something unstatic (is that a word? ok "dynamic"), like generating a real random number is a little harder.
Even so when using an avr.
Reading a bit on randomness using an avr, I landed on a few pages that describe this problem, questions were asked and answered (as this is not new, but it is for me) and I found some solutions that people have made in the past for this problem.
As per usual, I compiled a list of pages (file: listofpages.txt) that I visited and found some code to play with (see docs-link on the left).
I found getting some randomness into the system by reading the ADC a couple of times, and using the results as a seed quite interesting.
As for my solution to this problem, I am going to test reading some static on the ADC on another avr (with serial, so I can printf some characters) to see if that yields significant results.
While I'm still waiting on the laser diodes to arrive, I've made a simple setup with LED's, and made a little program that seems good enough to do the job. Again, nothing fancy, and yes this is all quite simple. So while the code is done and seems to work good enough, I can continue about my business... and you can too!
..pondering what I should use as smoke.. or mirrors perhaps...god this will blind people.. let's point them upwards ..
Oh and the fibers are for interesting displayal of more but tiny lasor beamz.
This should be straight forward for the test setup.
Place AVR on breadboard. Connect your programmer correctly. Connect some LED's and ofcourse power. Write some code (see code on the left) Look up the fuses at e.g. http://www.engbedded.com/fusecalc/ Get your fuses right. make install-fuses make install
It is a bit more specific with the board setup, as follows:
Place avr on the perf board and solder the islands and the reverse side. Place pin/headers on the perf board and solders the islands reverse side. Take the power board, add some pin/headers solder them to it, and solder the islands to the reverse side of the perf board. Now I have an avr with headers next to it. on the perf board side connect the pin/headers to the avr pins with solder. Now we have our basic setup on the board.
From there you can solder wires with female headers to the diodes and places them on any pin you like, as in you are free to change it later. That, and, you can still program your avr if you need to, since you can just still connect to miso, mosi and sck if needed.
I didn't feel like doing the same to the ground wires of the diodes, they just go to 'a ground' on the board (see project picture).
I added a 9v battery lead to the power board so everything is powered, and adjusted the power board to 4.85v as that seemed enough to power the diodes/pattern well enough and not burn the avr or diodes to cinders. Ground goes to the 4.85v output ground side of the power board.
I used some nuts and bolt to squeeze the 9v battery under the components board by another board.
After adjusting power, I connected the output to the avr, and the system began to run.
Not that I feel very negligent about not putting in some caps for power, or resistors and transistors for switching on/off the diodes, or not connecting !reset, etcetera, but alas, avr's work their way through a lot of not-supposed-to situations. Good for us.
The final product needs a casing:
Found a transparant plastic sphere in two halves, that fit together nicely, and just glued the diodes from the inside to shine outwards. Taped the diode to the fibers, drilled a hole big enough so I could lead the fibers through said hole. Connected the battery and watched the show :) have fun all, later!