# PIC Measurments query, voltmeter and ammeter on same circuit?

Status
Not open for further replies.

##### New Member
Hiya,

Im using a PIC24 and need to measure the voltage across a battery as well as the current into it.

The voltage across the battery is done, A/D input at +ve, PIC ground to negative. The problem comes when trying to measure current in, for which I plan to measure the voltage drop across a low value resistor.

As far as I can figure, my PIC will only measure positive voltage differences.

If I connect the resistor in series with the battery and try to measure the voltage across it, the placement of wires will effectively connect one of the A/D inputs of the battery voltmeter to the PIC ground of the resistor voltmeter and vice-versa.

Is there any way the pic will measure negative voltages so i can swap the polarity of the wires?
Any other suggestions?

Thanks.

#### nickelflippr

##### Member
You don't say what type of battery, voltage, and amps you are dealing with. It's possible a current sense IC like the Max4080/4081 would work. It gets around the battery charge/discharge (negative/positive) thing by level shifting the zero point to mid-range of the adc reading.

#### binzer

##### Member
Hiya,

Im using a PIC24 and need to measure the voltage across a battery as well as the current into it.

The voltage across the battery is done, A/D input at +ve, PIC ground to negative. The problem comes when trying to measure current in, for which I plan to measure the voltage drop across a low value resistor.

As far as I can figure, my PIC will only measure positive voltage differences.

If I connect the resistor in series with the battery and try to measure the voltage across it, the placement of wires will effectively connect one of the A/D inputs of the battery voltmeter to the PIC ground of the resistor voltmeter and vice-versa.

Is there any way the pic will measure negative voltages so i can swap the polarity of the wires?
Any other suggestions?

Thanks.
What if you use 2 adc inputs, one on each side of the resistor for your current measurement, you have battery voltage and you can calculate the voltage across the resistor (differance between the 2 inputs) and calculate the currect ( voltage diff and resistance to get amps), you could also figure out if you are charging or discharging.
Mike.

#### dougy83

##### Well-Known Member
You can use an opamp to amplify the voltage across the resistor (to get decent resolution on your current readings) and to invert its polarity.

If the battery is directly powering the PIC, you will need to use a reference voltage (possibly internal to the PIC). You will also need to drop the battery voltage to bring it into the working range of the ADC.

##### New Member
@nickelflippr, binzer, dougy83:

those are all excellent suggestions, thank you kindly.
im going to try measuring the difference between then two inputs first like binzer said (as I dont have to go get any extra bits for that one), then give the other two ideas a shot if i encounter problems.

Thanks again!

Status
Not open for further replies.