If the input LED has a forward voltage drop of 1.3V and you want 10mA (0.01A) to flow, the resistor needed will be:
Supply voltage - 1.3 / 0.01.
Example for 12 volts:
12 - 1.3 = 10.7V / 0.01A = 1070Ω, closest standard value is 1000Ω (1k).
The output of the opto-isolator goes directly to an ESP32 as an input
It's held high and goes low upon triggering (seems to work fine on the breadboard)
That link is useful but probably overkill for what I need. Not sure I need reverse polarity protection. Once the inputs are wired, they will not change often (plus PCB space is tight)
Nice devices that I have used to drive power indicator leds on circuits that might have a wide input voltage.
Shame... I think 20mA might be a bit high
Fair point.
You don't need 10mA optoLED current to drive a digital pin of the Arduino.
1-2mA opto LED current is more than enough.
Set the input pin to INPUT_PULLUP, and connect the opto transistor between pin and ground.
Leo..