Example: INA226 Basic Setup

It is Not Obvious at First How a INA226 Chip Needs to be Hooked Up to Measure Current and Voltage. Here is an Example.

Quick overview

In this example, a typical breakout board with INA226 is connected to an ESP8266, and basic voltage and current measurements are performed.

This is a good example to test-drive your INA226 and get to know its functionality.

Parts List

For this project you need the following parts:

  • 1x ESP8266 microprocessor: I am using a Wemos D1 Mini in this example.
  • 1x INA226 breakout board: I am using a cheap board with mounted R100 Shunt

Preparing the INA226 Breakout Board

Choose which side of the breakout board should face up, then add header pins, and solder two wires to the large solder pads for IN+ and IN-.

Pins IN+ and IN- are connected in series with the load. Relatively high currents pass these pins.

That’s why most breakout boards expose these pins twice: as part of the header pins, and on the opposide side via two larger solder pads. It is recommended that you solder larger diameter wires to these solder pads.

Here is the circuit for this high side setup (measuring the current on the positive side of the load):

First place the components onto your bread board and wire them according to the schematics. Things to watch out for:

  • Do not forget to onnect pins IN- and VBS
  • Add a black wire to GND and leave the other end unconnected for now. You will need it for the terminal later.

Here is a close-up:

Adding a Terminal

Next, create a terminal to connect the load. Here is the schematic for the terminal part:

You can use a 4-pin terminal or just 4 individual clamps (like I did). You also need a short black wire. Here is how my terminal looks like:

And this is how to connect the wires:

  • Take the red wire coming from IN+ and one end of a new short black wire. Add a clamp on each of these two cables, and combine them with some scotch tape. Lebel them Power.
  • Take the black wire coming from IN+ and place a clamp on it. Then take the free end of the black wire that you just added, and combine it with the black wire coming from GND, then place one clamp on them both. Combine both clamps and label them Load.

Code

Next, build and upload the firmware to run the hardware:

  • PlatformIO: use the project in the subfolder platformio and load it in VSCode.
  • Arduino IDE: use the sketch in the subfolder arduino and load it into the Arduino IDE

Comments

Please do leave comments below. I am using utteran.ce, an open-source and ad-free light-weight commenting system.

Here is how your comments are stored

Whenever you leave a comment, a new github issue is created on your behalf.

  • All comments become trackable issues in the Github Issues section, and I (and you) can follow up on them.

  • There is no third-party provider, no disrupting ads, and everything remains transparent inside github.

Github Users Yes, Spammers No

To keep spammers out and comments attributable, all you do is log in using your (free) github account and grant utteranc.es the permission to submit issues on your behalf.

If you don’t have a github account yet, go get yourself one - it’s free and simple.

If for any reason you do not feel comfortable with letting the commenting system submit issues for you, then visit Github Issues directly, i.e. by clicking the red button Submit Issue at the bottom of each page, and submit your issue manually. You control everything.

Discussions

For chit-chat and quick questions, feel free to visit and participate in Discussions. They work much like classic forums or bulletin boards. Just keep in mind: your valued input isn’t equally well trackable there.

  Show on Github    Submit Issue

(content created Feb 27, 2024)