Sunday, April 13, 2014

Voltage and Current measurements with the INA219 Sensor

Now that the Distributed Power Node (DPN) project is progressing on the software side I thought I better look into how the power management sensor will work for measuring the health of the battery. I got one of the Adafruit INA219 break-out boards back in December and had not had a chance to try it yet.

I wired it up exactly like the guide on Adafruit site and it worked with the library and sample code fine. I modified the code to sample every minute instead of every 2 seconds and wrote the output to the serial monitor in CSV format so I could cut and paste it into a text file for use with Excel. I connected a 12 volt 8.5 Ah SLA battery to a 400 watt power inverter running a 15 watt CFL and monitored the voltage and current for 2 hours or 120 samples. This is the results as plotted by Excel.


I was not happy with the current measurement since they varied by 500 ma from sample to sample. The voltage was not as bad. I was going to do some sample averaging in code and then thought that perhaps the power inverter is a "noisy" load and was causing the up and down readings. I decided to re-test with a static load of just a power resistor. I had just connected the power resistor load and had a couple of samples on the screen that seems much more stable and I reach over to check the heating on the load resistor and accidentally shorted the battery at the load. I notice the readings were way off now but it was still running so I powered it all down and checked everything. There was a slight smell of burnt resistor in the air so I checked the shunt resistor on the INA219 and it was open. The strange thing though was that the bus voltage was reading 32 volts constantly now. I could see the current reading being wrong since the shunt was open but the bus voltage is not dependent on the shunt. I made a temporary shunt with wire just to test it again and the current reading was still bad along with the bad voltage measurement. I think the large transient must have destroyed the op amp circuits on the chip but the I2C interface components survived because the Arduino can still talk to the board. This sensor design does provide good isolation from the MCU so I think the moral of the story is that if the battery would have been fused, it may have survived. I will need to study protection methods for the DC outputs anyway so this was a $9.95 plus shipping lesson!




No comments:

Post a Comment