Page 1 of 1

Monitor self voltage (ADC)

Posted: Mon Apr 25, 2016 2:08 am
by rpifreeze
Hello,
My plan is to monitor RPI own 5 and 3.3V voltage lines, but faced small problem. My results are always inaccurate and differ about 20-50mV compared to my multimeters that are not so cheap (~60$).
It's not about VREF, because I used Pololu small step-up converters (3.3, 5V). They are really good and keep voltage as I use them only to give few uAmps to VREF pin to ADC modules. I used ADC modules to monitor voltage like PCF8591P, ADS1015, MCP3424, but every time I get different results, so I'm now wondering whether I connect them properly.
Could anyone share some simple connection example ? I think I spent too much time and breadboards on putting cables in and out...

Re: Monitor self voltage (ADC)

Posted: Mon Apr 25, 2016 2:31 am
by rzusman
Average your readings.
The ADC is taking a snapshot of the voltage, which is going to vary as the switching regulator adjusts to changing loads.

Re: Monitor self voltage (ADC)

Posted: Mon Apr 25, 2016 9:10 am
by rpifreeze
I cannot average readings, as ALL of them are inaccurate and too low compared to real voltage (-20..50mV). I suppose this is also not an issue with regulator as ADC chips mentioned previously are powered by a 5V regulator. ADC use soooo less miliamps that regulator power doesn't even change a 0.001 volt.
Also, I think it's not a problem of a specific module since all of them behave the same.

What's the most interesting, is when I connect a battery to input pins of ADC, readings are perfect, both on 8 and 18-bit chips, and that's why I started to think that connections are not proper ones and asked for some example one with proper wiring :)

Re: Monitor self voltage (ADC)

Posted: Mon Apr 25, 2016 2:14 pm
by Tage
my guess is that it is a noise related problem. try to take ten readings and save them in an array, sort the array and throw away the two highest and the two lowest readings, then average the remaining six readings.
the reason why you need to throw away the highest and the lowest readings is that the errors tend to affect the result. you normally get a more steady result if you use this method as opposed to just averaging all ten readings.

Re: Monitor self voltage (ADC)

Posted: Mon Apr 25, 2016 4:15 pm
by Burngate
My take on this ...
the ADC readings of a battery agree with your DVM readings of same,
but ADC readings of Pi's rails are 20-50mV lower than DVM readings

So
20-50mV are getting lost ...
down the ground rail?

Re: Monitor self voltage (ADC)

Posted: Mon Apr 25, 2016 6:20 pm
by rzusman
Burngate wrote:My take on this ...
the ADC readings of a battery agree with your DVM readings of same,
but ADC readings of Pi's rails are 20-50mV lower than DVM readings

So
20-50mV are getting lost ...
down the ground rail?
This is certainly possible - Are you measuring with the ADC and the meter at the exact same points?

Re: Monitor self voltage (ADC)

Posted: Mon Apr 25, 2016 7:58 pm
by boyoh
rpifreeze wrote:Hello,
My plan is to monitor RPI own 5 and 3.3V voltage lines, but faced small problem. My results are always inaccurate and differ about 20-50mV compared to my multimeters that are not so cheap (~60$).
It's not about VREF, because I used Pololu small step-up converters (3.3, 5V). They are really good and keep voltage as I use them only to give few uAmps to VREF pin to ADC modules. I used ADC modules to monitor voltage like PCF8591P, ADS1015, MCP3424, but every time I get different results, so I'm now wondering whether I connect them properly.
Could anyone share some simple connection example ? I think I spent too much time and breadboards on putting cables in and out...
Remember your test are not in workshop test conditions ware meters are checked to calibration points
All connections should be clamped or soldered, not in breadboards, to eliminate contact resistance
Your power supply must be well filtered and stable. Good meters and short test leads
Make sure your AC is well filtered and noise free.

Re: Monitor self voltage (ADC)

Posted: Tue Apr 26, 2016 4:46 am
by liudr
So you are using a regulated voltage to power your ADC. What if you read the regulator's voltage with ADS1015 and with your meter? Forget rpi for now. Do they agree, within what range?

Re: Monitor self voltage (ADC)

Posted: Wed Apr 27, 2016 10:30 pm
by rpifreeze
I guess mz ADS1015 got damaged due to...testing, but I've read a little about ground loops and I think this is the root cause, because when I connect AAA battery to IN0+ IN0- on my MCP3424 module it shows correct voltage.
There might be also a problem with voltage divider (~10k and 18k), but I don't think this is really so important and matters here, since mentioned MCP3424 draws microamp or similar.
I asked you for some connection illustration (RPI-ADC), because I feel too weak to "discover" myself, as it's my first journey with ADC modules and I'm never fully convinced I do it right.

I will also take old PCF8591P module and try to measure voltages again then.
If you have any tips, go ahead, as I also think it might be a good idea to shre this knowledge - just another example of what RPI can do with itself :)

Re: Monitor self voltage (ADC)

Posted: Thu Apr 28, 2016 12:39 am
by liudr
Do you have very long wires? Anyway, if your ADC agrees with your meter, without involving RPI, that would be a good indicator you have your ADC wired correctly.

Re: Monitor self voltage (ADC)

Posted: Thu Apr 28, 2016 4:51 am
by FM81
rpifreeze wrote:... I've read a little about ground loops and I think this is the root cause ...
I think so too!
A part of raspberry's "supply current" may go over the "ground line to your ADC" and creates a little amount of voltage-drop - the same little part, which you're losing during the measurement.
It would be good, to see a EXACT schematic-picture of your wiring, including all grounds.

Bye, FM_81

Re: Monitor self voltage (ADC)

Posted: Thu Apr 28, 2016 8:11 am
by Cancelor
I did a quick google and found this ... http://www.rs-online.com/designspark/de ... 30700a.pdf ... might be some useful stuff in there.

Re: Monitor self voltage (ADC)

Posted: Fri May 06, 2016 11:17 pm
by rpifreeze
Thank you All for suggestions. I will provide my schematic shortly, but for now, let me tell you that I suppose some problem with wiring, because when I connect a separate power source (battery bank, pins directly from battery), and put +/- to IN1 and GND to PCF8591P, and merge grounds (ground of Pi and battery bank), then voltage is constant and won't even change a little.
But...when I put RPI 3V or 5V line into IN1 of PCF module then voltage varies 20-70mV, and it's not because of PCF being only 8-bit. Also, when I connect 5V to IN1 an 3.3V to IN1 then both of them vary. I wouldn't suspect Vref, because I use some Pololu stepup/down module only for Vref - no more devices are connected to this regulator, so I would assume its output is stable.

Re: Monitor self voltage (ADC)

Posted: Sat May 07, 2016 12:25 am
by rpifreeze
I think I solved the problem, but please watch this thread for few weeks still :)
First of all, I took a simple PCF8591P module. It's only 8-bit and Vref is pretty high (5.17V).
I put a low pass filter to all inputs. First one measured came from power supply (USB and to 5V rail of RPI) and differs (compared to my DVM) by only 0.013V. Second one was 5V rail or RPI and difference was similar like 0.011V. On 3V RPI line difference was only 0.006 an that's really impressive and satisfies me. 5V rails still dont...

I'm wondering now why my DVM always shows higher voltage and which tool should I trust more - DMV or PCF ? . I don't know how DVM calculates voltage (average, min/max?) and what interval it takes, but with this low pass filter on each input - 10kOhm and 100nF all look better. No more 20-50 mV difference.

What else could I do now to reduce this difference more ? Throw away DVM (Uni-T UT60A) or put some capacitors on RPI ?
Right now I'm powering it through GPIO 5V/GND.
Oh, and btw, I use breadboards for these tests, so nothing is soldered.

Now I will try to check MCP3424, but don't know how to split voltage as its Vref should not exceed 2.048V when in fact, I'm going to measure from 3.3-5.6V. I know, I know...resistor divider, but believe me, I tried to find two same ones (10k, 4.7k) but couldn't find a pair with EXACT same resistance so voltage was not split into two exact ones. 10k was sometimes 10.1 or 9.8. I also tried to split into different voltages (using different resistances), so that I could have 1/4th from 5.17 but never got close to that - possibly due to inaccurate dividers.