Reading Multiple Voltages with different grounds

Hi There,
I need to measure two voltage readings using Arduino… I use analog pins A0 and A1 to do that… when I only do one measurement (a wire from pin A0 -or A1- and a wire from Ground) everything is fine and voltage reading is correct (I check that with multimeter), but when I do them both (four wires-two from ground pins) then the numbers are inaccurate. It makes sense since the ground potential level for two readings is not the same but I connect them both to ground of Arduino. I will be grateful if someone can tell me how to fix this problem. For some reason I must use only one Arduino to do this task.

  //******BEGIN: VOLTAGE READING A0 pin************************************
  int sensorValue = analogRead(A0);
  float voltage = 0;
  float max_volt = voltage;
  for (int i = 0; i < 60000; i++)
  {
    voltage = analogRead(A0);
    if (voltage > max_volt)
    {
      max_volt = voltage;
    }
    ;
  }
  Serial.print(max_volt);
  Serial.print(",");

  //******BEGIN: VOLTAGE READING A1 pin*****************************************
  sensorValue = analogRead(A1);
  voltage = 0;
  max_volt = voltage;
  for (int i = 0; i < 60000; i++)
  {
    voltage = analogRead(A0);
    if (voltage > max_volt)
    {
      max_volt = voltage;
    }
    ;
  }
  Serial.print(max_volt);
  Serial.print(",");

  //******FINISHED: VOLTAGE READING A1 pin***********************************

Give us the full picture. What are the voltages, do you use dividers (resistor values), how are grounds shared, etc. A diagram is better than 1000 words. Also post your code (inside code tags). Leo..

Wawa: Give us the full picture. What are the voltages, do you use dividers (resistor values), how are grounds shared, etc. A diagram is better than 1000 words. Also post your code (inside code tags). Leo..

Thanks for your response. I didn't want to cause extra confusion before. I added a picture of circuit for which I want to measure voltage at two points using an Arduino Uno. I'm almost sure it's grounding issue, since I did many tests and one analog reading (either A0 one or A1) works perfect.

You cannot connect 2 points on that circuit to ground ... that essentially shorts the circuit between the ground wires. Is this a school project?

I would pick one point as ground for the Arduino, e.g. the right/bottom corner of your diagram. And use three analogue inputs for measuring. One for the bottom voltmeter, and two for the two terminals of the left voltmeter. Adding/subtracting can be done in code.

No values on your diagram apart from the voltage source. Arduino can only measure positive voltages, so the analogue pins have to be "lifted" to mid-voltage if you want to detect positive and negative peaks. Post the whole diagram, including connections to the Arduino. Leo..

Edit. If you know the resistor values, and there is no other load on the circuit, then you just can measure one point, and calculate the voltages on the remaining points.

dlloyd: You cannot connect 2 points on that circuit to ground ... that essentially shorts the circuit between the ground wires. Is this a school project?

That's true, but I didn't know what was the right thing to do ... no this is a research project I'm doing

Wawa:
I would pick one point as ground for the Arduino, e.g. the right/bottom corner of your diagram.
And use three analogue inputs for measuring. One for the bottom voltmeter, and two for the two terminals of the left voltmeter. Adding/subtracting can be done in code.

No values on your diagram apart from the voltage source.
Arduino can only measure positive voltages, so the analogue pins have to be “lifted” to mid-voltage if you want to detect positive and negative peaks.
Post the whole diagram, including connections to the Arduino.
Leo…

Edit.
If you know the resistor values, and there is no other load on the circuit, then you just can measure one point, and calculate the voltages on the remaining points.

Thank you very much! your suggestion totally solved the issue!