# Digital inputs problem [duplicate]

This question already has an answer here:

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.

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?

## marked as duplicate by Elliot Alderson, Chris Stratton, Huisman, SamGibson, Sparky256Aug 2 at 2:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

## 1 Answer

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.

• So is this schematic true according to your opinion? ibb.co/BsPDW16 this is the link for schematic. Thank you – Teoman Açıkgöz Jul 31 at 13:26
• Looks ok to me, you'll have to try it. :) – rdtsc Jul 31 at 14:21
• thank you so much @rdtsc :) – Teoman Açıkgöz Aug 1 at 6:22