Arduino Forum

Using Arduino => Sensors => Topic started by: amongstmyselves on Oct 27, 2013, 03:18 am

Title: Measure positive and negative voltage with common ground
Post by: amongstmyselves on Oct 27, 2013, 03:18 am
Howdy all,

I'm trying to do as the subject says - measure positive and negative voltages with a common ground but I need to know if the voltage changes between positive and ground and negative and ground and NOT between the positive and negative. Based on this I will need to use two analog input via resistor networks but the problem as I see it is the common ground which I can't get around and hence the need to measure a negative voltage.

The only way I can see around this is to use an opamp to invert the negative voltage to positive.

What I am building is a battery switcher which has two inputs. Each input  has three connectors terminals which are +12v / ground / -12v. Via some software I will switch between the two inputs when the voltage on either rail go below a define voltage. Hope that is clear enough.

So I what I am asking is if anyone can think of a way around using an opamp and do the job with just resistors. Any suggestions will be greatly appreciated.
Title: Re: Measure positive and negative voltage with common ground
Post by: CrossRoads on Oct 27, 2013, 03:28 am
Can you do this:
Use -12 as Gnd, use Gnd as +12, and +12 as +24V?
Title: Re: Measure positive and negative voltage with common ground
Post by: MarkT on Oct 27, 2013, 11:08 pm
I'm not sure I fully understand the battery circuit.  Maybe a diagram would be clearer?
Title: Re: Measure positive and negative voltage with common ground
Post by: dc42 on Oct 27, 2013, 11:22 pm
Yes you can do it with just resistors, but with resolution reduced by 25% for the negative supply reading. I assume that you will connect the Arduino ground to the ground of the input.

To measure the +ve supply, you just need a voltage divider - say 20K from +12V to the analog input and 10K from the input to ground. Then you can measure from 0V to +15V on that input, and the voltage present is (analog_reading * 15.0)/1024.0.

To measure the -ve supply, connect 30K between it and the analog input, and 10K between the analog input and +5V. Then as the -ve supply varies from 0V to -15V, the voltage at the analog input will vary from +3.75V to 0V. The voltage of the negative supply is ((analog_reading - 768) * 15.0)/768.0.
Title: Re: Measure positive and negative voltage with common ground
Post by: amongstmyselves on Oct 28, 2013, 01:46 am
Thanks dc42 that makes sense. Here's the Tinycad circuit just to confirm I've understood but I will also breadboard it before putting it into the final circuit.