How does it work?
Power Monitor 2 Click is based on two INA219s, a 12-bit I2C-output digital power monitor from Texas Instruments for precise power monitoring. These ICs are specifically designed to monitor the power consumption of connected load devices by measuring the current and voltage on two separate power rails – 3.3V and 5V – of an additional mikroBUS™ socket. This configuration allows for monitoring these two power lines, ideal for evaluating the power usage of any Click board™ inserted into the onboard mikroBUS™ socket. Thanks to its flexibility, the INA219 allows power monitoring without any special power-supply sequencing, making it capable of monitoring power even when the supply or bus voltage is independently present or absent.
The INA219s provide real-time digital readings of current, voltage, and power. It achieves this by sensing the voltage drop across shunt resistors (R3 and R4) connected to the bus of interest, and it can handle bus voltages ranging from 0 to 26V. The device’s programmable conversion times and filtering options ensure accurate measurements under various operating conditions. Additionally, the INA219 offers a programmable calibration value that, when combined with an internal multiplier, enables direct readouts of current in amperes and calculates power in watts through a multiplying register.
As mentioned, the INA219 communicates with the host MCU using a standard 2-wire I2C interface, supporting High-Speed mode with clock frequencies up to 1MHz. Each INA219 IC on the Power Monitoring 2 Click has a configurable I2C address, which can be set using the ADDR SEL jumpers. These jumpers (U2 or U3, corresponding to each INA219) allow the selection of the desired I2C address by positioning them to either 0 or 1. Additionally, considering that this Click board™ can operate with both 3.3V and 5V logic levels, the voltage to which the pull-up resistors for the I2C lines are connected can also be selected. This is achieved using the I2C PULL-UP jumpers, where the appropriate voltage level (3.3V or 5V) is selected by adjusting the jumpers accordingly.
This board also features an onboard switch labeled CS SEL, which enables the CS line from the mikroBUS™ socket to communicate with the ClickID feature on the board. The CS line is redirected by setting the switch to the ON position, allowing the ClickID feature to function properly for identifying the connected Click board™.
This Click board™ can operate with either 3.3V or 5V logic voltage levels. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. As an added feature, it includes two green LED indicators that show which power rail is active, either 3.3V or 5V. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.
Specifications
Type
Current sensor
Applications
Ideal for applications in power management, system diagnostics, and energy optimization in embedded systems
On-board modules
INA219 – 12-bit I2C-output digital power monitor from Texas Instruments
Key Features
Current/Voltage/Power monitoring, I2C interface with configurable addresses, 3.3V/5V logic level compatibility, real-time power data, high accuracy, filtering options, calibration registers, and more
Interface
I2C
Feature
ClickID
Compatibility
mikroBUS™
Click board size
L (57.15 x 25.4 mm)
Input Voltage
3.3V,5V
Pinout diagram
This table shows how the pinout on Power Monitor 2 Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | 3V3 | – | Active 3.3V mikroBUS™ Rail LED Indicator |
LD2 | 5V | – | Active 5V mikroBUS™ Rail LED Indicator |
JP1-JP2 | ADDR SEL | Right | I2C Address Selection 0/1: Left position 0, Right position 1 |
JP3-JP4 | I2C PULL UP | Left | I2C Pull-Ups Configuration Selection 3V3/5V: Left position 3V3, Right position 5V |
SW1 | CS SEL | Left | ClickID Selection Switch |
Power Monitor 2 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | 3.3 | – | 5 | V |
Software Support
We provide a library for the Power Monitor 2 Click as well as a demo application (example), developed using MIKROE compilers. The demo can run on all the main MIKROE development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager (recommended), downloaded from our LibStock™ or found on MIKROE github account.
Library Description
This library contains API for Power Monitor 2 Click driver.
Key functions
-
powermonitor2_set_address
This function sets the device slave address. -
powermonitor2_read_data
This function reads the shunt voltage, bus voltage, current, and power data measurements. -
powermonitor2_read_data_avg
This function reads the shunt voltage, bus voltage, current, and power data measurements averaged from num_conv samples.
Example Description
This example demonstrates the use of Power Monitor 2 Click by reading and displaying the power consumption at 3V3 and 5V of the connected click board.
void application_task ( void )
{
powermonitor2_data_t pm_3v3, pm_5v;
powermonitor2_set_address ( &powermonitor2, powermonitor2.address_3v3 );
if ( POWERMONITOR2_OK == powermonitor2_read_data_avg ( &powermonitor2, POWERMONITOR2_DEFAULT_NUM_CONV, &pm_3v3 ) )
{
log_printf( &logger, " --- 3V3 Power Monitor ---rn" );
log_printf( &logger, " Voltage: %.3f Vrn", pm_3v3.bus_v );
log_printf( &logger, " Current: %.3f Arn", pm_3v3.current );
log_printf( &logger, " Power: %.2f Wrn", pm_3v3.power );
log_printf( &logger, " -------------------------rn" );
}
powermonitor2_set_address ( &powermonitor2, powermonitor2.address_5v );
if ( POWERMONITOR2_OK == powermonitor2_read_data_avg ( &powermonitor2, POWERMONITOR2_DEFAULT_NUM_CONV, &pm_5v ) )
{
log_printf( &logger, " ---- 5V Power Monitor ---rn" );
log_printf( &logger, " Voltage: %.3f Vrn", pm_5v.bus_v );
log_printf( &logger, " Current: %.3f Arn", pm_5v.current );
log_printf( &logger, " Power: %.2f Wrn", pm_5v.power );
log_printf( &logger, " -------------------------rn" );
}
Delay_ms ( 1000 );
}
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager (recommended), downloaded from our LibStock™ or found on MIKROE github account.
Other MIKROE Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.PowerMonitor2
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 Click or RS232 Click to connect to your PC, for development systems with no UART to USB interface available on the board. UART terminal is available in all MIKROE compilers.
mikroSDK
This Click board™ is supported with mikroSDK – MIKROE Software Development Kit. To ensure proper operation of mikroSDK compliant Click board™ demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
For more information about mikroSDK, visit the official page.