Another odd circuit request

I got a bit of a weird circuit that I can't seem to find online. I need a circuit that will light up a row of LEDs until it gets to the top and then pause, and then shut off the leds rather slowly(like one every 3/4 a second) once it gets to the bottom, if the button is still being pushed, I want the process of lighting up the LEDs to start all over again. I also need it to turn them off in this fashion if the switch is let off for some reason. I also need it to pump some 5V to a DC motor whenever any of the LEDs are active.

Hopes this makes some sense. Thanks.

Reply to
John Comma Smith
Loading thread data ...

No, it makes no sense. I don't understand what you mean by top and bottom.

Here is what I think you said.

You have a button, a row of LEDs, and a motor. (and presumably a 5V DC power supply)

When the button is pushed, you want the row of LEDs to all be lit at once, and then, one at a time, you want them to go out, one every 3/4 of a second. (There may be another switch input corresponding to 'top' here which causes the LEDs to start going out.)

The button should cause the sequence to restart once all the LEDs go out.

In addition, you want an output of 5V for a DC motor of unspecified size while any LED is active.

Is that it?

--
Regards,
   Robert Monsen

"Your Highness, I have no need of this hypothesis."
     - Pierre Laplace (1749-1827), to Napoleon,
        on why his works on celestial mechanics make no mention of God.
Reply to
Robert Monsen

No that's not it!

Reply to
Shady

a

then

second)

the

to

I

No it is not quite it, but you are close. What I want done is for the leds to light up slowly, like one every half a second. If the button is released, for each one to power down ever 3/4 of a second in the opposite direction that they lined up. Like >light up

Reply to
John Comma Smith

--
It's still not clear.

For instance, if you press and release the switch do you want the LEDs
to light up 1,2,3,4,5, pause, and then extinguish 5,4,3,2,1 or do you
want them to light up in sequence for only for as long as you hold the
switch in and then to extinguish, one after the other when you release
the switch? 

Also, you said in your first post that if you kept the button pushed
you wanted them to light up and down in sequence for as long as the
button was pressed.
Reply to
John Fields

So you have a button and some LEDs. When somebody presses the button, you want the LEDs to turn on sequentially while the button is being held. Then, when you release the button, the LEDs that are lit go off in the opposite order from the one they lit in. The delay between lighting of subsequent LEDs must be adjustable, and different from the adjustable delay for turning them off. While the LEDs are turning off, pushing the button again has no effect until all the LEDs are off, at which time, it begins to light the LEDs sequentially.

It sounds like the effect you are going for is like a button which fills up a pool. Hold the button, the pool fills, let it go, the pool drains.

A capacitor to ground is like a pool which holds charge. If you pour charge in at a fixed rate, the voltage will increase at a fixed rate. You fill the capacitor from V+, and drain it to V-. Thus, the rate of filling and draining can be controlled separately.

For this to work, you need three things.

1) A way to accurately add and drain charge from a capacitor. 2) A way to detect that the capactor has reached a partiular voltage level, and then turn on an LED. 3) A way to prevent the button from working between the time it's been released, and when the LEDs are all off.

For 1, you use what is called a current source to both fill and drain the charge. These can easily be built using either discrete transistors, or voltage regulators. One trick is to make the draining current 'source' about twice as big as the filling one. Then, you can just leave them on, and when you want to fill, turn off the draining one.

For 2, you need a way to detect that a particular voltage has been reached, and change something else. A device called a 'comparator' is used for this. A comparator does what it's name implies, it compares the voltage on it's two inputs. The two inputs are called V+ and V-. If the V+ is lower than the V-, it pulls the output to ground. Otherwise, it lets the output float. This is just what you want. You connect each LED between the Vcc rail (the high voltage supply) and the output of the comparator with a resistor to limit the current. Then, you set the V+ input of the comparator to some value using a potentiometer, and connect the V- to your timing capacitor. When the capacitor reaches the voltage set by the pot, the LED turns on. When it goes below that voltage, the LED turns off. You also need a tiny voltage margin, so when the level changes, the LEDs don't flicker.

For 3, you again need a way to determine if there is some voltage across the cap, and also need what is called a 'flip-flop'. When you release the button, it needs to turn off the filling current source until the voltage on the capacitor gets down to the point where the first LED is lit.

This requires some simple logic gates. There are two conditions you care about:

A) Whether the button is pressed B) Whether there is no voltage across the timing capacitor.

Both of these conditions depend on each other; if you assert A, then B will be turned off at some point soon (the capacitor will start to fill up). When B is turned off, then clearing A will cause the capacitor to start discharging until B turns back on. The logic is

Turn on charging when A and B are true.

Turn off charging when A and B are false.

You can build this simple state machine out of a single quad nand gate and a couple of inverters. The logic is

S = A and B R = /A and /B

.-----------------. | | | __ | __ '-| \ Fill | A--------o-------------| \ | )o---. | | | )o----------|__/ | | B-----o--)-------------|__/ | | | | .------------' | | | |\ __ | | | '---| >O------| \ | __ | | |/ | )o------)---| \ Drain | | .---|__/ | | )o----------' | |\ | '---|__/ '------| >O--' |/ (created by AACircuit v1.28 beta 10/06/04

formatting link

The circuit should start out with B high and A low. Push the button, and A will go high. When the capacitor voltage gets to a predefined voltage, B goes low. Until that point, changing the value of A will have no effect.

Once B goes low, changing the value of A will turn off "Fill" and turn on "Drain". Again, changing the value of A after this will have no effect until the capacitor drains down, and once again B goes high.

For the current sources, a simple scheme is to use a dual transistor source, such as this:

Vin ------------o-----o--. | | | .-. | | R | |----------o--------o---o | .---|+/ | | | |/ | Lowest goes .-. | | to empty Adjust | |

Reply to
Robert Monsen

leds

released,

to

was a

I'm sorry, I see it in my mind but I am having trouble putting it to words. Lets have another go:

When the button is pushed the LEDs light 0,1,2,3,4,5 until it gets to the top, once it is there is a brief pause of like 1 second, then they turn off

5,4,3,2,1,0 is a slower speed then when it started lighting up. But, if the button is still being pressed when the sequence gets to 0, it will start over again. However if the button was released at 4 it would pause and got back down to 0 in the same fashion as if it had reached 5. I also need the light up sequence to be faster than the light down sequence. As I noted earlier, I need 5V to but put to a DC motor when any led from 1-5 is lit. Now there may be more than 5 LEDs, but I am just using those numbers to keep it as simple as possible. Maybe this paints a better picture.
Reply to
John Comma Smith

I have minimal experience with PICs, but how hard would it be to make a PIC do what I am requesting?

Reply to
John Comma Smith

bottom.

out.

leds

released,

direction

to

was a

lit.

And this is the only analog way to do what I need. I think I could do this, I am just unsure of my electronic building skills.

Reply to
John Comma Smith

There are lots of ways to do everything in electronics. This way requires a few basic skills to put everything together. However, it's not too hard, it just looks hard. Once you understand the building blocks, you can use them for other things as well...

However, if you have PIC experience, and a way to program them, that may be a better way to go. You can probably do this whole project with a PIC12F675 and a serial in parallel out shift register or two (you need a pin for each LED).

--
Regards,
   Robert Monsen

"Your Highness, I have no need of this hypothesis."
     - Pierre Laplace (1749-1827), to Napoleon,
        on why his works on celestial mechanics make no mention of God.
Reply to
Robert Monsen

Aaargh, just throw a PIC at it.

- YD.

--
Remove HAT if replying by mail.
Reply to
YD

this,

Thank you for all the info. I think I will do it the analog way, I just need to know if you happen to have those circuits in a more readable format. Thanks

Reply to
John Comma Smith

If you view them using a fixed point font in notepad, such as courier, they make more sense.

--
Regards,
   Robert Monsen

"Your Highness, I have no need of this hypothesis."
     - Pierre Laplace (1749-1827), to Napoleon,
        on why his works on celestial mechanics make no mention of God.
Reply to
Robert Monsen

Ok thank you

need

Reply to
John Comma Smith

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.