30 second delay (on and off)

Nov 02, 2006 11 Replies

I need to close a relay 30 seconds after a signal is present, and open the same relay 30 seconds after the signal drops out, (+/- 10%). I'm considering using a RC network on the input of a comparator so that the cap charges and closes the relay 30 seconds after the input is present, and opens the relay 30 seconds after the input falls. There will be a long period between on/off so the cap can fully charge and discharge. There is also some feedback to avoid relay chatter. I need to use fewest parts possible.



Is this about as simple as can be, or is there a better approach?


-Bill



I've used RC networks before without any problems for low accuracy applications. The only caveat I can think of is to avoid electrolytics (depending on the application) since they have a limited load life.

I would buy an off the shelf relay with time delays.

--- I think using a 7555 as a comparator would be simpler since the switching points are already defined as 1/3 and 2/3 Vcc, the reference divider's already in the chip, you've got an output you won't have to fiddle with (it's not a couple of open-collector (or totem-pole) comparator outputs), and you won't have to provide any hysteresis since everything is internal to the chip except the timing cap and resistor.

The internal reference divider will force the output high when Vt is < 1/3 Vcc (Vth is a don't-care), and the output will go low when Vth

So what you'd do would be to wire it like this:

View in Courier

+V>-------------------+-------+ |8 | +---+---+ | VIN--[POT]OUT | 6| |3 | | GND | |+ +---+---+ [Ct] |1 | | GND>---------+--------+

The 755 needs 500pA max for both the trigger and the threshold currents, so you could easily use something like a 30µF cap for CT, with the timing being:

Vcc T = RC ln ----------- = k (RC) Vcc - Vth

k, then would be equal to:

Vcc 1 k = ln ------------ = ln ---------- = 1.0790 Vcc - 0.66 1 - 0.66

and, for a capacitance of 30µF and a time constant of 30 seconds, R would be:

t 30s R = ---- = --------------- ~ 927000 ohms kC 1.08 * 30E-6F

So, if you used (say) a 10% electrolytic for the cap and a rheostat-wired 2 megohm pot you could easily get the timing down to where you needed it with the wiper at about 50% of its travel.

-- JF

Yes, that's a good idea, but I forgot to mention the supply voltage and relay are 24DC. I suppose a 12 volt zener in series with the 555 power line would help. I also have a second relay that requires 60 seconds delay on and only 30 off. I was figuring on setting the comparator reference at 2/3 the supply so the cap takes twice as long to ramp up as down. Maybe that can be done with a 555 using an extra diode somewhere?

-Bill

Oh, well, none of us are perfect.

Thinking about it a little more, and being a little less grouchy, I thought your 60 second ON / 30 second OFF delay could be done like this: (Shift into present tense for a while) +24V>---------------+-----+------+ | | | [100k] | [10k] | | | Vin>----[Rt]---+----|----|+\\ | | | | >----+ | +----|-/U1A | | | | | [100k] | | | | +----|----|+\\U1B | | | | >----+--->OUT | +----|-/ | | |LM393 | | | [Ct] [100k] | | | | GND------------+----+-----+---------->GND Initially, with Vin at 0V, the voltages on the - inputs of the comparators will be more positive than the voltage on the + inputs, and the outputs of both comparators will be low. With RtCt chosen for a 60 second time constant and +24V step applied to Vin, the voltage on the + inputs of the comparators will rise as Ct charges, and when it goes more positive than the voltage on the - input of U1B, U1B\'s output will go open collector. However, U1B\'s output will still be low, keeping OUT low. When Vin rises to >16V, (2/3 Vcc) U1A\'s + input will become more positive than its - input, and U1A\'s output will go open collector. Now, since both comparator outputs are no longer sinking current through the 10k ohm resistor, OUT will go high. If Vin is allowed to remain high until Ct is fully charged, then when Vin is pulled low, to 0V, Ct will start to discharge, and when the voltage on U1A+ becomes less positive than the voltage on U1A-, OUT will go low. But, the question is, how long will it take Ct to discharge to 2/3 Vcc from Vcc? the answer is, not half as long as it took to charge up to 2/3 Vcc from 0V. Consider: On the way up, when both comparators were open collector T = kRC where Vcc 24V k = ln ----------- = ln ----------- = 1.1 Vcc - Vth 24V - 16V So, choosing the parts to get that time constant would involve dividing their product by 1.1 and adjusting the value of either the capacitor or the resistor to get there. On the way down, though, we\'re starting with 24V since the capacitor is fully charged and we want to know how long it\'ll take to get to 16V, since that\'s the switchpoint for the wired AND. Since, in order to do that, we only have to traverse a potential difference of 8 volts out of a total of 24, we can use the same equation and write: Vt 24V K = ln --------- = ln --------- = 0.41 Vt - dV 24V - 8V Unfortunately, 0.41 isn\'t half of 1.1...

he

t,

Yes, I follow that, but was expecting to use just one comparator. Wouldn't you get the same result from something like this:

+24V>---------------+------------+ | | [100k] [10k] | |\\ | Vin>----[Rt]---+----|----|+\\ | | | | >----+----> OUT | +----|-/U1A | | |/ | [200k] | | [Ct] | | | | | GND------------+----+------------------>GND

Anyway, I like your original idea of the 555 with the built in references and feedback, but the output is inverted. That is, when pins

6 and 2 of the 555 move high, the output moves low, so inversion is needed somewhere. I'm planning on using a NPN transistor on the input with a pullup resistor so when the input goes high, the cap will discharge through one 540K resistor and output moves high 60 seconds later. When input moves low, the cap will charge through both 540K resistors (diode conducting) and output will move low 30 seconds later. I may have to adjust the resistors slightly to get it right. Something like this without the front end transistor and pullup shown. +V>-----------------------------+-------+ |8 | +---+---+ | | Vcc | | 2|_ _|4 | VIN--+-------[540K]----+----|T R|---+ | | | | ___ +--[D]--[540K]----+----|TH OUT|--->OUT | 6| |3 | | GND | | +---+---+ [100uF] |1 | | GND>--------------+--------+

-Bill

Yes. Matter of fact, I\'d changed mine to exactly what you have, was working on the 60-on 30-off circuit and was going to post them both at once, but you beat me to the punch on both counts! :-)

it just amazes me, as old as the 555 is, it still a common base timer to use! be it a cmos or monolithic type.

"I\'m never wrong, once i thought i was, but was mistaken" Real Programmers Do things like this. http://webpages.charter.net/jamie_5

A microcontroller with a built-in clock can probably provide better than the 10% accuracy of the RC timer.

For the easiest programming (in a dialect of BASIC), the PICAXE 08 chips are under $3 (single quantities) and the needed external components would be a 5 volt regulator (78L05 is more than adequate) and some bypass capacitors. The 08 ouputs can provide 20ma, which is more than enough to drive the transistors you plan to use to operate the 24v relays. The various PICAXE chips (8 to 40 pins) offer ADC inputs, PWM outputs, serial and I2C communications

The programming software is free. The primary site for the PICAXE is here:

formatting link

Links to more info on the PICAXE chips:

formatting link
formatting link

John

Yes, a microcontroller is a better approach that eliminates about 17 parts. I have the tools for the PIC16F628, which is an overkill, but I don't want to invest too much in a hardware programmer to load the smaller devices.

-Bill

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required