Optocoupler PC817

Hello, I want to ask about optocoupler. I using ESP32 for this circuit and is it okay to use optocoupler like this??? and can the ESP32 detect the HIGH voltage on the GPIO with this circuit?? *I will using ESP32 Integrated Pull Down Resistor for the GPIO so the ESP wouldn't have a floating input.
Screenshot 2023-04-03 152708

No. Connect pin 4 on the opto to the ESP input pin and pin 3 to ground. Use INPUT_PULLUP in your code.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.