rpifreeze
Posts: 76
Joined: Tue Jul 24, 2012 10:03 pm

Monitor self voltage (ADC)

Mon Apr 25, 2016 2:08 am

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...
usb and broadcom issues will never be solved...Too much time passed, too much to be done...

rzusman
Posts: 346
Joined: Fri Jan 01, 2016 10:27 pm

Re: Monitor self voltage (ADC)

Mon Apr 25, 2016 2:31 am

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.

rpifreeze
Posts: 76
Joined: Tue Jul 24, 2012 10:03 pm

Re: Monitor self voltage (ADC)

Mon Apr 25, 2016 9:10 am

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 :)
usb and broadcom issues will never be solved...Too much time passed, too much to be done...

User avatar
Tage
Posts: 287
Joined: Fri May 24, 2013 2:29 am
Location: St Thomas, Ontario Canada

Re: Monitor self voltage (ADC)

Mon Apr 25, 2016 2:14 pm

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.

User avatar
Burngate
Posts: 6011
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: Monitor self voltage (ADC)

Mon Apr 25, 2016 4:15 pm

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?

rzusman
Posts: 346
Joined: Fri Jan 01, 2016 10:27 pm

Re: Monitor self voltage (ADC)

Mon Apr 25, 2016 6:20 pm

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?

boyoh
Posts: 1328
Joined: Fri Nov 23, 2012 3:30 pm
Location: Selby. North Yorkshire .UK

Re: Monitor self voltage (ADC)

Mon Apr 25, 2016 7:58 pm

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.
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

User avatar
liudr
Posts: 685
Joined: Sat Jun 01, 2013 12:11 am
Location: Central MN, USA
Contact: Website

Re: Monitor self voltage (ADC)

Tue Apr 26, 2016 4:46 am

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?
Arduino data loggers, user interface, printed circuit board designer since 2009, RPI 3B 2B 2B Zero Jessie, assembly/C/C++/java/python programmer since the 80's

rpifreeze
Posts: 76
Joined: Tue Jul 24, 2012 10:03 pm

Re: Monitor self voltage (ADC)

Wed Apr 27, 2016 10:30 pm

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 :)
usb and broadcom issues will never be solved...Too much time passed, too much to be done...

User avatar
liudr
Posts: 685
Joined: Sat Jun 01, 2013 12:11 am
Location: Central MN, USA
Contact: Website

Re: Monitor self voltage (ADC)

Thu Apr 28, 2016 12:39 am

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.
Arduino data loggers, user interface, printed circuit board designer since 2009, RPI 3B 2B 2B Zero Jessie, assembly/C/C++/java/python programmer since the 80's

FM81
Posts: 518
Joined: Wed Apr 17, 2013 4:33 pm

Re: Monitor self voltage (ADC)

Thu Apr 28, 2016 4:51 am

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
A: What does the command 'cat /dev/urandom', can you tell me please?
B: Yeah, that's very simple: It feeds your cat with radioactive material!

User avatar
Cancelor
Posts: 757
Joined: Wed Aug 28, 2013 4:09 pm
Location: UK

Re: Monitor self voltage (ADC)

Thu Apr 28, 2016 8:11 am

I did a quick google and found this ... http://www.rs-online.com/designspark/de ... 30700a.pdf ... might be some useful stuff in there.
Can't find the thread you want? Try googling : YourSearchHere site:raspberrypi.org

rpifreeze
Posts: 76
Joined: Tue Jul 24, 2012 10:03 pm

Re: Monitor self voltage (ADC)

Fri May 06, 2016 11:17 pm

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.
usb and broadcom issues will never be solved...Too much time passed, too much to be done...

rpifreeze
Posts: 76
Joined: Tue Jul 24, 2012 10:03 pm

Re: Monitor self voltage (ADC)

Sat May 07, 2016 12:25 am

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.
usb and broadcom issues will never be solved...Too much time passed, too much to be done...

Return to “Beginners”