Skip to main content
3 of 3
added 192 characters in body
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.3 V rail.
Here are examples:

schematic

simulate this circuit – Schematic created using CircuitLab

P.S.: It is not clear what type of output is on your sensor. If it's an NPN open collector, you could simply use a pull-up resistor to the 3.3V rail, as others have indicated in their answers.

Edin Fifić
  • 7.4k
  • 10
  • 29