Our infrared solution is a versatile tool designed to enable precise presence sensing, motion detection, and remote overtemperature protection across various applications
A
A
Hardware Overview
How does it work?
Presence Click is based on the TPiS 1S 1385, a device from CaliPile™ multi-function infrared sensor series, from Excelitas Technologies. Despite its very compact design (4.4 x 2.6 x 1.75 mm2), it features an integrated signal processing ASIC, which allows detection of several different events, common to all the sensors from CaliPile™ series. The TPiS 1S 1385 features near-field motion detection, presence detection, and remote temperature measurement. The infrared light emitted from the object is detected by the thermopile sensor, converted by a highly sensitive 17-bit ADC, and digitally processed to allow event detection. Event detection can be fine-tuned over the I2C interface, by accessing corresponding config registers. The CaliPile™ series sensors can utilize the embedded processing engine to detect several different events, including motion, presence, and temperature shock events. Each of these events is based on measuring the temperature and then comparing it with a value which is taken after a time interval. The device does not consume much power while processing the data; significantly more power is consumed during the sampling intervals. Since the measurement is done in just a few points of time,
not much power is consumed overall. This feature allows using the sensor IC on battery-operated systems. A particularly interesting feature is ambient temperature shock detection. This allows detecting fast changes of the temperature, which can be used to remotely detect overtemperature event in some power installations or similar inaccessible locations. The TPiS 1S 1385 is able to perform data processing. However, the firmware running on the host MCU has to perform some calculations, taking calibration parameters from the EEPROM into account, in order to determine the temperature of the target object. The thermopile sensor reacts to IR light reflection; therefore, some external parameters have to be taken into consideration. More information about these parameters and how to calculate the output can be found in the TPiS 1S 1385 datasheet. The interrupt pin allows the detected event to be reported to the host MCU. This is crucial for wakeup-on-proximity applications. The interrupt will be cleared only after reading the Interrupt Status register. The interrupt pin is an active LOW output, routed to the INT pin of the mikroBUS™. It is pulled to a HIGH logic state by an onboard resistor, when not asserted. After the power on,
the device only responds to the General Call Address, which is 0x00. After it receives a general call, it loads its I2C address which is stored in the EEPROM register. Depending on the most significant bit (MSB) within this register, the states of the two physical pins A0 and A1 will replace the values of the two least significant bits (LSB). Pins A0 and A1 are routed to the SMD jumpers grouped under the ADR SEL label, allowing the developer to select an I2C slave address when more than a single device exists on the I2C bus. The datasheet of the TPiS 1S 1385 illustrates the use of the EEPROM register, along with the A0 and A1 pins. However, the Click board™ is supported by a set of mikroSDK library functions which simplify the use of this IC, along with a demo example which can be used as a reference for a custom design. In addition to TPiS 1S 1385, Presence click features two additional ICs: the PCA9306, and the 74LVCH1T45. The PCA9306 is a bi-directional level shifter for the I2C signals, while the 74LVCH1T45 is a single bit level shifter, used for the INT line. Both ICs are produced by NXP. They allow both 3.3V and 5V MCUs to be interfaced with the Click board™, vastly expanding its usability.
Features overview
Development board
PIC18F57Q43 Curiosity Nano evaluation kit is a cutting-edge hardware platform designed to evaluate microcontrollers within the PIC18-Q43 family. Central to its design is the inclusion of the powerful PIC18F57Q43 microcontroller (MCU), offering advanced functionalities and robust performance. Key features of this evaluation kit include a yellow user LED and a responsive
mechanical user switch, providing seamless interaction and testing. The provision for a 32.768kHz crystal footprint ensures precision timing capabilities. With an onboard debugger boasting a green power and status LED, programming and debugging become intuitive and efficient. Further enhancing its utility is the Virtual serial port (CDC) and a debug GPIO channel (DGI
GPIO), offering extensive connectivity options. Powered via USB, this kit boasts an adjustable target voltage feature facilitated by the MIC5353 LDO regulator, ensuring stable operation with an output voltage ranging from 1.8V to 5.1V, with a maximum output current of 500mA, subject to ambient temperature and voltage constraints.
Microcontroller Overview
MCU Card / MCU
Architecture
PIC
MCU Memory (KB)
128
Silicon Vendor
Microchip
Pin count
48
RAM (Bytes)
8196
You complete me!
Accessories
Curiosity Nano Base for Click boards is a versatile hardware extension platform created to streamline the integration between Curiosity Nano kits and extension boards, tailored explicitly for the mikroBUS™-standardized Click boards and Xplained Pro extension boards. This innovative base board (shield) offers seamless connectivity and expansion possibilities, simplifying experimentation and development. Key features include USB power compatibility from the Curiosity Nano kit, alongside an alternative external power input option for enhanced flexibility. The onboard Li-Ion/LiPo charger and management circuit ensure smooth operation for battery-powered applications, simplifying usage and management. Moreover, the base incorporates a fixed 3.3V PSU dedicated to target and mikroBUS™ power rails, alongside a fixed 5.0V boost converter catering to 5V power rails of mikroBUS™ sockets, providing stable power delivery for various connected devices.
Used MCU Pins
mikroBUS™ mapper
Take a closer look
Schematic
Step by step
Project assembly
Track your results in real time
Application Output
After loading the code example, pressing the "DEBUG" button builds and programs it on the selected setup.
After programming is completed, a header with buttons for various actions available in the IDE appears. By clicking the green "PLAY "button, we start reading the results achieved with Click board™.
Upon completion of programming, the Application Output tab is automatically opened, where the achieved result can be read. In case of an inability to perform the Debug function, check if a proper connection between the MCU used by the setup and the CODEGRIP programmer has been established. A detailed explanation of the CODEGRIP-board connection can be found in the CODEGRIP User Manual. Please find it in the RESOURCES section.
Software Support
Library Description
This library contains API for Presence Click driver.
Key functions:
presence_ambient_temperature
- This function returns ambient temperature in degrees Celsiuspresence_object_temperature
- This function returns object temperature.
Open Source
Code example
This example can be found in NECTO Studio. Feel free to download the code, or you can copy the code below.
/*!
* \file
* \brief Presence Click example
*
* # Description
* This application enables usage of sensor for motion and presence sensing
* and measuring of object's and ambient temperature.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes driver and performs the click default configuration.
*
* ## Application Task
* Checks whether a new event (motion, presence or over-temperature) is detected.
* If there's no event detected it reads the ambient and object temperature and displays
* the results on the USB UART.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "presence.h"
// ------------------------------------------------------------------ VARIABLES
static presence_t presence;
static log_t logger;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
presence_cfg_t cfg;
/**
* 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.
presence_cfg_setup( &cfg );
PRESENCE_MAP_MIKROBUS( cfg, MIKROBUS_1 );
presence_init( &presence, &cfg );
if ( PRESENCE_ERROR == presence_default_cfg ( &presence ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
uint8_t int_status = 0;
uint8_t tp_presence = 0;
uint8_t tp_motion = 0;
float t_amb = 0;
float t_obj = 0;
if ( PRESENCE_OK == presence_generic_read( &presence, PRESENCE_REG_INTERRUPT_STATUS, &int_status, 1 ) )
{
if ( int_status & PRESENCE_INT_MASK1_PRESENCE )
{
if ( PRESENCE_OK == presence_generic_read( &presence, PRESENCE_REG_TP_PRESENCE, &tp_presence, 1 ) )
{
log_info( &logger, "Presence detected! Level: %u", ( uint16_t ) tp_presence );
}
}
else if ( int_status & PRESENCE_INT_MASK1_MOTION )
{
if ( PRESENCE_OK == presence_generic_read( &presence, PRESENCE_REG_TP_MOTION, &tp_motion, 1 ) )
{
log_info( &logger, "Motion detected! Level: %u", ( uint16_t ) tp_motion );
}
}
else if ( int_status & PRESENCE_INT_MASK1_TP_OT )
{
log_info( &logger, "Temp threshold exceeded!" );
}
else
{
if ( PRESENCE_OK == presence_ambient_temperature( &presence, &t_amb ) )
{
log_printf( &logger, "Ambient temperature: %.2f degC\r\n", t_amb );
}
if ( PRESENCE_OK == presence_object_temperature( &presence, &t_obj ) )
{
log_printf( &logger, "Object temperature: %.2f degC\r\n\n", t_obj );
}
}
}
Delay_ms ( 1000 );
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END
/*!
* \file
* \brief Presence Click example
*
* # Description
* This application enables usage of sensor for motion and presence sensing
* and measuring of object's and ambient temperature.
*
* The demo application is composed of two sections :
*
* ## Application Init
* Initializes driver and performs the click default configuration.
*
* ## Application Task
* Checks whether a new event (motion, presence or over-temperature) is detected.
* If there's no event detected it reads the ambient and object temperature and displays
* the results on the USB UART.
*
* \author MikroE Team
*
*/
// ------------------------------------------------------------------- INCLUDES
#include "board.h"
#include "log.h"
#include "presence.h"
// ------------------------------------------------------------------ VARIABLES
static presence_t presence;
static log_t logger;
// ------------------------------------------------------ APPLICATION FUNCTIONS
void application_init ( void )
{
log_cfg_t log_cfg;
presence_cfg_t cfg;
/**
* 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.
presence_cfg_setup( &cfg );
PRESENCE_MAP_MIKROBUS( cfg, MIKROBUS_1 );
presence_init( &presence, &cfg );
if ( PRESENCE_ERROR == presence_default_cfg ( &presence ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
void application_task ( void )
{
uint8_t int_status = 0;
uint8_t tp_presence = 0;
uint8_t tp_motion = 0;
float t_amb = 0;
float t_obj = 0;
if ( PRESENCE_OK == presence_generic_read( &presence, PRESENCE_REG_INTERRUPT_STATUS, &int_status, 1 ) )
{
if ( int_status & PRESENCE_INT_MASK1_PRESENCE )
{
if ( PRESENCE_OK == presence_generic_read( &presence, PRESENCE_REG_TP_PRESENCE, &tp_presence, 1 ) )
{
log_info( &logger, "Presence detected! Level: %u", ( uint16_t ) tp_presence );
}
}
else if ( int_status & PRESENCE_INT_MASK1_MOTION )
{
if ( PRESENCE_OK == presence_generic_read( &presence, PRESENCE_REG_TP_MOTION, &tp_motion, 1 ) )
{
log_info( &logger, "Motion detected! Level: %u", ( uint16_t ) tp_motion );
}
}
else if ( int_status & PRESENCE_INT_MASK1_TP_OT )
{
log_info( &logger, "Temp threshold exceeded!" );
}
else
{
if ( PRESENCE_OK == presence_ambient_temperature( &presence, &t_amb ) )
{
log_printf( &logger, "Ambient temperature: %.2f degC\r\n", t_amb );
}
if ( PRESENCE_OK == presence_object_temperature( &presence, &t_obj ) )
{
log_printf( &logger, "Object temperature: %.2f degC\r\n\n", t_obj );
}
}
}
Delay_ms ( 1000 );
}
int main ( void )
{
/* Do not remove this line or clock might not be set correctly. */
#ifdef PREINIT_SUPPORTED
preinit();
#endif
application_init( );
for ( ; ; )
{
application_task( );
}
return 0;
}
// ------------------------------------------------------------------------ END