Asked — Edited

Relays Turn On, But Not Off

Alright. My dewy build is almost finished, but I have hit a problem with the relays I'm using. They require at least 1.5v to activate them, and then nothing to deactivate them.

Using a set digital control, I can turn them on, but turning the control off doesn't deactivate the relays.

Why would this be? Does setting the digital port off not set the voltage low?

How else can I activate them and deactivate them with the ez-b if not in this manor?


ARC Pro

Upgrade to ARC Pro

Unlock the true power of automation and robotics by becoming a proud subscriber of Synthiam ARC Pro.

#18  

Did anyone try the 10K resistor, signal to ground and what happened? I am unable to try it at this time, but think we did this in the past. It would be great to get rid of my transistor board on my current relay system if it works. Like Alan said, I assume it would pull down the voltage to the relay and "should" drop out the relay. I have a couple of projects which will need relays so I hope the answer can be found. I also have been using "Arduino" compatible relays.

Frustration is what made me go to the transistor board.

The sketch description above works for a push button input. I used it on my Madame Nindo project with no "magic smoke".

#19  

From the reading I was doing last night, it looks like you put the resistor between the signal and ground before the relay (see attached picture where I have very badly drawn in the resistor).

I am not sure if 10K is the right value or how to calculate the right value. There is much much more available online about using pull-up resistors than pull-down resistors.

User-inserted image

#21  

I can test it I think but I too have no knowledge on how to calculate the value.

PRO
Canada
#22  

So here's the scoop with Relays, there are a couple different types: Latching and non-latching. Non-latching are the most popular but do keep in mind that latching relays do exist. The difference is that when you energize the latching relay coil it stays in place if the voltage is removed, a non-latching relay would spring back to it's starting position. With a latching relay you could a pull up or pull down resistor to bring it back to a default position (as Alan suggested). A 10Kohm resistor is the most common value. Why? 5V/10Kohm = 500uA or 3.3V/10Kohm = 330uA, these low currents can continuously run through the resistors such as 1/8Watt or 1/4Watt sized without any chance of heat build up but they'll still be able to quickly pull the signal high or low.

When driving relays you always need a switching transistor to activate it. Why? Because the maximum output current that a microcontroller can usually drive from an output pin is 25mA (ez-bv4 is hardware limited to 10mA). Relay coils usually need at least 50mA to activate. You don't need a large TIP transistor to drive the relay, a simple switching transistor like a 2N3904 is fine.

Here's the rub, a 3.3V digital high signal from the ez-b likely won't be able to drive a relay directly as it is current limited to 10mA. There's not enough current to switch the relay directly but a 1.5V can likely switch a 5V relay no problem because it doesn't have a resistor in series with it (limiting the current).

The most popular way to switch relays with a microcontroller is to connect your signal pin to a resistor, to drive a 2N3904, and connect a flyback diode across the coil of the relay.

Here's a diagram:

User-inserted image

PRO
Synthiam
#23  

Also - check the relay if it has a flyback diode. Not all relays have a flyback diode. Since an inductor (the relay coil) cannot change it's current instantly, the flyback diode provides a path for the current when the coil is switched off. Otherwise, a voltage spike will occur causing arcing on switch contacts or possibly destroying switching transistors or the ez-b.

More info: https://en.wikipedia.org/wiki/Flyback_diode

#24  

I finally found the link to the relay that Richard R says is plug and play with the EZ-B, although the datasheet doesn't seem to validate that since it seems to require too much voltage and too high ma.... It does have a flyback diode (they just call it protection, but that is what they mean).

http://www.robotshop.com/en/electronic-brick-5v-relay.html

Alan