The Click board™ comes with two screw terminals, allowing the external circuit to be easily connected. Besides measuring the properties of an externally connected circuit, PWR Meter 2 click can be used to measure the power consumption of the Click board™ itself, when developing accurate power consumption monitoring applications. A shunt resistor of only 0.03 ? offers almost no interferences with the current passing through the load, making this Click board™ applicable in a wide range of monitoring projects, such as power metering in portable and automotive devices, embedded electronic applications, power monitoring for computer peripherals, and similar applications.
How does it work?
PWR Meter 2 click is equipped with the MCP3910, an integrated two-channel analog front-end (AFE) device from Microchip. This IC is composed of several sections, aimed at accurate capturing of the input voltage. Two sigma-delta input A/D converters used with the internal reference voltage of 1.2V with very low thermal drift, reducing the measurement noise at a minimum, yielding Signal to Noise ratio (SNR) up to 96dB. The input ADCs are fully configurable and can be set to work in 16-bit or 24-bit mode, can use oversampling ratio from 32 X up to 4096 X, gain ratio from 1 X to 32 X, and 24-bit digital offset and gain error correction for each ADC channel.
The Click board™ is clocked by a 20MHz crystal. However, it is up to the user to set the pre-scalers correctly, according to the datasheet of the MCP3910. However, the included library offers functions which take care about correct settings. High clock speed allows maximum oversampling rate (OSR) to be used, allowing the best performance to be achieved, but consuming more power at the same time.
The voltage and current readings are performed over two differential ADC input channels of the MCP3910 itself. The CH0 (Channel 0) is connected to a resistor voltage divider, allowing it to measure up to 0.6V when the input voltage is 24V, which is the maximum voltage at the input terminal. A simple voltage divider formula can be used to calculate the divider scaling:
VADC = VIN x R3 / (R2 + R3)
Although the voltage across a differential input on the ADC channel can go up to ±2V, it is recommended by the manufacturer to stay within the ±0.6V margin to achieve optimal harmonic distortion and noise ratios, which might affect the measurement accuracy.
The CH1 (Channel 1) differential input is connected to the shunt resistor of 0.03 ?. A small voltage drop is measured by the ADC, allowing up to 5A of current to be measured. More of 5A might destroy the shunt resistor so it is not recommended going over 5A. The current measurement is done by connecting the load in series with the Click board™, so the shunt value of 0.03? will not introduce significant error or influence the current through the load.
The measurement is performed using so-called Kelvin connections, where the main trace carries the majority of the current, while thin traces are used to measure the voltage across the shunt, reducing the current running through the ADC section of the IC itself. Additional 270 ? resistors reduce the current through the ADC even further.
The MCP3910 contains several additional pins, which are used to simplify the implementation and reduce the bulkiness of the firmware application.
The Data Ready pin can be used to trigger an interrupt event on the host MCU when there is conversion data ready to be read. This simplifies the MCU performance greatly, saving it from having to poll status bits in order to determine if the data is ready for reading. The Data Ready pin is routed to the mikroBUS™ INT pin, labeled as the DR.
Two Modulator Output pins are also routed to the mikroBUS™. These pins offer direct 1-bit data output directly from the delta-sigma modulators for a user-defined MCU or DSP filtering, overriding the internal SINC filter, which is turned off if these pins are activated. The DR pin is also disabled when these pins are enabled. MDAT0 and MDAT1 pins offer modulator output from ADC channel 0 and ADC channel 1. These pins are routed to mikroBUS™ pins PWM and AN and are labeled as MDT0 and MDT1, respectively.
As already mentioned, the Click board™ offers measurement of either internal power supply from the mikroBUS™, or the externally connected power source with up to 24V and 5A. To select the measurement target, the SMD jumper labeled as the INPUT SEL should be switched to the desired position.
Specifications
Type |
Measurements |
Applications |
PWR Meter 2 click can be used for digital power monitoring and power metering in portable and automotive devices, embedded electronic applications, power monitoring for computer peripherals, and similar applications. |
On-board modules |
MCP3910, an integrated two-channel analog front-end (AFE) device from Microchip. |
Key Features |
High resolution (16/24bit) dual sigma-delta A/D converter with differential inputs, on-chip dithering and anti-aliasing filtering, direct modulator outputs, 1X to 32X gain factor, oversampling ratio up to 4096X, digital error and offset calibration registers, low series resistance, and more |
Interface |
SPI |
Input Voltage |
3.3V |
Click board size |
M (42.9 x 25.4 mm) |
Pinout diagram
This table shows how the pinout on PWR Meter 2 click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Notes | Pin | | Pin | Notes |
---|
Modulator OUT 1 |
MD1 |
1 |
AN |
PWM |
16 |
MD0 |
Modulator OUT 0 |
Chip Reset |
RST |
2 |
RST |
INT |
15 |
DR |
Data Ready |
SPI Chip Select |
CS |
3 |
CS |
RX |
14 |
NC |
|
SPI Clock |
SCK |
4 |
SCK |
TX |
13 |
NC |
|
SPI Data OUT |
SDO |
5 |
MISO |
SCL |
12 |
NC |
|
SPI Data IN |
SDI |
6 |
MOSI |
SDA |
11 |
NC |
|
Power supply |
3.3V |
7 |
3.3V |
5V |
10 |
NC |
|
Ground |
GND |
8 |
GND |
GND |
9 |
GND |
Ground |
Onboard settings and indicators
Label | Name | Default | Description |
---|
LD1 |
PWR |
|
Power LED indicator |
JP1 |
INPUT SEL |
Right |
Monitoring input selection: left position external input, right position mikroBUS™ 3.3V power rail |
TB1 |
IN |
|
Input terminal for external power monitoring |
TB2 |
OUT |
|
Output terminal for external power monitoring |
Software support
We provide a demo application for Accel 5 Click on our Libstock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
The library can communicate with the device via SPI driver by writing in the registers and reading from the registers. Library offers a choice to measure output voltage and current, depending on the input voltage supply and can measure power by calculating this two data values. Library also can check the output state from modulator for both channels. The data resolution can be changed to 16, 24, and 32-bit. For more details check the documentation.
Key functions:
uint8_t pwrmeter2_writeReg( uint8_t register_address, uint32_t transfer_data )
- Function writes 24-bit data to the register.
uint8_t pwrmeter2_readReg( uint8_t register_address, uint32_t *dataOut, uint8_t nData )
- Function reads the desired number of 24-bit data from the register/registers.
uint8_t pwrmeter2_readConvData( uint32_t *dataCH0, uint32_t *dataCH1 )
- Function reads the converted data from both channels when conversion is finished.
void pwrmeter2_getData( int32_t *voltageData, int32_t *currentData, int32_t *powerData )
- Function gets the calculated voltage(mV), current(mA) and power(mW) data.
Example description
The application is composed of three sections :
System Initialization - Initializes peripherals and pins.
Application Initialization - Initializes SPI driver and performs the hardware reset of the device.
Also performs the device configuration and gain calibration for both channels, for the proper working.
Application Task - (code snippet) - Gets calculated voltage, current and power data every 500 milliseconds
and shows results on UART.
void applicationTask()
{
pwrmeter2_getData( &voltageRes, ¤tRes, &powerRes );
LongToStr( voltageRes, text );
mikrobus_logWrite( "U = ", _LOG_TEXT );
mikrobus_logWrite( text, _LOG_TEXT );
mikrobus_logWrite( " mV", _LOG_LINE );
LongToStr( currentRes, text );
mikrobus_logWrite( "I = ", _LOG_TEXT );
mikrobus_logWrite( text, _LOG_TEXT );
mikrobus_logWrite( " mA", _LOG_LINE );
LongToStr( powerRes, text );
mikrobus_logWrite( "P = ", _LOG_TEXT );
mikrobus_logWrite( text, _LOG_TEXT );
mikrobus_logWrite( " mW", _LOG_LINE );
mikrobus_logWrite( "", _LOG_LINE );
Delay_ms( 500 );
}
The full application code, and ready to use projects can be found on our Libstock page.
Other MikroElektronika libraries used in the example:
Additional notes and information
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. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.
mikroSDK
This click board is supported with mikroSDK - MikroElektronika 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.