# I want to build a circuit to randomly operate small lights for a display.

Discussion in 'The Projects Forum' started by Chipsmith1579, Aug 24, 2016.

1. ### Chipsmith1579 Thread Starter New Member

Aug 24, 2016
2
0
I have a vintage fire department, station alerting box that was used to notify fire trucks that they were being dispatched on an emergency. The box is slightly larger than a shoe box and is divided into 4 sections, each with its own 12v light bulb. The bulb would illuminate thru a translucent cover on the box and identify the individual fire truck or trucks being dispatched. I would like to build a curcuit that would randomly illuminate one or more of these bulbs for 30 seconds then turn off and do it throught the day when its turned on. This would simulate apparatus dispatch for the display. A "random light generator circuit" that just flashes lights wont work, it needs to operate 3 or 4 different lights in different order for upto 30 seconds. Thank you for your help.

Jun 18, 2008
1,463
372
3. ### AlbertHall Well-Known Member

Jun 4, 2014
2,282
450
The simplest way would be with a microcontroller, especially if you need quite long off times for the lights. A microcontroller can do a good pseudo-random sequence.

4. ### AnalogKid Distinguished Member

Aug 1, 2013
4,709
1,301
Can you post a photo so we can see what you are talking about?
4 bulbs
At least one bulb on at all times
Sometimes more than one bulb on at the same time
bulb pattern changes every 30 seconds
Correct?

What is the max number of bulbs that can be on at one time? What is the on current for each bulb?

When a very high-speed 4-bit counter is latched randomly at a much slower rate, it is a very effective random pattern generator. A CD4060 running at a few MHz produces the patterns, and a 4-bit latch that is triggered every 30 seconds (*not* synchronized to the high speed clock) latches a pattern and drives the output stages.
1 - CD4060 pattern generator
1 - CD4060 or NE555 making a 30-second latch pulse
1 - CD 4042 quad latch
4 - output drivers

ak

5. ### Alec_t AAC Fanatic!

Sep 17, 2013
5,980
1,138
That will produce one of 16 possible patterns randomly, but two or more of the lights would switch simultaneously: not very realistic for the intended application. I think the circuit would need to be more complex.

6. ### AnalogKid Distinguished Member

Aug 1, 2013
4,709
1,301
Re-reading the original question, I see that now. It also sounds like this thing does not cycle automatically, but sits and waits for some external action to trigger the next display. If it really is 2 or 3 lights (never 1 or 4), that is only 10 patterns. Could be a high speed 4017 followed by 24 1N914's (or 3 ULN2804's)...

Or an 8-pin PIC.

ak

Last edited: Aug 26, 2016
7. ### ian field Distinguished Member

Oct 27, 2012
4,460
792
A sort of pseudo-random can be had by stringing LEDs between a couple of counter chains that each have their own CR oscillator.

If you need a very long period, its easier to prescale the oscillators with more counter chains than make very slow oscillators.

You will need inverter transistors on one of the counters outputs so one is active high and the other active low - if you must use bulbs; the non-inverted outputs will need emitter followers.

Counters like the 4017 give you a one of ten active output, BCD counters give you a 4 bit code which is a truncated version of binary. Binary counters give a code that represents the 16 possible states on a 4 bit chain. You can experiment with mixing the counter types to get the visual effect you want - watch out whether different types are active high or active low, you may not need to invert anything with some combinations.

8. ### Bernard AAC Fanatic!

Aug 7, 2008
4,248
424
Seems like OP has flown but just wanted to get this problem off my chest. Slowing down a random pulse gen. doesn't seem to compute so came up with this outline: Use a conventional start stop 7 stage counter ( 4060 ); at stop - load count into a register the length as determined of how many alarms per day are allowed, say 6 per each of the 4. A second counter runs in real time. The register ( 74C164 X 7 ) & counter feed into a digital comparator ( 74C85 X 2 ) ; when counts match, a timer is set for 30 sec. ( 555 ) direct drive for LED or a driver for bulb.
A second short random pulse generator ,1 to 6 determines how many calls are allowed. At every advance of the real time counter the register is cycled to the comparator. Now we need 4 of these or a long register with other nasty complications
The start stop random pulse generator similar to one on You Tube, Jack Bernard firefly.

Last edited: Aug 29, 2016
9. ### AlbertHall Well-Known Member

Jun 4, 2014
2,282
450
Or one 8 pin PIC.

10. ### AnalogKid Distinguished Member

Aug 1, 2013
4,709
1,301
There's no need for that kind of language. Repeating that jerk in post #6 is frowned upon out here in the colonies.

ak

11. ### AlbertHall Well-Known Member

Jun 4, 2014
2,282
450
Are we not allowed to agree in here? That would account for some of the threads.

Apr 30, 2011
1,426
364
As an aside, annunciator devices such as the one held by the O.P. generally follow some rules of operation that randomness would not simulate accurately. That may be of little or no concern if the goal is merely to produce an active decorative object.

13. ### Bernard AAC Fanatic!

Aug 7, 2008
4,248
424
A PIC or hardware, you still need a plan.

14. ### mxabeles Active Member

Apr 25, 2009
182
0
"Linear Feedback Shift Register"or LFSR is a way to generate random pulses. Need a 555 for clock, 2 8bit shift registers and an XOR gate if my memory serves me correctly. Maybe slow the 55y down to speed you desire?
Of course microntroller may well be the expedient choice.
Have fun!

15. ### Bernard AAC Fanatic!

Aug 7, 2008
4,248
424
What is the output of a LFSR ? Maybe a pattern of 1's & 0's that does not repeat. Now what do we do with it ?

16. ### Kjeldgaard Member

Apr 7, 2016
73
17
I had to draw an idea down on paper.

It's a circuit that should, at regular intervals, change one of four outputs. There can always be anywhere from none to four outputs active.

RAND-OSC is a fast oscillator, counting decade counter 4017 up on the CP1 input, then one of Q0, Q1, Q2 or Q3 is always high. After the fourth clock pulse will Q4 reset the counter at the R input.

SHIFT_TIME is a slow clock, which changes the JK flip/flop output whose JK inputs are high.

To ensure against race problems between the two oscillators, I have chosen to stop the decade-counter 4017 when the SHIFT TIME is low, then the JK inputs are always stable in the low to high transition of the SHIFT TIME.

All this should be seen only as an sketch, that lacks some details before it can be a stable circuit.

17. ### Northeastman New Member

Mar 6, 2013
3
0
Hi,
check out this equipment it is exactly the hardware you need to control your bulbs.
There are two units one is a 6 channel flicker unit with remote control and variable flickering effects.
The second item is a 10 channel controller that is also IR controlled. This just switches lights on/off using an IR remote.
Both are 12V DC powered and are designed for Dolls houses and similar models.

18. ### Chipsmith1579 Thread Starter New Member

Aug 24, 2016
2
0
Thank you everyone for your input here. I will try to upload some pictures so you have a visual of what I'm working with.

19. ### ICCircuitman New Member

Feb 22, 2015
2
0
Try a particle photon I believe there is a C library (math.h) that will generate bounded numbers within the range of the data lines. Use a bus driver to drive the leds. The photon can be reprogrammed wirelessly

20. ### Tonyr1084 Active Member

Sep 24, 2015
637
112
You want to mimic the random nature of the alarm codex.

Assume the random nature of fire itself. When one occurs an alarm is generated and the display lights up. It may be a "One Alarm" fire, or two, three or four alarm.

So, lets say at 10:00 AM a call comes in. It's a small brush fire and a truck is dispatched. It's a single alarm fire so only one lamp lights up. Because it's a brush fire a tanker is sent out. Truck #1 (light #1) handles the call. Two minutes after the alarm comes in the light extinguishes (30 seconds per the OP request). At 11:45 another call comes in, a garage is on fire. Again, it's a single alarm so only one truck is sent out. This time it's a pumper. Truck #2 goes out.

The day is relatively quite and not until 5:45 PM another call comes in. This one is a major fire at a paper mill. The mill is very big and has lots of chemicals at hand, so this one is a Four Alarm fire. All available trucks are sent out, so all four lights light up.

I believe what you're asking for is something that will generate a similar frequency, where only the events of the day can dictate the random needs, whether it's a single alarm, whether truck #1, 2, 18 or 56 will be sent. (trucks are not sequentially marked in any given fire station).

In my example the day has been relatively quiet. Each time an alarm has come in different resources were allocated, depending on the random need of the community. It would seem to me that the best solution would be a random number generator program on a PIC would suit the need best. Because there are such long delays between "Alarms" the PIC can be programmed for varying times between alarms that can be very long or rather frequent. The PIC can also be programmed to respond with "One of Four" outputs, "Two of Four" outputs, three or all four outputs at the same time. In this scenario I don't see any way a "random" number can be generated using a clock (or multiple clocks) that would not be repetitive. The cycles between all 10 possibilities would be so long that someone would have to sit and watch for hours before seeing a pattern emerge.

If you don't want to go with a PIC then work with a long time period counter - and have it set to give you (you pick the outputs) an output consisting of light #1, or 2, or 3 or 4. OR #1 & 4, or 2 & 4 or 1 & 3 and so on. YOU decide which lights will light at the next planned occurrence and don't worry about anyone being able to detect a pattern. Surely YOU will know the pattern because you built it that way. But to all others, they'll see what appears to be random. So in this sense, you don't truly need a random event generator. However, if you truly want "Random" then the best solution would be the PIC.

My opinion. Others may have a different view of how to approach this. Honestly, at first I thought of building a clock using a variable temperature probe to act as part of a random clock rate generator. With changes in the temperature the clock will run at a different speed. This way nobody is in control of the clock rate, the temperature is. And if you have two clocks running, one controlled by temperature another controlled by a light sensor - when their periods align, you get your random event. Next problem would be how to decide randomly between which light or lights should light up.

Clocks and counters are not my expertise. In fact, I don't think I even HAVE an "Expertise". I'm just a hobbiest who tries to figure things out on my own. When stuck, I depend on the often good advice of those who are much more senior to me. But sometimes I just have to open my mouth. Sometimes something actually comes out that makes sense.