ESP32 Personal Particulate matter monitoring
Modern cities are growing - so are the particulate pollution levels in and around these growing cities. This device will unvei the dark sides...
ESP32 Particulate matter monitoring
Particulate matter: Dust is a silent killer. Ever since the smog pollution of Delhi has hit the headlines, the public awareness about these two particulate matters have become a bone of contention. PM2.5 is particulate matters which is less than 2.5 micron in diameter and PM10 is particulate matters which is less than 10 micron in diameter. That means a PM10 report includes PM2.5 as well. Both these particles are way smaller than a human hair which is about 70 microns in width.
What causes PM10: Crushing and grinding operations like stone crushers, coal grinders, rotary kiln in cement industry, dusts on the roads stirred by moving vehicles. These particles are about 30 times smaller than the width of a human hair and is small enough to get inhaled past our defensive nose hairs and settles into our lungs. Limit of PM10 for 24 hour average is 150 µg/m3
What causes PM2.5: Fine particles produced from all types of combustion, including motor vehicles, thermal power plants, residential wood burning, forest fires, agricultural burning and other industrial processes. While a PM10 ends at our lungs, PM2.5 passes further through alveoli of our lungs and gets mixed into our blood cells and be carried throughout our bodies thereby making them “the invisible killer”. Limit of PM2.5 for 24 hour average is 35 µg/m3.
The common diseases that are caused by these two particulate matters are – Asthma, Influenza, lung-heart-cardiovascular diseases and premature death.
Measurement of PM2.5 & PM10: Since both these particulates are invisible in nature, there measurements are not easy. Big Industries at their factory entrances put up display of many pollutants including these two particulate matters. But as the industries themselves are the big polluter of these particulate matters, most of these readings are tampered. So to have a clear idea of these two parameters, it’s better to develop your own measurement system using cheap yet efficient electronics.
Nova Dust sensor – SDS011: With it’s size, it’s the best and the finest particulate sensor in terms of accuracy & price ($20 , aliexpress.com). It has an UART interface and has a measurement resolution of 0.3μg/m3. Operating voltage is 5V.
RH Correction of PM2.5 & PM10: The PM2.5 & PM10 has a relation with Relative Humidity. Therefore, an RH correction has been placed in the sketch as well to fine tune the readings. For Temperature, pressure and relative humidity we have added a cheap BME280 on I2C bus of ESP32.
SDS011 on ESP8266 & ESP32: Arduino being an advanced technology as on date, almost for anything and everything there is always a library available for any kind of sensors. So for SDS011 too a ready made library is available which uses SoftwareSerial library and works out of the box for UNO and ESP8266 as both these hardwares can use SoftwareSerial library. However, in ESP8266 I could not make it work along with a colored display ILI9361 (128x128).
But my preferred hardware is ESP32 and it doesn't work with SoftwareSerial. It has three UART ports and it uses HardwareSerial for connecting the UART devices. To tackle the problem I studied the existing library and the same command is imitated with the hardwareserial and the PM data started coming from the sensor. These commands are placed in processdata.h file which is to be kept in the same folder of the Arduino sketch and to be compiled together with the main sketch.
Sleep mode of SDS011: As per specification the SDS011 has a sleep current of 2mA. I tried with the sleep commands as stated all over Internet. The sensor worked on sleep mode infrequently – not always to be precise. These commands are also placed in the processdata.h file for you to try. However, I used a GPIO pin (D13) to switch on an NPN transistor (2N 2219) to keep the SDS011 on during the active stage and then it goes into power off mode.
Schematic:
Schematic: Table-1 [ OLED & ESP32 ]
While most of the schematics I’ve shown in the tables ,here’s a hand written sketch of the final assembly of the items.
Final Schematic:
Prototype:
Cloud computing with thingspeak.com: ThingSpeak.com: It’s an open source Internet of Things (IOT) application and API to store and retrieve data from things using the HTTP protocol over the Internet via a LAN. ThingSpeak enables creation of sensor logging applications, location tracking applications and a social network of things with status updates.
That means, If we can send data from our sensors to ThingSpeak at regular interval ,it will create , store and display data in a trend automatically. What more ? it has math modeling inbuilt in the form of Matlab documentation which you can use free!
Getting started:
A. ThingSpeak.com account & Channel set up
The first thing one needs to do is ,open an account and a channel in thingspeak.com for which one needs to have an email account. The site will send a confirmation email , clicking the link in the email will validate the site and the channel will be opened. However, from here on You can create as many channels as you want. The moment you create a channel you get three “thingspeak” identity – channel ID , write API KEY and read API KEY. Note them down as we will require them little later. Meanwhile give some name to the eight data streams in the channels – PM2.5, PM10, ambient temperature, Relative Humidity etc.
B. 8 data per channel: Each channel can take 8 data signal from your many devices. That means using thingspeak API you can upload 8 data per channel which will eventually gathered, logged and put into a trend data by Thingspeak like this.
[URL of the above page is https://thingspeak.com/channels/279012 ]
…
Uploading on ESP32:
OK, Now everything is set and done by you. Assemble the devices on a piece of general purpose vero board and then insert the USB power supply cord to the ESP32 mini USB plug.
Change / provide the wifi ID and password towards the beginning of the sketch.
Change the thingspeak.com channel number by your channel number and API Key by your API Key
Find the board as “ESP32 Dev Module” from the pull down menu under tools → board , select the right usb port from the pull down menu under tools→ port and now for the magic moment press the upload button. If you have done everything right as per my guidance till now, the computer will start talking with the ESP32 board for some time [depending upon your computer processing power ] and then it will be uploaded and soon the PM2.5 and PM10 data along with BME280 data will start showing up on the OLED screen. The data will also show up in the serial terminal of the computer but it’s more majestic on the OLED screen. Open the thingspeak.com channel on any Internet browser, even your smart phone browser too will work. You will find that data is stacking up beautifully there like this.
BOM:
ILI9341 ... $7.5
ESP32 ... $7.5
SDS011... $20
BME280... $3.7
2N2219 Transistor...$0.3
Total $39
Software: attached.
Aftermath: Since SDS011 runs on 5Volt , we need to provide 5Volt there. We can have 2*3.7 volt Li-Ion and then use a small linear regulator like 7805 to step it down to 5 volt. Alternately there are tiny inverter available at aliexpress.com which can boost voltage from 1.5 to 5 volt level and with that you can manage with one LIPO battery making it a truly portable device.
[instructions to integrate ESP32 on Arduino IDE]
http://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-mac-and-linux-instructions/
http://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-windows-instructions/
Bye, bye
Bera S
Particulate matter: Dust is a silent killer. Ever since the smog pollution of Delhi has hit the headlines, the public awareness about these two particulate matters have become a bone of contention. PM2.5 is particulate matters which is less than 2.5 micron in diameter and PM10 is particulate matters which is less than 10 micron in diameter. That means a PM10 report includes PM2.5 as well. Both these particles are way smaller than a human hair which is about 70 microns in width.
What causes PM10: Crushing and grinding operations like stone crushers, coal grinders, rotary kiln in cement industry, dusts on the roads stirred by moving vehicles. These particles are about 30 times smaller than the width of a human hair and is small enough to get inhaled past our defensive nose hairs and settles into our lungs. Limit of PM10 for 24 hour average is 150 µg/m3
What causes PM2.5: Fine particles produced from all types of combustion, including motor vehicles, thermal power plants, residential wood burning, forest fires, agricultural burning and other industrial processes. While a PM10 ends at our lungs, PM2.5 passes further through alveoli of our lungs and gets mixed into our blood cells and be carried throughout our bodies thereby making them “the invisible killer”. Limit of PM2.5 for 24 hour average is 35 µg/m3.
The common diseases that are caused by these two particulate matters are – Asthma, Influenza, lung-heart-cardiovascular diseases and premature death.
Measurement of PM2.5 & PM10: Since both these particulates are invisible in nature, there measurements are not easy. Big Industries at their factory entrances put up display of many pollutants including these two particulate matters. But as the industries themselves are the big polluter of these particulate matters, most of these readings are tampered. So to have a clear idea of these two parameters, it’s better to develop your own measurement system using cheap yet efficient electronics.
Nova Dust sensor – SDS011: With it’s size, it’s the best and the finest particulate sensor in terms of accuracy & price ($20 , aliexpress.com). It has an UART interface and has a measurement resolution of 0.3μg/m3. Operating voltage is 5V.
RH Correction of PM2.5 & PM10: The PM2.5 & PM10 has a relation with Relative Humidity. Therefore, an RH correction has been placed in the sketch as well to fine tune the readings. For Temperature, pressure and relative humidity we have added a cheap BME280 on I2C bus of ESP32.
SDS011 on ESP8266 & ESP32: Arduino being an advanced technology as on date, almost for anything and everything there is always a library available for any kind of sensors. So for SDS011 too a ready made library is available which uses SoftwareSerial library and works out of the box for UNO and ESP8266 as both these hardwares can use SoftwareSerial library. However, in ESP8266 I could not make it work along with a colored display ILI9361 (128x128).
But my preferred hardware is ESP32 and it doesn't work with SoftwareSerial. It has three UART ports and it uses HardwareSerial for connecting the UART devices. To tackle the problem I studied the existing library and the same command is imitated with the hardwareserial and the PM data started coming from the sensor. These commands are placed in processdata.h file which is to be kept in the same folder of the Arduino sketch and to be compiled together with the main sketch.
Sleep mode of SDS011: As per specification the SDS011 has a sleep current of 2mA. I tried with the sleep commands as stated all over Internet. The sensor worked on sleep mode infrequently – not always to be precise. These commands are also placed in the processdata.h file for you to try. However, I used a GPIO pin (D13) to switch on an NPN transistor (2N 2219) to keep the SDS011 on during the active stage and then it goes into power off mode.
Schematic:
Schematic: Table-1 [ OLED & ESP32 ]
While most of the schematics I’ve shown in the tables ,here’s a hand written sketch of the final assembly of the items.
Final Schematic:
Prototype:
Cloud computing with thingspeak.com: ThingSpeak.com: It’s an open source Internet of Things (IOT) application and API to store and retrieve data from things using the HTTP protocol over the Internet via a LAN. ThingSpeak enables creation of sensor logging applications, location tracking applications and a social network of things with status updates.
That means, If we can send data from our sensors to ThingSpeak at regular interval ,it will create , store and display data in a trend automatically. What more ? it has math modeling inbuilt in the form of Matlab documentation which you can use free!
Getting started:
A. ThingSpeak.com account & Channel set up
The first thing one needs to do is ,open an account and a channel in thingspeak.com for which one needs to have an email account. The site will send a confirmation email , clicking the link in the email will validate the site and the channel will be opened. However, from here on You can create as many channels as you want. The moment you create a channel you get three “thingspeak” identity – channel ID , write API KEY and read API KEY. Note them down as we will require them little later. Meanwhile give some name to the eight data streams in the channels – PM2.5, PM10, ambient temperature, Relative Humidity etc.
B. 8 data per channel: Each channel can take 8 data signal from your many devices. That means using thingspeak API you can upload 8 data per channel which will eventually gathered, logged and put into a trend data by Thingspeak like this.
[URL of the above page is https://thingspeak.com/channels/279012 ]
…
Uploading on ESP32:
OK, Now everything is set and done by you. Assemble the devices on a piece of general purpose vero board and then insert the USB power supply cord to the ESP32 mini USB plug.
Change / provide the wifi ID and password towards the beginning of the sketch.
Change the thingspeak.com channel number by your channel number and API Key by your API Key
Find the board as “ESP32 Dev Module” from the pull down menu under tools → board , select the right usb port from the pull down menu under tools→ port and now for the magic moment press the upload button. If you have done everything right as per my guidance till now, the computer will start talking with the ESP32 board for some time [depending upon your computer processing power ] and then it will be uploaded and soon the PM2.5 and PM10 data along with BME280 data will start showing up on the OLED screen. The data will also show up in the serial terminal of the computer but it’s more majestic on the OLED screen. Open the thingspeak.com channel on any Internet browser, even your smart phone browser too will work. You will find that data is stacking up beautifully there like this.
BOM:
ILI9341 ... $7.5
ESP32 ... $7.5
SDS011... $20
BME280... $3.7
2N2219 Transistor...$0.3
Total $39
Software: attached.
Aftermath: Since SDS011 runs on 5Volt , we need to provide 5Volt there. We can have 2*3.7 volt Li-Ion and then use a small linear regulator like 7805 to step it down to 5 volt. Alternately there are tiny inverter available at aliexpress.com which can boost voltage from 1.5 to 5 volt level and with that you can manage with one LIPO battery making it a truly portable device.
[instructions to integrate ESP32 on Arduino IDE]
http://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-mac-and-linux-instructions/
http://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-windows-instructions/
Bye, bye
Bera S
Diskussion (0 Kommentare)