Hi all,
I want to make 4 LED's light up in the following sequence (looping): O O
_ _
_ O O _
_ _ O O
O _ _ O
O O _ _
_ O O _
_ _ O O
O _ _ O
the above shows it has gone through two sequences, I'll want it to be
continuous and with variable frequency (a potentiometer?)
I've read up on 555 oscillators, logic gates (nand, nor, etc.),
flip-flops, op-amps..........
I don't know where to start. I DO have a nine volt battery and some
LEDs.
Any guidance is greatly appreciated,
Bart
A 555 can be used as a variable frequency source. The traditional setup is
to use the output pin to drive a resistor, which then feeds a capacitor
which is connected to ground. The junction of the resistor and capacitor
can then be used to drive the trigger and threshold inputs, thus causing
an oscillation that has the frequency proportional to R * C. If you
replace the R with a pot, you can have a nice clock which can be adjusted
using a pot. This only works well with cmos 555s, since the older ones
have too much leakage into their threshold and trigger inputs, and can
thus cause problems. Search on the Internet for a datasheet for a 555, and
look up the values. There are also suggested circuits for this kind of
thing in most datasheets.
That can drive a 4017, which is what is called a 'johnson counter'. It is
basically a set of flipflops, all connected in sequence, so the output of
one changes the state of the next one on low to high transitions. There
are 10 output pins, and they are each brought high, one at a time, when a
clock (such as the one above) is applied. There is a reset input that will
reset the counter back to 0 when applied, so, for counts less than 10, one
usually just connects an output to this reset. Then, when the chosen
output goes to 1, it'll reset the chip back to the beginning.
Generating your output pattern can be easily accomplished by using either
logic gates, or simply using diodes from the appropriate outputs. You
might be able to drive the LEDs directly from these diodes for certain
classes of logic chips. An example would be for diodes to point from Q0 to
both the first and second LED's anodes, the LED's cathodes each to small
resistors to ground. Then when Q0 is high, LEDs one and two will glow,
when Q1 is high, LEDs 2 and 3 will glow, etc.
If the LEDs are the standard ones, it'll only take about 5mA to light them
up, so you can use the scheme above. If they are those high powered ultra
bright ones, it may take more. In that case, skip the driver, and use the
output of the 4017 + diodes to power the base of an NPN transistor (one
for each LED). The NPN transistor should have its emitter grounded, and
have the LED, plus current limiting resistor, between the collector and
positive voltage source. The LED may have a forward voltage drop of
anywhere between 1.4 and 3.4 volts, so you'll need to calculate the
resistor size by
1) determining the LED Vf (look at the datasheet, or measure it) 2)
Subtract this number from the volts supplied by your voltage source 3)
Take the result, and subtract 0.2 from it for the voltage drop of the NPN
transistor.
4) Decide on the current you need, and take the result of 1-3 above, and
divide it by that current. The result will be a number like 53 or
something like that. Buy resistors that are near that value.
As an example, assume your led has a Vf of 3.4V, and your power supply is
9V. Also, assume the LED datasheet says you need 20mA. Then, you need a
resistor which is
R = (9 - 3.4 - 0.2) / 0.020 = 270 ohms.
You can use a resistor (say 100 ohms) between the diode output junction
and the NPN transistor for safety's sake, although a CD4017 won't allow
more than about 5mA though the base anyway, so it is probably safe to
omit.
Bob Monsen