Welcome to Synthiam!

The easiest way to program the most powerful robots. Use technologies by leading industry experts. ARC is a free-to-use robot programming software that makes servo automation, computer vision, autonomous navigation, and artificial intelligence easy.

Get Started
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?


Upgrade to ARC Pro

Harnessing the power of ARC Pro, your robot can be more than just a simple automated machine.

@Jeremie if I were to add a diode what should I use? Is what would the specs be? I have some but am not sure whether they will work.
User-inserted image

It seems you already have a flyback diode on your relay board so no need to add another. It doesn't really look like a diode but it's an older style germanium.

I'm getting the sense that your relay has an issue, do you have anymore of these boards to test? Can you test something like a servo on the digital pin you are using just to make sure everything is in working order?

I take it back that the board has too many resistors. I didn't notice that second LED on there. So that's one resistor per LED and one for the transistor base.
I've tested 3 different from the same manufacturer. They're all the same. Voltage on the in line.
I also get some voltage at the IN1 pin on my board (-0.7V) but I suspect it's just because the base of the transistor is floating. You could use a 10Kohm pull down resistor on the IN1 pin if this voltage bothers you.
The 10kohn pull down to what? Ground? Because this activates the relay...
So how much voltage is at the IN1 pin? Is it 3.3V or 5V. If that's the case you might have a PNP transistor on-board so the logic will be inverted. You will have to send a low signal to turn it on and a high to turn it off.
If it isn't connected it stays off. If I connect to the ez-b with the port I triggered it stays off. If I turn the port on, it turns on. If I turn the port off it goes half off, signalled by the led, but does not deactivate. If I add a 10kohm resistor to the Gnd or signal line, the relay acts in the way you described.
Couple questions:

There's two LEDs on the board, is one a power LED?

You mentioned that if you send a high signal from the ez-b to IN1 on the relay board the relay activates. (no resistors applied)

You also mentioned if you place a pull-down resistor (from IN1 to GND) the relay activates.

These two scenarios are in conflict with each other.

Are you certain that you have a common ground?

I am unsure what you mean by "triggering a port" but I will say this: The I/O pins on the ez-b are tri-state, which means that when they are not set to a digital high (3.3V) or digital Low (0V) they are in a high resistance state (High-Z). In a High-Z state the pin will appear to have 0V but in reality it is floating and has no state until a high or low signal is sent.
2 LEDs. 1 for power, and the other for activation status(on, relay activated).

Yes, I agree, but it is what is happening. This makes me think that when the ez-b activates, the current flows through it to gnd.

Common ground is achieved by connecting the gnd pin of the ez-b to the gnd of the 5v power source for the relay. This allows, in my mind, common ground. Perhaps not?

In High Z state the relay is doing nothing.

When the port is set on(no resistor) it activates. When port is set off(no resistor) the relay hits the mid point, where it is half way to turning of, as indicated my the activation light dimming.

When port is set on(WITH resistor) it deactivates, and when turned off, it activates.

I too am puzzled by this conundrum. I will play with it again, and see if something changes.
I have a relay of similar design. My knowledge of electronics is very limited so please be understanding.

This relay has a 2TY device, 3 resistors all marked 102, 2 leds and a diode. I am assuming the 2TY is a transistor. If anyone knows this is true, can they tell me the pinout ? I will then try to make a schematic of the one I have.

Maybe we then can get a better idea of what we are dealing with.

Here is a schematic,

User-inserted image

I assume 2TY is a transistor.

Someone please help how to use this circuit.

Diode polarity may be drawn wrong.
Sweet, thanks for that @Andy it gives me a bit more to go on. As I suspected earlier on, the 2T transistor is a PNP (looked it up via it's SMD code). This makes more sense now, in order to activate a PNP transistor you have to bring your signal low.

One thing to remember about PNP transistors is that voltage relationships matter. If you are supplying 5V at the VCC pin and switching the transistor base with 3.3V logic the 1.7V difference might appear as a logic low to the PNP and it will turn on.

You'll likely have to use 3.3V on the VCC pin, that being said, I hope 3.3V is enough to turn these PNP transistors off.

What I also suspect is happening is that there is a 1Kohm (102) resistor + the 330ohm resistor on the ez-b itself in series with the digital pin which is limiting the amount of current that can be "sunk" by the ez-b digital pin. This is likely why the LED is stuck half on. What I would suggest is adding a solder blob across the 102 resistor that attaches to the IN pin in order to create a 0 ohm resistor instead of 1Kohm.

No matter how you look at it, if you want to use the control circuitry on this board you will have to use inverted logic due to the PNP transistor. 0V turns it on, 3.3V turns it off. But remember with a bit of soldering skills you can bypass the on-board control circuitry, solder directly onto the relay coil pins, and use your own circuit to control the relay (I'd suggest a NPN transistor...much easier)

Please note: I believe there's a couple minor errors with the schematic above. The LEDs should be flipped as the cathode should be toward GND and the Flyback diode should be probably be across (parallel with) the relay coil, not in series with it.
Thanks for the explanation.. At last I may get it to work.

My electronic skills are minimal and diode polarity escapes me. Anyway it seems I got it close enough for you to figure it out.

Thanks again,

What is the relay part number ?
I am sorry to say they were an ebay deal I got quite a while ago so I have no information. Here is a picture.

User-inserted image

They are low level logic. (signal Off = relay on, Signal On = relay off)

I would try to find a High logic one. (needs npn transistor) per Jeremie
I think we are complicating what is simple.

the relay is rated to work with 5V, there are other relays from the same family (Songle) one of them is rated to run at 3V (but is not what is in the pcb)

The circuit expects VCC=5V has a PNP transistor, this means when Vb is less than Ve the transistor closes.

1) EZB Pin Low => 0, Vb is less than Ve the transistors closes => relay on

2) EZB Pin High => 3.3v Vb is still less than Ve and the transistor closes => relay on

3) if you put 5V on IN, Vb is not less than Ve and the transistor is open => relay is off

we have a Logic Level issue, how to convert 3.3v to 5V.

Without complicating too much there are LLV circuits less than $1 why not use one ?

I wrote this on the beginning of the thread, no one supported my opinion is it wrong or not adequate ?

I use the KISS principle why complicate, changes and soldering new components ?
Hi @ptp, like many others here, have a limited knowledge of electronics so we are learning as we go. I didn't understand what goes on or how the relay circuit worked. Now I have a better idea. You, Jeremie and others have helped greatly.

If I understand, I just need to buy one of those 3.3vdc to 5vdc converters? I think they also work the other way too? (5v to 3.3v) They cost about $3 and have like 4 or 6 outputs. Right? This would be an easy fix.
Thanks for the explanation and all the help you have given. . I will get a converter and give it a try. I will keep trying things and learn.


It was a question too,

i'm not an expert neither i feel 100% confident, so that is why i asked the question.

i was waiting for Jeremie's or anyone to argue against a LLV, otherwise it seems too me the cleanest solution.

I like more software than hardware and i'm not good hacking circuits i have lost a few circuits, so i look to hardware like lego pieces, integrate circuits versus changing.
if you like breadboards this is the cheapest circuit:


has 8 ports can convert 8 x 3.3v to 5v (unidirectional) but the cost can get more expensive with shipping costs ($4 to $9)

if you like "legos":

these is the cheapest i found in the ebay:


each circuit has 4 ports, they wrote i2c because most people use them to interface arduinos 5v with 3.3v i2c devices, but they are bidirectional they can convert the opposite way.

There is a high side & low side, you can use them also to convert to 1.8v (intel edison)

if you don't trust ebay vendors you can get this one from sparkfun:


also has 4 ports.
Thanks for the info. I ordered 1 and once it is here I will play.