Skip to main content
1 of 3
Edin Fifić
  • 7.4k
  • 10
  • 29

You can do this without a voltage divider as well, either by using a zener, an LED across the input with a resistor in series with the sensor, or place a Schottky diode from the input to the 3.3V rail.
Here are examples:

schematic

simulate this circuit – Schematic created using CircuitLab

Edin Fifić
  • 7.4k
  • 10
  • 29