Why not just use a 12V:5V voltage divider, 15K feeding into 10K.
The nice thing about that sucker is, the input pin isn't floating when the sensor isnot connected.
Ok so this will work?
So I can eliminate the pull down?
QuoteSo I can eliminate the pull down?No, the pulldown is what keeps the input from floating, and also produces 5V to the pin.As dc42 says, higher value Rs can be used, just keep the same ratio.Read the part on figure 2,http://en.wikipedia.org/wiki/Voltage_divider
The pin protection diode will protect the mcu, and the 100K resistor limits the input current to a safe value.
is this a good approach for solving the problem?
Quote from: dc42 on December 01, 2012, 11:57:09 AMThe pin protection diode will protect the mcu, and the 100K resistor limits the input current to a safe value.ya know, I just dont trust those things