Hello everyone,
Throughout the years, Werk_AG has been developing a powerful weather station, with advanced capabilities and always more variables to measure.
In an attempt to add my little stone to this already great project, I’d like to propose to measure something I experience from time to time where I live.
I live in Singapore for a few years already, and at certain periods of the years, the city and its whereabouts are surrounded by an unpleasant smell coming from the forests on fire mainly from Indonesia. This phenomenon is named the “haze”.
What is the haze? Well, imagine you are caught in the middle of a big fire (or simply at the back of your garden) and you smell this strong odor of burnt wood; well, this is what the haze is about..
A more comprehensive definition here
Where is it coming from? Well, transboundary haze in Southeast Asia has been recorded since 1972. The haze is largely caused by illegal agricultural fires due to industrial-scale slash-and-burn practices in Indonesia, especially from the provinces of South Sumatra and Riau in Indonesia's Sumatra island, and Kalimantan on Indonesian Borneo.
So every year, Singapore “swims” in the haze. It’s of course not healthy and prevents outdoor activities.
What can we do about it? Mmm though this is illegal, every year seems to repeat itself, and farmers in Indonesia keep burning their plantations. When it happens, better closing doors and windows. After, this is a political matter too..
Anyway, the National Environment Agency (NEA) maintains information (http://www.haze.gov.sg) on the quality of the air in the city and offers a full range of measures – the most popular being the PSI index.
The PSI reflects a total of six pollutants - sulphur dioxide (SO2), particulate matter (PM10) and fine particulate matter (PM2.5), nitrogen dioxide (NO2), carbon monoxide (CO) and ozone (O3).
What is a matter of interest is actually the 1-hr PM2.5. Particulate matter, or PM, is the term for particles found in the air, including dust, dirt, soot, smoke, and liquid droplets. The problem is that particles less than 10 micrometers in diameter (PM10) pose a health concern due to possible inhalation and accumulation in the respiratory system. Particles less than 2.5 micrometers in diameter (PM2.5) are referred to as "fine" particles and can lodge deeply into the lungs.
So I have decided to also measure the PM2.5. I had bought this sensor a long time ago but never really found the time to do so. Now that my Weatherduino Pro2 upgrade is done, I finally did it!
The theory
There are a few sensors on the market capable of measuring PM2.5; I eventually decided to get the Sharp DN7C3CA006 module (full specs here). Note that it also exists the Sharp GP2Y1010AU0F, but this one does not incorporate a fan (more on this later).
It is equipped with a particle separator, which uses the air pressure of a fan and passes micro particulate matters (PM2.5) to the dust sensor that detects micro particulate matters.
The bloc diagram is as follows:
![[Image: SharpBlocDiag.jpg]](http://oaphotographies.com/weatherduino/images/SharpBlocDiag.jpg)
Driving the sensor is simple and needs a PWM signal to power on the internal LED. Later, we need to measure the sensor output.
![[Image: SharpDriver.jpg]](http://oaphotographies.com/weatherduino/images/SharpDriver.jpg)
This module outputs a voltage that changes with the particle volume concentration (μm/m3) of dusts in the atmosphere. It won’t measure the mass concentration (μg/m3) that is what we are interested in. However, with a simple formula, it is possible to approximate the mass concentration.
The measurement range is 25-500μm/m3 and is good enough.
To convert the volume to a mass concentration, there are two steps:
1. We need to get a reference voltage.
This can be obtained either by storing a reference voltage (Vs) in an environment with less dust (a clean box for instance) or by storing a reference voltage (Vs) corresponding to state where particles fall by gravity (using a fan). We are going to use the second method here.
Note: that's why I did not opt for the Sharp GP2Y1010AU0F as it does not have a fan.
2. Measure the Δ voltage[mV] (Vo[mV] – Vs[mV]) between the reference voltage(Vs) and the output voltage (Vo) when the fan is turned on.
Then it is possible to approximate the PM2.5 level by use following conversion formula:
PM2.5 level (μg/m3) = α × β ×(Vo[mV] – Vs[mV])
Where:
α: Conversion factor in the true environment. Recommendation : 0.6
β is the humidity factor(h=humidity(%)) given by:
β = {1-0.01467 * (h-50)} if h>50
or
β=1 if h≦50
![[Image: ConversionFormula.jpg]](http://oaphotographies.com/weatherduino/images/ConversionFormula.jpg)
So you see me coming; we are now all set to measure the PM2.5 with an arduino and a few components!
The practice
I have setup a working prototype using an arduino nano and a breadboard.
The prototype looks like this:
![[Image: IMG_5953.JPG]](http://oaphotographies.com/weatherduino/images/IMG_5953.JPG)
The corresponding code is here below.
Results:
Today the haze was about 50μg/m3 according to the NEA. The measures taken with the prototype must be averaged over an hour to be comparable with the NEA figures.
However I do not expect a perfect match – this matter being very sensitive in Singapore (and how much the governement does to fights against the haze), that’s exactly why I wanted to build this prototype!!
I tried to catch some air outside with a plastic bag and exposed it to the sensor.
![[Image: IMG_5949.JPG]](http://oaphotographies.com/weatherduino/images/IMG_5949.JPG)
Results are not bad!
![[Image: IMG_5952.JPG]](http://oaphotographies.com/weatherduino/images/IMG_5952.JPG)
So, on average 20μg/m3, but it would be worth repeating the exercise outside when the haze is higher, over an hour and taking the average.
What about the Weatherduino Pro2?
Now I need to incorporate this measures into my existing setup. I was thinking using the Leaf/Soil Interface inputs or the extra sensors?
I have not yet figured out yet how but I'm open to any suggestion!
I hope this was interesting
I tried to show how we can improve the Weatherduino capabilities with some cool sensor.
Regards,
Zitoune
Throughout the years, Werk_AG has been developing a powerful weather station, with advanced capabilities and always more variables to measure.
In an attempt to add my little stone to this already great project, I’d like to propose to measure something I experience from time to time where I live.
I live in Singapore for a few years already, and at certain periods of the years, the city and its whereabouts are surrounded by an unpleasant smell coming from the forests on fire mainly from Indonesia. This phenomenon is named the “haze”.
What is the haze? Well, imagine you are caught in the middle of a big fire (or simply at the back of your garden) and you smell this strong odor of burnt wood; well, this is what the haze is about..
A more comprehensive definition here
Where is it coming from? Well, transboundary haze in Southeast Asia has been recorded since 1972. The haze is largely caused by illegal agricultural fires due to industrial-scale slash-and-burn practices in Indonesia, especially from the provinces of South Sumatra and Riau in Indonesia's Sumatra island, and Kalimantan on Indonesian Borneo.
So every year, Singapore “swims” in the haze. It’s of course not healthy and prevents outdoor activities.
What can we do about it? Mmm though this is illegal, every year seems to repeat itself, and farmers in Indonesia keep burning their plantations. When it happens, better closing doors and windows. After, this is a political matter too..
Anyway, the National Environment Agency (NEA) maintains information (http://www.haze.gov.sg) on the quality of the air in the city and offers a full range of measures – the most popular being the PSI index.
The PSI reflects a total of six pollutants - sulphur dioxide (SO2), particulate matter (PM10) and fine particulate matter (PM2.5), nitrogen dioxide (NO2), carbon monoxide (CO) and ozone (O3).
What is a matter of interest is actually the 1-hr PM2.5. Particulate matter, or PM, is the term for particles found in the air, including dust, dirt, soot, smoke, and liquid droplets. The problem is that particles less than 10 micrometers in diameter (PM10) pose a health concern due to possible inhalation and accumulation in the respiratory system. Particles less than 2.5 micrometers in diameter (PM2.5) are referred to as "fine" particles and can lodge deeply into the lungs.
So I have decided to also measure the PM2.5. I had bought this sensor a long time ago but never really found the time to do so. Now that my Weatherduino Pro2 upgrade is done, I finally did it!
The theory
There are a few sensors on the market capable of measuring PM2.5; I eventually decided to get the Sharp DN7C3CA006 module (full specs here). Note that it also exists the Sharp GP2Y1010AU0F, but this one does not incorporate a fan (more on this later).
It is equipped with a particle separator, which uses the air pressure of a fan and passes micro particulate matters (PM2.5) to the dust sensor that detects micro particulate matters.
The bloc diagram is as follows:
![[Image: SharpBlocDiag.jpg]](http://oaphotographies.com/weatherduino/images/SharpBlocDiag.jpg)
Driving the sensor is simple and needs a PWM signal to power on the internal LED. Later, we need to measure the sensor output.
![[Image: SharpDriver.jpg]](http://oaphotographies.com/weatherduino/images/SharpDriver.jpg)
This module outputs a voltage that changes with the particle volume concentration (μm/m3) of dusts in the atmosphere. It won’t measure the mass concentration (μg/m3) that is what we are interested in. However, with a simple formula, it is possible to approximate the mass concentration.
The measurement range is 25-500μm/m3 and is good enough.
To convert the volume to a mass concentration, there are two steps:
1. We need to get a reference voltage.
This can be obtained either by storing a reference voltage (Vs) in an environment with less dust (a clean box for instance) or by storing a reference voltage (Vs) corresponding to state where particles fall by gravity (using a fan). We are going to use the second method here.
Note: that's why I did not opt for the Sharp GP2Y1010AU0F as it does not have a fan.
2. Measure the Δ voltage[mV] (Vo[mV] – Vs[mV]) between the reference voltage(Vs) and the output voltage (Vo) when the fan is turned on.
Then it is possible to approximate the PM2.5 level by use following conversion formula:
PM2.5 level (μg/m3) = α × β ×(Vo[mV] – Vs[mV])
Where:
α: Conversion factor in the true environment. Recommendation : 0.6
β is the humidity factor(h=humidity(%)) given by:
β = {1-0.01467 * (h-50)} if h>50
or
β=1 if h≦50
![[Image: ConversionFormula.jpg]](http://oaphotographies.com/weatherduino/images/ConversionFormula.jpg)
So you see me coming; we are now all set to measure the PM2.5 with an arduino and a few components!
The practice
I have setup a working prototype using an arduino nano and a breadboard.
The prototype looks like this:
The corresponding code is here below.
Code:
/***********************************************************************************
2.5ppm Sensor Reader
Version: : 1.0
Version Release date : 26/08/2016
Last revision date : 27/08/2016
This program uses a Sharp DN7C3CA006 module to measure the volume concentration of
2.5ppm particules using a light scattering method. The module irradiates atmospheric
dust going along the sensor with a LED and detects the borrowed light.
The voltage changes by reflected light. The output voltage change as a particle
volume concentration (μm/m3) of dusts in the atmosphere. It is necessary to convert
the volume concentration toobtain the mass concentration (μg/m3).
**************************************************************************************/
// --------------------------------------------------------------------------------------
// Hardware input/output pins
// --------------------------------------------------------------------------------------
int SensorPin = 0; // Seonsor output connected to A0
int PowerLEDPin = 12; // LED power connected to D12
int PowerFanPin = 8; // Fan power connected to D8
// --------------------------------------------------------------------------------------
// General global variables
// --------------------------------------------------------------------------------------
// Pulse sampling timing caracteristics: Pw = 320ms; T=10ms
int RisingTime = 280; // Pulselenght of 0.28ms to power the LED
int deltaTime = 40; // time left after pouwer up to read the value
int sleepTime = 9680; // T = 10000ms-320ms=9680ms
int countReading = 30; //reading counter
float countMeasure = 100; //number of sensor measures
float VsRead = 0;
float humidity = 80; //humidity level (coming from WeatherDuino Pro2)
float alpha = 0.6; //alpha factor (recommended value) to derive teh mass concentration
float beta = 0; //beta factor, humidity dependant, to measure the mass concentration
float VsOutput = 0;
float VsFinal = 0;
float V0 = 0; // Stores measured output (0-1023) from sensor
float SensorOut = 0; // actual voltage output from sensor
float V0Sensor = 0;
float V0SensorFinal = 0;
float DustDensity = 0; // dust density [ug/m3]
float Vs = 0; // Vs reference value
// --------------------------------------------------------------------------------------
// Sensor calibration function to compute a reference for Vs when fan is OFF
// Vs reference will be computed upon startup by averaging countReading measures
// --------------------------------------------------------------------------------------
void setup() {
Serial.begin(9600);
pinMode(PowerLEDPin, OUTPUT); //declare LED output
pinMode(PowerFanPin, OUTPUT); //declare Fan output
digitalWrite(PowerFanPin, LOW); // power off Fan to begin measurement
delay(2000);
for (int i = 0; i <= countReading; i++) {
delay(1000);
digitalWrite(PowerLEDPin, LOW); // power on the LED
delayMicroseconds(RisingTime); //Wait RisingTime before reading V0output
VsRead = analogRead(SensorPin); // read the sensor output
delayMicroseconds(deltaTime); //Wait deltaTime before powering off the LED
digitalWrite(PowerLEDPin, HIGH); // power off the LED
VsOutput = VsRead * 5.0 / 1024.0; // Calculate actual voltage [V]
VsFinal = VsFinal + VsOutput; //Adding up all read voltages
Serial.print(" Vs Output [mV]: "); // Print Vs Output to see progress
Serial.print(VsOutput*1000); // print mV
Serial.print(" VsTotal [mV]: "); // Print Vs Total to see progress
Serial.println(VsFinal*1000);
}
Vs = VsFinal / (countReading) * 1000.0; //Calculate reference value (Vs)
digitalWrite(PowerFanPin, HIGH); // power on Fan
delay(2000);
Serial.print(" VsFinal [mV]: ");
Serial.print(Vs);
}
// --------------------------------------------------------------------------------------
// Main Program
// --------------------------------------------------------------------------------------
void loop() {
measurement();
}
// --------------------------------------------------------------------------------------
// Measurement Function
// V0 is computed and compared to Vs to compute the mass concentration
// --------------------------------------------------------------------------------------
void measurement() {
V0Sensor = 0;
V0SensorFinal = 0;
for (int i = 0; i < countMeasure; i++) {
delay(100);
digitalWrite(PowerLEDPin, LOW); // power on the LED
delayMicroseconds(RisingTime); //Wait RisingTime before reading V0output
V0Sensor = analogRead(SensorPin); // read the sensor output
delayMicroseconds(deltaTime); //Wait deltaTime before powering off the LED
digitalWrite(PowerLEDPin, HIGH); // power off the LED
V0SensorFinal = V0SensorFinal + V0Sensor;
}
SensorOut = V0SensorFinal / countMeasure; // measure the average on countMeasure
V0 = SensorOut * (5.0 / 1024.0) * 1000.0; // Output voltage V0 converted
if (humidity < 50) { // We take into account the humidity level to compute beta factor
beta = 1;
} else {
beta = 1 - 0.01467 * (humidity - 50);
}
if (V0 > Vs) {
DustDensity = alpha * beta * ((V0 - Vs)) * 5.0 * 1000.0 / 1024.0;
} else {
DustDensity = 0;
}
Serial.print(" | Dust density [μg/m3]:");
Serial.println(DustDensity);
delay(2000); // Delay before next reading
}Results:
Today the haze was about 50μg/m3 according to the NEA. The measures taken with the prototype must be averaged over an hour to be comparable with the NEA figures.
However I do not expect a perfect match – this matter being very sensitive in Singapore (and how much the governement does to fights against the haze), that’s exactly why I wanted to build this prototype!!
I tried to catch some air outside with a plastic bag and exposed it to the sensor.
Results are not bad!
So, on average 20μg/m3, but it would be worth repeating the exercise outside when the haze is higher, over an hour and taking the average.
What about the Weatherduino Pro2?
Now I need to incorporate this measures into my existing setup. I was thinking using the Leaf/Soil Interface inputs or the extra sensors?
I have not yet figured out yet how but I'm open to any suggestion!
I hope this was interesting
I tried to show how we can improve the Weatherduino capabilities with some cool sensor.Regards,
Zitoune



