# Help with simple LED sequence

Discussion in 'Electronic Basics' started by Bart, Sep 17, 2005.

1. ### BartGuest

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

2. ### Bob MonsenGuest

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

3. ### JeffMGuest

Posting the same question individually to multiple groups
is really stupid.

Learn to cross-post.
Put ALL the groups in which you would like the question to appear
on the To: line (Groups line)
THE FIRST TIME you post the question.

4. ### petrus bitbyterGuest

Bart,

I don´t say electronics to be difficult but you *do* need some basic
knowlegde. As you know about the 555 you may start to build an astable
multivibrator with a low frequency. Let´s say 1 or 2Hz. You can connect a
LED to the output (use a series resistor to limit the current) so you made a
you made that you can learn to vary the frequency using a potentiometer. If
you made that you need only two flipflops and some XORgates to make the
walking light you want to have. I can make the schematic for you, but can
you read it? Personally I'd program a smal PIC micro for a job like this but
I guess you're not in for that.

petrus bitbyter

5. ### BartGuest

I apologize to the group. What Jeff calls stupid is actually my
unfamiliarity with newsgroup "netiquette". It won't happen again,
Jeff is correct that I should crosspost. I found
and my manners will improve exponentially.

Bart

6. ### John FieldsGuest

---
Your manners are fine and Jeff's rudeness was out of line. This is
seb, a starting point where newbies aren't supposed to know
anything, where they're not supposed to be bullied because of their
ignorance, and where there are no stupid questions but, often, lots
of stupid responses to those questions.

Anyway, welcome to the group!

7. ### JeffMGuest

Posting the same question individually to multiple groups
When Fields calls you rude, you know you've stepped over the line.

8. ### Terry PinnellGuest

This should do what you want. I've shown waveforms too.

If LEDs are not bright enough, drive them with transistors as Bob
described.
http://www.terrypin.dial.pipex.com/Images/LED-Sequencer-Bart.gif

10. ### Terry PinnellGuest

You're right, thanks. Found several other careless mistakes too. Hope
it is now correct.

BTW, I *think* that -ve spike on B (Q0 output) is just a simulation
artifact, but I'm not entirely sure.

LOL!

Cheers!
Rich

16. ### Rich GriseGuest

Have you got anything I can play that with? Windows Media Player
keeps insisting that it can't find a decoder. Xine doesn't like
it either, but that doesn't surprise me much.

If I have to spend money for some third-party coded (Which turned
out to be the most likely possibility after screwing around for
about two hours with Microsoft's "help" pages.), then screw it,
it ain't worth it.

Or, could you put it in a format that's compatible with a plain
vanilla WMP?

Or, what's it a movie _of_? (I can hear the gal singing on the
Victrola, but no video).

Thanks,
Rich

18. ### Terry PinnellGuest

I'm no video expert (just started dabbling with it), but I'm surprised
WMP can't play the MS proprietary WMV format. I think that's also
probably WMP's 'native' video format? Can you play *any* WMV?

You didn't say which version of WMP you have, so I'll assume it's
fairly recent. I have WMP9; haven't got around to the latest yet.
Under Tools|Options|File Types, presumably all looks OK? For example,
WMV is checked?

Out of curiosity, what happens if you try Open With|your browser?

FWIW, I can play that WMV (video and sound) here in the following
players:
- WMP9
- IrfanView
- Nero ShowTime
- RealPlayer
- PowerDVD

I'm trying to convert it to an AVI file, but so far can't get it below
8MB.

19. ### ehsjrGuest

That's frustrating. It plays for me with Windows Media Player.
Wish I knew the magic incantation you need to use to get it
to play for you.

Ed

20. ### Rich GriseGuest

So have I, now.

Never mind. ;-) (what's the smiley for "tail between legs"?)

Cheers!
Rich