# Delay on/off circuit

#### vitaterne

Joined Dec 2, 2011
15
The concept is relatively simple. It is in essence a timer circuit that stays on for as long as a switch is closed. ie: switch closes for 5 seconds and is then opened but the circuit stays on for as long as the switch was closed, so 5 seconds.

I had an idea about using a capacitor circuit to turn on a transistor but i really don't have a clue about how such things work. here is a schematic that i drew up of my idea.

If anyone could give any helpful pointers/advice on how to go about it, or correct deficiencies in my schematic i would be very grateful.

#### wayneh

Joined Sep 9, 2010
17,499
There are some problems with your circuit. To make it work at all, you'll need to charge and discharge the capacitor through a resistor, to slow it down. As drawn, the cap charges instantly and information on how long the switch is closed is lost. For "human" time periods (ie. seconds), you'll need a big cap and a big resistance value.

You may not need the resistor giving a current path to ground. The cap will drain through the base of the transistor. You'll only need to add that resistor if you need it to drain even faster.

You should put the meter (or motor?) above the transistor, and let the transistor (an NPN, I assume) open a path to ground when current flows through M. The threshold voltage for the transistor will then be a predictable ~0.7V. Above that it's on, below it's off.

#### vitaterne

Joined Dec 2, 2011
15
Thank you, that does make sense come to think of it, it also simplifies the whole circuit as i no longer need to have 3 resistors. time to make a trip down to the electronics shop. Quick question, if the input voltage is 6v what sort of transistor should i use? would an n channel mosfet be the best option?

#### SgtWookie

Joined Jul 17, 2007
22,230
Trying to design something like this using only resistors and capacitors will be very problematic. If the switch ON times are short or very long, the circuit response won't be very accurate.

If you are needing some reasonably accurate timing, you'll likely need to go to a microcontroller solution, where the microcontroller counts up while the switch is closed, and then when the switch is opened, it counts down until it reaches zero.

Something like that might be done using a timer clocking 74 series or 4000 series logic ICs, but it could require quite a few of them depending on the accuracy required.

What is the range of seconds (minimum, maximum) that you need to time?

#### vitaterne

Joined Dec 2, 2011
15
between 1 and 15 seconds with an accuracy of half a second. I have no idea how to actually use logic chips, or even what they are. This is why I'm using resistors and capacitors.

Might be a bit of an ask but would it be possible (seeing as my schematic is inherently flawed) to draw up a schematic?

apologies for my lack of knowledge on the subject matter.

#### wayneh

Joined Sep 9, 2010
17,499
...with an accuracy of half a second.
That's fatal to the simple RC strategy. Half a second out of 10 seconds is only 5% error. You'll need something much more sophisticated to achieve that, as has been suggested. Something with a digital clock.

#### SgtWookie

Joined Jul 17, 2007
22,230
That amount of accuracy means you'll need to use at least 5 counter bits with an accurate clock. Since you can't really buy an IC that is a 5-bit counter, two 4-bit binary counters can be used; you'll benefit by having greater accuracy than you require, and the timer components won't be as critical.

#### vitaterne

Joined Dec 2, 2011
15
How would i go about it? i have no idea about how to use a 4 bit binary chip, Is there a tutorial somewhere that would give me an idea on how to use it in conjunction with the aim of the circuit in mind?

#### SgtWookie

Joined Jul 17, 2007
22,230
I'm thinking of using a couple of CD4516B up/down counter ICs, as they have separate clock and up/down selection pins, rather than a count-up clock and a count-down clock.

You might review the datasheet for a CD4516B counter; just google "4516" and you should get lots of hits.
[eta]
http://www.kpsec.freeuk.com/components/cmos.htm

#### vitaterne

Joined Dec 2, 2011
15
I've had a readthrough on the link and im finding it confusing, am i right in saying that i could have it count up for a certain amount of time, and when the voltage turns off it will start counting down? This is a completely new area for me so im pretty much blind when it comes to working it out. i appreciate your help though.

would i have to have a separate pulse circuit to act as a clock? or is that integrated within the IC?

also, does the chip function as a transistor? or would it activate a transistor which would be on a separate circuit? Im going to try and power-learn this tonight and have a circuit ready as i have only the weekend to get this working.

#### SgtWookie

Joined Jul 17, 2007
22,230
I've had a readthrough on the link and im finding it confusing, am i right in saying that i could have it count up for a certain amount of time, and when the voltage turns off it will start counting down?
You've got the idea. You catch on fast.
This is a completely new area for me so im pretty much blind when it comes to working it out.
It is new to EVERYONE at some point in time. At one point, it was new to me as well. I try to keep that in mind when I am helping people.
Would i have to have a separate pulse circuit to act as a clock? or is that integrated within the IC?
Yes, you do need a separate pulse to act as a clock.
This is easily accomplished using a 4093 quad Schmitt-trigger NAND gate, a resistor and a capacitor. Using this as a clock has an advantage in that we can use it to "gate" the clock on and off, without having to use another IC or gate.

Find a datasheet for a 4093B quad NAND gate.
Various companies use different prefixes:
Motorola/ONsemi uses MC1
Texas Instruments and many others use CD
Philips/NXP uses HEF
ST Microelectronics uses HCF
There are others, but that list will get you started.
Philips/NXP and ONsemi datasheets are usually quite good.
TI's datasheets can be hard to read, as many were simply scanned in from old printed datasheets, and the quality is not so good.

#### vitaterne

Joined Dec 2, 2011
15
Im really very sorry, but I'm in way out of my depth. I really do appreciate the help you are trying to do, and i do understand the basic concept but the logistics of it are a little beyond me. all i have access to is a soldering iron and i'm assuming i would need an oscilloscope to measure the frequency of the pulses along with a couple of multi-meters which i just don't have.

Is there no simpler method? If not i will force myself to learn but it seems very complex for what is in essence a simple idea, or is it one of those easier said than done?

#### SgtWookie

Joined Jul 17, 2007
22,230
It's in the "easier said than done" category, I'm afraid. There is not a good, simple way to do what you want that I know of with any kind of accuracy.

I can simulate the circuit, and select components that will work for you.

#### vitaterne

Joined Dec 2, 2011
15
That would be wonderful, would you be able to correct any deficiencies in my schematic once i have worked it out?

#### vitaterne

Joined Dec 2, 2011
15
Would the pulse/oscillator circuit be wired as such?

#### SgtWookie

Joined Jul 17, 2007
22,230
Actually, I'm working on one.

#### vitaterne

Joined Dec 2, 2011
15
Really, Thank you so much, Il still sit here scratching my head and try to learn about the 4000 series, I'm finding it a surprisingly good read!

#### SgtWookie

Joined Jul 17, 2007
22,230
Here, have a look at the attached.

Pressing and holding down S1 results in the two decimal up/down counters counting up as far as they can. Releasing S1 causes the counters to count down. When they reach 0, the countdown stops.

C2/R2 cause both counters to get all zeroes loaded when the circuit is first powered up.

D1 through D9 act as a 9-input OR gate. If any of those are high, U3A will be generating a square wave output, causing U1 and U2 to count.

Once S1 has been closed long enough for any of the counter outputs to have clocked a 1 output, U3A is latched on until S1 is open and U1/U2 have all zero outputs.

R3 is required; without it, that area would float.
C3 is a small capacitor to help keep that node quiet.
V1 is simply a simulated 21-second button press. Note that the green trace (A) is high for 21 seconds.
Note that the yellow trace (B) is high for 42 seconds.
I showed the trace from that point, as displaying the trace from Out2 would have the two traces overlaying each other for the 1st 21 seconds.

If someone holds the switch down too long, the counters will overflow and your mileage will vary greatly.

D10 can be replaced with a piece of wire. I was going to do something differently, but it is no longer required, and such a small change doesn't mean a revised schematic is necessary.

I did not show U3d. It should have its' inputs wired to ground; otherwise it may oscillate in an uncontrolled manner.

ALL CMOS INPUTS must have a current path to ground or Vdd.
[eta]
I did not show bypass capacitors. People who have been doing this for awhile, know that they must use 0.1uF/100nF ceramic or poly metal film capacitors across the supply pins of each IC in a circuit. If you don't use them, you invite a lot of problems. Use them and avoid a lot of problems.

#### Attachments

• 51.3 KB Views: 15
Last edited:

#### vitaterne

Joined Dec 2, 2011
15
Thank you so much, just a couple of questions, what is the purpose of out2? and i assume that the U3d is connected in similar fashion with U3b and U3c. And that all 4 U3's are part of the same 4093 Schmitt trigger?

Would i connect the motor in series through wire ?

The grounding can be taken as just the negative terminal of a battery pack?

sorry for the amount of questions but im really trying to understand this, i don't want to just go away and build it without learning how it works.

#### SgtWookie

Joined Jul 17, 2007
22,230
OK, just a couple minor changes; the timing resistor R1, removed D10, changed the displayed time range.

With these values, the maximum time for the counters is about 16 seconds; after that they will roll over.

Also, the maximum resolution is 150mS, or 1/6.667 second. If you want finer resolution, another counter and four diodes can be added. That addition would give you better than 10mS resolution.

#### Attachments

• 45.7 KB Views: 10