Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Led sequential light up.

Status
Not open for further replies.

gijoe411

New Member
I'm trying to make a row of 21 bi-color leds, in their normal state they will be all red, but when you press a momentary switch the first one would change to blue, press the button again and the next would change to blue, while the rest stay red. Once all 21 leds are blue and press the button again, they will all reset to red.

Any ideas?

Thanks in advance for your help!
 
This is going to require a row of mechanical relays, filp-flop chips, or a microcontroller. Name your poison.
ps, You'd be more likely to get answers if you made an effort to lay out a circuit and post it here. I am having difficulty in convincing myself to work for 2 or 3 hours to hand you something you have made no effort to start on.
 
Here are a few tips :

- First, you have to figure out what type of bi-color LED you have : one that emits one color with forward current and another color with reversed current (only two pins) ? or one that can lit both colors independantly (at least 3 pints). You'll find out the latter will proove easier to work with for your application.

- Then, you will need to deceive wheter you go discrete components (flip-flops, logics) or with microcontroller. To stay cheap and on the learning side, let's assume discrete components.

- Your design involves states that change over time (no blue LED, 1 blue LED, then 2, .... then 21, then back to none). This type of behavior is achieved by the use of sequential logic. That is, flip-flops, counters, shifters. All these chips requires the notion of reset (what's the state when power is applied) and a clock. For your particular application, look at a simple RC network for reset, and look at your button as being the clock, that is the signal that make the states change.

- Regarding the actual type of sequential logic you would need, look at shifters. You might find they can do pretty much what you need. Cascading 3 8bit shifters would provide a possibility of 24 leds. The little challenge will be how to end the sequence and go back to "no blue LED". I'll let you think on that !

- I said your button can act as a clock but actually, buttons don't really make good clocks !! To correct the situation, you will have to look at "debouncing" techniques.

- Once your sequential logic is up and running, it will be time to actually light up LEDs. Don't forget that LEDs cannot be directly fed with 5V. Limiting resistors will be needed. An even if you limit the current flowing through the LEDs, most of them will still require 10-20mA which might (and will certainly) be too much current for your sequential logic. So you will need to look at open collector buffers.

- Finally, because lighting a blue LED means turning off the red LED (and vice versa), you will also need to look at invertors as well.


Overall, sounds like a nice project to learn a lot !!!
Good luck with it !!
 
you can do it with
4017 counters cascaded - 3 nos
21 SR flipflops.
when you make 4017 to go through 21 startes and resets, every pin that will come high wil set a SR flip flop connected to it making blue to work. the out put of SR flip flop can be wired to LEDs via resistors. when the counter resets all SR FF will reset and set all LEDs to red.
 
Yep ! Counters and SR Latches would work as well ! Although it would require a bit more ICs.

If you go with three 74ACT164 shift registers, and three 74ACT240 octal inverters, you will be in business. Both ACT ICs are strong enough to drive 8 LEDs at aroung 10-12mA each. The shifters would drive the blue LEDS and the inverters the red ones.

Add to that a 74HC7002 (schmit-trigger NOR gates) for reset management (power up and end-of-cycle) and for debouncing and you should have your circuit up and running with just 7 ICs.

Also, as a first step, if you forget about the red LEDs, you need to hook up only 4 ICs to have your "first version" with blue LEDs up and running !
 
This is going to require a row of mechanical relays, filp-flop chips, or a microcontroller. Name your poison.
ps, You'd be more likely to get answers if you made an effort to lay out a circuit and post it here. I am having difficulty in convincing myself to work for 2 or 3 hours to hand you something you have made no effort to start on.

all i wanted was a staring point, not for you to do the project for me, but thanks for the input.
 
Last edited:
TechnoGilles & mbarazeen, thanks for the input, I will look into those avenues.

I do have the 3 - prong led's. I guess technically they are tri-color because you can light both colors at once and make the third. I figure I will just have a constant supply of power to the red led and allow the counter to activate the blue led to make purple, this will make it simpler.

I understand the basics, but I'm trying to wrap my head around logic circuits, and learning what parts are available to me. Thanks!
 
Last edited:
People who work with digital chips are way better suited to this than I am. I'm a precision analog guy. Thanks to the people who stepped up to this. I was still negotiating the method while your minds jumped to "these chips will do the job".
 
The chips I mentionned are available at mouser.com and/or digikey.com for under 1$ each. If you need precision with anything, don't hesitate. Or maybe better, draw a little schematic of the circuit and we can review it.
 
ok, I'm trying to feel my way through drawing a circuit diagram based on the data sheet of the 74ACT164. I'll post that when I finally finish.

But, unfortunately the 74ACT164 isn't in stock at mouser or digikey. Are their any other options as far as suppliers?
 
Hum ! Too bad ! Than you'll have to go with plain 74LS164 followed by 75ACT245 octal buffers to drive the LEDs. Both in stock at digikey. The 74HC7002 is also in stock at digikey.
 
Ok experts, here's my first try at a circuit like this.

This obviously isn't the full & final circuit, just a test to check my theory. This, I hope will light up 7 led's sequentially for each momentary switch press and on the 8th press reset too nothing lit.

2 questions I can think of so far:

1. Does the 74LS164 require a clock input, if so, from where? It appears from the data sheet that it does, but I left it Not Connected for now.

2. The CLR needs constant power and resets the chip when the voltage goes to low (or so I understand from the data sheet), hopefully I am using the PNP correctly to achive this.

Your patience would be greatly appreciated. The expert advice found here is invaluable.

**broken link removed**
 

Attachments

  • IMG_0308..JPG
    IMG_0308..JPG
    53.7 KB · Views: 476
Last edited:
When, that's a good start !! There are a few problems but we can work our way out of them from this point !

I'll forget about power and current problems for now and stick to the functionality. There is one important concept you missed in the use of sequential logic. But you were instinctively wondering about it : sequential logic indeed absolutely need a clock to live !!!

All sequential ICs** sample there inputs and compute their outputs while the clock is either high or low. Then, during the rising edge of the clock (during the transition from 0 to 1), the IC updates its output pins with the new result, holding it until the next rising edge of the clock where they will be updated with a new result.

For the 164, A and B are inputs. You were right to tie the B input to 1. And you were "kinda" right when trying to input "ones" to the A pin. But remember that no matter what A is, the output will not change until the clock pin sees a rising edge from 0 to 1. Can you think of a way to rewire your circuit to solve that ?

As for reset, you were perfectly right when using the eighth output to reset the IC. And since the CLR input is active-low (it should indeed be labeled /CLR), one can indeed use a transistor to invert the signal, although as wired in your diagram, there is a little problem. But instead of using a transistor, try to incorporate the 74HC7002 in your diagram to acheive that purpose. You will need the chip anyway later in the process.

Good work ! Keep going !
 
I forgot my ** remark !! I just wanted to say that some ICs work with an inverted clock (/CLK). It is exactly the same principle, except that the outputs are updated on the falling edge (transition from 1 to 0) of the clock.
 
Last edited:
OK, here is revision 2. My attempt at incorporating the 74HC7002, in order to reset the 74164.

Other changes I made were added capacitors to help with the flow.

Made the A input of the 74164 a pulldown.

Attached the CLK to the SPST switch, hopefully this is allowed.

Please check it over and let me know if this should work, then I will expand it for the full 21 leds.

Much thanks as always!

thumbnail for bigger pic.

**broken link removed**
 

Attachments

  • IMG_0315..JPG
    IMG_0315..JPG
    373.7 KB · Views: 394
Last edited:
Ok, we`re making progress ! Using one NOR gate from the 7002 as an inverter is exactly what you need. Although in this case, the QH output of the 164 doesn't need a pull-down resistor beacause the 164 outputs are always driven to a valid logic level (0 or 1). Also, you don't need the diode for the second input of the NOR gate. A simple way to hook up NOR or NAND gate as inverters is simply to send your signal (QH) to both inputs. Do the logic table to convince yourself !!

Using a pull-down along with your button to make the clock is exactly what we are looking for. In your diagram, however, the pull-down is not quite wired properly (small mistake I guess !!). It must be between clock and ground. As for the A input, there is a little problem. Remember that the sequential ICs sample and compute their output before the clock edge and update them during the clock edge. So in your case, if you change the value of A from 0 to 1 at the same time as the clock edge occurs, the circuit won't see the "1" but will instead inject a "0" at the output. The A input needs to be stable before the clock edge. And in this first stage, you always need to inject the same thing, don't you ? Should be simple !! ;)

Hooking the unused input of the 7002 to ground is also good. But we'll soon use them too !!

Using decoupling (or bypass) capacitors for your Vcc is also a good thing. But bypass capacitors must be put in parallel with the source, not in series like you did.

Another thing you could look at, at this point, is the value of the current limiting resistors for your LEDs. 56Ω seems a bit low. Remember that you want to run them at 10-20 mA each.

And finally, what did you have in mind when adding the two resistors in series with the ICs power ?

Let me know !
 
Last edited:
Hi thanks for your help as always, I like figuring this stuff out.

Unfortunately, I'm on the road for work and I don't have my large whiteboard with me, I'll do what I can without it...


the QH output of the 164 doesn't need a pull-down resistor
There isn't a pulldown resistor on the Qh output, (at least not the way I see it). Maybe you saw my two crossover points and thought that was a resistor symbol.

Also, you don't need the diode for the second input of the NOR gate.
I don't know why I put that there, I'll delete it.

A simple way to hook up NOR or NAND gate as inverters is simply to send your signal (QH) to both inputs.
Is that the way it works? Here is the function table from the data sheet. I was confused about that because it doesn't tell you what you get with two High inputs. That's too easy if your right.
**broken link removed**

pull-down is not quite wired properly (small mistake I guess !!). It must be between clock and ground.
It is hooked up like that, isn't it?

The A input needs to be stable before the clock edge. And in this first stage, you always need to inject the same thing, don't you ? Should be simple !!
Add a capacitor in between the switch and the CLK? That would allow the A input time to get there before the CLK.

capacitors must be put in parallel with the source
OK, I'll fix this when I get back to my whiteboard.

the value of the current limiting resistors for your LEDs. 56Ω seems a bit low.
I based the R value on: R = (VS - VL) / I, Vs being 3.2v (typical high output off the data sheet of the 74LS164), Vl being 1.7v, and I being 30mA (from the data for this led: MV5439A4R0). I came up with 56Ω, hopefully I did this correct.

the two resistors in series with the ICs power ?
This I did based on the same idea, that I had too much source voltage feeding to the Vcc s so I wanted to knock it down with a resistor.

!!!Thanks as always for your responses!!!
 
Last edited:
There isn't a pulldown resistor on the Qh output

I'm referring to the 10k resistor near the 1A input of the 7002. It looks like a pull-down and is not required.

Is that the way it works?

Yep ! 0 or 0 gives 0, inverted gives 1. And 1 or 1 gives 1, inverted gives 0. Tha's exactly an inverter. Same thing works with a NAND gate.

It is hooked up like that, isn't it?

Your're totally right. Sorry ! :D

Add a capacitor in between the switch and the CLK? That would allow the A input time to get there before the CLK.

Nope ! Let's stay in the digital world !! The first shifter in your design always need to inject ones into the shifter because you always want previous LEDs to stay lit. If you wanted only one LED at a time, you would inject a 1 the first time, and 0s afterwards. If you wanted two LEDs to "travel" along your 21s, you would inject 2 ones and zeros afterwards and so forth...

So in this case, the A and B inputs can both be tied to Vcc. This way, each time you press and release the button, the rising clock edge will occur and a 1 will be injected in the shifter. Since the A remains stable at Vcc, you respect the timing of the IC. Easy !!

I based the R value on: R = (VS - VL) / I

Equation is good, although numbers are not quite right. But I also forgot something. The chip we're dealing with now is the 74LS164 (and not the ACT version) wich is not strong enough to drive LEDs. You will have to hook up the output of the shifter to a 74ACT245 as previously mentionned. Your led max current is 30mA but it is rated for 20mA. And the 245 can source max 24mA per pin. So I would redo the calculation with 20mA. Also remember that Vcc for the 245 will be 5V. So you have to figure out its VOH at 20mA (from the datasheet).

This I did based on the same idea, that I had too much source voltage feeding to the Vcc s so I wanted to knock it down with a resistor.

Your intuition is right. You indeed have to knock your source voltage down. But you cannot do this with a resistor since the current consumption of an IC is not fixed. It depends on the state of its inputs and outputs and can vary widely.

What you need is an active chip that will ensure you that the Vcc is stable at 5V. Such a device is called a voltage regulator. A very popular one is the 7805. But this kind of device usually requires a few volts of dropout (difference between input and output). In you case, because you have only one volt of dropout (6V - 5V), you need a Low Drop Out Voltage Regulator or LDO regulator. I suggest the LM2940T-5.0/NOPB.


Your're almost there !
Keep me posted !
 
No problem ! Let me know when you have your new design. There are still 2 little issues that I want to talk to you about (Reset and debouncing). After that, I think you'll be able to expand your design to 21 LEDs !!
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top