LED randomizer

Gary

Resin Comando
Joined
May 10, 2009
Messages
91
How would I go about building a LED randomizer. Purpose... Well, imagine a war ship in space with holes in it and fires raging in the holes and spaces as the damage control parties try to bring the ship back from the brink. Remember the pilot to the new Battlestar Galactica when she got hammers and Ty had to vent the spaces on fire to save the ship? I don't want to vent the ship. With a series of red yellow and white LEDs attached to a randomizer, you could make fires seem to appear. I am told it's simple... so yeah. How simple is it?
 
cmos chips is the simple answer. Learning cmos is the complicated drawn out version I still have as yet to master.

Another option is checking your local dollar store. I found 'flickering led candles' for $1 each. They are orange and flicker like flame which will be perfect when I do something similar to what you are going for.

A more expensive version of that is to hit your local train shop as they will have prewired stuff like that in many train scales. Expect to pay mondo moola though, relatively speaking.
 
Google found me this - I haven't tried this circuit myself, but generally speaking I think railroad modelers know their stuff when it comes to wiring and lighting effects. If you build this circuit yourself and power it from a 5V source you can leave out the 78L05 (voltage regulator) and all the stuff to the left of it.

Of course, if I were doing this myself, I'd just use a microcontroller to accomplish the same thing. I work mostly with PICMicros, in part because I feel like they have a better selection of small parts... But AVRs would probably be a better place to start - you can program them with very little specialized hardware if your PC has a true (not USB) serial port or parallel port, and you can compile C code for an AVR using the GCC compiler, which is great if you don't want to code assembly...

This is the thing that always gets me these days when people talk about doing this kind of effect with ICs like the 555 and logic ICs... It's true those old ICs are dirt-cheap and it's good to know how to work with 'em - those three chips in the design I linked can probably be had for $0.75 each or less. But look at how fast the circuit grows as you add little bits of complexity... I mean, this guy created a circuit that can flicker one LED pseudo-randomly - and it took him three ICs to do it. If he wanted to flicker two LEDs independently, the circuit would grow to almost double-size... Kick that number up to 8 or so and you're pushing the limits of what can physically fit into a smallish model like the 1:1000 NCC-1701... If you wanted to make the effect better as well, you could expect to double the size of the circuit again...

By way of comparison, for two dollars you could buy a small microcontroller, capable of running at 2MHz with no external components, as small as or smaller than the 555 alone, and capable of doing the same job, just as well, or better than that TTL version... A microcontroller could, for instance, create a distinct sequence like this for each of its I/O lines (that would be 5 or 6 outputs on an 8-pin chip), or create a more complicated sequence - and all you need to do is write the program to do it...
 
Incidentally - I wrote a PIC program that should be equivalent to the "fire effect" circuit I linked, to see how the effect would look... I think the quality of the effect varies a bit depending on how fast it's run... I ran it at around 30 Hz and I think the effect was pretty good. It's not a true random sequence, of course, and if you run it for a certain amount of time it will loop back to its original state... The circuit can only take on 256 possible states (8 bits in the shift register) and I think the sequence as run actually goes through about 220 states before looping back to the beginning... So if you watched the blinky for about 7 seconds, and then watched it for another 7 seconds, you should see the same pattern repeat... But in practice I can't spot it. I'd say it's "random enough" for the effect... Though if I were running multiple flickering LEDs in a single display I might worry that their patterns would look too similar... Something to test, I think.

(EDIT): And for more fun, here's a Wikipedia article on this type of random number generation: it's called Linear Feedback Shift Register. One of its big advantages is that it's easy to implement in hardware (as with the circuit I linked) or on simple microcontrollers like the PIC.
 

Latest posts

Back
Top