Some calculation help needed


I’m trying to clean up a very messy 24 VDC signal while cutting it down to 4 VDC so I can feed the voltage into A0.

I have a voltage divider and a zener to clamp any potential spikes, followed by a low pass filter. I’m not sure what R values to use, or C for that matter. I can change my current 46K and 10K to what ever I need, i’m just not sure to what–I can compute voltage dividers and low pass filters, but when connected i’m not sure what values to use so the filter doesnt’ affect the divider.

Circuit diagram attached.

Can anyone help?



Dump the zener. Not needed. Does not work when the Arduino is off.

You need a 4:(24-4)= 4:20 divider.

If you use 20k:100k, then you are protected to at least 100volt.
Because the 100k resistor limits input pin current.
Assuming <=1mA input pin clamping diode is safe.

I would use 22k and 100k, so 24volt produces 4.34volt.
Use a 100n cap to ground.

Thanks Leo,

Voltage divider 22K and 100K, thoughts on what resistor to use in the R3 (low pass filter) or is it not needed?

Use Thévenin's theorem to find the effective resistance of the combination of the 46kΩ and 10kΩ resistors. (Answer = 8.2kΩ) This resistance is then in series with R3, so you need to use (8.2kΩ + 10kΩ) as the resistance value R when you calculate the value of the capacitor in the low pass filter.

Not needed. Just use two resistors. The 100k from 24volt to the analogue pin and the 100n cap to ground already make a lowpass filter. Leo..

You haven't told us anything about the signal - its nature (analog, digital), its bandwidth, its timing requirments. Hard to know where to start without that.

I'm pretty sure it's for this issue ->

I still contend, however, that if your actual battery voltage has that much 20kHz ripple on it your first priority should be to reduce the actual battery ripple with a big Cap on the input of the PWM controller.

You're not doing yourself any favors having that much ripple on your actual battery voltage, but hiding it from your Arduino with a filtered A/D measurement.

Dumping the zener is good idea, not only because it’s unnecessary, but because they leak below their nominal turn on voltage, upsetting the accuracy.

also, I’d use 18k/100k as your resistor values, since you charge a lead acid battery to 120%, so your 24v can be 28.8 fully charged,

18/100 gives you a ratio 18/(18+100) , ( 0.1525x )which should cover the full range.

If you want to be accurate, measure the resistors with an ohm- meter - they can be ± 20% depending on what grade you buy. Put the real values in the sum above.

And measure your nominal 5v reference too and account for that. It could easily be 10% out.



From the discussion in the link "BigBobby" posted above, you're sampling at 1 Hz, so you'd design the filter for cutoff around or above that point since higher frequency components are going to alias and confuse the measurement. Presuming "WaWa's" 100k / 20 k resistor values and no R3, that would put you at 10 uF or higher for the filter capacitor.