Page 1 of 1

measure own voltage through testpoints?

Posted: Tue May 27, 2014 3:10 am
by moli.hu
Hello,
Is there a way to the Pi to measure it's own 5V voltage by soldering wires to the TP1+TP2 test points on the board and connecting them with something to the gpio? Or will it fry the board? I'm dumb to electronics. If it's ok, how to do it exactly? The Pi is fed from the mains through the microUSB port!

Re: measure own voltage through testpoints?

Posted: Tue May 27, 2014 4:09 am
by rpdom
Yes, it is possible. You will need an ADC (Analogue to Digital Converter) of some sort, probably one that will connect to the I2C bus on the gpio. You will only need to conect to the +5V test point, as the 0V/GND point is already connected to the gpio GND internally.

You could also use the 5V pins on the gpio as a test point, rather than soldering wires to the board. If you do that you might as well monitor the 3.3V pin as well :)

Re: measure own voltage through testpoints?

Posted: Tue May 27, 2014 4:17 am
by joan
moli.hu wrote:Hello,
Is there a way to the Pi to measure it's own 5V voltage by soldering wires to the TP1+TP2 test points on the board and connecting them with something to the gpio? Or will it fry the board? I'm dumb to electronics. If it's ok, how to do it exactly? The Pi is fed from the mains through the microUSB port!
The Pi is NOT fed from the mains through the microUSB. It is fed 5V DC.

Re: measure own voltage through testpoints?

Posted: Tue May 27, 2014 4:20 am
by joan
I think you need a reference voltage. I guess the 3V3 rail could be used as it's meant to be regulated from the unregulated 5V input. You'd have to voltage divide the 5V down to get it within the regulated range to feed into the ADC.

Re: measure own voltage through testpoints?

Posted: Mon Jun 02, 2014 2:47 pm
by moli.hu
@rpdom:
You could also use the 5V pins on the gpio as a test point, rather than soldering wires to the board.
Is the 5V on the gpio the same as the 5V on the TP? I mean what was the reason of the Foundation to include a TP when that 5V could be measured on the gpio? There should be something behind this.
You will need an ADC of some sort
OK, what sort? I'm completly new to this, all i did so far was to solder a few wires my cat chewed on, solder back a displaced speaker to the pcb in my dect, solder off the beeper from my microwave (hated that), etc.
Please give me a shopping list with the item list i could google for and learn more about.


@joan:
I think you need a reference voltage.
ok, but what if that "3V3" is varied by the 5V input? Is it?
Could i calibrate the ADC by using a multimeter once? Or will the calibration drift away in time, or change with the temperature?

Re: measure own voltage through testpoints?

Posted: Mon Jun 02, 2014 4:04 pm
by Douglas6
moli.hu wrote:I mean what was the reason of the Foundation to include a TP when that 5V could be measured on the gpio? There should be something behind this.
Can't help with your other questions, but I suspect the reason for the TP pads is simply to make automated testing easier. Easier to connect to pads via a coupla pogo pins in a testing jig than to try and connect to a GPIO pin, and less possibility of damage in a robotic testing process. A handy spot to poke a multimeter probe is just a side benefit. If you look at the schematics, I'm sure you'll find a direct connection between the TP pads and the 5V and GND GPIO pins.

Re: measure own voltage through testpoints?

Posted: Mon Jun 02, 2014 4:26 pm
by rpdom
Douglas6 is correct in that the TPs are directly connected to the GPIO supply pins.
moli.hu wrote:ok, but what if that "3V3" is varied by the 5V input? Is it?
The 3V3 is supplied from the 5V input via a 3V3 regulator, so as long as the input is at least enough to drive that regulator then the 3V3 line will be exactly 3V3 (within tolerances).

Re: measure own voltage through testpoints?

Posted: Mon Jun 02, 2014 4:49 pm
by hampi
The voltage should be well constant if you are using a proper power supply. However if I would do a circuit like that I would probably use my own PiPIC https://github.com/oh7bf/PiPIC to start with and to get something functional rapidly, and modify the daemon code https://github.com/oh7bf/Tmp102d for writing the voltages to a log file. With a high common mode operational amplifier it would be interesting to measure the input current too from the voltage drop across the input fuse.

Edit: the code pipicpowerd.c is probably easier to modify in my case though needs more line deleting

Re: measure own voltage through testpoints?

Posted: Mon Jun 02, 2014 6:19 pm
by GTR2Fan
Knowing the exact voltage isn't always necessary, and having a simple logic '0' or '1' below or above a set threshold might be sufficient.

You could use a cheap single opamp as a comparator (with a little hysteresis) comparing the 3V3 rail to a potted-down 5V rail and feed the output of the opamp into a GPIO pin via a resistor and a 3V3 zener to ground. I make that 1 opamp, 4 resistors, 1 zener diode. Cheap and simple.