Skip to main content
1 of 2
Janka
  • 1.7k
  • 9
  • 11

A very secure solution uses an optocouple. As 1kΩ resistor is good for an input voltage range of 5 to 20 volts.

The output is inverted, that means, the Pi senses low on it's GPIO if there is 5–12V on the input, and high if not.

schematic

simulate this circuit – Schematic created using CircuitLab

Janka
  • 1.7k
  • 9
  • 11