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
PIC18F57Q43 Curiosity Nano evaluation kit is a cutting-edge hardware platform designed to evaluate microcontrollers within the PIC18-Q43 family. Central to its design is the inclusion of the powerful PIC18F57Q43 microcontroller (MCU), offering advanced functionalities and robust performance. Key features of this evaluation kit include a yellow user LED and a responsive
mechanical user switch, providing seamless interaction and testing. The provision for a 32.768kHz crystal footprint ensures precision timing capabilities. With an onboard debugger boasting a green power and status LED, programming and debugging become intuitive and efficient. Further enhancing its utility is the Virtual serial port (CDC) and a debug GPIO channel (DGI
GPIO), offering extensive connectivity options. Powered via USB, this kit boasts an adjustable target voltage feature facilitated by the MIC5353 LDO regulator, ensuring stable operation with an output voltage ranging from 1.8V to 5.1V, with a maximum output current of 500mA, subject to ambient temperature and voltage constraints.
Microcontroller Overview
MCU Card / MCU

Architecture
PIC
MCU Memory (KB)
128
Silicon Vendor
Microchip
Pin count
48
RAM (Bytes)
8196
You complete me!
Accessories
Curiosity Nano Base for Click boards is a versatile hardware extension platform created to streamline the integration between Curiosity Nano kits and extension boards, tailored explicitly for the mikroBUS™-standardized Click boards and Xplained Pro extension boards. This innovative base board (shield) offers seamless connectivity and expansion possibilities, simplifying experimentation and development. Key features include USB power compatibility from the Curiosity Nano kit, alongside an alternative external power input option for enhanced flexibility. The onboard Li-Ion/LiPo charger and management circuit ensure smooth operation for battery-powered applications, simplifying usage and management. Moreover, the base incorporates a fixed 3.3V PSU dedicated to target and mikroBUS™ power rails, alongside a fixed 5.0V boost converter catering to 5V power rails of mikroBUS™ sockets, providing stable power delivery for various connected devices.
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Click board™ Schematic

Step by step
Project assembly
Track your results in real time
Application Output
1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

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( 2000 );
}
void main ( void )
{
application_init( );
for ( ; ; )
{
application_task( );
}
}
// ------------------------------------------------------------------------ END