SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on how to get your MSP JTAG programmer up and running.
By dnovosel
#76943
Hello all,

I'm in the process of attempting to convert 12V signals coming from an automotive switch to 3.3V so that I can interrupt, and execute some code on an MSP430. What would be the best way to do this? Ideally I'm looking for something that will allow me to convert up to 4 incoming sources. I basically just need to step down, but I haven't found a device that will do this for me. SMD is fine, as I will be building a PCB for it.

Thanks,

Dave
By wiml
#81828
The easiest way is to simply connect the input to an input pin through a large-value resistor, and rely on the input protection diodes to clamp this to an allowable voltage. Check the data sheet for info on the protection diodes— it'll tell you how much current is safe to run through the diodes. That will tell you how large the resistor has to be: divide the highest input voltage (50-100 volts, say, for a power surge in the automotive wiring) by the allowable current (often around 1 mA). That's the minimum allowable resistor value. To figure out the maximum allowable resistor value, you need to look at two things: one is, how much current will the resistor be carrying normally? For a high-impedance digital input, that's very very little current, just the input leakage current (100 nA, say). Make sure the voltage drop across the resistor when it's carrying that much current isn't so large that it would keep the input pin from reading correctly. The other thing is to look at the input capacitance, including the parasitic capacitance of any wiring, and think about the RC time constant of this capacitance in combination with the resistor, and how fast you need this input pin to respond to changes. (The input resistor combined with the capacitance forms a simple low-pass filter.)

Usually if you do all the numbers, you'll find that the maximum allowable resistor value is much higher than the minimum, which makes design easy. 100kΩ or 1MΩ usually works fine.
By MichaelN
#81832
I would suggest something similar to wiml, but with the addition of another resistor to form a resistor divider to ground.

Otherwise, the circuit will register any input above 1V or so as a logic "1", and in an automotive application the voltages usually aren't clean 0V and 12V.

A divider ratio of perhaps 4:1 (eg 100K + 22K) should be OK. As for capacitance, I often add an additional capacitor to the port, as this provides some low-pass filtering (ie, immunity to noise on the line), as well as protection against high-voltage, fast rise-time voltage spikes.
By waltr
#81838
In an automotive system high voltage noise and spikes are common. I would also include a 12V TVS on the 12V line input.
By rockom
#83095
Don't forget load dump.....