We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2024-10-31
Package Version: 2.1.0.2
mikroSDK Library: 2.0.0.0
Category: Motion
Downloaded: 25 times
Not followed.
License: MIT license
PIR 3 Click is a compact add-on board designed for efficient and reliable motion detection in various applications. This board features the ZDP323B1 sensor from Zilog (Littelfuse), with high EMI immunity and precise motion detection capabilities. It includes a spectral filter window tuned to an 8-13um wavelength, dual sensing elements with a 0.6mm spacing, and a field of view of 148° on the X-axis and 136° on the Y-axis. The board also integrates the ZNCL10S PIR lens for maximum IR transmissivity and includes the Click Snap feature for flexible implementation.
Do you want to subscribe in order to receive notifications regarding "PIR 3 Click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "PIR 3 Click" changes.
Do you want to report abuse regarding "PIR 3 Click".
DOWNLOAD LINK | RELATED COMPILER | CONTAINS |
---|---|---|
5742_pir_3_click.zip [489.46KB] | mikroC AI for ARM GCC for ARM Clang for ARM mikroC AI for PIC mikroC AI for PIC32 XC32 GCC for RISC-V Clang for RISC-V mikroC AI for AVR mikroC AI for dsPIC XC16 |
|
PIR 3 Click is a compact add-on board designed for efficient and reliable motion detection in various applications. This board features the ZDP323B1 sensor from Zilog (Littelfuse), with high EMI immunity and precise motion detection capabilities. It includes a spectral filter window tuned to an 8-13um wavelength, dual sensing elements with a 0.6mm spacing, and a field of view of 148° on the X-axis and 136° on the Y-axis. The board also integrates the ZNCL10S PIR lens for maximum IR transmissivity and includes the Click Snap feature for flexible implementation.
We provide a library for the PIR 3 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.
This library contains API for PIR 3 Click driver.
pir3_cfg_setup
Config Object Initialization function.
void pir3_cfg_setup ( pir3_cfg_t *cfg );
pir3_init
Initialization function.
err_t pir3_init ( pir3_t *ctx, pir3_cfg_t *cfg );
pir3_default_cfg
Click Default Configuration function.
err_t pir3_default_cfg ( pir3_t *ctx );
pir3_set_detection_level
This function sets the detection threshold level in the ctx->config structure.
void pir3_set_detection_level ( pir3_t *ctx, uint8_t detlvl );
pir3_write_config
This function writes a config structure to the sensor by using I2C serial interface.
err_t pir3_write_config ( pir3_t *ctx );
pir3_read_peak_hold
This function reads a 12-bit signed peak hold data by using I2C serial interface.
err_t pir3_read_peak_hold ( pir3_t *ctx, int16_t *peak_hold );
This example demonstrates the use of PIR 3 Click board by reading and displaying the peak hold tracking data.
The demo application is composed of two sections :
Initializes the driver and performs the Click default configuration.
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
pir3_cfg_t pir3_cfg; /**< Click config object. */
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
pir3_cfg_setup( &pir3_cfg );
PIR3_MAP_MIKROBUS( pir3_cfg, MIKROBUS_1 );
if ( I2C_MASTER_ERROR == pir3_init( &pir3, &pir3_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( PIR3_ERROR == pir3_default_cfg ( &pir3 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
Reads the peak hold tracking data every 100ms and displays the results on the USB UART.
void application_task ( void )
{
int16_t peak_hold = 0;
if ( PIR3_OK == pir3_read_peak_hold ( &pir3, &peak_hold ) )
{
log_printf( &logger, " PEAK HOLD: %d\r\n\n", peak_hold );
Delay_ms ( 100 );
}
}
In order to establish communication with the sensor, some of the supported MCUs may require the I2C lines to be pulled up additionally either with the external or internal weak pull-up resistor.
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:
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.