How does it work?
PAC1954 Click as its foundation uses the PAC1954, a four-channel energy monitoring solution with bus voltage monitors and current sense amplifiers that feed high-resolution ADCs from Microchip Technology. Its real-time calibration minimizes offset and gain errors. Built-in 8x averaging feature makes low noise high-resolution measurement results. There are four current sense shunt resistors connected to PAC1954’s integrated current sense amplifier. Electricity is brought to shunts via screw terminals where the middle screw connector represents GND used for bus voltage monitoring. Bus voltage, sense resistor voltage, and accumulated proportional power are stored in registers for retrieval by the MCU.
One major feature of the PAC1954 design is a set of digital comparators that allows the user to detect over/under voltage, over/undercurrent, and overpower against user-programmed limits for each channel and generate an alert when the threshold is exceeded. Digital circuitry of the PAC1954 performs power calculations and energy accumulation, which enables energy monitoring with integration periods up to one year or longer. After the Start-Up sequence, the PAC1954 is in the Active state and begins sampling the inputs sequentially. Voltage and current are sampled for all active channels at 1024 samples/second by default, and power is calculated and accumulated.
PAC1954 Click communicates with MCU using the standard I2C 2-Wire interface to read data and configure settings, supporting Fast Mode operation with a clock frequency up to 1MHz. Besides, it also allows the choice of the least significant bit of its I2C slave address by positioning the SMD jumper labeled as ADDR SEL to an appropriate position marked as 0 and 1. The Power-Down pin, labeled as EN and routed to the CS pin of the mikroBUS™ socket, optimizes power consumption and is used for power on/off purposes. All circuits, including the interface pins, are inactive in this state, and the PAC1954 is in the form of minimum power dissipation.
The SLW pin, routed to the RST pin of the mikroBUS™ socket, serves as the conversion rate control. If the SLW pin is asserted, the sample rate is eight samples per second. For sampling rates lower than 1024 samples/second, the PAC1954 is in a Sleep mode for a portion of the conversion cycle, which results in lower power dissipation. No matter the programmed sample rate, this new sample rate will affect the following conversion cycle.
The alert functionality, routed to the INT pin of the mikroBUS™ socket, has multiple purposes; to notify the system that a conversion cycle for all active channels is complete, or to notify the system that the accumulator or accumulator count has overflowed, or that an electrical parameter is outside the programmed limit. Besides the INT pin, the SLW pin can function as another alert feature by attaching a pull-up resistor to it, which is done via onboard SMD jumper labeled as SLW PULL by positioning 10k resistor to an appropriate position marked as DOWN or UP.
This Click board™ can operate with both 3.3V and 5V logic voltage levels selected via the VCC SEL jumper. This way, it is allowed for both 3.3V and 5V capable MCUs to use the I2C communication lines properly. However, the 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.
Specifications
Type
Measurements
Applications
This Click board™ performs power calculations and energy accumulation, enabling energy monitoring with integration periods up to one year or longer.
On-board modules
PAC1954 – four-channel energy monitoring solution with bus voltage monitors and current sense amplifiers that feed high-resolution ADCs from Microchip Technology
Key Features
High-side current monitor, real-time auto-calibration of offset and gain errors for voltage and current, 1% power measurement accuracy over a wide dynamic range, alert feature, and more.
Interface
I2C
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
M (42.9 x 25.4 mm)
Input Voltage
3.3V or 5V
Pinout diagram
This table shows how the pinout on PAC1954 Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | – | Power LED Indicator |
JP1 | VCC SEL | Left | Logic Level Voltage Selection 3V3/5V: Left position 3V3, Right position 5V |
JP2 | ADDR SEL | Left | I2C Address Selection 0/1: Left position 0, Right position 1 |
JP3 | SLW SEL | Left | SLW pin ALERT Function Selection DOWN/UP: Left position DOWN, Right position UP |
PAC1954 Click electrical specifications
Description | Min | Typ | Max | Unit |
---|---|---|---|---|
Supply Voltage | 3.3 | – | 5 | V |
Analog Input Voltage Range | 0 | – | 32 | V |
ADC Data Resolution | – | – | 16 | bits |
Operating Temperature Range | -40 | +25 | +125 | °C |
Software Support
We provide a library for the PAC1954 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
This library offers a full control of the PAC1954 Click board™. The main functions are: modification of any configuration register; status, configuration and data registers reading; executing an all necessary conversions and calculations to get entire data in standard units. For more details, please, check the full documentation.
Key functions:
void pac1954_single_write( uint8_t reg_addr, uint8_t data_in );
– This function writes single data byte to the selected register.void pac1954_refresh_cmd( void );
– The readable registers for the VBUS, VSENSE, Power, accumulator outputs and accumulator count are updated by the REFRESH command and the values will be static until the next REFRESH command.float pac1954_get_calc_measurement( uint8_t meas_sel, uint8_t ch_sel, uint8_t avg_sel, uint8_t meas_mode );
– This function will call function for getting the selected measurement data and will perform all necessary calculations to get measurement value in standard unit.
Examples description
The application is composed of three sections :
- System Initialization – Performs the configuration for all necessary pins and peripherals.
- Application Initialization – Performs the driver initialization and executes a default configuration of the PAC1954 Click board™.
- Application Task – (code snippet) – First calls a REFRESH command to allow all measurement and config registers to be updated. After that reads the calculated measurement results of channel 1 and sends the results to the usb uart port every 1 second.
void application_task( ) { pac1954_refresh_cmd( ); vsource = pac1954_get_calc_measurement( PAC1954_MEAS_SEL_V_SOURCE, PAC1954_CH_SEL_CH_1, PAC1954_AVG_SEL_ENABLE, PAC1954_MEAS_MODE_BIPOLAR_FSR ); isense = pac1954_get_calc_measurement( PAC1954_MEAS_SEL_I_SENSE, PAC1954_CH_SEL_CH_1, PAC1954_AVG_SEL_ENABLE, PAC1954_MEAS_MODE_BIPOLAR_FSR ); power = pac1954_get_calc_measurement( PAC1954_MEAS_SEL_P_SENSE, PAC1954_CH_SEL_CH_1, PAC1954_NULL, PAC1954_MEAS_MODE_BIPOLAR_FSR ); FloatToStr( vsource, log_txt ); Ltrim( log_txt ); float_cut( ); mikrobus_logWrite( "V(source) is ", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_TEXT ); mikrobus_logWrite( " V", _LOG_LINE ); FloatToStr( isense, log_txt ); Ltrim( log_txt ); float_cut( ); mikrobus_logWrite( "I(sense) is ", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_TEXT ); mikrobus_logWrite( " A", _LOG_LINE ); FloatToStr( power, log_txt ); Ltrim( log_txt ); float_cut( ); mikrobus_logWrite( "P(sense) is ", _LOG_TEXT ); mikrobus_logWrite( log_txt, _LOG_TEXT ); mikrobus_logWrite( " W", _LOG_LINE ); mikrobus_logWrite( "", _LOG_LINE ); Delay_ms( 1000 ); }
Additional Functions :
float_cut
– Uses the converted string with the measurement result and cut it to be rounded on two decimal places.
The full application code, and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in the example:
- Conversions
- C_String
- I2C
- UART
Additional notes and informations
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.