Read status on SCART output
I would use something like below. The optical isolator (PC817 or similar) protects your ESP.

Use a 1.0-1.5K resistor from the incoming SCART switch signal (SCART pin 8) to the anode of the Opto isolator (pin 1 in case of the PC817). This will limit the current through the PC817 internal LED to about 10mA with a 12V signal but the PC817 can survive up to 50mA, i.e. up to 60V on the SCART plug and even then will not damage your ESP processor.

Connect SCART ground (pin 14) to the cathode of the Opto isolator
(pin 2).

Connect a 3.3K - 4.7K resistor to the collector of the phototransistor of the PC817 (pin 4 of the PC817) and connect the other side of this resistor to Vcc of your ESP (+3.3V) as a pullup.

Connect pin 3 (emitter) of the PC817 to the Ground of your ESP.

Connect a digital input pin of your ESP to pin 4 (phototransistor collector) of your PC817 to create an active-low signal indicating your set top box is active.


This is the schematic you could use:



simulate this circuit &ndash; Schematic created using CircuitLab