Introduction: Adjustable Auto-shutoff Relay Timer for High Power Applications
Submitted by Ace Monster Toys Hackerspace in Oakland, CA for the Instructables Sponsorship Program
Have you ever wanted to make sure that an electrical device you are using automatically powers itself off after a set amount of time? This can dramatically improve the safety of a soldering iron, a glue gun, or anything else that's dangerous to leave unattended, or even be connected to an automatic plant-watering system that is turned on daily or twice a day by a simple mechanical timer, does its thing for a minute or two, then shuts the pump off until it's powered on the next day. Before we begin, we need to be aware that the maximum power-on time for a circuit like this is only about 10 minutes because of reasons I'll explain within.
You can buy a device like this pre-made, but if you want to power high-current and high-voltage devices, you'll have to DIY.
DISCLAIMER: Working with high-voltage electronics can be dangerous!
Here's what you will need to start:
* a multimeter
* a breadboard
* a 555 timer. I am using a TI 555P because of its ability to source 200mA of current needed to directly drive the relay. If you only have a low-power 555, you can build a transistor circuit to up the current from your 555 in order to drive your relay, but that won't be covered here.
* A relay that you know the rating of
* for high-voltage high-current applications, a quality relay socket with screw terminals
* Some capacitors, resistors, and a variable resistor (often called a potentiometer). In this example, I will use a 1Mohm potentiometer, a 470 or 1000 uF electrolytic capacitor, 2 10Kohm resistors, 1 50Kohm resistor, 1 0.1uF capacitor (electrolytic) and 1 .01uF capacitor (ceramic)
* a normally-open pushbutton switch if you want to be able to reset the timer without disconnecting and reconnecting the power supply
* a diode
* a standard LED (red)
* Hook-up wires for the low-voltage side
* A heavy-duty grounded extension cord that you don't mind hacking up
* A power source with the correct voltage for your relay coil (the solenoid side) and your 555. I am using a 6V "wall-wart"
* perf board, soldering iron and solder if you want to solder it all together
Step 1: Matching Your Timer Output Power to Your Relay
Relays are simple electromechanical devices which employ a solenoid (electromagnet) driven by a relatively low current and voltage which controls a mechanical switch that will close a circuit capable of carrying a much higher voltage and current. Using this principle, we can use a small DC voltage coming from the output of the 555 timer chip, to actuate the solenoid and turn on a much higher voltage circuit such as your soldering iron.
When we are working in the domain of electronics, we need to be sure that the output of the 555 timer chip is suitable to drive the solenoid of the relay. We need to examine a couple of aspects of the datasheets or specifications of both to determine if this will work.
First, find the relay coil voltage and resistance. For my example, I am using a NTE R14-11D10-6 which has a coil voltage of 6V and a resistance of 40 ohms. The most basic law of electronics, Ohm's Law, states:
or V (voltage) is equal to I (current in amperes) multiplied by resistance (in ohms). Since our voltage is 6V and our resistance is 40 ohms, we find that I=6/40 or .15 amps. So we know we need a current of 150 milliamps to actuate the relay and turn on the high-power side.
Then we examine the datasheet of the 555. I am using a TI NA555P timer and its datasheet says that it is capable of sourcing or sinking 200mA. Perfect, this is plenty for the relay! This is important to note because some 555 timers cannot source 200mA. One can add a transistor to source a higher current if needed, but that is outside of the scope of this document.
It is also important to note the operating voltage of both parts. Our relay is 6V so it should be operated with 6V. The 555 can be operated anywhere between 5V and 15V. So we will operate both parts from a 6V supply. 4 AA batteries or a 6V wall-wart will suffice. Note that the wall-wart must provide at least 150 milliamps for the relay plus 2-5 milliamps for the 555 itself. Keep in mind that the 555 triggering is based on ratios of its source voltage, so the rest of the decisions (resistor and capacitor values to set the time) are independent of the source voltage.
So from reading datasheets and doing a little simple math, we have determined that our 555 can drive our relay directly. We'll discuss using a protection diode to protect your circuit during the section where we hook up the relay, but first..
Step 2: Determining the Values for Your Resistor and Capacitor
We are going to be creating a circuit with the 555 timer called a "monostable timer." Monostable means that the circuit will be stable (i.e. not change) when in one state; that is, the "off" or "low" state. The "on" or "high" state, which switches the relay on, is temporary. When triggered, the 555 output will go into "high" state until the big capacitor is charged, and then switch off, and stay in the "off" state. This is "monostable" operation.
To determine the amount of time that the 555 will stay in the temporary on state, you add a resistor and capacitor of carefully selected values using this simple formula:
T=1.1 * R * C
So 1.1 times the resistor value (in ohms) times the capacitor value (in farads) yields the time in seconds that your circuit will stay on before turning off. This is true within a window - when your resistor value approaches 1 megaohm and your capacitor is large (say >500uF), the capacitor may leak charge faster than it will be charging up. If you need a timer circuit longer than about 10 minutes, you will need to use a different approach (microcontroller, 555 circuit with tantalum capacitor, or timer/counter chip such as the MC14541.) But this basic 555 circuit is cheap, easy to construct, and is reasonable for non-precise requirements up to about 10 minutes.
You'll need a large capacitor and a small resistor to measure times in the seconds or minutes. The basic theory is that the capacitor charges through the resistor and signals to the 555 to turn off when the voltage at the point between the resistor and capacitor reaches a certain point, which it will when the capacitor charges. The larger capacitance you have, and the less current the resistor allows through, the longer this will take the capacitor to charge and signal the 555 to turn its output off. Some easy to find values to start with are a 470 uF or 1000 uF capacitor and a 1 megaohm resistor. The 1 megaohm resistor can take the form of a potentiometer. Go ahead and do the math and figure out how long the timer will stay on for 1 megaohm and 470 uF, or when it's turned down halfway to 500Kohm, or all the way down to 10 ohms.
The 555 will turn the relay off nearly immediately if you turn the potentiometer down to 0 because the capacitor will charge nearly instantly. If that's what you want, just use the potentiometer, but if you would like a minimum time off time of, say, 2 minutes, then you will need to add a fixed resistor in series with your potentiometer to make the adjustable range.
So, if I want to set a lower bound of 1 minute, I can do the math backwards:
60 = 1.1 * ? (R) * .00047
R = 120 / (1.1 * .00047)
the resistance value will be about 116k ohms. So I will wire a standard value 100k ohm resistor in series with my potentiometer to give my circuit a lower bound of about 2 minutes and that will make the upper bound just over 20 minutes, by making the minimum resistance 100k ohms and the maximum resistance 1100k ohms.
Also be aware that capacitor values are not very precise; you may see a capacitance difference of up to 20% from the rating, and electrolytic capacitors leak charge at a variable rate depending on how long they've been operating - so it'll be important to time your circuit once it's working.
Another thing to be aware of is if you are using a voltmeter between ground and pin 6/7 of the 555 to check the voltage buildup, the voltmeter will allow a small amount of charge to leak while it's attached and will not give you an accurate idea of the amount of time your circuit will stay on without the voltmeter attached.
Step 3: Building the 555 Timer Circuit
Once you've selected your resistor and capacitor values to set your time bounds, it's time to wire up the circuit to test!
Get out your breadboard and get ready to wire it up! Install the 555 chip in the middle of the breadboard with the circle or indentation facing left. That designates the side of the chip that has pin 1. install the jumper wires. One between pin 6 and 7, connect your +V rail to pin 8, and pin 1 to the ground rail.
Install the "pullup" 10K resistors from pins 2 and 4 to +V. Those are the "trigger" and "reset" pins respectively and if they are left floating (unattached) the chip will not know when to trigger or reset, so they need to be set to the positive logic level with a small current - so use 10K resistors. Remember that 10K resistors are brown, black.
Install the 0.01uF capacitor between pin 4 and ground. This is like tying the control pin to ground via the capacitor but allows a small amount of capacitance to buffer any electrical demand inside the chip.
Install the LED with the longer leg towards pin 3, and a current-limiting resistor (I am using 270 ohms) between the other LED pin and ground.
Connect the 0.1uF capacitor to ground (be sure to orient the negative side of the capacitor towards ground if you're using an electrolytic) and connect the positive side to pin 2
Install the pushbutton switch between the positive side of the 0.1uF capacitor and the ground. If you're using a 3-terminal switch, ensure that you use the 2 terminals that are disconnected (open) when the button is not pressed and connected (closed) when the button is pressed. Use your multimeter in continuity mode if you're not sure.
Since this is already "pulled up" by the 10K ohm resistor to +V, the pushbutton will short that pin to ground with less resistance and pull the pin low. The capacitor and switch in parallel will trigger the circuit on power-on (because the capacitor will be close to ground on power-on, and take enough time to charge up that the 555 will trigger) and the pushbutton will allow you to turn your stuff back on after it's turned off.
Now you're ready to hook up your custom resistors and capacitor. Connect the potentiometer and resistor (my 1M ohm and 47Kohm) to +V in series, it doesn't matter which order.
Then attach a wire between the other end of your resistors to pins 6 or 7 (since these two are already connected, you only have to connect to one of them), then connect your big capacitor's positive side to that same wire, and the capacitor's negative side to ground.
Now you're ready to test your 555 timer circuit! Check your resistance value of your potentiometer (and inline resistor) with a multimeter. You will have to remove the pin that connects +V to the potentiometer in order to get an accurate reading, because the rest of the 555 is going to present less resistance and you will get a skewed value if you test it with +V attached to the multimeter. Calculate how long you want to test for by setting the resistor value according to the T=1.1*R*C formula. For example with a 1000uF cap, set it to about 10kOhm for an 11-second test.
After setting the resistance to a good test value, re-attach the +V to the potentiometer and plug the power in! With any luck, your LED should come right on and go off after about 11 seconds. Detach and re-attach power a couple of times to ensure that your circuit triggers reliably on power-on. If it does not trigger reliably, try using a larger capacitor value between the trigger pin and ground, and ensure that the capacitor is oriented correctly (with the - side connected to ground).
Check that the 555 timer is not generating too much heat. If it feels warm or hot to the touch, something is wrong. First check and double-check that everything is plugged in correctly. If everything is plugged in correctly, your 555 might be blown and you should try a different one.
Step 4: Connecting the Timer Circuit to the Relay
Once you have your 555 circuit wired up and tested with a LED, you're ready to hook up the relay! Disconnect the power from your circuit and connect the OUT pin from the 555 to one of the leads for the coil on the relay, then connect the other coil lead from the relay to ground. Before powering your circuit, install a protection diode in parallel to your relay with the negative side connected to the OUT pin of the 555 and the other side connected to the ground pin. This will protect your 555 from the discharge voltage from the relay. You can leave the LED connected in parallel to the relay for visual feedback that the circuit is still working correctly.
Re-connect the power and the relay should energize, closing the high power circuit. Verify with a multimeter using the resistance setting that the pins on the relay are not giving any resistance when closed, then that there is no connection when the timer has expired and the circuit is shut off.
Step 5: Connecting the Relay to AC Power
Now we're onto the potentially dangerous part - so be careful!
Find the datasheet for your relay and locate the pins for the contact that are normally open and close when the coil is energized. If you're using a relay socket, find the screw terminals that map to those two pins. They are not polarized so it doesn't matter which way you connect the power cord.
Then, about 6 inches from the plug end, gently open the outer shielding of your heavy-duty extension cord with a razor-sharp utility or hobby knife. being very careful not to slice into the inner shieldings. It is best to do this slowly and deliberately. If you slice into the inner wires, you will have to throw the cord away because it won't be safe to use! Carefully strip away about 2 or 3 inches of outer shielding, depending on how much free wire you need to connect it to the relay socket screw terminals.
The three wires inside of the extension cord will probably be green, white, and black for ground, neutral, and hot respectively. You will only be cutting the black one. Cut it with your wire cutters in the middle and strip away enough shielding to securely attach it into the screw terminal with no bare wire sticking out (remember, this will be high voltage wire, and you definitely don't want it shorting to anything!). Now you want to make absolutely sure that the black wire is the hot wire. Use your multimeter in resistance mode to measure the resistance to the plug. You should see that the wire you just cut goes to one of the blade prongs, not the ground prong. It really doesn't matter which one, but if it goes to the ground prong, your relay will not work and the assembly will be ungrounded.
Screw each side of the wire into the screw terminals for the normally-open contact points on the relay and do one final test - using a multimeter in resistance mode on the AC wire from the hot blade on the plug to the hot socket on the receptacle, ensure that when the device is off, there is no continuity. Then power and trigger the device and ensure that there is no resistance when the relay is energized. Then make sure there is no continuity again when the relay powers off. Try this a few times to make sure it triggers reliably, and also try your timer with the potentiometer at maximum resistance.
The next step is to ensure that your device is hooked up safely.
Step 6: Safe Operation of Relay-controlled Devices
First of all, ensure that you do not try to power anything that takes more power than any element in your system can supply. Know the ratings on your extension cords, screw terminals and blade terminals of the relay socket, and the relay itself. The lowest value of any of these connections is the maximum rated value of the circuit - and for safe operation, only operate at 80% of that value at maximum.
Be aware that relays react differently to different types of load; the typical load ratings given with resistors are for "resistive loads" such as lights, soldering irons, glue guns, and so on. Many relays also include values for "inductive loads" - an inductive load is something like an electric motor, fan, AC compressor, or pump. Usually the maximum inductive load of a relay is significantly less than the resistive load, so to err on the side of caution, do not use a relay for an inductive load if you're not sure!
We have a be nice policy.
Please be positive and constructive.