Beginner
10 min

Monitor multiple voltage levels with high accuracy using the TPS389006 and PIC32MZ2048EFM100

Six-channel window voltage supervisor

HW Monitor 3 Click with Curiosity PIC32 MZ EF

Published Dec 04, 2024

Click board™

HW Monitor 3 Click

Dev Board

Curiosity PIC32 MZ EF

Compiler

NECTO Studio

MCU

PIC32MZ2048EFM100

Voltage monitoring with SIL-3 safety compliance perfect for medical devices, industrial robotics, and motor drivers

A

A

Hardware Overview

How does it work?

HW Monitor 3 Click is based on the TPS389006, a six-channel window voltage supervisor and monitor IC from Texas Instruments. This I2C-programmable device is engineered to provide precision voltage monitoring for systems operating on low-voltage supply rails with tight tolerance margins. The IC's thresholds for overvoltage and undervoltage conditions are internally set using precision resistors, providing ±6mV accuracy across a wide temperature range (-40°C to +125°C). It supports voltage levels with fixed window thresholds in fine steps, offering 5mV granularity for inputs between 0.2V and 1.475V or 20mV steps for higher ranges from 0.8V to 5.5V. The device also incorporates a 2.48V undervoltage lockout (UVLO) feature, ensuring stable operation in critical conditions. With compliance with SIL-3 safety standards, this board is tailored for applications requiring the highest reliability and safety, such as medical devices, industrial robotics, server switches, and motor drivers. The TPS389006 offers exceptional performance with integrated features for robust error detection and monitoring. It includes two remote sense pins for voltage measurement at

high-current core rails, compensating for voltage drops across PCB traces. This ensures highly accurate monitoring, making it ideal for systems demanding precise power management. The built-in CRC error checking and sequence logging capabilities track system states during power-up and power-down events, while an integrated ADC provides real-time voltage readouts for additional redundancy in error checking. HW Monitor 3 Click uses a standard 2-wire I2C communication protocol to enable the host MCU to control the TPS389006. The I2C interface supports clock frequencies up to 1MHz, with the I2C address selectable via the ADDR SEL jumper. The I2C interface gives flexibility in selecting thresholds, reset delays, glitch filters, and pin functionality. The internal glitch immunity and noise filters eliminate the need for external RC components to reduce false resets resulting from power transients. In addition to the interface pins, this board uses several pins from the mikroBUS™ socket to enhance its functionality. The EN pin serves as a device-enable signal, allowing activation of the TPS389006 when needed. The INT pin is an active-low open-drain

interrupt output, which asserts a signal whenever the monitored voltage moves outside the predefined safe window, providing real-time alerts for critical voltage deviations. Additionally, the SLP pin enables a low-power sleep mode through an active-low signal, optimizing power efficiency when the device is not actively monitoring. In addition, the TPS389006 offers a sync feature via the SYN pin of the mikroBUS™ socket (sequence logging synchronization across multiple devices) for tagging rails as they come up. When either the EN or SLP pin transitions from low to high or high to low, the sequence logging function becomes active until the sequence timeout expires. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VCC SEL jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. 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.

HW Monitor 3 Click hardware overview image

Features overview

Development board

Curiosity PIC32 MZ EF development board is a fully integrated 32-bit development platform featuring the high-performance PIC32MZ EF Series (PIC32MZ2048EFM) that has a 2MB Flash, 512KB RAM, integrated FPU, Crypto accelerator, and excellent connectivity options. It includes an integrated programmer and debugger, requiring no additional hardware. Users can expand

functionality through MIKROE mikroBUS™ Click™ adapter boards, add Ethernet connectivity with the Microchip PHY daughter board, add WiFi connectivity capability using the Microchip expansions boards, and add audio input and output capability with Microchip audio daughter boards. These boards are fully integrated into PIC32’s powerful software framework, MPLAB Harmony,

which provides a flexible and modular interface to application development a rich set of inter-operable software stacks (TCP-IP, USB), and easy-to-use features. The Curiosity PIC32 MZ EF development board offers expansion capabilities making it an excellent choice for a rapid prototyping board in Connectivity, IOT, and general-purpose applications.

Curiosity PIC32MZ EF double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

PIC32

MCU Memory (KB)

2048

Silicon Vendor

Microchip

Pin count

100

RAM (Bytes)

524288

Used MCU Pins

mikroBUS™ mapper

Sequence Logging Synchronization
RPB4
AN
Device Enable
RA9
RST
ID COMM
RPD4
CS
NC
NC
SCK
NC
NC
MISO
NC
NC
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
Sleep Mode Control
RPE8
PWM
Interrupt
RF13
INT
NC
NC
TX
NC
NC
RX
I2C Clock
RPA14
SCL
I2C Data
RPA15
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

HW Monitor 3 Click Schematic schematic

Step by step

Project assembly

Curiosity PIC32MZ EF front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Curiosity PIC32 MZ EF as your development board.

Curiosity PIC32MZ EF front image hardware assembly
GNSS2 Click front image hardware assembly
Prog-cut hardware assembly
GNSS2 Click complete accessories setup image hardware assembly
Curiosity PIC32 MZ EF MB 1 Access - upright/background hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
Curiosity PIC32 MZ EF MCU Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.

Software Support

Library Description

This library contains API for HW Monitor 3 Click driver.

Key functions:

  • hwmonitor3_enable_channel - This function enables the selected monitoring channels.

  • hwmonitor3_set_scaling - This function sets the scaling level for the selected monitoring channels.

  • hwmonitor3_read_voltage - This function reads the voltage level from all 6 monitoring analog input channels.

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 main.c
 * @brief HW Monitor 3 Click example
 *
 * # Description
 * This example demonstrates the use of HW Monitor 3 click board by reading and
 * displaying the voltage level from 6 analog input channels.
 *
 * The demo application is composed of two sections :
 *
 * ## Application Init
 * Initializes the driver and performs the click default configuration.
 *
 * ## Application Task
 * Reads the voltage level from all 6 analog input channels and displays
 * the results on the USB UART once per second approximately.
 *
 * @author Stefan Filipovic
 *
 */

#include "board.h"
#include "log.h"
#include "hwmonitor3.h"

static hwmonitor3_t hwmonitor3;
static log_t logger;

void application_init ( void ) 
{
    log_cfg_t log_cfg;  /**< Logger config object. */
    hwmonitor3_cfg_t hwmonitor3_cfg;  /**< Click config object. */

    /** 
     * 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.
    hwmonitor3_cfg_setup( &hwmonitor3_cfg );
    HWMONITOR3_MAP_MIKROBUS( hwmonitor3_cfg, MIKROBUS_1 );
    if ( I2C_MASTER_ERROR == hwmonitor3_init( &hwmonitor3, &hwmonitor3_cfg ) ) 
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }
    
    if ( HWMONITOR3_ERROR == hwmonitor3_default_cfg ( &hwmonitor3 ) )
    {
        log_error( &logger, " Default configuration." );
        for ( ; ; );
    }
    
    log_info( &logger, " Application Task " );
}

void application_task ( void ) 
{
    hwmonitor3_ch_mon_t ch_mon;
    if ( HWMONITOR3_OK == hwmonitor3_read_voltage ( &hwmonitor3, &ch_mon ) )
    {
        log_printf ( &logger, " CH1: %.3f V\r\n", ch_mon.ch1_v );
        log_printf ( &logger, " CH2: %.3f V\r\n", ch_mon.ch2_v );
        log_printf ( &logger, " CH3: %.3f V\r\n", ch_mon.ch3_v );
        log_printf ( &logger, " CH4: %.3f V\r\n", ch_mon.ch4_v );
        log_printf ( &logger, " CH5: %.3f V\r\n", ch_mon.ch5_v );
        log_printf ( &logger, " CH6: %.3f V\r\n\n", ch_mon.ch6_v );
    }
    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

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.