I'm designing a digital I/O module which isolated with optocouplers. I'm done with the outputs, but having a confusion about input side.

enter image description here

I will have some switches and sensors to read as inputs, but I don't know how to do the connections, can someone show me as a schematic?

Which pin should be GPIO pin for example?

  • \$\begingroup\$ Isnt this an open collector opto? See this example for interfacing i.sstatic.net/O77bb.png \$\endgroup\$
    – cm64
    Commented Jul 31, 2019 at 11:01
  • 1
    \$\begingroup\$ subset of this question \$\endgroup\$
    – Andy aka
    Commented Jul 31, 2019 at 11:06
  • \$\begingroup\$ Yes actually it is related to that question \$\endgroup\$ Commented Jul 31, 2019 at 11:08
  • \$\begingroup\$ You need to be very specific about the "sensors". What kind of signal are they providing? \$\endgroup\$ Commented Jul 31, 2019 at 11:48
  • 1
    \$\begingroup\$ You already posted this at electronics.stackexchange.com/questions/450691/… DO NOT REPOST \$\endgroup\$ Commented Jul 31, 2019 at 14:24

1 Answer 1


The collector outputs will each need a pull-up resistor to Vdd, your CPU logic voltage, so that these pins may go "high". Other than that, it should work. The resistance value chosen (along with the capacitance of each line) determines how fast the output goes high. If speed isn't an issue, 10kΩ should work. But for fast speeds, much lower values will be better, and this means the current rating of the transistors inside the opto needs to be taken into consideration.

Edit: The STM32F072C8T6 has a supply voltage of 3.3v nominal. Bypass caps must be installed across Vdd/Vss pins. Make sure BOOT0, VBAT, and NRST lines are handled correctly according to the datasheet.

The TLP280-4 LEDs can be driven to 50mA: 24v/50mA = 480Ω minimum input resistance. Output transistor limit is also 50mA: 3.3v/50mA = 66Ω minimum pull-up. Smaller resistances will be faster, if speed is a concern.

  • \$\begingroup\$ So is this schematic true according to your opinion? ibb.co/BsPDW16 this is the link for schematic. Thank you \$\endgroup\$ Commented Jul 31, 2019 at 13:26
  • \$\begingroup\$ Looks ok to me, you'll have to try it. :) \$\endgroup\$
    – rdtsc
    Commented Jul 31, 2019 at 14:21
  • \$\begingroup\$ thank you so much @rdtsc :) \$\endgroup\$ Commented Aug 1, 2019 at 6:22

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