Skip to main content

Remote monitoring and notifications for temperature, pressure, humidity and air quality measurement using BME 680

This project shows how to monitor and send alert notifctaions for high accuracy gas, pressume, humidity and temperatue using BME 680 sesnsor and Hologram Nova.


Things used in this project:

Hardware components:
  • Raspberry Pi Zero 
  • BME 680 Sensor
  • Hologram SIM

Software Apps:
  • Python
  • Hologram CLI




Install Python library required from BME 680 breakout as show in Pimoroni portal article.

The installation instructions for Hologram SIM are provided here 


First establish a cellular connection  using the credentials that uses a devicekey obtained from Hologram dashboard and the import BME 680 and time libarries. As described in the Pimoroni portal  articlesensor = bme680.BME680() creates an instance of the sensor and it is used for taking the readings for pressure, humidity etc.



#!/usr/bin/env python

import bme680
import time
from Hologram.HologramCloud import HologramCloud
import datetime
import logging

# Provide Hologram device key
credentials = {'devicekey': 'xxxxxxxx'}
hologram = HologramCloud(credentials, network='cellular')

try:
    sensor = bme680.BME680(bme680.I2C_ADDR_PRIMARY)
except IOError:
    sensor = bme680.BME680(bme680.I2C_ADDR_SECONDARY)sensor.set_humidity_oversample(bme680.OS_2X)
sensor.set_pressure_oversample(bme680.OS_4X)
sensor.set_temperature_oversample(bme680.OS_8X)
sensor.set_filter(bme680.FILTER_SIZE_3)
sensor.set_gas_status(bme680.ENABLE_GAS_MEAS)

sensor.set_gas_heater_temperature(320)
sensor.set_gas_heater_duration(150)
sensor.select_gas_heater_profile(0)


Gas, temperature, pressure, humidity values can be obtained using sensor.data.gas_resistance,  sensor.data.temperaturesensor.data.pressure, and sensor.data.humidity.

After comparing the meausre values such as gas resistence against the predefined theshold values, alerts can generated using Hologram api as shown below.


try: while True: if sensor.get_sensor_data(): output = '{0:.2f} C,{1:.2f} hPa,{2:.2f} %RH'.format( sensor.data.temperature, sensor.data.pressure, sensor.data.humidity)
 if((sensor.data.gas_resistance) < Gas_resistance_threshold):

                
                   msg['Subject']='Alert for possible gas leak or smoke'
                   res_message = "High Gas Sensor Value" 
                                  +str(sensor.data.gas_resistance)
               response_code = hologram.sendMessage(res_message)



It also sends notifications using cellular network if the sensor value  for temperature or humidity exceeds the predefined threshold values.

Configure routes in Hologram dash board to send the notifications (e.g., SMS, email etc).



Comments

Popular posts from this blog

Water Leak Detection Notifications

Water Leak Detection Project with GrovePi  and Hologram Nova This project uses the Grove water sensor that can detect water leaks, spills, floods, and rain. It also can send notifications using cellular network. Things used in this project: Hardware components: Raspberry Pi Zero W or WH GrovePi Zero  Grove Water Sensor Grove LCD RGB Backlight Hologram SIM Software Apps: GrovePi  Python Hologram CLI Water sensor module from Grove system provides  the ability to detect if there is any water leak by measuring conductivity. The water sensor traces have a weak pull-up resistor of 1 MΩ and it pulls the sensor trace value high until a drop of water shorts the sensor trace to the grounded trace. GrovePi Zero is a HAT from Dexter Industries   that allows Grove Water sensor to connect to Raspberry Pi zero with out needing soldering or breadboards. One can plug in the Grove water sensor start programming. Grove water sensor works with digital I/...

Temperature and Humidity Monitoring Notifications

Temperature and Humidity Monitoring Project with GrovePi and Hologram Nova A Temperature and Humidity Grove sensor is used in this project to measure relative humidity and temperature. It provides relative humidity measurement expressed as a percentage of the ration of moisture in the air to the maximum amount that can be held in the air at that temperature. The relative humidity changes with temperature as air becomes hotter and it holds more moisture. Things used in this project: Things used in this project: Hardware components: Raspberry Pi Zero  WH GrovePi Zero  Gove -Temperature and Humidity  Sensor Grove LCD RGB Backlight Hologram SIM Software Apps: GrovePi  Python Hologram CLI GrovePi Zero is a HAT from  Dexter Industries   that allows Grove PIR motion sensor to connect to Raspberry Pi zero with out needing soldering or breadboards. One can plug in the Grove water sensor start programming. Grove Temperature and Humid...

Raspberry Pi Setup for Voice Assistant Applications Using ChatGPT, Whisper API, gTTS and Pysstx3

  Raspberry Pi can be used for providing voice assistant capabilities by integrating with ChatGPT and Whisper APIs from OpenAI. This article shows how to set up the required libraries such as Chat GPT, Whisper API, Text-to-speech Pysttx3 etc., on Raspberry Pi for enabling voice  assistant  applications.   Hardware components Raspberry Pi Micro SD Card Power Supply USB Speaker USB Microphone Recommended for initial setup USB Mouse USB Keyboard HDMI Cable Monitor Software Apps: Python ChatGPT, Whisper, Speech Recognition, Pysttx3 libraries Raspberry pi operating system needs to be installed on a micro SD card before installing any ChatGPT based libraries. Raspberry Pi Imager running on another computer can be used to copy the operating system into the SD card.  Click on 'CHOOSE OS' button and select Raspberry Pi OS (64-bit) option and select 'WRITE' button to install the operating system on the SD card. After installing Raspberry pi os on SD card, it can be insert...