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.11
mikroSDK Library: 2.0.0.0
Category: Motion
Downloaded: 117 times
Not followed.
License: MIT license
Motion 3 Click is a Click board™ based on EKMC1606112, PIR motion sensor from Panasonic Corporation that's used as human motion detector. Also featured on Motion 3 Click bord is TLP241A photorelay from Toshiba that is used to provide a reinforced galvanic isolation for the external signals used to drive some external high power electronic equipment when motion is detected. It's allowing up to 40V between the SSR contacts in OFF state, and currents up to 2A while in ON state, thanks to a very low ON-state resistance. Motion 3 Click board™ is supported by a mikroSDK compliant library, which includes functions that simplify software development. This Click board™ comes as a fully tested product, ready to be used on a system equipped with the mikroBUS™ socket.
Do you want to subscribe in order to receive notifications regarding "Motion 3 Click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Motion 3 Click" changes.
Do you want to report abuse regarding "Motion 3 Click".
DOWNLOAD LINK | RELATED COMPILER | CONTAINS |
---|---|---|
4527_motion_3_click.zip [445.29KB] | 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 |
|
Motion 3 Click is a Click board™ based on EKMC1606112, PIR motion sensor from Panasonic Corporation that's used as human motion detector. Also featured on Motion 3 Click bord is TLP241A photorelay from Toshiba that is used to provide a reinforced galvanic isolation for the external signals used to drive some external high power electronic equipment when motion is detected. It's allowing up to 40V between the SSR contacts in OFF state, and currents up to 2A while in ON state, thanks to a very low ON-state resistance. Motion 3 Click board™ is supported by a mikroSDK compliant library, which includes functions that simplify software development. This Click board™ comes as a fully tested product, ready to be used on a system equipped with the mikroBUS™ socket.
We provide a library for the Motion3 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 Motion3 Click driver.
motion3_cfg_setup
Config Object Initialization function.
void motion3_cfg_setup ( motion3_cfg_t *cfg );
motion3_init
Initialization function.
MOTION3_RETVAL motion3_init ( motion3_t *ctx, motion3_cfg_t *cfg );
motion3_enable
This function enables/disables motion sensor by setting EN pin state.
void motion3_enable ( motion3_t *ctx, uint8_t state );
motion3_detect_state
This function returns INT pin state.
uint8_t motion3_detect_state ( motion3_t *ctx );
This example demonstrates the use of Motion 3 Click boards.
The demo application is composed of two sections :
Initializes the driver and enables the motion sensor.
void application_init ( void ) {
log_cfg_t log_cfg; /**< Logger config object. */
motion3_cfg_t motion3_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.
motion3_cfg_setup( &motion3_cfg );
MOTION3_MAP_MIKROBUS( motion3_cfg, MIKROBUS_1 );
if ( motion3_init( &motion3, &motion3_cfg ) == DIGITAL_OUT_UNSUPPORTED_PIN ) {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
motion3_enable( &motion3, MOTION3_MODULE_ENABLE );
Delay_ms ( 100 );
log_printf( &logger, "The sensor is ready.\r\n" );
log_printf( &logger, "-----------------------\r\n" );
}
It checks if the sensor has detected movement and therefore displays the desired message on the USB UART.
void application_task ( void ) {
uint8_t int_status;
int_status = motion3_detect_state( &motion3 );
if ( int_status == MOTION3_DETECT_OBJECT )
{
log_printf( &logger, "Motion detected!\r\n" );
log_printf( &logger, "-----------------------\r\n" );
while ( int_status == MOTION3_DETECT_OBJECT ) {
int_status = motion3_detect_state( &motion3 );
}
log_printf( &logger, "The sensor is ready.\r\n" );
log_printf( &logger, "-----------------------\r\n" );
Delay_ms ( 100 );
}
}
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.