Continuously monitor voltage, current, and power levels to ensure safe and efficient operation of electrical systems
A
A
Hardware Overview
How does it work?
VCP Monitor 2 Click is based on the INA3221, a three-channel, high-side current and bus voltage monitor with alert indication function ensuring the intended application works within desired operating conditions fromTexas Instruments. It performs two measurements on up to three power supplies of interest (CH3 - CH1). The voltage developed from the load current passing through a shunt resistor creates a shunt voltage that is measured between the IN+ and IN- pins. The device also internally measures the power supply bus voltage at the IN- pin for each channel. The differential shunt voltage is measured with respect to the IN- pin, and the bus voltage is measured with respect to ground. The featured chip which is used for channel measurements, INA3221-Q1, is typically powered by a separate power supply that ranges from 2.7V to 5.5V. The monitored supply buses range from 0V to 26V. The INA3221-Q1 takes two measurements for each channel: one for shunt voltage and one for the bus voltage. Each measurement can be independently or sequentially measured, based on the Configuration mode settings. When the INA3221-Q1 is in the normal operating mode the device continuously converts a shunt-voltage reading followed by a bus-voltage reading. This procedure converts one channel, and then continues to the shunt voltage reading of the next enabled channel, followed by the bus-voltage reading for that channel, and so on, until all enabled channels have been measured. The programmed Configuration register mode setting applies to all channels. Any channels that are not enabled are
bypassed in the measurement sequence, regardless of mode setting. The INA3221-Q1 has two operating modes, continuous and single-shot, that determine the internal ADC operation after these conversions complete. When the INA3221-Q1 is set to continuous mode, the device continues to cycle through all enabled channels until a new configuration setting is programmed. The Configuration register MODE control bits also enable modes to be selected that convert only the shunt or bus voltage. This feature further allows the device to fit specific application requirements. In single-shot (triggered) mode, setting any single-shot convert mode to the Configuration register triggers a single-shot conversion. This action produces a single set of measurements for all enabled channels. To trigger another single-shot conversion, write to the Configuration register a second time, even if the mode does not change. When a single-shot conversion is initiated, all enabled channels are measured one time and then the device enters a power-down state. The INA3221-Q1 registers can be read at any time, even while in power-down. In addition to the two operating modes, the INA3221-Q1 also has a separate selectable power-down mode that reduces the quiescent current and turns off current into the INA3221-Q1 inputs. Power-down mode reduces the impact of the supply drain when the device is not used. Full recovery from power-down mode requires 40 µs. The INA3221-Q1 registers can be written to and read from while the device is in power-down mode. The device remains in power-down mode until one of the
active MODE settings are written to the Configuration register. VCP Monitor 2 Click also provides programmable thresholds that make sure the intended application operates within the desired operating conditions. Multiple monitoring functions are available using four alert pins: Critical, Warning, PV (power valid), and TC (timing control). The status of these alert pins are accessible over PCA9538A, a low-voltage 8-bit GPIO expander with interrupt and reset. The open-drain interrupt (INT) output is activated when any of the alert pins state has changed. This signal is used to inform the microcontroller that the bus voltage is not within the desired operating conditions. The PCA9538A uses the I2C communication protocol to read the current states of the alert monitoring pins with the changeable slave address to avoid bus conflict in advanced systems. For the visual representation of any deviation from programmed thresholds, alert monitoring pins are connected to 4 LEDs located on Click board™. The VCP Monitor 2 Click supports the I2C communication protocol. Since there are two slave devices on the Click board™, the solderable SMD jumpers are conveniently placed for easy I2C slave address reconfiguration. The INA3221-Q1 has one cross-shaped jumper selection for one address pin with four possible addresses with connections to GND, VCC, SDA or SCL. The other one, PCA9538A, has two jumpers for address pins A1 and A0 with the possibility of four different slave addresses, making this Click board™ flexible for implementation in other systems with various peripherals sharing the same bus.
Features overview
Development board
Arduino UNO is a versatile microcontroller board built around the ATmega328P chip. It offers extensive connectivity options for various projects, featuring 14 digital input/output pins, six of which are PWM-capable, along with six analog inputs. Its core components include a 16MHz ceramic resonator, a USB connection, a power jack, an
ICSP header, and a reset button, providing everything necessary to power and program the board. The Uno is ready to go, whether connected to a computer via USB or powered by an AC-to-DC adapter or battery. As the first USB Arduino board, it serves as the benchmark for the Arduino platform, with "Uno" symbolizing its status as the
first in a series. This name choice, meaning "one" in Italian, commemorates the launch of Arduino Software (IDE) 1.0. Initially introduced alongside version 1.0 of the Arduino Software (IDE), the Uno has since become the foundational model for subsequent Arduino releases, embodying the platform's evolution.
Microcontroller Overview
MCU Card / MCU

Architecture
AVR
MCU Memory (KB)
32
Silicon Vendor
Microchip
Pin count
28
RAM (Bytes)
2048
You complete me!
Accessories
Click Shield for Arduino UNO has two proprietary mikroBUS™ sockets, allowing all the Click board™ devices to be interfaced with the Arduino UNO board without effort. The Arduino Uno, a microcontroller board based on the ATmega328P, provides an affordable and flexible way for users to try out new concepts and build prototypes with the ATmega328P microcontroller from various combinations of performance, power consumption, and features. The Arduino Uno has 14 digital input/output pins (of which six can be used as PWM outputs), six analog inputs, a 16 MHz ceramic resonator (CSTCE16M0V53-R0), a USB connection, a power jack, an ICSP header, and reset button. Most of the ATmega328P microcontroller pins are brought to the IO pins on the left and right edge of the board, which are then connected to two existing mikroBUS™ sockets. This Click Shield also has several switches that perform functions such as selecting the logic levels of analog signals on mikroBUS™ sockets and selecting logic voltage levels of the mikroBUS™ sockets themselves. Besides, the user is offered the possibility of using any Click board™ with the help of existing bidirectional level-shifting voltage translators, regardless of whether the Click board™ operates at a 3.3V or 5V logic voltage level. Once you connect the Arduino UNO board with our Click Shield for Arduino UNO, you can access hundreds of Click boards™, working with 3.3V or 5V logic voltage levels.
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic

Step by step
Project assembly
Software Support
Library Description
This library contains API for VCP Monitor 2 Click driver.
Key functions:
vcpmonitor2_get_manifacture_id- Get Manufacture IDvcpmonitor2_get_die_id- Get DIE IDvcpmonitor2_get_bus_voltage- Get BUS voltage in mV.
Open Source
Code example
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.
/*!
* \file
* \brief Vcpmonitor2 Click example
*
* # Description
* VCP Monitor 2 Click is a three-channel, high-side current and bus voltage monitor with alert indication
* function ensuring the intended application works within desired operating conditions.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initiaizes the driver, and checks the communication by reading the manufacture device ID.
* After that, performs the device default configuration.
*
* ## Application Task
* Displays the voltage, current, and power detected from channel 1 on the USB UART every 2 seconds.
* It also displays the status of alert indicators.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "vcpmonitor2.h"
// ------------------------------------------------------------------ VARIABLES
static vcpmonitor2_t vcpmonitor2;
static log_t logger;
static uint16_t check_id;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void display_alert_status ( )
{
uint8_t status;
status = vcpmonitor2_get_alert_status( &vcpmonitor2 );
if ( ( status & VCPMONITOR2_ALERT_PVALID ) != 0 )
{
log_printf( &logger, ">> Alert status: [ PVALID ]\r\n" );
}
if ( ( status & VCPMONITOR2_ALERT_WRNG ) != 0 )
{
log_printf( &logger, ">> Alert status: [ WRNG ]\r\n" );
}
if ( ( status & VCPMONITOR2_ALERT_CRTCL ) != 0 )
{
log_printf( &logger, ">> Alert status: [ CRTCL ]\r\n" );
}
if ( ( status & VCPMONITOR2_ALERT_TCTRL ) != 0 )
{
log_printf( &logger, ">> Alert status: [ TCTRL ]\r\n" );
}
}
void display_channel_data ( uint8_t channel )
{
float shunt_volt;
float bus_volt;
float current;
float power;
shunt_volt = vcpmonitor2_get_shunt_voltage( &vcpmonitor2, channel );
log_printf( &logger, ">> Shunt voltage: %.2f mV\r\n", shunt_volt );
bus_volt = vcpmonitor2_get_bus_voltage( &vcpmonitor2, channel );
log_printf( &logger, ">> BUS voltage: %.2f mV\r\n", bus_volt );
current = vcpmonitor2_get_current( &vcpmonitor2, channel );
log_printf( &logger, ">> Current: %.2f mV\r\n", current );
power = vcpmonitor2_get_power( &vcpmonitor2, channel );
log_printf( &logger, ">> Power: %.2f mV\r\n", power );
}
void application_init ( void )
{
log_cfg_t log_cfg;
vcpmonitor2_cfg_t cfg;
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
vcpmonitor2_cfg_setup( &cfg );
VCPMONITOR2_MAP_MIKROBUS( cfg, MIKROBUS_1 );
vcpmonitor2_init( &vcpmonitor2, &cfg );
check_id = vcpmonitor2_get_manifacture_id( &vcpmonitor2 );
if ( check_id == VCPMONITOR2_DEF_MANUFACTURE_ID )
{
log_printf( &logger, ">> Manufacture ID: 0x%.4X\r\n", check_id );
}
else
{
log_error( &logger, " WRONG ID READ! " );
log_printf( &logger, "Please restart your system.\r\n" );
for ( ; ; );
}
vcpmonitor2_default_cfg( &vcpmonitor2 );
}
void application_task ( void )
{
log_printf( &logger, ">> CHANNEL 1 <<\r\n" );
display_channel_data( VCPMONITOR2_CHANNEL_1 );
display_alert_status( );
log_printf( &logger, "--------------------------\r\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END
Additional Support
Resources
Category:Measurements



































