Opto-coupler how-to ? (BOB-09118)

Hi Folks,

Forgive the noob question, but I picked up a Sparkfun BOB-09118.

I had in mind I could use it like a switch (Relay). I have an ESP32 and wanted to use a GPIO line (3.3v) to open/close a 12v circuit.

Looking at the BOB-09118 though, I’m confused with it’s 2 input and 2 output pins (holes).

Do I set up my ESP32 GPIO4 + GND to IN1 + GND … then set up my 12v to IN2 + OUT2 ? or should that be GND + OUT1 ?

I couldn’t find anything on Youtube about it this specific part, in fact I might be trying to use the wrong thing completely. It just looked neater than using a big mechanical relay.

Thanks for reaching out to us on this.

What you put into the IN pins, will be replicated on the the OUT pins, but at the higher voltage (HV). HV is the high-side signal supply.

Hope this helps, and happy sparking!

This photo might help you in connecting these up. :slight_smile:

Keep in mind these are not relays but they do offer isolation between the two sides of the device. They can drive something that uses 20mA like a LED but if you need to control a higher voltage or current load you will need to connect a relay or MOSFET to the output of the board and then those can switch your higher power load.

Hi,

Such a simple circuit…I connected per the diagram with in1=3.3V + (in)gnd but there is no output at all at HVG(nd) + Out1. Did I accidentally fry the module ?

malenerd7:
Hi,

Such a simple circuit…I connected per the diagram with in1=3.3V + (in)gnd but there is no output at all at HVG(nd) + Out1. Did I accidentally fry the module ?

Facing the same problem, please help me.

Send a diagram of all of your connections.

Hi,

Thanks for your help.

I am using RPI 3 B+ GPIO5 to thru a transistor ,used as a switch, to turn a 24V relay on/off that in turn connects 120VAC to a large resistive load.

When GPIO5 output is lo, signal to base of transistor disconnects the relay gnd so relay is not energized.

When GPIO output is high, the transistor switches on and connects the gnd of 24 EM relay to turn it on.

When the GPIO 5 is lo, I am still getting crosstalk and leakage current which is still powering the resistive load very slightly, so I added the optoisolator.

I input 5V into ‘IN1’ but ‘OUT1’ is 0V, please see circuit.

Expected Operation:

GPIO 5 output goes to Bob-09118 and when high, the 24VDC gnd is switched on and 24V EM relay energizes. IN1=5V, Out1=5V?? right?

GPIO 5 output to Bob -09118 is lo, the 24VDC relay is normally open, or unenergized and 120VAC is supposed to be isolated.

IN1=logic lo out1=logic lo.

Disconnect GND and HVG, those need to be totally separate grounds.

Connect HV to your 24 volt supply that powers the relay.

Thanks , that makes much more sense to achieve isolation. Is this the proper way to connect ? I don’t want anything fried due to operator error :slight_smile:

Hi,

Actually I think Rev 2.0 below is the right way to connect BOB-09118. Is Rev 2.0 correct or is earlier one I posted today correct ?

My understanding is that when GPIO5 goes hi, the 24VDC will be switched on to the relay and energize it and when GPIO5 is logic ‘lo’ the relay will be disconnected ? So when the 24VDC supply turns on, it supplies up to 3A to switch relay and when off it is open and hence no ground loop or crosstalk ? That is very clever and fantastic… and perfect…

Update: I have 24V DC to pin 2, when I apply 4.6V to in1(pin 7) thru a 350ohm resistor, and 24VDC gnd to pin 4(HVG).

I read pin 2 (HV) and there is 0 volts. I also check pin 1 (output) and it is also 0V.

I was expecting the 24V to be output when input pin is logic high. Did I fry BOB-09118 ?

thanks for your help

If you connected 24VDC to OUT2 and GND to HV_GND, pulling IN2 high would likely fry the opto when it shorted out your power supply, The proper connections are:

Pi to JP2p3 (IN2) (no series resistor).

Pi gnd to JP2p4 (GND)

24V Positive to JP1p3 (HV) and one end of the relay

Other end of relay to JP1p2 (OUT2). The flyback diode across the relay coil is correct in your drawings; cathode to 24V positive end of the coil

24V GND to JP1p1 (HV-GND)

You may want to try using IN1/OUT1 instead of IN2/OUT2 to see if that side of the opto is still OK

/mike