I have a switched mode power supply outputting 12v into my sensor. When my sensor is HIGH the output will be 12v, and so I will use a voltage divider to reduce this to 4.5v. Do the following values look ok?
Vin = 12v
r1 = 10K
r2 = 6K
Vout = 4.5v
Is there any thing else I should add to this protection circuit?
You could give yourself a bigger margin of safety against over-voltage. Something like 27k and 10k will give 3.24V for 12V and be safe upto 18.5V.
Using higher value resistors provides even more protection against damage (but the values I chosen stay below the 10k impedance limit recommended for the analog inputs to guarantee full accuracy).
MarkT:
You could give yourself a bigger margin of safety against over-voltage. Something like 27k and 10k will give 3.24V for 12V and be safe upto 18.5V.
That makes sense. What voltage does an Arduino consider HIGH?
I was thinking of connecting like in the attached diagram, is this correct?
So I'm doing a project where I'll hook up the arduino power to 12v, from the car lighter. In my project I'll have a 7805 voltage regulator, so it will break down the 12v to 5v.
I'll use 12v to power the arduino. And the 5v from the voltage regulator to a sliding switch that I'll read as input on a digital pin.
I'm afraid that over-voltage can occur on the digital input, so I was thinking about protecting the digital pin with the following circuit:
that I've read from this link: http://www.thebox.myzen.co.uk/Tutorial/Protection.html
It's my page so yes I think it is good especially if you are only protecting against transients. If the voltage is going to be constantly over 5V then make that resistor something like 100R.
Grumpy_Mike:
It's my page so yes I think it is good especially if you are only protecting against transients. If the voltage is going to be constantly over 5V then make that resistor something like 100R.
Yes you do. 1mA is the maximum current that should flow through the internal protection diodes.
Not if you use a 10K series resistor as he suggested, that will limit the current to (12 - 5)/10 = 0.7mA. But personally, I would use a higher value, e.g. 47K or 100K.
(Assuming you've limited the number of amps that can reach the pin, eg. though a 10k resistor)
The thing is that once you start putting 10K series resistors on inputs your noise immunity is shot and it limits the rise time of the signals. That is why I have a 22R series resistor so the protection circuit does not end up crippling the signal.
Grumpy_Mike:
It's my page so yes I think it is good especially if you are only protecting against transients. If the voltage is going to be constantly over 5V then make that resistor something like 100R.
Yes, using other values will control the balance between protection against spikes and disrupting the input signal.
The capacitor absorbs voltage spikes ( good ) and also slows down the input rise time ( bad ) .