Black Lives Matter - Action and Equality. ... Adafruit is open and shipping.
0

Digital voltmeter
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Digital voltmeter

by muhoo on Tue Sep 07, 2010 3:49 am

I'm making a digital voltmeter to measure and log a car battery state of charge.

Seems like a simple thing, just a couple voltage dividers, current-limiting resistor, and off we go. I used a separate ADC (not the Arduino built-in) for noise resistance, to put the sensor closer to a nice thick battery wire (so I'm measuring battery voltage not the voltage drop across a long wire) and also to lift the ground reference up to get better detail.

I've got the digital stuff working (communication to the ADC chip from the microcontroller), that part was easy. I'm just not sure about the analog part being sufficiently noise-resistant. There's some fluctuation which is highly irritating. Circuit diagram attached. Any suggestions?
Attachments
voltagesensormodule.png
The design as it is now
voltagesensormodule.png (5.75 KiB) Viewed 2022 times
muhoo
 
Posts: 1
Joined: Tue Sep 07, 2010 3:42 am

Re: Digital voltmeter

by JohnDowdell on Tue Sep 07, 2010 7:04 am

Can you describe the nature of the "fluctuations"?

How often are you sampling? Does the fluctuation occur every sample, every second sample or maybe every ten seconds or so? or completely unpredictable? and what is the magnitude of the fluctuation?

Can you tell us what the VCC supply looks like? is the supply actually on the board with the ADC near the battery or is it on some other slightly remote board that the ADC is sending to?

If the VCC is supplied from a "remote" source, consider a 100uf or higher electrolytic on the board where the ADC is. Also, do you have other filter caps on this board that don't appear in the schematic? like perhaps a 0.1uf close between GND and VCC pins of the ADC? And another between GND and VREF. I would also put maybe a 10uf Tantalum and a 0.1uf cermaic between ground and Vin- .

Is this battery actually in a car that is using it as a car battery? Heat would be one concern and noise from the alternator that is charging the battery would be the other (as well as an ignition noise).

You could put some small filter caps between ground and Vin+ to smooth it out but your readings will lag the actual battery voltage. It's usually better to average out and/or clean that up in software. At least try to make sure the divider and current limiting resistor is close to the ADC input. As soon as you increase the impedance between what you are trying to read and the reader, you are inviting noise.

I didn't see what ADC you are using but you can usually expect act least the LSB of your samplesto wobble all about the place from sample to sample. If it's a 12bit ADC and youre not too picky about the resolution, you could probably ignore the 2 Least Significant Bits and treat it like a 10 bit ADC.

JD
JohnDowdell
 
Posts: 27
Joined: Sun May 02, 2010 1:59 am

Re: Digital voltmeter

by richms on Tue Sep 07, 2010 10:12 am

With no lowpass filter on the ADC, you will see lots of fluctuations on a car that is operating. massive currents go into the injectors, and that causes loads of noise on the system, alternators put out rectified AC which is quite peaky.

The voltage drop on wires to the ADC will be stuff all because the only current going thru those wires is your sense current, but unless you are grounding at the battery and only at the battery then you will have a considerable ground offset which will screw things up. Cars are a total pain to work with electrically because of the shared chassis being ground everywhere, but at the same time being ground nowhere since it has resistance and you have to decide where you are assuming ground to be.

In the case of measureing battery voltage, you want ground to be the -ve post of the battery, and hope that you are not wanting to interconnect your ADC and whatever its talking to to any other piece of grounded equipment in the car.

If you do want to, then you have to start to look at isolation or a differential input ADC so that you are not affected by the ground. And you still need to filter the input so you are not running the risk of sampling right on the crest of some noise on the car.

richms
 
Posts: 558
Joined: Tue Jan 20, 2009 3:05 am
Location: New Zealand

Re: Digital voltmeter

by zener on Tue Sep 07, 2010 4:05 pm

You need some capacitors. Look at the datasheet of your AD. It will call out some caps on the power and gnd pins I am guessing. Then do some over sampling, digital filtering. Make a running average. The voltage is changing slowly so you can take advantage of this fact.

zener
 
Posts: 4567
Joined: Sat Feb 21, 2009 2:38 am

Please be positive and constructive with your questions and comments.