I need a very simple circuit. When it's on, I need it to stay off for
a few seconds, then output a pulse for a few seconds then turn off.
This theoretically could be done with a 556 with both halves working
as monostable oneshot timers. However, when I tried this i had some
weird results. First off, I need this to be triggered when power is
applied to the circuit, not when the trigger pin is activated so I
just tied it to ground.
what happens afterwards is a bit weird. At first, both outputs go
high (from both halves) then the first one times out and triggers the
second one. However, I dont need that initial spike since this needs
to latch a relay after a few seconds wait. The other problem is that
the timing capacitor on the second half of the circuit seems to affect
the delays on both halves.
the one thing so far that i havent checked into is power supply i'm
using. So far I've been testing this w/ a 9v battery (i dont know how
fresh it is).. if the battery is weak, can it cause this kind of an
issue?
My circuit is wired like this:
http://home.cogeco.ca/~rpaisley4/LM555Delays2.GIF
except for the first trigger which is tied to ground.
Is there a way to prevent that initial trigerring of the second part
of the circuit.. or rather keep it intentionally low until the first
half triggers it?
---
Yes.
With 556s or 7556s:
VCC>--+---------+-------+----------+-------+-------+
| | | | | |
[10K] +---+---+ [1M] [10K] +---+---+ [1M]
| |__ | | | |__ | |
+----O|TR OUT|-----[100nF]--+--O|TR OUT|------->OUT
| | _| | | _| |
| | D|O--+ | D|O--+
| |_ | | |_ | |
| +-O|R TH|---+ +-O|R TH|---+
| | +-------+ |+ | +-------+ |+
[10nF]| 1/2 7556 [3.3µF] | 1/2 7556 [3.3µF]
| | | | |
GND>--+--+--------------+-----------+--------------+--->GND
or, if you don't like 555s:
VCC>--+-----+----+----+----+
| | | | |
[R1] [R4] | [R5] |
| | | | |
+-----|---|+\ | |
| | | >--+ |
| +---|-/ | |
[R2] | LM393 | |
| +---|+\ | C
| | | >--+---B NPN
+-----|---|-/ E
| | | |
| |+ | +------+
[R3] [C1] | |K |
| | | [CR1] [COIL]
| | | | |
GND>--+-----+----+---------+------+
The LM393 forms a window comparator with a wired-or output which goes
high only when the voltage at the junction of R4 and C1 is more
positive than the voltage at the junction of R2 and R3 and less
positive than the voltage at the junction of R1 and R2. This
condition will only be satisfied during part of the time C1 is
charging to Vcc after Vcc is connected to the circuit, and while the
output is high, current will flow through R5 into the relay coil,
latching it.
If we want the output of the comparators to remain low for three
seconds after power is first applied, then to go high for three
seconds, and finally to go low forever after that, then we must find
to what voltage C1 charges in 3 seconds, then in six seconds, and then
arrange the resistances on the voltage divider R1 R2 R3 so that the
proper voltages appear on the comparator inputs to allow the timing we
want to happen to happen.
Recalling that, in a circuit like this,:
V+
|
[R4]
|
+---V0
|
[C1]
|
0V
When V+ is abruptly connected to R4 the voltage across the capacitor
will rise to about 2/3 of the supply in a time equal to RC, if we say
that we'll let our six second charge point be equal to about 2/3 of
the supply, we can start to figure out the values for R and C. Since
the inputs of the comparators will also be connected to the junction
of R4 and C1, all the current from R4 won't go into the cap but some
of it will be diverted into the comparator inputs or, if the
comparator inputs source current, they will add to the current flowing
into the cap. In any case, whether the comparator inputs sink or
source current, they will contribute to the timing error and must be
considered. Looking at the LM393 data sheet we find that the input
bias current is 500 nA worst case for both inputs and that the inputs
source current, so with a 9V source driving the comparators (and R4)
that corresponds to about 18 megohms in parallel with R4.
Next, we need to look at the leakage current of C1, since that's
current that just gets thrown away and doesn't contribute to the
charging of C1. Since this doesn't seem to be a particularly critical
application, we can probably use a plain old aluminum electrolytic for
C1, and for a time constant of 6 seconds we're in the 1 to 100µF
ballbark, so if we set R1 equal to 1M and take the ~5% error due to
the bias current, we'll need about 6µF to get to 6 seconds.
Looking at Panasonic's aluminum electrolytics reveals that about the
best we can do is 3µA, so with a 1 megohm resistor in there we'll have
a 3V drop across it when the cap charges to 6V, so with not much
headroom, that's pretty iffy.
Searching a little more leads us to their EF series of leaded
tantalums. With a leakage current of 0.008CV or 0.05µA (whichever is
greater) that seems more like it. Going with a 6.8µF 10V unit will
get us
Il = 0.008CV = 0.008*6.8µF*10V = 0.54µA.
Not bad. On top of that, since our comparator inputs are sourcing
current, they'll be supplying some, if not all, of C1's leakage
current, taking some of the timing error away from R4.
OK. Now we've got:
V1
|
[1M]
|
+---V2
|
[6.8µF]
|
0V
Now, to check how long it takes the cap to charge up to 6V, we can
write:
V1 9V
T = RC (ln -------)s = 1Mohm * 6.8µF * ln ------- ~ 7.47s
V1-V2 9V-6V
A little high, but since we can fix the timing with R1 R2 R3, let's
leave it alone.
Now, since we've chosen the high voltage point to be 2/3 of Vcc, Let's
just arbitrarily make R1 = R2 = R3 to force the low voltage point to
be 1/3 Vcc and see what kind of time it takes for C1 to charge up to
3V.
9V
T = 6.8 * Ln ------- ~ 2.76s
9V-3V
A little low, but we can fix it.
How?
By figuring out the voltages on C2 corresponding to exactly 3 seconds
and 6 seconds and adjusting R1, R2, and R3 to put those voltages on
the reference inputs of the comparators.
Read the next exciting installment, due out tomorrow!-)