Measuring voltage on external circuit without connecting grounds

The external circuit under the question is a 2-pins computer fan connected to +5v and +12v atx psu lines. Let's assume we've only got access to the fan's pins available (so there is no access to the ground of the psu).

Using a generic multimeter I can easily measure the 7v accross the fan's pins.

But how can I measure it with an arduino?? All of "arduino voltmeter" tutorials I see in google pay the most attention to either a voltage divider to expand the measuring range (which is essential but not the main point) or to connecting an lcd (which is absolutely not related to measuring voltages). In all cases they assume the only connection case: probe 1 goes from arduino's ground to the external ground, probe 2 goes to the measuring point.

Connect the Arduino to PC ground, and use TWO analogue inputs to measure the TWO voltages.
Then subtract in software.
Not sure why you want to do this, because 5volt and 12volt of a PC are (hopefully) always the same.
Leo..

Wawa:
Connect the Arduino to PC ground,

Sry but as I said above the external circuit ground is not available. You only have access to the +5v and +12v wires.

Wawa:
Not sure why you want to do this, because 5volt and 12volt of a PC are (hopefully) always the same.

I'm not sure why it isn't obvious what I try to accomplish: measuring voltages between two random points like multimeters do. The 5-12 fan is just some particular example to talk about. Think of it like that: a fan is connected to an atx psu with 2 wires which can be any two of {0, +5v, +12v}. Use arduino to find out the voltage between the fan pins without connecting to the psu ground.

If you really have no access to the PC ground then provided the Arduino is isolated from any other ground, i.e. powered by a battery, then there's nothing stopping you connecting the Arduino ground to +5V and measuring the 7V difference. Voltages are not absolute, they are always relative.

I can't imagine why you'd want to do that but it would work. It doesn't tell you any actual voltages because you'd see the same 7V difference if you had 5V > 12V or 13V > 20V etc.

Steve

If you are powering the Arduino via the computer's USB port then it is already connected to the computer's ground line.

If you want it to behave like a multimeter and do 'floating' measurements, then you must power the Arduino from an isolated power supply or batteries and disconnect the USB cable from the computer.
You will still need to use a resistive divider as the 7v difference between the 12 and 5 volt rails exceeds the 5v limit of the analog input.

I've got it now, thanks. So the main point is a general use arduino based voltmeter MUST have no connections to the outer world (this implies an isolated power source). So if I plug probe wires into the board's ground and A0 and put the probes on any two points in some external circuit the only way for the current to flow between the both circuits are the wires so all of the current will surely flow through A0. And since input pins are like 100MOhms the current is very limited.

Last quick quiestion to wrap it up then. Back again to the 5-12 fan example. What happens if I connect arduino voltmeter probes in reverse polarity so arduino ground gets 12v and A0 gets 5v? Is it allowed at all to feed negative voltage to input pins?

Is it allowed at all to feed negative voltage to input pins?

NO.

Akiana:
I've got it now, thanks. So the main point is a general use arduino based voltmeter MUST have no connections to the outer world (this implies an isolated power source). So if I plug probe wires into the board's ground and A0 and put the probes on any two points in some external circuit the only way for the current to flow between the both circuits are the wires so all of the current will surely flow through A0. And since input pins are like 100MOhms the current is very limited.

As you have found powering things via USB can problematic.
There's more to be aware of. The metal case of a typical desktop PC is connected to the ATX power supply ground and the mains earth cable. If you have a second desktop PC then it will share the same ground as the first, so you cannot do a floating measurement on one whist the Arduino is powered by the other.

To make things more complicated, some laptops have isolated mains power supplies and some have grounded mains power supplies. If you are powering your Arduino from a laptop with an isolated power supply (check for the square within a square logo on the power supply) then you can do floating measurements. If the power supply isn't isolated then it's shares the same ground as your desktop PC.

Akiana:
Last quick quiestion to wrap it up then. Back again to the 5-12 fan example. What happens if I connect arduino voltmeter probes in reverse polarity so arduino ground gets 12v and A0 gets 5v? Is it allowed at all to feed negative voltage to input pins?

Negative voltages will fry the Arduino. If in doubt put a diode before the input and add 0.6v to whatever reading you see.