Carte à clic PWR Meter 2
Carte à clic PWR Meter 2
Le PWR Meter 2 Click Board™ est un Click Board™ de surveillance de puissance compact et précis, capable de mesurer et de surveiller une tension jusqu'à 24 V et un courant jusqu'à 5 A. Il est équipé du MCP3910, un dispositif frontal analogique intégré (AFE), qui se compose de deux convertisseurs A/N delta-sigma (ADC), de deux amplificateurs à gain programmable (PGA), d'une section de compensation de retard de phase, d'une section de référence de tension, de registres d'étalonnage d'erreur de décalage et de gain numériques et d'une interface SPI standard de l'industrie. Ce dispositif permet de construire un dispositif de surveillance de puissance avec un nombre raisonnablement faible d'éléments : une résistance de détection de courant connectée à un canal avec le diviseur de tension connecté au deuxième canal est tout ce qu'il faut pour effectuer une mesure de puissance précise.
The PWR Meter 2 Click Board™ comes with two screw terminals, allowing the external circuit to be easily connected. Besides measuring the properties of an externally connected circuit, the PWR Meter 2 Click Board™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 The PWR Meter 2 Click Board™ Work?
The PWR Meter 2 Click Board™ 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 PWR Meter 2 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, labelled 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 labelled as MDT0 and MDT1, respectively.
As already mentioned, the PWR Meter 2 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 labelled as the INPUT SEL should be switched to the desired position.
SPECIFICATIONS
Type | Measurements |
Applications | The PWR Meter 2 Click Board™ 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 |
Compatibility | mikroBUS |
Click board size | M (42.9 x 25.4 mm) |
Input Voltage | 3.3V |
PINOUT DIAGRAM
This table shows how the pinout of the PWR Meter 2 Click Board™ 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 the PWR Meter 2 Click Board™ 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:
- SPI
- UART
- Conversions
ADDITIONAL NOTES AND INFORMATION
Depending on the development board you are using, you may need a 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
The PWR Meter 2 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.
Software Support
We provide a demo application for the PWR Meter 2 Click Board™ 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:
- SPI
- UART
- Conversions
ADDITIONAL NOTES AND INFORMATION
Depending on the development board you are using, you may need a 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
The PWR Meter 2 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.
Carte à clic PWR Meter 2
Frequently Asked Questions
Have a Question?
Be the first to ask a question about this.