IR Sense 5 Click
IR Sense 5 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.
Click Library
- Author : Nenad Filipovic
- Date : Feb 2024.
- Type : ADC/I2C type
Software Support
Example Description
This library contains API for the IR Sense 5 Click driver for measuring ambient and object temperature.
Example Libraries
- MikroSDK.Board
- MikroSDK.Log
- Click.IRSense5
Example Key Functions
- irsense5_cfg_setup Config Object Initialization function.
void irsense5_cfg_setup(irsense5_cfg_t *cfg)
IR Sense 5 configuration object setup function.
IR Sense 5 Click configuration object.
Definition irsense5.h:146
- irsense5_init Initialization function.
err_t irsense5_init(irsense5_t *ctx, irsense5_cfg_t *cfg)
IR Sense 5 initialization function.
IR Sense 5 Click context object.
Definition irsense5.h:131
- irsense5_get_obj_temp This function reads and calculate object temperature in degree Celsius [degC].
err_t irsense5_get_obj_temp(irsense5_t *ctx, float *obj_temp)
IR Sense 5 get object temperature function.
- irsense5_get_amb_temp This function reads and calculate ambient temperature in degree Celsius [degC].
err_t irsense5_get_amb_temp(irsense5_t *ctx, float *amb_temp)
IR Sense 5 get ambient temperature function.
- irsense5_read_raw_adc_thm This function reads the thermistor raw ADC value.
err_t irsense5_read_raw_adc_thm(irsense5_t *ctx, uint16_t *raw_adc)
IR Sense 5 read thermistor raw ADC value function.
Application Init
The initialization of the I2C and ADC module and log UART.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
if ( ( ADC_ERROR == init_flag ) || ( I2C_MASTER_ERROR == init_flag ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
#define IRSENSE5_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition irsense5.h:118
void application_init(void)
Definition main.c:29
Application Task
The demo application measures ambient and object temperature in degrees Celsius. Results are being sent to the UART Terminal, where you can track their changes.
{
float temperature = 0;
{
log_printf( &logger, " Ambient Temperature: %.2f [degC]\r\n", temperature );
Delay_ms ( 1000 );
}
{
log_printf( &logger, " Object Temperature: %.2f [degC]\r\n\n", temperature );
Delay_ms ( 1000 );
}
}
@ IRSENSE5_OK
Definition irsense5.h:165
void application_task(void)
Definition main.c:60
Application Output
This Click board can be interfaced and monitored in two ways:
- Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
- UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Additional Notes and Information
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.