12v 15 Minutes Delay Off Circuit

Thread Starter

s200bym

Joined Aug 9, 2017
82
Hi all,

I want to make a delay off circuit, so when the switched 12v is removed the circuit will stay live for around 15 minutes. Can you please look at the circuit below and tell me whether it is gobbledegook or it will actually work.

This is more a joint automotive and general electronics project as it will be used on a microcontroller in my car, but I thought it would be more suited here.

From my limited knowledge, I have hopefully put together a working NE555 timer circuit from designs I have found on the net. There is a permanent 12v input and a switched 12v input. When the switched input is active it switches Q1 and brings pin 2 low, the 555 does its magic and outputs 12v to pin 3 and switches Q2 to complete the circuit and activate the solid state relay. When the switched 12v supply is removed the circuit will stay active for around 15 minutes then turn off.

Please see the circuit below.

Thanks,
Mike.

InkedPower Delay_LI.jpg
 
Last edited:

dendad

Joined Feb 20, 2016
4,479
Just one thing, the solid state relay may not work for you. It will need to be designed for DC operation. Some are only for AC as they don't turn off until the AC crosses zero. Check the data sheet.
 

bertus

Joined Apr 5, 2008
22,278
Hello,

If you are really using an AQB1A-ZT3/6VDC relays, it will not work.
The input voltage is to high and the relays is ment to be used on AC.
The way it is now, it will not switch off.

Bertus
 

Attachments

Alec_t

Joined Sep 17, 2013
14,332
15 minutes is rather long for a 555-based timer, since it involves high value timing components. In an automotive environment there is a lot of electrical noise. The 1meg timing resistor makes the circuit rather susceptible to interference, and the 1000uF electrolytic timing capacitor could have a leakage current (made worse by high temperature) comparable to its charging current. The timeout is therefore likely to be subject to considerable drift. This may or may not be important in your application.
 

Thread Starter

s200bym

Joined Aug 9, 2017
82
Thanks for your replies.

@dendad @bertus I have changed the picture as the relay I want I cant find to add to the library, it's going to be the Omron G3DZ-DZ02P.

@Alec_t Its, not a critical time just more of a convenience. I will be running a custom ATmega328 exhaust controller that defaults to closed when resetting/power loss if I switch the car off while popping into a shop or friends, I don't want to keep pressing the button every time I switch the car off/on frequently. Is there another method I could use?

Cheers,
Mike.
 

crutschow

Joined Mar 14, 2008
34,464
Your circuit will keep retriggering and timing out as long as the switched 12V is applied which means the timeout after you remove the switched 12v can be any value between zero and 15 minutes.

Below is the LTspice simulation of a circuit that avoids this problem:
I used a CMOS version of the 555 (LMC555) to avoid any adverse affects of input leakage for such a long delay.
The transistor turning on at 100s (blue trace) brings both the capacitor and Reset voltage low (red trace), causing the output to go high.
The capacitor voltage stays low and doesn't start to charge until the switched voltage is removed and the transistor turns off at 200s.
The output then stays high until the capacitor voltage reaches the upper threshold and times out.

I connected C1 to V+ to that the 555 doesn't trigger and time out upon initial application of steady 12V.
That also minimizes the adverse affect of capacitor leakage (in this configuration leakage tends to shorten the delay, not lengthen it).

upload_2019-1-19_12-26-43.png
 

crutschow

Joined Mar 14, 2008
34,464
I will be running a custom ATmega328 exhaust controller that defaults to closed when resetting/power loss if I switch the car off while popping into a shop or friends,
Why not just close it as soon as the power is off?
Why the 15 minute delay?
 

Thread Starter

s200bym

Joined Aug 9, 2017
82
@crutschow I want the valves to stay open if I have to do frequent stops during the day. so I want a 15 min delay for power off. I don't want to keep constant power to the ATmega so it doesn't drain the battery. I have set it to default close so when I start the car in early mornings the valves then default to close just in case I forget to close them manually so not to wake the neighbours.

I take it I still need to connect a transistor to the output pin to invert the output?

Thanks,
Mike.
 
Last edited:

crutschow

Joined Mar 14, 2008
34,464
I take it I still need to connect a transistor to the output pin to invert the output?
Not really.
The 555 output should be able to drive the optocoupler directly.
But I see no reason for the coupler as the power and ground for the output are not isolated.
Why do you think you need the opto?
 

Thread Starter

s200bym

Joined Aug 9, 2017
82
Yeah, I don't know why I put that in tbh.

I have come across a CD4060 circuit design which looks like it would work. I have opted to go with version 2 as it keeps current consumption down when the timer has stopped.

242.png

Connecting Range to pin 13 will give me a time range of 15-45mins, and if I am right replacing the reset switch with a transistor for the switched 12v to control.

Here is a description of how the circuit works.

Code:
The Cmos 4060 contains a 14-bit binary counter.

The various bits of the counter are connected internally to the output pins.

You'll see from the diagram that bit-12 (Q12) is connected to pin 1. Bit-13 (Q13) is connected to pin 2 etc.

Although the 4060 contains a 14-bit counter - only 10 of those bits are available as outputs.

Q1, Q2, Q3 & Q11 do exist - but they are not connected to output pins.

                 ============

The Cmos 4060 also has two built-in inverters.

They are connected in series across pins 11, 10 & 9.

You can tell they're inverters because the symbols are drawn with a small circle at the output.

                 ============

As the name suggests - the output of an inverter is always the opposite of its input.

If the input pin is high - the output pin will be low.

If the input pin is low - the output pin will be high.

                 ============

Together with R3, R4, R5 & C3, the inverters form a simple oscillator.

The oscillator gives the 14-bit counter something to count.

                 ============

While the oscillator is running - pin 9 switches continuously from high to low and vice-versa.

It's rather like the swing of a pendulum - or the ticking of a clock.

Pin 9 is connected internally to the binary counter - and the counter counts the ticks.

                 ============

As the count progresses - its state is reflected by the output pins.

For example - after eight oscillations - Q4 (pin 7) will go high.

After sixteen oscillations - Q5 (pin 5) will go high.

After thirty-two oscillations - Q6 will go high - and so on.

It takes 8192 oscillations for Q14 to go high.

                 ============

R4 controls the frequency of the oscillator.

That is - the speed at which the clock ticks.

By altering the frequency of the oscillator - you can control the speed at which the count progresses.

In other words - you can control the length of time it takes for any output pin to go high.

                 ============

When the output pin goes high - it's connected internally to the positive line.

So it will supply base current to the transistor - through R7.

The transistor will switch on - connect the negative side of the relay coil to ground - and the relay will energize.

                 ============

When the output pin goes high - it does a second job.

It takes pin 11 high - through D1.

This stops the oscillator - so the count cannot proceed.

In other words - the timer stops when the relay energizes.

                 ============
If the oscillator were to continue to run - the counter would go on counting.

And - after a similar time interval - the output pin would go low again.

So - the transistor would switch off - and relay would de-energize.

In fact - the relay would keep energizing and de-energizing at the same regular time intervals.

If you have an application where this would be useful - simply leave out D1.

                 ============

The basic difference between the two circuits is: -

The first uses an NPN transistor to connect the relay coil to ground.

And the second uses a PNP transistor to connect the relay coil to the positive line.

In Circuit No.1 - when the output goes high - the transistor switches on.

In Circuit No.2 - when the output goes high - the transistor switches off.

                 ============

While the output pin is low - it's connected internally to the negative line.

In Circuit No1- it connects the base of the NPN transistor to ground through R7.

So the transistor is switched off - and the relay is de-energized.

When the output pin goes high - it's connected internally to the positive line.

So - it supplies base current to the transistor - through R7.

This causes the transistor to switch on.

The transistor connects the negative side of the relay coil to ground - and the relay energizes.

                 ============

In Circuit No2 - while the output pin is low - it connects the base of the PNP transistor to ground through R7.

So current is flowing through the emitter-base junction - and the transistor is switched on.

The transistor connects the positive side of the relay coil to the positive supply line - so the relay is energized.

But when the output pin goes high - it's connected internally to the positive line.

So - it connects the base to the transistor to the positive line - through R7.

Without a path to ground for its base current - the PNP transistor switches off.

This cuts the power to the relay coil - and the relay de-energizes.

                 ============

The reason for the two versions of the same circuit is to help keep overall current consumption to a minimum.

The first circuit uses less power while the timer is running.

The second uses less power after the timer has stopped.

You choose the one that best suits your application.

                 ============

To reset the counter to zero - pin 12 must first be taken high - and then taken low.

At the exact moment that pin 12 goes low - the counter resets.

That is - all the outputs go low - and the counter begins to count up from zero.

                 ============

The purpose of C2 and R6 is to perform an automatic reset when power is applied.

Initially - at power-up - C2 is discharged.

In a discharged state it acts like a wire link connecting pin 12 to the positive rail.

That is - it takes pin 12 high.

Almost immediately - C2 charges through R6 - and the resistor takes pin 12 low.

This causes all of the outputs to go low - and the count begins at zero.
                 ============

When you're operating the timer you can use the optional reset button.

It takes pin 12 High and discharges C2.

When you release the button - C2 will charge through R6 - and the resistor will take pin 12 low.

The moment pin 12 goes low - all of the outputs go low - and the counter begins to count up from zero.

                 ============

However - when you are setting up the timer - you must reset the circuit by interrupting the power supply.

The reset button only resets the counter - it does not reset the oscillator.

In fact it stops the oscillator right at the point where it's about to deliver the first pulse.

So the first cycle is shorter than normal.

Consequently - the length of time - between the release of the reset button - and the arrival of the first pulse to be counted - is too short.

In everyday operation this amount of inaccuracy is insignificant.

However - during setup - the error is magnified by the factors in the setup table.

                 ============

Interrupting the power for a few seconds not only resets the counter - it also resets the oscillator.

This makes the time it takes for the yellow LED to light - much more predictable.

And makes the fine adjustment of the timer much easier.



                 ============

  HOW THE OSCILLATOR WORKS

                 ============

Note that R3, R4 & C3 are connected in series between the outputs of the two inverters.

If the cycle starts with pin 11 low - then pin 10 will be high - and pin 9 will be low.

So the capacitor will begin to charge from pin 10 - through R3 & R4.

The speed at which it charges depends on the value of the capacitor - and the setting of R4.

As it charges - the voltage at the junction of C3 & R4 will rise.

When it reaches just over half the supply voltage - it takes pin 11 high - through R5.

                 ============

Now everything reverses.

Pin 11 is high - so pin 10 is low - and pin 9 is high.

C3 begins to charge again - only this time it's in the opposite direction.

As Pin 9 charges the capacitor - the voltage at the junction of C3 & R4 will fall.

The speed at which it falls depends on the value of the capacitor - and the setting of R4.

When it falls to just below half the supply voltage - it takes pin 11 low - through R5.

With pin 11 low - the cycle is complete - and the next cycle can begin.

                 ============

The oscillator runs because the polarity of the charge on C3 keeps reversing.

As a result - the junction of C3 & R4 keeps taking pin 11 back and forth between high and low.

And since pin 11 keeps changing back and forth between high and low - the polarity of the charge on C3 keeps reversing.

It's a sort of controlled feedback - where the frequency generated is determined by the values of R3, R4 & C3.

                 ============

The main purpose of R3 is to set an upper limit on the frequency.

Its value was chosen to provide a minimum period of about 30 seconds at pin 7.

The value of R4 was chosen to provide up to about 24-hours at pin 3.

Thus - R4 will adjust the timer over the range from 30-seconds to 24-hours.

                 ============

When they are biased in the reverse direction - polarized capacitors will conduct direct current.

Since the charge on C3 is constantly reversing in polarity - ideally the capacitor should be non-polarized.

Modern electrolytic capacitors generally have a very low leakage current - even in the reverse direction.

So you can usually get away with using a regular polarized "aluminium" electrolytic capacitor.
                 ============

Because the minimum value of R3 + R4 is 150k - very little current will flow through the resistors.

So - even if C3 does leak in the reverse direction - the worst that can happen is that the oscillator won't run.

It's easy to tell if the oscillator is working.

Set R4 at about mid-point.

If the green LED is turning on and off at about 5-second intervals - the oscillator is running properly.

                 ============

By connecting two regular capacitors back-to-back - you can simulate a non-polarised capacitor.

Since one of the capacitors is always correctly biased - no DC current can flow through the pair.

                 ============

When two capacitors are connected in series - their combined capacitance is reduced.

The formula for capacitors connected in series - is similar to the formula for resistors connected in parallel.

Where just two capacitors are connected in series - the formula may be expressed as : -

         (The Product / The Sum)
                            Or
             (Ca x Cb) / (Ca + Cb)

So two 22uF capacitors - connected in series - have a combined capacity of : -

                 (22 x 22) / 44
                      = 11uF

                 ============

When - as here - both capacitors have the same value - there's a simpler calculation.

The combined capacitance is equal to half the value of one capacitor.

So two 22uF capacitors - connected in series - have a combined capacity of : -

                22 / 2 = 11uF.

                 ============

The oscillator stops when D1 takes pin 11 high.

The diode allows a high output pin to take pin 11 high.

But - it prevents a low output pin from holding pin 11 low.

By clamping pin 11 high - D1 forces pin 10 to remain low.

So pin 9 has to remain high.

                 ============

Since pin 11 can no longer change its state - the polarity of the charge on C3 cannot change.

So the oscillator cannot run.

In effect - the counter is frozen at the moment your chosen output pin goes high.

It will remain frozen until the circuit is reset.

That is - until pin 12 is taken high and then low again.

                 ============

Note that R3, R4 & R5 are connected in series between pins 10 and 11.

They join the output of the first inverter to its own input.

The value of R5 needs to be very high.

That way - any influence the output of the first inverter has on its own input will be very small.

It will be swamped by the influence of the changing charges on C3.

                 ============

The data sheet for the 4060 says that the value of R5 should be at least ten times the value of R3 + R4.

That would make it about 6M8.

But a 4M7 resistor seems to work well enough.

The value of 4M7 was chosen because it's widely available - but you can fit a higher value resistor if you wish.

It's possible to use such high value resistors because Cmos inputs are operated by voltage - and not by current.

Because no current flows through the 4M7 resistor - there's no voltage drop across it.

                 ============

Coils of all sorts give off high reverse-voltage spikes that will destroy Cmos ICs.

Always connect diodes across relay coils - and across any other device that might contain a coil.

Note that the cathode of D2 - the side with the bar - is connected to the positive terminal of the coil.

Any reverse-voltage spikes will be short-circuited at source - before they can do any damage.

                 ============

I've used a SPCO/SPDT relay in the drawing.

But you can use a multi-pole relay - if it suits your application.

I specified a minimum coil resistance of 270 ohms.

A higher value will improve battery life.

                 ============

With a 12-volt supply - the maximum current through the transistor will be
(12v / 270 ohms) about 45mA.

This is well within the limits of the BC547 and BC557 - which have an IC(max) of 100mA.

There is nothing special about the transistor.

Provided the NPN/PNP requirement is satisfied - any small transistor with a gain (hfe) greater than 100 and an IC(max) of at least 100mA should do.

But remember that the pin configuration of your transistor may be different from that of the BC547 and BC557.

Just because your transistor looks the same - don't assume that its pins are arranged in the same order.

                 ============

Although static electricity can destroy Cmos ICs - they are extremely reliable in operation.

Most modern versions will survive a fair degree of abuse.

But it's worth taking a couple of basic precautions.

Avoid touching the pins - and don't overheat them with the soldering iron.

A socket will reduce the chances of damaging the IC - and will make it easier to replace if necessary.

If you're using a socket - always turn-off the power - before inserting or removing the IC.

Also - check that the IC is the right way round. Pin 1 should be in the top left-hand corner.

And check that all of the pins are correctly inserted into the socket.

Sometimes - instead of entering the socket - a pin will curl up underneath the IC.

                 ============
Cheers,
Mike.
 
Last edited:

crutschow

Joined Mar 14, 2008
34,464
if I am right replacing the reset switch with a transistor for the switched 12v to control.
Just apply the switched 12V to the reset input to keep the counter from starting, no transistor needed.
When the reset voltage goes below about 6V, the timer will start.
 
Top