How this optocoupler module works

Reloadron

Joined Jan 15, 2015
7,892
You want to sense a 24 VDC signal. You want to run the 24 VDC into an opto-coupler. You want the opto output at a 5V logic to a uC (micro-controller). You want this:
PC817 Opto.png

My read is as built your module can take a 24 VDC input. That is the maximum. You want a 5.0 volt logic out. Your grounds can be isolated or not with the onboard jumpers. So just make it like the above drawing. That's it. On your board R1 and R2 are 3 Kohm resistors built on the board. Use the 5.0 volts from your Arduino.

Ron
 

BobTPH

Joined Jun 5, 2013
11,557
So, if R2 is on the board, there have to be 3 connection, but there are not, there are only 2.

It looks to me like the collector of the opto is connected through a 3K resistor to the Ox pin and the emitter is connected to the G pin. I can’t tell what the jumper does.

Bob
 
R2 is not on the board. When current flows through the led on the input side the transistor on the output side turns on and pulls current through the external load resistor (R2) to ground. In the example shown by Reloadron, a 24V square wave on the input side will produce a 5V square wave at the output. If the supply to R2 was 12V that would give a 12V square wave on the output. The device only 'needs' power as supplied through the internal led by the 24V. In principle it is much the same as a simple relay - a small current through the coil operates bigger switch contacts but those contacts don't 'need' their own supply it just switches whatever is supplied to it (through R2).
 

Reloadron

Joined Jan 15, 2015
7,892
Apparently this is the design, extremely poor design IMO.

View attachment 267866
I agree as to poor design. Looking at the board pictorial I pretty much see the above but I "think" (operative word) there is also an external to the chip LED in series with the chip. The jumper is for exactly as above. They mention that somewhere. Problem being like so much stuff imported there is lousy supporting documentation. Trying to look at pictures and connect the dots is a pita. :)

Ron
 

MaxHeadRoom

Joined Jul 18, 2013
30,692
This was from a blog that some one posted after reverse-engineering it.
It does not make it that flexible a design.
 
Last edited:
Top