Measure up to 24vdc with Arduino?

Hello, I have a water flow meter which outputs 3.3vdc - 24vdc and I would like to read this meter with an Arduino based setup. I would like to display current flow, average flow, total flow and 24 hour averaged total.

2 years ago I built a similar setup with all the above display outputs which reads a 4-20ma(flow) signal and a 0-5vdc(head) signal.

Is there a shield or add-on for reading up to 24vdc?

If not, I assume I'll need to design the circuit to cut the voltage down.

Any advice is appreciated, I'm no expert at this stuff.

Build a voltage divider, that converts the 24V into 5V (ratio 24:5).

DrDiettrich:
Build a voltage divider, that converts the 24V into 5V (ratio 24:5).

Thanks for that pointer.

Looks like resistor 1 would be 1900 ohms and resistor 2 would be 500 ohms.

Seems pretty simple.

Thanks

It is simple :slight_smile:

The most complicated task is the selection of available (E24?) resistor values. Consider that the voltage divider draws current from the signal source, and 10mA may be a bit heavy - check the sensor specs.

The A/D is designed for in input impedance of up to 10k Ohms. I think that means that your divider resistors can be as high as 10k without problems. Like, multiply by 5 to get 9.5k and 2.5k. That would draw about 2 mA from your power source.

I would go for a 23:1 resistor ratio and then use the internal 1.1V reference. E.g. 12k and 510R would be suitable values (drawing about 5 mA from the source). Then at least you don't have any issues with instability in the 5V supply which is normally used as analog reference.

Why such low values for the resistors ?
For which Arduino board is it ? I will assume it is an Arduino Uno.

Using the 1.1V internal reference requires measuring/tuning to the actual reference voltage since it can be 1.0 ... 1.2V.
With 1.1V internal reference, I would use and 470k and 15k.

Circuit impedance at the analog input is 470k // 15k = 14.5k, which is no problem at all.
Highest voltage that can be measured = 35 V
Current drawn from the 24 V = 50 µA
Allowed voltage without damaging something (1 mA is pushed into the analog pin) = 632 V

Alternative: 10k and 270k

Koepel:
Why such low values for the resistors ?

No particular reason.

With 1.1V internal reference, I would use and 470k and 15k.
[...]
Allowed voltage without damaging something (1 mA is pushed into the analog pin) = 632 V

The analog pin doesn't take any significant current. At 632V that 470k resistor will get hot (dissipating 0.5W)... but that voltage is not realistic anyway.

Good values for the resistors also depend on the output itself: some analog outputs need a certain load to work well.

High resistance and consequently low current makes the connection between sensor and ADC susceptible to environmental interference. The usual cure are shielded or twisted pair cables and capacitors (RC low pass filter).

@wvmarle, I was talking about the internal ESD diodes. It is not mentioned in the datasheet how much current they can take. There is a application note of Atmel where it is mentioned that 1 mA may be pushed into a pin (analog or digital) for AVR chips. In real life those internal diodes can take a lot more. The 632 V is totally nuts of course, but it shows that it can take a large voltage peak, for example a peak from an induction.

@DrDiettrich, when the voltage divider is very close to the analog pin, then 10k impedance is probably okay in most situations. I see no problem between the 24V and the voltage divider. A multimeter with long wires is not less accurate when the impedance of the multimeter is very high.

Thank you guys! As it turns out, the sensor I was considering does not work quite the way I thought it did and cannot be used in this case. I've started another thread based on my new direction and different sensor.

The question here is "can the arduino count AC pulses?"