How to handle a 4 to 20V signal going into analog pin

I'm working on a project right now, and it will basically trigger an LED light tower alarm setup when lamps have been running for a certain amount of hours.

The LED light towers are running off 24VDC, the ardunio off of the 9V power supply, and I am using NPN (2n3904) transistors as switches to fire the LED towers via digital out signals.

My question comes in here: To know when to fire these alarms, I will need to monitor a signal coming from a meter. This meter provides a 4 to 20 volt signal that I need to read with a analog pin.

I know the max voltage an analog pin can read is 5v, so how should I go about this?

Should I just create a voltage divider, with a 1:10 ratio so my voltages would range from .4 volts to 2 volts?

Thanks!

Josh

Edit: Changed digital to analog

jeckwith:
Should I just create a voltage divider,

Should work

jeckwith:
with a 1:10 ratio so my voltages would range from .4 volts to 2 volts?

Why would you do that? Is the signal has a absolute max of 24V then just map that to 5V This way you have a much bigger range to read.

septillion:
Why would you do that? Is the signal has a absolute max of 24V then just map that to 5V This way you have a much bigger range to read.

What do you mean map it? I thought the I/O pins couldn't take in more than 5.5V or else you could damage the board? Thanks.

Think "map" was actually meant to be "scale". Instead of a 1:10 divider use 1:5 so the max voltage is 4V instead of 2V, giving finer resolution and a better reading of the low voltages. Also not a bad idea to put a 5V Zener diode across your analog input in case something goes wrong with the voltage divider and 20V gets to the analog input. The zener (look up "Zener protection) will hold the input to 5V maximum and "protect" the input.

Thanks Rick. I was debating on putting a voltage regulator of some sort in there, for safe measures. Looks like I'll throw a zener in there. And yeah, reducing the voltage divider definitely would be better for the finer resolution.

Indeed, map as in scale. Just like the map function of Arduino works :wink:

So something like a 82k and a 22k. And if you put a parallel to the 22k your 100% save. Just orientate the zener the right way :wink:

Hi,
What device is giving you 4 to 20V output?
Usually it is 4 to 20mA as one of the standard analog outputs.

Tom.... :slight_smile:

As always. The magical zener device is thrown in.
A zener is non lineair and leaks. Usually a bad idea to use one without knowing the resistor values connected to it.

Use the inbuild 1mA protection diodes.
A simple 10k/39k divider protect to 63.5volt.
And uses almost the full range of the A/D with 24volt input.

And, as TomGeorge pointed out, the numbers "4-20" are usually used in current loops.
Leo..