hallcurrent2 2.0.0.0
Main Page

Hall Current 2 click

Hall current 2 click is a very accurate current measurement Click boardâ„¢, which relies on the Hall effect.

click Product page


Click library

  • Author : MikroE Team
  • Date : Dec 2019.
  • Type : I2C type

Software Support

We provide a library for the HallCurrent2 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 form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.

Library Description

‍This library contains API for HallCurrent2 Click driver.

Standard key functions :

Example key functions :

‍This application very accurately measures current using Hall effect.

The demo application is composed of two sections :

Application Init

‍Initializes Driver init and reset chip

void application_init ( void )
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
HALLCURRENT2_MAP_MIKROBUS( cfg, MIKROBUS_1 );
hallcurrent2_init( &hallcurrent2, &cfg );
hallcurrent2_reset( &hallcurrent2 );
}
void hallcurrent2_reset(hallcurrent2_t *ctx)
Functions for reset chip.
#define HALLCURRENT2_MAP_MIKROBUS(cfg, mikrobus)
Definition hallcurrent2.h:66
HALLCURRENT2_RETVAL hallcurrent2_init(hallcurrent2_t *ctx, hallcurrent2_cfg_t *cfg)
Initialization function.
void hallcurrent2_cfg_setup(hallcurrent2_cfg_t *cfg)
Config Object Initialization function.
void application_init(void)
Definition main.c:32
Click configuration structure definition.
Definition hallcurrent2.h:117

Application Task

‍Reads current and logs on usbuart every 1 second.

void application_task ( void )
{
int16_t current_data;
current_data = hallcurrent2_get_current( &hallcurrent2 );
log_printf( &logger, "--- Current : %d mA\r\n", current_data );
Delay_ms ( 1000 );
}
int16_t hallcurrent2_get_current(hallcurrent2_t *ctx)
Reads current in mV.
void application_task(void)
Definition main.c:59

The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.HallCurrent2

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.