Go Down

### Topic: Voltage Divider (Read 4271 times)previous topic - next topic

#### SagarDev #45
##### Sep 23, 2015, 03:20 am
How do I measure current?
Shakespeare's pen is an Electronics Engineer's Soldering Iron...

#### raschemmel #46
##### Sep 23, 2015, 04:30 amLast Edit: Sep 23, 2015, 04:26 pm by raschemmel
By Ohms law;
Current "I" = Voltage "V"/Resistance "R" (I=V/R)
If you have a DPDT relay, wired as follows:
BATTERY Voltage "V" ==> COMMON (of relay contact)
Circuit (normal load) ===> Normally Closed contact (of relay) (N.C.)
Calibration Resistor ====> Normally Open contact (or relay) (N.O.)

Where RCalibration =  100 ohms/ 0.01%

The load circuit (to include EVERYTHING EXCEPT the uP) will be powered by the battery until the uP turns on the digital output pin driving the transistor that drives the relay. At that time, ALL of the circuitry EXCEPT the arduino  will be disconnected from the battery and the calibration resistor will be connected across the battery. The battery voltage will be measured by the output of a voltage divider consisting of two 20 k resistors in series that are permanently connected across the CAL resistor to GND.
The voltage divider divides the voltage in half so the measured value must then multiplied by 2. The CAL resistor is a known resistance  so the current drawn by the resistor (and the arduino) is represented by the voltage across the battery. An arduino UNO has a power dissipation of 0.22185 W (43.5 mA @ 5.1V). By measuring the voltage, [analog count * (5/1024)] V , multiplying by 2 to obtain the real voltage, dividing by 100, the result is the current.
ie:
Let actual battery voltage = 8V (when connected to CAL resistor)
VA0 pin = 8V/2 = 4V
Analog counts measured by arduino = 4V /0.0048828125 V = 819 counts.
Calculated voltage = measured counts * 2 * 0.0048828125 V = 8V
The current measured = 8V / 100 ohms = 80 mA (CAL resistor) and since we know the arduino draws 43.5 mA @ 5.1 V, so it draws 27.73125 mA @ 8V.

the equivilent current for the arduino running off 8V=  ( 0.22185 W / 8V = 27.73125 mA)
Therefore the equivilent resistance of the arduino is 288.48 ohms.
With the arduino in parallel with the  100 ohm resistor
RTotal = (100 * 288.45)/(100 + 288.45) = 74.26 ohms.
ITotal = 8 V /74.26 ohms = 107.72 mA

The power dissipated by the resistor = P = I x V = 0.080 A A * 8 V = 0.64 W (@ 8V)
The power dissipated by the arduino = I * V = 0.02773 * 8 V = 0.22184 W
Total power dissipated = I * V = 0.10772 * 8V =0.86183 W.

How much current would the resistor draw at 9V ?
0.64 W/9 V = 0.0711 A.

How is this helpful ?
With such a setup, the uP can profile the battery by recording voltage values periodically, say, every 15 to 30 minutes. You can print these values to the serial port and record them using a Terminal capture program like Clear Term

Once you have the discharge curve for the battery profiled, you can use an array or some calculation to determine the % life left in the battery.

See attached.
Note that two factors are constants
A- The load resistance
B- Power dissipation.

The power dissipation is a function of the voltage and current but the current is a function of the resistance and voltage, so as you can see from the spreadsheet, as the voltage decreases, the current increases and the power dissipation remains the same because the resistance doesn't change. By collecting more data points using the method described, you can take a voltage measurement and calculate remaining battery life.
Arduino UNOs, Pro-Minis, ATMega328, ATtiny85, LCDs, MCP4162, keypads,<br />DS18B20s,74c922,nRF24L01, RS232, SD card, RC fixed wing, quadcopter

Go Up