Current Sensor: INA209

Print Friendly, PDF & Email

In this post we show you how to use a XBee S2B ZB module with a current shunt monitor chip (INA209) from Texas Instruments.

The INA209 chip is a high-side current shunt and power monitor with an I2C interface. The INA209 monitors both shunt drop and shunt bus voltage. A programmable calibration value, combined with an internal multiplier, enables direct readouts in amperes.

We have to choose the current that we want to measure, in our case 2A, and apply this formula:

Rshunt = Vshunt / Max current.

Vshunt = 0,32V

Max current = 2 A

With this data we get a 0.16 Ω resistor.

To test the INA209 sample you need to install Codewarrior 10.2 (download from Digi), Programmable XBee SDK from (download from Digi) and this file. They are all Windows programs.

When you download the attached files you need to copy them into these paths:

current.png to: C:\Program Files\Digi\PXBee\v1.5\pxbee_api\1.5.2\.utils\xml_components\icons

i2c_current_sensor.xml to: C:\Program Files\Digi\PXBee\v1.5\pxbee_api\1.5.2\.utils\xml_components\common

Ina209.h to : C:\Program Files\Digi\PXBee\v1.5\pxbee_api\1.5.2\src\headers

Ina209.c to: C:\Program Files\Digi\PXBee\v1.5\pxbee_api\1.5.2\src\drivers\i2c

Hardware Settings

To test this example we are going to use the S2B isolation board to connect the INA209 Board.

IMGP1636 IMGP1639

Here the schematic for this board:



Here the final result, with all the items connected.



Now, we need to make a new project: New-> Xbee Application Project, then set the name and accept.

Now open config.xml, add the i2c current sensor, and disable the watchdog. The config.xml after these steps should look like this:



The final step is replace the main.c in the project, with the attached file.

You should see this output in the serial console.


It´s the same as power supply!


The API gives us some functions for controlling the basic functions of the current sensor

void ina209_default_config()
Initialize ina209 with default config
uint16_t read_act_current()
Return the actual current
uint16_t read_max_current()
Return the max value of the current since last reset
uint16_t reset_current_sensor()
Reset the sensor

Happy prototyping! Questions or comments? Let us know!

Comments are closed.