Problems with driving a relay with the propeller.
Private19872
Posts: 61
I'm trying to drive a relay that needs an input voltage of somewhere around 9 volts with my propeller DemoBoard. My propeller was able to make it click so I thought that it was working, but when I tried to hook up an LED to the relay to see when it was on, the LED wouldn't light. I hooked the 9 volt that was powering the separate LED circuit to the relay, and sure enough it worked. I then found a transistor and tried the relay that way powering the transistor with the 5 volt power on the DemoBoard and it still didn't work. Both of the ground connections on the circuits are together. My next guess is going to be to hook one end of the relay to the 9 volt power source's positive end and then use the propeller pin as a ground for the relay. Will this damage the propeller in any way since it operates on 3.3 volts or can it handle it just fine? Thank you for your time.
Comments
Watt is the measure of power. Obviously 1/3 the volts means the relay is struggling with much less power than required.
Additionally, the Propeller does have a limit of about 25 milliamps of current output on its i/o pins, maybe 40 milliamps before failure. Many relays require 60 milliamps. So without verifying what the actual coil's current demand is, you can possibly damage a Propeller i/o pin by direct drive of a relay coil.
I doubt that is occurring in this situation, but use a 2n2222 transistor between the Propeller and the 9 volt relay. Then provide a full 9 volts to the relay coil. The 2n2222 can handle 500ma, so you won't damage it.
Between the Propeller and the transistor's base, you should have a current limiting resistor to prevent damage to the Propeller's i/o. 3.3v at 25ma would indicate about 133 ohms minimum... but something larger won't hurt anything. 220 ohms, 330 ohms, 1k ohms are all going to work but the higher you go the more chance that you will affect the relay's performance.
You really need to comprehend how a transistor can control power and protect the Propeller i/o. Otherwise, your experiments are likely to result in burning out an i/o pin on the Propeller
There are plenty of circuit examples on the Internet for driving a relay from a micro controller pin using a separate V+ for the relay. The ULN2003 driver chip is made for this, and is especially handy if you're wanting to power more than one relay. It contains 7 drivers in one small package.
Be mindful of the diode shown in many circuits, especially the transistor ones. Without it the back-EMF from the relay can damage the driver.
Nuts and Volts Column #6 shows some examples of using a transistor to switch a higher voltage or current. The examples are for the Basic Stamps, but work the same with the Propeller if you adjust the base resistor value. Instead of the 390 Ohm resistor mentioned in the article, use 270 Ohms which will give you about 10mA of base current. With a relay, you'll need a diode connected across the relay as shown in the article. This prevents problems when turning off the relay ... the collapsing magnetic field produces a voltage spike that can damage the switching transistor and can possibly damage the Propeller as well. The diode dissipates the energy from the collapsing magnetic field.
http://forums.parallax.com/showthread.php/155265-Relay-contacts-welding-together....is-there-a-simple-solution
One good turn deserves another. Perhaps you could explain in a bit more detail what you did, for the benefit of others visiting here and looking for something similar.
The two best resources I found was the tektronix design series (old but excellent) and from the local Goodwill store a very well written ASEE text from about 1989 in which each chapter not only covers design, but gets into troubleshooting the chapters circuits.
Never know what will turn up in a Goodwill. Gave away a 42" plasma tv to a friend after a year when we went larger. it was $1 and only cost $50 for a driver chip. last saturday turned up a cisco 2960 switch for $3.00..... Ya just never know.......