Electronic – Looking to build signal level converter to reduce 20V input to 3.3v out. Am I on the right track

raspberry pivoltage-regulator

I'm working on a small pet project with my RaspberryPi and I'm looking hook it up to some sensors. The output from the sensors is normally at 0v but when the sensor is triggered, goes high to 20v. The RaspberryPi's gpio ports will only accept a maximum voltage of 3.3v, so I've been researching how best to drop the input voltage from 20v to 3.3v, so it won't fry my Pi's gpio ports. The Pi doesn't need to send anything back, it's strictly one-way into the Pi, and the line will only go to 20v when the sensor is triggered.

In my research, I read about a circuit comprising of an LM317 Variable Regulator, and 2 resistors, which could give me the 20v to 3.3v that I need. However, I'm worried about the kind of heat that could be given off with such a large difference in voltage.

I've tried to be as clear as possible, and have also included a handy dandy schematic of what I mean.

schematic

simulate this circuit – Schematic created using CircuitLab

To add to things, I'm likely to be adding more 20v connections to other io ports on the Pi, probably up to 15, so I'm also considering what the combined heat could be like…

Am I on the right track, and is the heat just something that I'm going to have to work with? Or is there a better solution out there?

Best Answer

If they are signals to the pi then use a resistor potential divider. A 1k ohm across the input and 0v of the pi and a 9k resistor from the pi input to a high voltage logic signal will reduce that voltage by ten to one. You should be looking for slightly less than a 10:1 reduction. Can you work this bit out yourself? See the link.

enter image description here