1. Use Case: Smart Caretaker for perishable goods
There is a large number of expensive consumable items that require storage at precise limits of environmental conditions, characteristic examples being wine and cigars. The level of humidity and temperature at which wines are kept have a significant effect on their longevity whereas a consistent relative humidity in the range of 65-75 % and temperature of 12°-16°C are considered ideal. Similarly a consistent relative humidity of 70 - 72 % and temperature of 18° - 21°C are ideal for cigars. Additionally an environmental monitoring system can act as a security mechanism by also monitoring light levels at the storage facility (cellar for wines, case for cigars), thus offering warnings for unauthorized entry or access to the stock.
2. Solution
The RSL10-SENSE-DB-GEVK includes the following sensors:
• NOA1305, ambient Light sensor
• N24RF64, NFC EEPROM
• BME680, environmental sensor (temperature, humidity,
pressure, air quality)
• BHI160 + BMM150, 3−axis accelerometer, gyroscope,
magnetometer. Together returnabsolute orientation
supported in software
• INMP522 −> ultra−low power microphone for audio
applications
After installing the toolchain as described in document EVBUM2614.pdf (RSL10-SENSE-GEVK (and RSL10-SENSE-DB-GEVK) UserGuide), I imported the example project sense_noa1305_example which controls the ambient light sensor and fused it with the BME680 demo app in order to monitor temperature and humidity.
The following limit variables were defined:
#define APP_ALS_THRESHOLD_LEVEL_LUX (10) /* If LUX measured is above this value then an interrupt is generated */
#define APP_TEMP_LOW (18.0)
#define APP_TEMP_HIGH (21.0)
#define APP_HUM_LOW (70.0)
#define APP_HUM_HIGH (72.0)
and the main program performs the necessary checks of the measured variables against these.
void ALS_ReadCallback(uint32_t lux, bool is_interrupt)
{
if (is_interrupt == true)
{
// Print this line if callback was called in response to lux value
// passing above / below threshold value.
if (lux<=APP_ALS_THRESHOLD_LEVEL_LUX) {
printf("\n");
printf("BOX IS CLOSED ***** LUX = %lu\r\n", lux);
}
else {
printf("\n");
printf("LUX value passed threshold. BOX WAS OPENED!!! %lu\r\n", lux);
}
}
// printf("ALS: LUX = %lu\r\n\n", lux); /* No need to call this all the time. Outer Loop will report Values */
}
void PrintEnvData(struct BME680_ENV_Data *data)
{
int32_t tmp;
/* Print measured data.
*
* Note:
* newlib-nano printf does not support float by default.
* To enable float in printf enable following option in project properties:
* C/C++ Build -> Settings -> GNU ARM Cross Linker -> Miscellaneous
* -> Use float with nano printf
*/
/* printf("ENV: Measurement done [%lu ms]\r\n", HAL_Time()); */
printf("ENIVORNMENTAL DATA BEGIN---------------------------\n");
printf("\n");
tmp = data->temperature / 100;
if((tmp>APP_TEMP_LOW) & (tmp<APP_TEMP_HIGH)) {
printf(" TEMPERATURE WITHIN LIMITS --> %ld.%02ld °C\r\n", tmp, data->temperature - (tmp * 100));
}
else {
printf(" TEMPERATURE OFF LIMITS !!!!!! %ld.%02ld °C\r\n", tmp, data->temperature - (tmp * 100));
}
tmp = data->humidity / 1000;
if((tmp>APP_HUM_LOW) & (tmp<APP_HUM_HIGH)) {
printf(" HUMIDITY WITHIN LIMITS --> %ld.%02ld °C\r\n", tmp, data->humidity - (tmp * 100));
}
else {
printf(" HUMIDITY OFF LIMITS !!!!!! %ld.%02ld °C\r\n", tmp, data->humidity - (tmp * 100));
}
printf("ENIVORNMENTAL DATA END---------------------------\n");
printf("\n");
/* printf(" pressure=%lu Pa\r\n\n", data->pressure); */
}
The whole project with the necessary modifications in configurations so as to run properly with the BME680 sensor is in the provided GIT address as a zip file.
The output of the program is shown below (throw the J-Link viewer):
A future improvement is to transmit the data over BT to cloud, but this POC shows that the RSL-10 is perfectly capable to monitor critical environmental conditions for expensive goods.
Comments