Asked — Edited

Using Opto- Couple Relays With An Ezb

There has been much confusion on how to add a relay to an Ezb. There are three style relays, relay only, relay with a built in transistor circuit, and a relay with an opto-couple circuit. I have the relay with an opto-couple circuit. (817C) ?

This relay requires a 10 K resistor placed in series with the digital output. It is programmed by using a digital output, and "Set Digital". The issue is when the signal sent is "On" the relay is turned off. When the signal is sent "Off" the relay turns on.

This operation needs to be accounted for in your design so relay do not come on during a start up.

User-inserted image


Upgrade to ARC Pro

With ARC Pro, your robot is not just a machine; it's your creative partner in the journey of technological exploration.


Hi Jeremie,

I have gotten the relay working as discussed. I have an issue where the indicator on the relay board stays on. It is bright when the relay is energized and dim when the relay is de-energized. I checked the voltages on the relay board side of the resistor. When Set Digital is Off, the voltage is 3.3 volts (relay on). When Set Digital is On, the voltage is 4.66 (relay off). The relay does operate correctly. If I add a diode will that fix my problem? I ask first because I do not want any "magic smoke.


@ptp Have you used this style relay? How did you wire it ?

I hope Jeremie can respond when he finishes with @Tech.

Thanks, Ron



They are very similar same optocoupler, same relay, mine has some dip switches to change from low/high logic control.

do you know the meaning of the green switch (bottom left) ?

otherwise can you post a link to the schematic/ebay link to check if there are more details ?


The pins are marked RY_vcc vcc gnd and the jumper currently connects the two vcc together. The relay board I have on my desk has a drop of hot glue on the back which I can't remove, otherwise I could tell you where the jumped wires go. I will return later and see if I can find another one. I also will go on ebay to see if I can find more data. I don't believe there was a data sheet, just a description.



I got it, the green jumper is similar to mine !

but mine is only two pins basically you put the cap or not.

in yours the third pin "GND" got me confused, but is disconnected it's only a visual information.

Only to be clear mine besides the optical isolator, plus the VCC selection pin also has the possibility to drive the relay with inverted logic (0->ON / VCC-OFF)

based on info i got from my relay i'll create another post explaining how to wire yours.


Found another relay board I had with 817C optocoupler control.

I followed the traces on this board and I believe that the Jumper provides VCC to the collector side of the optocouplers in order to activate the transistors, which in turn activates the relays.

Please note: Although the 5V regulator in this example can provide regulated voltage to a number of relays I don't suggest powering more than 4. It's going to get really hot if you have more than 4 relays on at a time.



I found a relay similar to yours and i tested, and it worked.

VCC <--- 5v Power Supply GND <-- 0v Power Supply <--- EZB GND IN1 <- EZB PIN

but... you wrote:


This relay requires a 10 K resistor placed in series with the digital output.

where you got that idea ?

I went to test and i add 10K resistor, the pcb led stays dimmed like you have mentioned.

If you are using the 10K resistor remove it.


Hi @ptp, I just got back. Thanks for doing the testing. Your assumptions about the jumpers look correct. What you explained seems to be the way it looks. Maybe the gnd is just a spare point. I will set up the board and test without the resistor.


Ok, I hooked all back up with no resistor. I sent a signal Off, nothing happened except the led got brighter. I sent a On signal the led got dimmer, but the relay never activated.

I next inserted a 10k resistor in series with D0 to the In1 on the relay, and Off signal turned on the relay, On signal turned off the relay.

Just for info I am using an external power supply 5vdc @ 225 ma..

I saw it work on your video, but mine doesn't.

The gnd pin near the jumper is just a gnd.

Note: I also have a 8 relay board. I connected it as you did and it didn't work. I added the resistor and it works, but I still have the led issue.

I am at a loss? Insanity is taking over.... LOL....


@Andy are the external supply ground and ez-b ground connected somewhere?

5V, 225mA supply seems a bit weak, have any USB chargers that are 1A rated?


Yes with the common grounds. I will dig up a higher current 5 vdc power supply and test tomorrow. Thanks,



Can you write the resistors values (numbers) r1, r2, r3, r4 ?


Do you mean a resistor color chart ?

10k is brown, black, orange and maybe a gold stripe on the last one. I used it in series with the signal.


no the pcb resistors


you wrote:


I next inserted a 10k resistor in series with D0 to the In1 on the relay, and Off signal turned on the relay, On signal turned off the relay.

this means the relay works with a 10K resistor between EZB pin and IN1 ?

when you tried without the resistor did you connected both IN1 to D0 and IN2 to D1 ?

if not please connect both.


Good Morning,

I took the values off the boards (the 2 relay board and the 8 relay board are the same.) They are: r1=102 r2=115, r3-115 r4=102. The 8 relay board continue with the same values. The transistors looks like J3Y. The opto-coupling is a 817c B1419 on the 2 relay board and AFETEL 817C U448 on the 8 relay board.

I am currently running these boards using a tip 120 circuit, and they works fine. I prefer to eliminate the slave board and run direct. Even though it is inverse logic, I can rewire and reprogram them to work correctly. I will continue my test later this morning.


Hey @ANDY Do you mind posting a schematic /photo of how you wired the relays in conjunction with the tip120 circuit? How are you powering the relays?

I'd also like to know why you need the relays at all, if you have a tip120...just picking your reasoning:)


Hi Doom, The TIP circuit works fine, and operates the relays correctly. I built a circuit based on a thread from Rich. I use the contacts on the relays to operate in place of a pushbutton on a wireless remote. This wireless remote operates 110 vac remote outlets to turn on lights and a coffee pot. I do not have enough electronic knowledge to wire the TIP circuit directly into the remote, thus eliminate the relay. I don't want to destroy the remote control if I connect something wrong. I will check my papers and post a diagram of the TIP circuit for you.

I use the relays due to frustration ! LOL I was never able to get any of my relays ( I have three different styles and types ) to work. I was running out of time, so I just built the TIP circuit and used that.

Due to the latest threads posted, I pulled everything apart to try to get the relays to work directly with the ezb, again. A resistor in series between the ezb port and the relay lets it work in the inverse. This means I need to do some rewiring, add a master relay, and reprogram which is ok. This way I can eliminate the TIP controls. The other relays still won't work, but I will mess with them more later. Jeremie continues to post information. so I will continue to try things.



Did you tried connecting both D0 D1 to In1, In2 without resistors ?


Yes and no good. I found a second one and tried it with the same results. When I use the resistor, the leds don't work correctly, but the relay does. Maybe I will paint the leds black and forget about them.... LOL

I just finished drawing a schematic for the transistor style relay and posted it on the other thread, I will try to do the same here. At least with a drawing we may see how these things work and what is needed to operate them.

I will try to make the drawing now.


yes a schematic would help,

it's strange it's a very simple circuit.

Q1) regarding the resistors r2 & r3 you wrote 115 are you sure ?

Q2) can you confirm if the led is red ?

Q3) can you confirm the power supply VCC is 5v ?

this is what we have so far:

setup: vcc=power supply 5v gnd = ezb gnd + power gnd (common ground ) in1 = EZB D0, in2 = EZB D1.

  1. above setup the relay switches on with EZB pin LOW, the relay does not switch off with EZB pin HIGH.

  2. you add 10K resistor between EZB Dx and Inx

the relay switches on & off, but the led does not switch off (dimmed)

Sorry to repeat, but this is a KISS device .... so double checking


For r2 and r3 which may be 511 instead of 115 ( hard to see )

It is a flat led which is a red / orange ?

Power supply is 5 volts. ( it is able to power an 8 relay board and 8 TIP 120s)

Operation is as you described.

Here is the sketch for one circuit. I think it is right except for maybe the diode polarity.

The jumper is on vcc to vcc. gnd is open. (vcc's needs to be jumped)

User-inserted image


I believe the connection between the coil, flyback diode, and 817C goes to VCC as well, correct? With the jumper on, of course.

*edit: Whoops this post was meant for @Andy's diagram


Thanks @rgordon that's a very classy diagram!


I Thank everyone....

At last I may get this board working right.


I am just curious..? If I bypassed the opto- coupler and put the signal direct to R2 would it work? If it did work, would it work inverse or not?



my setup, Jeremie's video and Gordon diagram all of them are pointing to the same setup (no resistors add-ons)

if you can't put it to work, something is broken: the wiring, the power supply, the pcb, or EZB pin;)

  1. if you disconnect/brake the optocoupler pin from the VCC

  2. if you connect the EZB pin before the R2

  3. VCC=5V

  4. Common Ground

you have a NPN transistor circuit relay without a optocoupler.

High = On Low = Off


Thanks for the answer. LOL . This is what I wanted the whole time. I will give it a try next week.



Sorry i did not understood you wanted to "change" the behavior, like i said in another thread i avoid hacking circuits.

I can't rationalize why your pcb relay does not work as expected. Gordon's diagram is very clear. It's a mystery:) better call Fox Mulder.


No LOL .....It is a learning question. I was curious about the circuit. I now know what a NPN transistor circuit (also a PNP circuit) is and how to use it. Also how the optical isolator works. Next time I order relays I will know what I need and what to look for, "not just a relay on a board". I ordered a converter like you mentioned and will experiment with that. (Was cheap). Thanks,


Thanks to all that helped with this and @MazeHorizonTech 's thread on relays also. I think it is a lot clearer now on what relay boards to buy and how to make them work.