1. Introduction
There have always been bad time when the dust arrives, that keeps me from playing outside. The PM2.5 can enter into lungs and harm us. I want to use the analyzer to predict the air pollution, and make preparation in advance.
Air pollution analyses based on Intel Edison Board, can gather data from SW-PWM-01 type PM2.5 sensor,
2. Smart Dust Sensor SW-PWM-01
One smart dust sensor of PWM-01 shall be connected with GP14 of Edison GPIO board, optical signal reflected by air dust can shown the numbers of dust in air. as follows,
The dust concentration is in line with low pulse occupancy rate in percent %.
According to the graph the dust concentration can be sensed.
3. Sparkfun Edison GPIO board and Base board are plugged together. The gpio pins can be connected with the SW-PWM-01 by jumper wires.
Wiring as follows, in this case, only GP14 is used as PM2.5, if PM10 shall be needed, GP15 could be used too.
4. Coding
Libmraa shall be installed. It is shipped with edison board in Linux Yocto distribution.
First, lib of MRAA and time shall be imported,
import mraa
import time
Then, set the GPIO pins,
# GP14 for x and GP15 for y
x = mraa.Gpio(36)
x.dir(mraa.DIR_IN)
y = mraa.Gpio(48)
y.dir(mraa.DIR_IN)
time.sleep(0.05)
During the program loop, the edison read the low pulse, and count the numbers.
It feeds back the count into dust concentration and return the data to output services.
while True:
value= 0.0
t_x = 0
t_x2 = 0
TimesOfInt = 0
CntOfLP = 0
reading = 0
if value >= 1:
CntOfLP+=1
TimesOfInt+=1
if TimesOfInt >= 5000:
lastValue = (1-FILTER_A) * CntOfLP + FILTER_A * lastValue
#converting LPO to dust concentration
t_x = lastValue/ 50.0
t_x2 = t_x * t_x
reading = (PARAM_A * t_x2 * t_x + PARAM_B * t_x2 + PARAM_C * t_x + PARAM_D)
print(reading)
CntOfLP = 0
TimesOfInt = 0
time.sleep(1)
5. Since for some reason, the Intel AI SDK are not well installed, it will not be used in this project. Pm2.5 data from Database of Harvard University shall be used based on Intel Deep Learning SDK, to make prediction Model, feed new data to the prediction model for improvement.
With these data, predict the PM2.5 data according to temperature, humidity, seasons and present PM 2.5 data. This prediction can help me make preparation earlier.This prediction can help us to do some research upon PM2.5. That is the work to be done in next step.
Comments