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: 2019-05-13
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Miscellaneous
Downloaded: 3547 times
Not followed.
License: MIT license
Presence click is an infrared sensing Click board which can be used for presence sensing, motion detection, and a remote overtemperature protection. Presence click is equipped with the TPiS 1S 1385, a thermophile sensor from CaliPile series.
Do you want to subscribe in order to receive notifications regarding "Presence click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Presence click" changes.
Do you want to report abuse regarding "Presence click".
Library Description
The library initializes and defines the I2C bus driver and drivers that offer a choice for writing data in register and reads data form register. The library includes function for read Ambient and Object Temperature in C. The user also has the function for start eeprom process for read and storage calibration coefficients, function for general call address and functions for get Interrupt state.
Key functions:
uint8_t presence_eepromProcess()
- EEPROM process.float presence_ambientTemperature()
- Ambient Temperature.float presence_objectTemperature()
- Object Temperature.Examples description
The application is composed of the three sections :
Commands : 'a' - Ambient Temperature 'o' - Object Temperature
void applicationTask()
{
uint8_t intStatus;
uint8_t dataReady_;
char receivedData_;
char demoText[ 50 ];
float Tamb;
float Tobj;
dataReady_ = UART_Rdy_Ptr( );
presence_readData(_PRESENCE_REG_INTERRUPT_STATUS, &intStatus, 1);
if (dataReady_ != 0)
{
receivedData_ = UART_Rd_Ptr( );
switch (receivedData_)
{
case 'a' :
{
Tamb = presence_ambientTemperature();
FloatToStr(Tamb, demoText);
mikrobus_logWrite("---- Ambient Temperature: ", _LOG_TEXT);
mikrobus_logWrite(demoText, _LOG_LINE);
break;
}
case 'o' :
{
Tobj = presence_objectTemperature();
FloatToStr(Tobj, demoText);
mikrobus_logWrite("---- Object Temperature: ", _LOG_TEXT);
mikrobus_logWrite(demoText, _LOG_LINE);
break;
}
}
}
if((intStatus & 0x08) != 0)
{
mikrobus_logWrite("--- Presence detected! ---", _LOG_LINE);
}
else if((intStatus & 0x04) != 0)
{
mikrobus_logWrite("--- Motion detected! ---", _LOG_LINE);
}
else if((intStatus & 0x10) != 0)
{
mikrobus_logWrite("--- Temp threshold exceeded! ---", _LOG_LINE);
}
}
Other mikroE Libraries used in the example:
I2C
UART
Conversions
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. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.