Voltage divider problem

How do you mean? Sorry if I'm a little slow. :slight_smile:

I tried testing in just below 0°C and now I just bothered to take notes on method 2 and 3 since 1 was too far off.

Powering using USB:
4.47V (measured using my meter)
4.45V (method 2) diff 0.4%
4.39V (method 3) diff 1.8%

Powering usning 3S:
11.55V (measured using my meter)
11.56V (method 2) diff 0.1%
11.54V (method 3) diff 0.1%

Now if it gets even colder I will try again but for now I pretty happy with method 2, it seems to be very consistent with my meter which was what I strived for in the start.

dhenry:
Put a small capacitor on the analog input pin. Anything from 0.1n to 1000n will work.

When should I use a capacitor like this? On all analog inputs? I have some inputs that goes straight from a 0-5V source and thus doesn't need a voltage divider but do I still need the capacitor?

Also should I route both ground and + from this source? I also monitor its voltage so I guess there's a risk of ground loops.

Quote from: dhenry on January 02, 2013, 03:55:02 PM
Put a small capacitor on the analog input pin. Anything from 0.1n to 1000n will work.
When should I use a capacitor like this? On all analog inputs? I have some inputs that goes straight from a 0-5V source and thus doesn't need a voltage divider but do I still need the capacitor?

What I fail utterly to see here is how a component that can be anywhere in a 10,000 to 1 range could possibly be meaningful compensation for anything.

Bob

Docedison:

Quote from: dhenry on January 02, 2013, 03:55:02 PM
Put a small capacitor on the analog input pin. Anything from 0.1n to 1000n will work.
When should I use a capacitor like this? On all analog inputs? I have some inputs that goes straight from a 0-5V source and thus doesn't need a voltage divider but do I still need the capacitor?

What I fail utterly to see here is how a component that can be anywhere in a 10,000 to 1 range could possibly be meaningful compensation for anything.

Bob

The concept of adding a cap is if the output impedance of whatever is driving the analog input pin is higher then 10K ohms then the internal sample and hold cap may not have time to charge up to the true value of the applied voltage. Possible solutions are:

Buffer the applied voltage with a device that meets the output impedance recommendation of the AVR ADC

Do consecutive analogRead() commands on the same input pin and ignore the first reading obtained

Add a small cap that will accumulate the charge of the applied voltage and will be able to transfer that charge voltage faster to the internal sample and hold cap when the pin is read.

Lefty

Is there a risk when adding a cap when it's not really neccessary?

Boopidoo:
Is there a risk when adding a cap when it's not really neccessary?

Nothing damaging, but if high speed sampling is being done on higher frequency type analog signals the cap may act as a low pass filter not giving as accurate a sample as it would without it.

Lefty

Is there a risk when adding a cap when it's not really neccessary?

Yes.

Of course I'd like it to be even better so I guess I should now start investigating this VREF that I guess is how the arduino close the arduino 5V supply is to 5V. Is that correct? Is there a prefered method of doing this?

I would use a 4.7 volt zener/resistor combination to provide a 4.7v reference into Aref. (This could be fed off the power either pre or post regulator, but may be better pre regulator) Decouple Aref with a capacitor (<1uF) to ground. Measure exact voltage from the zener for more precision for your calculations. Or you could use a precision voltage reference chip.

For the resistor divider into A0 I would use a 10k trimmer (e.g. 25 turn type for finer adjustment) across the battery terminals; any more and your may get noise, any lower and you will be burning up too much power from your batteries. Decouple the input to A0 with .1uF or greater to ground. Tune to give 4.7 volts output for the maximum expected voltage from the LiPos.

dhenry:

Is there a risk when adding a cap when it's not really neccessary?

Yes.

This is my current breadboard. I drew it so it shows the connectors I plan to use. The caps I'm talking about are the ones that are placed for each analog input.

The caps I'm talking about are the ones that are placed for each analog input.

I was talking about the same caps too.

Ok, so I should be able to remove these without having signal problems? If they don't do anything good then it will simplify my wiring and PCB-shield a lot.

Also, don't forget that the act of taking a measurement actually affects the circuit.

A DC Ammeter should have a low resistance, close to zero, but crucially NOT zero. Same, but opposite, for a DC Voltmeter; it should have high resistance, theoretically infinite, but it will just be very high.

This means that you never read the true value. Adding an ammeter will put a little more resistance in series, meaning a little less current flowing. Adding a voltmeter will add a very large resistance in parallel, meaning a little more current flowing, so more voltdrop in the series part of the circuit, than without it.

The effect will be dependant on the existing conditions of the circuit, in relation to the connection point, and value of resistance , of your test instrument. You can't take a measurement without affecting what you are measuring.

Biggest errors will be measuring current when you already have a low resistance circuit, or measuring voltage when you have a very high resistance circuit.

Using a resistor divider network and then measuring voltage at a midpoint will put the voltmeter in parallel with one of the resistors and mean the combined resistance value is now lower; 1/(1/R1+1/Rmeter). This will change your divider ratio and the voltage at that point to a lower volt drop than would be present without the meter connected. Therefore, the value with and without your meter connected WILL be different anyway, dependent on the values in the circuit and that of your meter.

Add on the errors mentioned previously and you will NEVER measure exactly the same with and without the meter connected, unless you actually had an infinite impedance voltmeters.

You could well be chasing ghosts here, by trying to get a value that is the same (or as close as you seem to want it), with all the factors that are affecting the measurement of that value via different methods.

As an example, imagine:-

Your voltmeter has a resistance of 10 Megohm

You have a 12V supply with 2 x 10 Megohm resistors across it (R1 and R2), making a 1:1 divider. Calculations tell you that there will be a 6v volt drop across each one, so you'll measure 6v at the mid point with reference to Gnd, or -6v with reference to +12v.

Now, you take your voltmeter and connect it across R2 and Gnd to measure the output voltage of your divider. This puts a 10Megohm resistance in parallel with R2, meaning you now have an effective series resistance in your circuit of 10 Megohm (R1) and 5 Megohm (R2 + Rmeter paralleled), totalling 15 Megohm. This is now a 2:1 divider.

So, you expect to measure 6v at the midpoint, but you actually measure 4v, an 'error' of -33% :wink:

This is without considering the resolution and accuracy of the instrument itself, which will mean that measured 4v could be up or down by a few percent too.

When testing and measuring it is important to understand the effect your instruments can have on what you are measuring. I regularly test for both extremely low and extremely high resistances in high voltage circuits. This is why I have specific instruments for each application. A micro-ohmeter for injecting 100A to measure micro-ohms and 40kV+ test sets for measuring Gigohms and Terraohms and leakage currents in micro-amps at, say, 25kV.

Well maybe I'm just lucky but I'm actually very happy with the measurements which are within 0.01V from what my volt-meter measures. This has now been tested between 4-12V and between -5 to +25 degrees C. If this is consistent I don't need the results to be any better in this project.

The measured voltage on my Arduino doesn't seem to change noticably when I add a volt-meter to the circuit and vice versa.

Now my problem is making the PCB which was harder then I imagined... a real puzzle. :slight_smile:

Boopidoo:
Well maybe I'm just lucky but I'm actually very happy with the measurements which are within 0.01V from what my volt-meter measures. This has now been tested between 4-12V and between -5 to +25 degrees C. If this is consistent I don't need the results to be any better in this project.

The measured voltage on my Arduino doesn't seem to change noticably when I add a volt-meter to the circuit and vice versa.

It's all about the output impedance of whatever you are wiring to the analog input if the 10/11 megohm input impedance of your DMM will effect the reading or not. As the analogRead() command is optimized (and recommended) for reading a voltage source with an output impedance of 10K ohms or less, a DMM reading at the same time will have no effect noticeable.

Lefty

Now my problem is making the PCB which was harder then I imagined... a real puzzle. :slight_smile:

What if I removed the caps on RX1 & RX2-inputs and placed resistors in series with the ground (to eliminate ground loops) or eliminated the ground for RX1&2 inputs altogether.

The ground on the RX1&2 is from two devices that is powered from the 12V-source which I am monitoring so that ground is already connected.

2 x 10 Megohm resistors across it (R1 and R2), making a 1:1 divider

That type of dividers are basically unusable for an avr's adc.

dhenry:

2 x 10 Megohm resistors across it (R1 and R2), making a 1:1 divider

That type of dividers are basically unusable for an avr's adc.

It was a hypothetical example to show the effect of a test instrument on the circuit being tested, in as simple terms as possible. The values were simply comparable to typical resistance of a voltmeter and values where any calculations were either simple enough to do in your head, or just intuitive to anyone with a little experience.

Even in those cases (of extreme resistance), you can still make it work if you are prepared for some compromises.