2
\$\begingroup\$

I want to control another circuit that is completely isolated from the ESP32. I decided to use an optoisolator. Both the ESP32 and the second control board are powered by 3.3V but they are independent power supplies.

From the datasheet, it has a forward current of 20mA and a max forward voltage of 1.7V. Hence I used a 100-ohm resistor on the ESP32.

For the second control board, I just pulled up the Vo using a 1-kilo ohm resistor.

enter image description here

enter image description here

Datasheet: 6N137

I want if the below circuit is correct and what else can be improved to make it an industry design?

schematic

simulate this circuit – Schematic created using CircuitLab

I want to isolate my output from the ESP32 to the second device.

\$\endgroup\$
9
  • 1
    \$\begingroup\$ You don’t need to run the led at 20mA. What is the gpio current spec for the ESP32? \$\endgroup\$
    – Kartman
    Commented Jul 14, 2022 at 13:58
  • \$\begingroup\$ @Kartman around 40mA per the datasheet \$\endgroup\$
    – JoeyB
    Commented Jul 14, 2022 at 14:01
  • 3
    \$\begingroup\$ In fact, you shouldn't run the LED at 20 mA. That's the absolute maximum rating, you should always operate well below the absolute maximum. The recommended operating conditions are to use a forward current between 5 and 15 mA, so I'd say go with 5-7 or so. \$\endgroup\$
    – Hearth
    Commented Jul 14, 2022 at 14:05
  • 3
    \$\begingroup\$ Note that recommended operating conditions suggest that a \$V_{CC}\$ supply voltage should be minimum of +4.5V. Your +3.3V is outside this limit. So your work to validate proper operation becomes a significant effort. \$\endgroup\$
    – glen_geek
    Commented Jul 14, 2022 at 14:06
  • 1
    \$\begingroup\$ @PStechPaul digikey.co.za/en/products/detail/texas-instruments/ISO7310FCD/…. This will work just as well :) \$\endgroup\$
    – JoeyB
    Commented Jul 14, 2022 at 19:44

3 Answers 3

7
\$\begingroup\$

Look carefully at this highlighted table from the data sheet in your question: -

enter image description here

Your MCU rail is 3.3 volts. Do you see the problem? This is the main showstopper.

You also need to have \$V_{ENABLE}\$ tied to \$V_{CC}\$. Secondary showstopper.

Please use 10 mA for the anode current (R1 = 220 Ω).

\$\endgroup\$
9
  • \$\begingroup\$ If the supply is 3.3 volts and the LED drops 1.1 to 1.7 volts, the 100 ohm resistor will drop 2.2 to 1.6 volts, so I(f) would be 22 to 16 mA. 150 ohms should be OK. There will also be some voltage drop from the ESP32. \$\endgroup\$
    – PStechPaul
    Commented Jul 14, 2022 at 18:50
  • \$\begingroup\$ @PStechPaul no, not on the LED side, on the MCU side <--- the MCU is running from 3.3 volts and that side of the opto needs 5 volts for it to work. \$\endgroup\$
    – Andy aka
    Commented Jul 14, 2022 at 19:15
  • 1
    \$\begingroup\$ @JoeyB the side of the opto that connects to U3 needs 5 volts. U3 runs from 3.3 volts hence, trying to power that side of the opto from 3.3 volts IS NOT going to work. As I said in my earlier comment to PStechPaul "no, not on the LED side" \$\endgroup\$
    – Andy aka
    Commented Jul 14, 2022 at 20:01
  • \$\begingroup\$ @Andyaka I see. I found another IC that works for that range ISO7310FCD digikey.co.za/en/products/detail/texas-instruments/ISO7310FCD/… \$\endgroup\$
    – JoeyB
    Commented Jul 14, 2022 at 21:12
  • 1
    \$\begingroup\$ Then it should be OK if you can live with the inversion @JoeyB \$\endgroup\$
    – Andy aka
    Commented Jul 15, 2022 at 8:57
3
\$\begingroup\$

Without knowing any details about U3, I would say to increase R1 to 220 ohms, and increase R2 to something in the 4.7K to 10K range. A higher resistance slightly increases the inputs susceptibility to external noise, but lowers the circuit's battery drain and reduces stress on the 6N137's output stage.

\$\endgroup\$
1
\$\begingroup\$

R1 could be larger and still meet ratings; this saves some power consumption, and doesn't seem to have any impact on performance. Anything 100-390Ω seems fine, as shown.

Conversely, R2 affects risetime, with smaller values giving faster output (and better noise immunity). If you don't need the speed, a larger value can be chosen, saving some power consumption again.

I recommend a pull-up, or hard tie, from Ve to Vcc; the logic suggests there is an internal pull-up, but a value is not given. (Current is given, which seems to suggest a constant current source instead of a pullup resistor, interestingly enough.) Given the high CMRR this device offers, leaving a pin floating seems a little silly.

\$\endgroup\$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.