Re: Another odd circuit request

From: John Comma Smith (JCSforindependence_at_yahoo.com)
Date: 02/05/05


Date: Fri, 4 Feb 2005 22:36:01 -0800


"Robert Monsen" <rcsurname@comcast.net> wrote in message
news:Cd2dnVCfs6sWbZ7fRVn-rA@comcast.com...
> John Comma Smith wrote:
> > "Robert Monsen" <rcsurname@comcast.net> wrote in message
> > news:SvKdnRuJmNUpsJ7fRVn-rg@comcast.com...
> >
> >>John Comma Smith wrote:
> >>
> >>>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.
> >
> >
> > 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.

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.