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.
Can you do this:
Use -12 as Gnd, use Gnd as +12, and +12 as +24V?
I'm not sure I fully understand the battery circuit. Maybe a diagram would be clearer?
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.
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.