Maker Pro
Maker Pro

Another odd circuit request

  • Thread starter John Comma Smith
  • Start date
J

John Comma Smith

Jan 1, 1970
0
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.
 
R

Robert Monsen

Jan 1, 1970
0
John said:
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.

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.
 
J

John Comma Smith

Jan 1, 1970
0
Robert Monsen said:
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.

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 <light down. I also need the speed of the
LEDs lighting up and powering down to be adjustable. And yes, I need 5V to
be pumped out to a motor whenever any of the LEDs are active. I hope I was a
little clearer that time.
 
J

John Fields

Jan 1, 1970
0
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 <light down. I also need the speed of the
LEDs lighting up and powering down to be adjustable. And yes, I need 5V to
be pumped out to a motor whenever any of the LEDs are active. I hope I was a
little clearer that time.

---
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.
 
R

Robert Monsen

Jan 1, 1970
0
John said:
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 <light down. I also need the speed of the
LEDs lighting up and powering down to be adjustable. And yes, I need 5V to
be pumped out to a motor whenever any of the LEDs are active. I hope I was a
little clearer that time.

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 www.tech-chat.de)

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 | |<---' |
Source | | |
'-' |
| |<
o------| PNP
| |\
PNP |------o
/| |
| |
Output .-.
| | 100k
| |
'-'
|
'---- ON/OFF

(created by AACircuit v1.28 beta 10/06/04 www.tech-chat.de)

The value of R determines the current, which is 0.7/R. Adjusting
resistance will change the current, which, along with the size of the
capacitor, will determine how quickly the voltage rises. This is defined
using the formula

Volts/Second = 0.7/(R*C)

If you are going between say 0.7V and 4.3V, and you have 10 LEDs that
should turn on at 0.75 second intervals, then they need to turn on every
0.3 volts, so 0.3/0.75 = 0.7/(R*C), so R*C = 0.57. Thus, with a 1uF
capacitor, you would need a 570k resistor. The drain works the same way.

The current sink is the same circuit, only the PNPs are replaced by
NPNs, and Vin is swapped with ground.

For the source, turn it on by putting the ON/OFF terminal to ground, and
turn it off by putting that terminal to Vin. Vice versa for the sink.

Each of the LEDs (and the 'empty' signal above) must detect the voltage
at the capacitor, and do something. Use a comparator like this:

VCC
+
|
o-------------------------o--------.
| | |
| | - LED
| .-. ^
| | | 10k |
| | | .-.
| '-' | | 1k
| | | |
| |\ | '-'
o-----------)-----------|-\ | |
| | >----------o--------o---o
| .---|+/ |
| | |/ | Lowest goes
.-. | | to empty
Adjust | |<-----o | signal
for each| | | ___ | "B"
LED '-' '---|___|---------'
|
| 1MEG
===
GND
(created by AACircuit v1.28 beta 10/06/04 www.tech-chat.de)

Use the LED that turns on first as the 'B' input for the flipflop
circuit above.

Note that a string of resistors from Vcc to ground might be just what
you want as references instead of the pots. That way, the resistors
would be at equal voltages.

The button is simple. Pushing it needs to bring a signal high. Thus, use
a normally open button, connected on one side to ground through a 100k
resistor, and on the other side to Vcc. Take the signal from the place
where the button connects to the 100k resistor.

That's all the pieces. See what you can do with them.

--
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.
 
Y

YD

Jan 1, 1970
0
On Fri, 04 Feb 2005 14:00:43 -0800, Robert Monsen

<snip some complicated stuff>

Aaargh, just throw a PIC at it.

- YD.
 
J

John Comma Smith

Jan 1, 1970
0
John Fields said:
---
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.

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.
 
J

John Comma Smith

Jan 1, 1970
0
YD said:
On Fri, 04 Feb 2005 14:00:43 -0800, Robert Monsen

<snip some complicated stuff>

Aaargh, just throw a PIC at it.

- YD.

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

John Comma Smith

Jan 1, 1970
0
Robert Monsen said:
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 www.tech-chat.de)

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 | |<---' |
Source | | |
'-' |
| |<
o------| PNP
| |\
PNP |------o
/| |
| |
Output .-.
| | 100k
| |
'-'
|
'---- ON/OFF

(created by AACircuit v1.28 beta 10/06/04 www.tech-chat.de)

The value of R determines the current, which is 0.7/R. Adjusting
resistance will change the current, which, along with the size of the
capacitor, will determine how quickly the voltage rises. This is defined
using the formula

Volts/Second = 0.7/(R*C)

If you are going between say 0.7V and 4.3V, and you have 10 LEDs that
should turn on at 0.75 second intervals, then they need to turn on every
0.3 volts, so 0.3/0.75 = 0.7/(R*C), so R*C = 0.57. Thus, with a 1uF
capacitor, you would need a 570k resistor. The drain works the same way.

The current sink is the same circuit, only the PNPs are replaced by
NPNs, and Vin is swapped with ground.

For the source, turn it on by putting the ON/OFF terminal to ground, and
turn it off by putting that terminal to Vin. Vice versa for the sink.

Each of the LEDs (and the 'empty' signal above) must detect the voltage
at the capacitor, and do something. Use a comparator like this:

VCC
+
|
o-------------------------o--------.
| | |
| | - LED
| .-. ^
| | | 10k |
| | | .-.
| '-' | | 1k
| | | |
| |\ | '-'
o-----------)-----------|-\ | |
| | >----------o--------o---o
| .---|+/ |
| | |/ | Lowest goes
.-. | | to empty
Adjust | |<-----o | signal
for each| | | ___ | "B"
LED '-' '---|___|---------'
|
| 1MEG
===
GND
(created by AACircuit v1.28 beta 10/06/04 www.tech-chat.de)

Use the LED that turns on first as the 'B' input for the flipflop
circuit above.

Note that a string of resistors from Vcc to ground might be just what
you want as references instead of the pots. That way, the resistors
would be at equal voltages.

The button is simple. Pushing it needs to bring a signal high. Thus, use
a normally open button, connected on one side to ground through a 100k
resistor, and on the other side to Vcc. Take the signal from the place
where the button connects to the 100k resistor.

That's all the pieces. See what you can do with them.

--
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.

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.
 
R

Robert Monsen

Jan 1, 1970
0
John said:
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.

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.
 
J

John Comma Smith

Jan 1, 1970
0
Robert Monsen said:
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.

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
 
R

Robert Monsen

Jan 1, 1970
0
John said:
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

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.
 
Top