Environnemental parameters in a home are crucial to preserve the health of the inhabitants. The aim of this project is to monitor in real-time toxic gases and luminosity level remotely and display them to the user via a Web application. We used simple and widely spread hardware components to make the project easily reproducible.
Toxic Gas monitoringToxic gases have huge environmental impacts. Every year, they are responsible of countless deaths. We chose to monitor three gases : Carbon monoxide (chemical formula CO ), Nitrogen dioxide (chemical formula NO2 ), Propane (chemical formula C3H8 ).
What these different gases have in common is that they are fatal if inhaled in large quantity. We programmed a Grove - Multichannel Gassensor to mesure these three gases and send the values to an OM2M platform.
The gas sensor used in this module is based on MEMS technology and has the advantage of being in a small size with considerable measurement stability :
o Carbon monoxide CO 1 – 1000ppm
We considere, in this project, that CO levels of more than 50 ppm are dangerous therefor the gas sensor would alert the user. At sustained CO concentrations above 150 to 200 ppm, disorientation, unconsciousness, and death are possible.
o Nitrogen dioxide NO2 0.05 – 10ppm
Exposure to more than 5 ppm of Nitrogen dioxide is very dangerous and can be fatal.
o Propane C3H8 > 1000 ppm
A high concentration of Propane can displace oxygen in the air. If less oxygen is available to breathe, symptoms such as rapid breathing, rapid heart rate, clumsiness, emotional upsets and fatigue can result. We consider that for an exposure to more than 1000 ppm, user should be alerted.
Luminosity level monitoringTo monitor the luminosity level we used a Grove - Light Sensor.
The Grove - Light Sensor module incorporates a Light Dependant Resistor (LDR). The resistance of the LDR or Photoresistor will decreases when the ambient light intensity increases. This means that the output signal from this module will be HIGH in bright light, and LOW in the dark. Our sensor is interfaced to an ESP8266 by an I2C serial communication bus. We consider in our project that the brightness is too strong when it's over 600 lux and too low when it's under 100 lux.
PowerAll sensors are powered through GPIO the ESP8266 and the ESP can be powered by battery.
SoftwareFor developing our project, we mainly used Arduino IDE for the Firmware of the ESP8266. We start by retrieving the data from the different sensors. The data is sent with a little descritpion and the the initial value.
The ESP8266 is connected to wifi, the user should enter his wifi network identifier and password. For every user is associated an ApplicationEntity(AE) resource on the remote CSE (this is done by sending a POST request). The user should have an active CSE on his gateway, or on his local machine (for testing purposes). The IP adress of the CSE host machine should be added in the Arduino code.
On the remote CSE, we create a Container for every ContentInstance(CI) resource. The CI contains all the data detected by the sensors. We created 4 Content Instance :
LuminositySensor, NO2Value, COValue and C3H8Value.
The data (in XML) is then retrieved and processed by our Node-RED dashboard and sent to our Web application.
We also used an application in javascript to monitor in real-time all the data sent to our CSE ressource. You can find this monitor attached below.
Settingupthesystem
Start by downloading these software resources :
- Arduino IDE, you will need only the following libraries : ESP8266 and MiCS6814-I2C.
- OM2M, download the latest library on the Eclipse Foundate Website : https://wiki.eclipse.org/OM2M/Download. You should have pre-installed "JAVA 1.8" and "Apache Maven 3". You can check this guide : https://wiki.eclipse.org/OM2M/one#Getting_started.
Wiring of the Hardware components :
Connect the Grove- Light Sensor to the port A0. The port is powered by 3.3 V pin of the ESP8266. With the ESP8266 12-E NodeMCU kit and other ESP8266 development boards, it is easy to access the A0, you simply connect a jumper wire to the pin.
The Grove Multi-channel sensor can be connected to one of the two I2C serial communication bus. We recommend calibrating the sensor before using it. Open the example "calibrate" in the arduino library MiCS6814-I2C and upload it to your ESP8266.
The user can also add a Grove - temperature sensor, the code is already done in our Arduino code.
Once the circuit wiring is completed. You can upload the code on the ESP8266 in Arduino IDE. Don't forget to launch your CSE resource first. If the device is connected to Wifi, you should be able to see the environnemental parameters in your home on our website platform : https://yacine180496.github.io/SmartHM/.
Comments