Nowadays, air pollutionis omnipresent and more particularly in our cities. Large cities are prey all year with pollution levels sometimes reaching (and often for certain) levels very dangerous to human health. Children are extremely sensitive to the quality of the air they breathe. This polluted air leads to them, among other allergy problems. The air is polluted outside our home, but also at levels of the most important times, inside our homes and cars.
The air quality level is available at the following site. This Chinese site gathers all the air quality measurements of the sensors of the whole mode. The air quality level is formatted according to an AQI index, which may vary slightly from one country to another. This document explains how to calculate this index. This other document is an understanding guide.
In order to know the quality of the air we breathe, wherever we go and in real time, I set about creating a portable atmospheric particle counter (which we will call CPA later). , able to fit in the pocket.
It was created for:
- Hold in the pocket.
- Have a great autonomy of operation.
- Be easy to understand
- Can save the measurements on PC.
- To be rechargeable.
- To be able to access it with your phone without the presence of the local networks of Wifi communication.
- Be able to control an air purification device if the pollution exceeds a certain threshold.
- Size: 65x57x23mm
- Measured particles: PM1, PM2.5 and PM10
- Autonomy: between 3 hours and several weeks depending on the chosen operating mode.
- Lithium-ion battery 3v7 - 680 mAh
- Micro USB interface for charging and data transfer.
- Memory of 2038 measurements (680 per type of PMxx)
- Sampling period: continuous, 5min, 15min, 30min, 1h
- 3v3 command output according to pollution level.
- Multicolored LED interface for ease of understand
- Control interface on PC, tablet, phone (Android, iOS) via Wifi.
Step 1: The Prototypes of Box
I began by thinking about the shape that I could give the box, inspired by modern designs of objects.
Here are some drawn boxes.
In the end, I chose the simplest case to make and the smallest : see the main photo on this instructable.
Step 2: Card Prototypes
I have in all 3 prototype cards. But only 2 are visible here.
The prototypes have made it possible to develop the 5V and 3v3 power supplies. These were difficult to develop because I had to find the components to obtain the power needed to start the WiFi microcontroller (ESP8266 - 12). The electronic charging part of the Lithium-ion battery was faster to operate.After, I changed several times the location of the various switches and connectors for good ergonomics of the device.
Step 3: The Box
The LEDs are visible by transparency through the housing. The air inlets are on the left side of the case. On the right side we find :
- The display mode selection button.
- The on / off switch.
- The selection switch for transferring measurements to the PC. It allows switching between a serial link between the ESP8266 and the particle sensor or between the ESP8266 and the micro USB port. Attention, if this one is not well positioned, the communication between the electronic card and the sensor will not be assured anymore and the CAP will not be able to start correctly.
- The micro USB socket for recharging the battery or serial protocol transfer measures.
Step 4: The Sensor
I tested two different sensors. The SDS011 V1.2 PM2.5 Laser sensor from Nova Fitness Co. Ltd. (doc) with the usb serial interface key.
The other sensor (metalic case) is PMS7003M from PLANTOWER (doc).
This is the one I use in my case. It is able to measure the concentration of fine particles of less than 1μm (PM1); less than 2.5μm (PM2.5) and less than 10μm (PM10). The operating principle of the PSM7003M sensor is as follows: a laser illuminates the dust of the air. An optical sensor captures the laser light and generates an electrical signal proportional to the rate and size of dust in the air.
Its characteristics are show in the table of characteristic.
Step 5: Mounting
There is just the place of the battery on the side of the sensor.
Step 6: Operation
The heart of the system is the ESP8266 (type ESP-12F). This microcontroller is equipped with a Wifi transmitter. The ESP8266 is available in several variants. The ESP8266 communicates with the PMS7003 sensor via serial link. It recovers the particle concentration values and the number of particles. Then, it calculates the index of quality AQI, If the mode of control of the output is in "Automatic" and the level of pollution in PM2.5 is higher than 50 (indexe of quality of the air AQI PM2.5 > 50), the output is set high (3v3). Otherwise, it is set low (0v).
The ESP8266 is configured in Access Point -> AP (Wifi point). That is, it is recognized as a Wifi terminal on which the phone can connect. The phone must select this Wifi terminal and enter the code APPSK (a bit like a WEP code of an ADSL box) to access it. Then, the phone enters the IP address to reach. Here it will be 192.168.4.1. Then, the web page is displayed on the phone, from which one controls the box and visualizes the pollution values. The APPSK code configured in the program is "AQI_index". The APPSK code can be modified by the programmer because it is contained in the program loaded in the ESP8266. The address to load the integrated web page is: "192.168.4.1".
The ESP8266 measures the battery voltage. If it is below its limit voltage (3v2 = 0%), the device is put in standby. The battery is 100% when the voltage is 4v2.
The ESP can store up to 2038 samples of PM1, PM2.5 and PM10 particle concentration value. About 680 samples per particle size. These measurements can be downloaded by connecting a cable equipped with a USB / Serial converter and launching the transfer via the embedded application. The values of the transferred samples are normalized as follows to save memory space:
- PM1: (μg / cm3) / 5
- PM2.5: (μg / cm3) / 5
- PM10: (μg / cm3) / 6
To find the right concentration value, then multiply the value by 5 or 6 depending on the case.
Step 7: Web Interface 1/4
It is the interface available after connection between the CPA and the telephone. It allows to visualize the microparticle concentration values for PM1, PM2.5 and PM10, in μg / m3. The index of air quality is AQI, represented by a number and a literal expression, according to the table of definition of the AQI index.
There is also the battery gauge.
A section is dedicated to the automatic control of the output of control of the CPA, under the name of Fan Configuration. After the ":" of the section title, the current mode is displayed (Automatic, Start, Stop). At the base, this output would control an air purification device (fan = fan). It is thus possible to force on or off, or leave it in automatic mode with a trip when the air exceeds an AQI index of 50.
A section is dedicated to the "Measure config" measurement. After the ":" is indicated the current mode (continued, periodic 5min, 15min, 30min, 1h, stop). It is thus possible to take measurements continuously (in fact the sampling period is close to 2 seconds), or every 5, 15, 30 min, 1h, or stop sampling.
The section "Display Mode" allows to choose how the information (all those available on the web interface) will be displayed on the box via multicolored LEDs. After the ":" is indicated the current mode (Compiled, PM1.0, PM2.5, PM10). Each press of "Display Mode" switches from one display mode to another in the following order:
Step 8: Web Interface 2/4
The meaning of the LED color in "Compiled" mode is as follows:
- > 30% = green
- > 10% and <30%: orange
- <10% = red
- > 30% = green
- > 10% and <30%: orange
- <10% = red
- High output: green
- Low output: red
- Automatic control mode: blue
Step 9: Web Interface 3/4
Output PM1.0, PM2.5 and PM10:
The color of the LED is that corresponding to the color table of the AQI index. The meaning of the color of the 10 LEDs in "PM1.0, PM2.5, PM10" mode is as follows:
- The color of the LEDs represents the level of air pollution as indicated in the table of the AQI index. For example, if the LEDs are red, it means that the level of pollution is bad for health.
- The number of LEDs lit represents the value of the AQI index for the color in question, as indicated in the table of the AQI index. For example, if there is only one green LED on 10, the index is 1 / 10th of the maximum green index, ie 50/10 = 5. If 5 green LEDs on 10, the value is 50 / 10x5 = 25. If 5 purple LEDs are lit, the value is (300-201) /10x5+201=250.5.
- Each time the push button is pressed, one of the 4 LEDs on the right flashes orange. It indicates which is the selected display mode:
Step 10: Web Interface 4/4
The "Data Remaining" section indicates the remaining memory space for saving the measurements. After the ":" is indicated the remaining %. Pressing the "clear memory" button erases the memory. Pressing the "download" button starts the transfer of the samples to the PC.
At the end of the web interface, the table of the AQI index is displayed.
Step 11: Getting Started
- Switch the On / Off switch to the On position.
- A rainbow of LEDs appears to make sure all the LEDs work .... and then it's pretty.
- The turquoise LEDs light up one after the other. This allows the particle sensor time to initialize.
- One of the LED display modes appears.
- On the phone or PC, choose the Wifi network starting with "AQI_I3D-"
- Enter the code "AQI_index"
- Open for example Google and type in the address bar: 192.168.4.1
- The web page is displayed
Step 12: Transfer of Data to the PC
To transfer the data from the box to the PC you must:
- Connect a micro USB cable / serial link (3v3 voltage level) to USB PC.
- Open a serial terminal on the PC and configure it as follows: 9600 BAUDS, 1 stop bit, parity NONE, 1 start bit.
- Switch the micro switch "enable data upload"
- On the interface, press "Download"
- On the serial terminal, wait for the end of transfer and copy the data.
- Switch the micro switch "enable data upload" to the original position
If the CAP appears not to work, it is possible that the switch is not put back in place.
Step 13: Standby Between Sampling Phase
In the 5min, 15min, 30min, and 1h sampling modes, the CAP automatically goes into sleep after taking its measurement sample and does not wake until 5, 15, 30, or 60 minutes later. The autonomy of the CAP is thus extremely increased.
Step 14: Reset to Factory Mode
In the case where the CAP has some operating problems, it is possible to reset all operating parameters and restart the CAP reliably. For that :
- Turn off the CAP Stay on the push button Light the CAP.
- The rainbow of LED appears
- A turquoise LED strip appears in less than a second
- Turn off the CAP
- The CAP is now reset.
Step 15: The Program Under Arduino
To program the card it is necessary:
- Open Arduino on the PC
- Configure Arduino for the ESP8266 board
- Connect the UBS Micro USB / Serial Cable (3v3) between the card and the PC
- Toggle the SW3 button to "prgm"
- Stay on the "SW1" button
- Switch on the device -> The device enters programming mode
- Releasing "SW1"
- Under Arduino, start programming
- After the end of programming, switch "SW3" to "SW3"
- Shut down and restart the device
Step 16: Electrical Diagrams
Step 17: PCB
Step 18: Nomenclature
Step 19: Do It Yourself
Step 20: And More ...
The next step is to associate the device with an ionizer. So that the air is polluted, the device starts the ionizer, An ionizer allows somehow to drop the fine particles on the ground. It generates negative electrons that associate with surrounding gas and dust, turning their positive electric charge into a negative charge. As the ground and most objects have a positive charge, the negatively charged particles by the ionizer are attracted and sticks to them. The air is thus cleaned up. The ionization of the air is also a lot of other health benefits.
Today, the ionizer works. This presentation will be the subject of an upcoming blog.
This is an entry in the
Epilog X Contest