Reverse voltage protection on Analog Input

Dear Arduino community;

How do I add reverse voltage protection to the analog input pin? There are loads of tutorials on the interwebs for batteries and digital input pins where a small voltage drop does not really matter, but if you want to measure voltage, this could be issue.

A little more detail: I want to hook up a laser triangulation sensor (Keyence LK-G 32) to the Uno. It is possible to scale the measurement nicely to 0-5 Volt, or however I wish---which is great. However, the sensor outputs -10 V, if the measurement is out of range, supposedly this is for diagnostics purposes. This situation is likely to occur, and unfortunately I can't turn this stupid "feature" off. This could fry the UNO.

Thank you for your attention.

A common approach is to simply put a 22K to 47K ohm resistor in series with the port pin. This will limit the current drawn (in the event of reverse voltage on input) to reasonably safe values. I don't know if there are long term consequences, though.

If I get this right, this should drop the voltage on the input anyways (even with positive, non-reverse voltages), so it is not much of an improvement in comparison with a simple diode. Or am I missing something?

The resistor will not drop the voltage significantly on an Arduino input. The input impedance of either an analog or digital input (with pullups off) is approximately 100 megohms. By comparison 47 Kohms is a short circuit. However, there are "body diodes" to Vcc and ground that become conducting if the input is greater than Vcc or less than 0V, and that is the problem. The extra resistor will reduce the current through the body diode to safe levels.

How about using an op-amp as a "unity gain amplifier" on the output from the sensor, the lowest op-amp output will be ground if that is the negative supply of the op-amp, even if the sensor input is negative.

I wonder what is the thought process of these companies when they publish datasheets for these devices which provide no information whatsoever about what output their alleged "sensors" actually create.

@jremington Thank you for the clarification. I'll look into this option, however I expect the -10 V signal to appear quite often, so maybe this is not the best solution for extended periods of operation.

@michinyon I have a rail to rail op amp here with me ( http://www.ti.com/product/tlc2272 ), , but the input voltage is listed as Vdd-0.3 V. So if I supply it with 0-5V, then again -10 V could fry the op amp according to the datasheet. Or could I use this one?

Add this circuit between the sensor and the Arduino input pin. It should protect the port from any long term damage with -10 V input, and will not introduce a significant voltage drop for inputs in the normal range of 0-5 V. Be sure to connect the sensor and Arduino grounds together.

Port_protect.png

jremington: Add this circuit between the sensor and the Arduino input pin. It should protect the port from any long term damage with -10 V input, and will not introduce a significant voltage drop for inputs in the normal range of 0-5 V. Be sure to connect the sensor and Arduino grounds together.

Good circuit. I would suggest possibly changing to 1K ohm resistors as the arduino analog input pins are optimized to be driven by 10K ohms or less of source impedance, and this circuit is adding 20K ohms to what ever the source impedance already is.

Dear all,

This is a follow-up post and of course a thank you note. Thanks for all who has contributed towards the solution of this little problem.

I've ended up using the circuit suggested by jremington with success. I've driven two different Uno boards and a Mega 2560 board this way without any problems. The input signal is scaled to 0-5V as expected and there are instances of a -10 V signal in case the sensor loses its range of measurements. The boards are undamaged.

Thank you again, I consider this problem to be solved. :)