Current Sens 2 click
Current Sens 2 Click is a compact add-on board designed for precise current measurements in industrial applications. This board features the HO 10-P, an AC/DC current transducer from LEM USA.
click Product page
Click library
- Author : Stefan Ilic
- Date : Nov 2023.
- Type : ADC type
Software Support
We provide a library for the Current Sens 2 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Library Description
This library contains API for Current Sens 2 Click driver.
Standard key functions :
currentsens2_cfg_setup
Config Object Initialization function.
void currentsens2_cfg_setup(currentsens2_cfg_t *cfg)
Current Sens 2 configuration object setup function.
Current Sens 2 Click configuration object.
Definition currentsens2.h:122
currentsens2_init
Initialization function.
err_t currentsens2_init(currentsens2_t *ctx, currentsens2_cfg_t *cfg)
Current Sens 2 initialization function.
Current Sens 2 Click context object.
Definition currentsens2.h:107
Example key functions :
currentsens2_get_int_pin
Current Sens 2 get int pin state function.
uint8_t currentsens2_get_int_pin(currentsens2_t *ctx)
Current Sens 2 get int pin state function.
currentsens2_tare
Current Sens 2 tare function.
err_t currentsens2_tare(currentsens2_t *ctx)
Current Sens 2 tare function.
currentsens2_get_current
Current Sens 2 read current function.
err_t currentsens2_get_current(currentsens2_t *ctx, float *current)
Current Sens 2 read current function.
Example Description
This example demonstrates the use of Current Sens 2 click board by reading and displaying the input current measurements.
The demo application is composed of two sections :
Application Init
Initializes the driver and logger.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_printf( &logger, " Remove Click from the electrical circuit \r\n" );
Delay_ms ( 1000 );
{
log_error( &logger, " Click tare error." );
for ( ; ; );
}
log_printf( &logger, " Connect Click to the electrical circuit \r\n" );
log_info( &logger, " Application Task " );
}
@ CURRENTSENS2_ERROR
Definition currentsens2.h:138
#define CURRENTSENS2_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition currentsens2.h:95
#define CURRENTSENS2_NUM_OF_PASSES_1
Definition currentsens2.h:75
void currentsens2_set_prim_turn_no(currentsens2_t *ctx, uint8_t turns)
Current Sens 2 set number of primary coil turns function.
void application_init(void)
Definition main.c:29
Application Task
Reads the input current measurements and displays the results on the USB UART approximately once per second.
{
float current = 0;
{
log_printf( &logger, " Current : %.2f[A]\r\n\n", current );
Delay_ms ( 1000 );
}
}
@ CURRENTSENS2_OK
Definition currentsens2.h:137
void application_task(void)
Definition main.c:70
The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.
Other Mikroe Libraries used in the example:
- MikroSDK.Board
- MikroSDK.Log
- Click.CurrentSens2
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. UART terminal is available in all MikroElektronika compilers.