Thoughts, news and information about the world as seen through RV windows
RSS icon Home icon
  • Using the INA219 Voltage/Current Sensor

    Posted on February 20th, 2021 admin No comments

    For some time as a fun project I’ve been working on Debasish Dutta’s PWM Battery Charger which, using an Arduino microprocessor, turns on a load (garden lights, in my case) when it gets dark. He originally used ACS712 sensors to measure current in the charging and load sides of the circuit. So I ordered a couple, and followed some simple online tutorials to try them out. Not sure if I burned them out by following a bad tutorial or if I just got bad boards, but they didn’t perform as expected. When I hooked them up as shown in his circuit diagram, neither worked.

    Replacing the ACS712 with INA219

    INA219 Breakout board from Amazon.ca

    At any rate, in the comments on Dutta’s excellent Instructable, someone asked why he hadn’t used the INA219 sensor, which detects both voltage and current and uses the I2C protocol. This made sense, as the project also uses that protocol to communicate with a Liquid Crystal Display (LCD). So I ordered a batch to try them out.

    Just Show Me a Circuit Diagram, Please

    adafruit_products_2012_10_26_IMG_0725-1024.jpg

    When they came, I checked several online tutorials, but initially found them a bit confusing. Most of them are done by amateurs, hobbyists, who use photos of their hookup or brightly colored wiring diagrams made with Fritzing software. These are fine if you are exactly duplicating their project, but a bit difficult if you want to do something different. For that, a schematic diagram is most useful.

    Adafruit has a detailed explanation of the boards, but again uses Fritzing wiring diagrams and photos such as the one above right. While I can follow that tangle of wires to see what is hooked to what, it’s not as clear or simple as a schematic diagram. After studying a few tutorials online, I wound up summarizing them all in this rough sketch:

    Basic circuit diagram for INA219, showing exactly what is hooked to what

    Vsupply is in one part of Dutta’s circuit the solar panel, and in the other part of the circuit it is the storage battery. The first part measures current through the charger, the second current through the load.

    What, You Need Resistors?

    After I got one INA219 hooked up properly and working well, having adapted the Adafruit Arduino code to show the voltage and current on the LCD, I added a second INA219… which didn’t work. A little head scratching and research revealed that adding 1K8 pullup resistors on the data (SDA) and clock (SCL) lines — not mentioned in any of the INA219 tutorials I’d seen — might be helpful. I added them to my rough sketch.

    It was helpful, and now I have two different INA219 modules reporting voltage and current in two different parts of Dutta’s circuit to the LCD, just as required.

    Leave a reply

Supporting your fulltime RV adventures and aspirations