• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Help - Octcoupler UART circuit

Not open for further replies.


New Member
Hi guys,

I wish to communicate through UART between two pic mcu's, one of which is floating @ 230VAC.

I therefore plan to use some digital octocouplers to communicate through.

The Pic im using is the PIC16F1826 which i'm powering from 3.3v...the dsPic im trying to communicate with is 3.3v.

The Baud rate i intend on using is 9600 therefore meaning the period is 104uS.

I have a few of these octocouplers lying around and it would be handy if i could use them. http://docs-europe.electrocomponents.com/webdocs/009c/0900766b8009c194.pdf

Problem is im not really sure where to start - i started to make a rough circuit (picture attached) however there wasn't a square wave on the output and i wasn't receiving the right data the other end.

Thanks for your time.



Well-Known Member
Most Helpful Member
Which specific variant of the optocouplers do you have on hand? We need to check the Current Transfer Ratio.

You will need to get more current into the diode. Knowing the CTR, we can suggest a pull-up resistor on the output side.


Well-Known Member
Most Helpful Member
I use "Digital Isolators" The SI8421 is not for new applications. Will be phased out. Look at any Digital Isolator. You do not have to worry about LED current or CTR. You just send TTL into one side and get TTL out the other side. The 8421 is a dual part with one facing right and the other facing left. (in that family there is also a dual where both isolators are facing the same direction)

See ISO7221:

Dick Cappels

Active Member
You did not mention the actual rise and fall time measurements, but at 9600 baud rise and fall times of less than 5 us should be fine.


Well-Known Member
Most Helpful Member
The A-2 has a min CTR of 0.6, so if you can get 5mA into the LED, you will be able to sink about 3mA at the collector.

I am guessing that your PIC can source 5mA at a voltage drop of ~0.3V, so R1 (designator in your sim) will have 3.0V at one end, and 1.25V (the Vf of the input LED @ 5mA) at the other end, so R1= (3-1.25)/5m = 350Ω.

R2 will have 3.3V at one end, and Vce(sat) at the other when the collector current is 3mA, so R2 = (3.3 - 0.5)/3m = ~ 1KΩ.

Get rid of R3, it only makes it worse....

The speed of the opto is more than sufficient at 9600 baud at these current levels...

Since the configuration you showed originally in your sim inverts, I think you want to wire the input LED so that its anode is tied to 3.3V, and its cathode goes to the transmitting port pin. That doesn't change the math enough to worry about.
Last edited:
Not open for further replies.

Latest threads

EE World Online Articles