TOP Contributors

  1. MIKROE (2784 codes)
  2. Alcides Ramos (385 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (97 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (139842 times)
  2. FAT32 Library (72209 times)
  3. Network Ethernet Library (57392 times)
  4. USB Device Library (47740 times)
  5. Network WiFi Library (43364 times)
  6. FT800 Library (42700 times)
  7. GSM click (29980 times)
  8. mikroSDK (28440 times)
  9. PID Library (26989 times)
  10. microSD click (26398 times)
Libstock prefers package manager

Package Manager

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]

< Back
mikroSDK Library

PIR 2 Click

Rating:

0

Author: MIKROE

Last Updated: 2024-10-31

Package Version: 2.1.0.3

mikroSDK Library: 2.0.0.0

Category: Motion

Downloaded: 48 times

Not followed.

License: MIT license  

PIR 2 Click is a compact add-on board designed for high-performance motion detection applications. This board features the ZSLM323511, a dual-element balanced differential pyroelectric (PIR) sensor from Zilog. Key features include excellent EMI immunity, a low-profile surface mount package, and a typical field of view of 150 degrees on the X-axis and 139 degrees on the Y-axis. The board also integrates the ZCWM05GIV1 PIR lens for maximum IR transmissivity. Ideal for security systems, lighting control, and video doorbells, PIR 2 Click ensures reliable motion detection in various demanding environments.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "PIR 2 Click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "PIR 2 Click" changes.

Do you want to report abuse regarding "PIR 2 Click".

  • Information
  • Comments (0)

mikroSDK Library Blog


PIR 2 Click

PIR 2 Click is a compact add-on board designed for high-performance motion detection applications. This board features the ZSLM323511, a dual-element balanced differential pyroelectric (PIR) sensor from Zilog. Key features include excellent EMI immunity, a low-profile surface mount package, and a typical field of view of 150 degrees on the X-axis and 139 degrees on the Y-axis. The board also integrates the ZCWM05GIV1 PIR lens for maximum IR transmissivity. Ideal for security systems, lighting control, and video doorbells, PIR 2 Click ensures reliable motion detection in various demanding environments.

pir2_click.png

Click Product page


Click library

  • Author : Stefan Ilic
  • Date : Dec 2023.
  • Type : ADC/I2C type

Software Support

We provide a library for the PIR 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 PIR 2 Click driver.

Standard key functions :

  • pir2_cfg_setup Config Object Initialization function.

    void pir2_cfg_setup ( pir2_cfg_t *cfg );
  • pir2_init Initialization function.

    err_t pir2_init ( pir2_t *ctx, pir2_cfg_t *cfg );

Example key functions :

  • pir2_read_raw_adc This function reads raw ADC value.

    err_t pir2_read_raw_adc ( pir2_t *ctx, uint16_t *raw_adc );
  • pir2_read_voltage This function reads raw ADC value and converts it to proportional voltage level.

    err_t pir2_read_voltage ( pir2_t *ctx, float *voltage );
  • pir2_set_vref This function sets the voltage reference for PIR 2 Click driver.

    err_t pir2_set_vref ( pir2_t *ctx, float vref );

Example Description

This example demonstrates the use of PIR 2 Click boards.

The demo application is composed of two sections :

Application Init

Initializes the driver and selects the driver interface.


void application_init ( void )
{
    log_cfg_t log_cfg;      /**< Logger config object. */
    pir2_cfg_t pir2_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 " );

    pir2_drv_interface_sel( &pir2_cfg, PIR2_DRV_SEL_I2C );

    // Click initialization.
    pir2_cfg_setup( &pir2_cfg );
    PIR2_MAP_MIKROBUS( pir2_cfg, MIKROBUS_1 );
    err_t init_flag = pir2_init( &pir2, &pir2_cfg );
    if ( ( ADC_ERROR == init_flag ) || ( I2C_MASTER_ERROR == init_flag ) )
    {
        log_error( &logger, " Communication init." );
        for ( ; ; );
    }

    log_info( &logger, " Application Task " );
}

Application Task

It checks if the sensor has detected movement and displays message on the USB UART.


void application_task ( void ) 
{
    float voltage = 0;
    pir2_read_voltage ( &pir2, &voltage );
    if ( voltage > PIR2_VOLTAGE_TRESHOLD )
    {
        log_printf( &logger, " Motion detected \r\n" );
        Delay_ms ( 1000 );
    }
}

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.PIR2

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.


ALSO FROM THIS AUTHOR

LTE Cat.1-EU click

5

LTE Cat.1-EU click is a Click board based on Thales Cinterion ELS61 wireless module that delivers highly efficient Cat 1 LTE connectivity for M2M IoT solutions offering seamless fall back to 2G and 3G networks.

[Learn More]

Hall Current 14 Click

0

Hall Current 14 Click is a compact add-on board that contains a precise solution for AC/DC current sensing. This board features the MCS1801, a fully integrated Hall-effect-based isolated linear current sensor designed for the current range of ±25A from Monolithic Power Systems (MPS). The galvanic isolation between the pins of the primary copper conductive path and the sensor leads allows the MCS1801 to replace optoisolators or other isolation devices. Applied current flowing through this copper conduction path generates a magnetic field that the differential Hall sensors convert into a proportional voltage, where after that, the user is given the option to process the output voltage as an analog or digital value.

[Learn More]

Cap Extend Click

1

Click – board with SX8633 low power capacitive touch button controller | MikroElektronika Cap Extend click carries a SEMTECH SX8633 low power, capacitive button touch controller. It has 12 pins for connecting capacitive inputs (either touch-buttons or proximity sensors). Any sort of conductive object can be used as an input.

[Learn More]