Responsive image
...
Tutorial - Build Your Own Sensor
Version 1 - Educational Kit

We offer you here to build your own sensor to measure air quality. This educational kit invites you to discover the basics of electronics and fine particle measurement using an Arduino UNO microcontroller board and an SDS011 probe. The kit is equipped with a battery to power the different components as well as a screen to visualize the data. Connections are made using small Dupont cables.

This kit is an excellent educational tool that has proven itself during interventions with students in schools, with the general public during events such as Science Fair and even with air quality professionals.

Required Material

Check that you have all the necessary components:

  • Battery (18650) and its charger (TP4056)
  • Arduino UNO microcontroller board
  • Screen (LCD1602 with I2C connector)
  • Fine Particle Probe SDS011
  • Dupont Cables (M-F and F-F 15cm)
  • Mini Breadboard
The above components can be ordered as a kit from AirCarto or purchased separately from sites such as AliExpress or Amazon.

...
Step 1 - Battery and Breadboard

The first step is to connect the + and - of the battery to the breadboard which will serve as an "electrical power strip" to power all the components. For this we use the connections available on the side of the battery always respecting the polarity: + (5V) and - (GND). The "-" pin is located above the "+" pin on the side of the battery. We use the red line for + and the black line for - (GND). Make the connections as shown in the images above using "Male-Female" cables.

Step 2 - Arduino UNO

The second step is to power the Arduino UNO with electricity. For this, connect the + and - on the breadboard using the 2 "Male-Male" cables. Be careful to respect the polarity on the Arduino by connecting the - to a GND pin and the + to the 5V pin. The Arduino starts up and the small red LED lights up.

Step 3 - Screen

Power the screen with electricity using the 5V and GND pins (as for the Arduino). Connect the screen to the Arduino UNO using pins A4 and A5 as shown in the images above. Note that once the connections are made the screen lights up. Restart the Arduino UNO using the small red button located on it, you should see the inscriptions "AirCarto.fr - Sensor Workshop" appear.

Step 4 - Fine Particle Probe

The last step is to connect the fine particle probe. Power the screen with electricity using the 5V and GND pins (as for the Arduino and screen). Connect the probe to the Arduino using pin 10 as shown in the images above. Once the cables are connected the screen may display inconsistent information. Restart the Arduino UNO using the small red button located on it, you should see the inscriptions "AirCarto.fr - Sensor Workshop" appear then a second screen with real-time fine particle measurements

Step 5 - Pollution Storm Challenge!

The screen displays fine particle measurements updated every second. To test your sensor you can wave a scarf or rub your clothes above the air inlet of the sensor to see the dust concentrations increase.

...
Electrical Diagram

In case of doubt, here is the electrical diagram of the connections to be made.

Source Code

In case of purchasing the kit from AirCarto, the code is already present on the Arduino and this step is not necessary. If you have your own material here is the code to upload to the microcontroller. You can also modify the code to your liking if you wish.

                                
/*
Code for Arduino UNO - Educational air quality kit proposed by AirCarto and AtmoSud (2024 version)
More info on the aircarto website: aircarto.fr
Assembly tutorial: https://aircarto.fr/kit_pedagogique/tuto/
Hardware:
1.Arduino UNO
2.Fine particle sensor SDS011 connected to pin 10 (TX)
3.LCD screen 1602 with I2C module connected to pins A4 and A5

You need to install two libraries to make the script work
*/

#include 
#include   //library for LCD screen (LiquidCrystal I2C by Frank de Brandander https://github.com/johnrickman/LiquidCrystal_I2C)
#include              //library for SDS011 sensor (SDS011 sensor Library by R. Zshiegner https://github.com/ricki-z/SDS011)

LiquidCrystal_I2C lcd(0x27,16,2);

float p10,p25;
int error;
bool led_on = true;

SDS011 my_sds;


void setup()
{
Serial.begin(9600);
my_sds.begin(10,11);
pinMode(LED_BUILTIN, OUTPUT);
lcd.init();                      
lcd.init();
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("Sensor Workshop"); //intro message line 2

for (int i = 0; i <= 16; i++) {
  lcd.setCursor(i,1);
  lcd.print("-");
  // we blink the LED
  if(led_on){
    digitalWrite(LED_BUILTIN, LOW);
    led_on = false;
  }else{
    digitalWrite(LED_BUILTIN, HIGH);
    led_on = true;
  }
  delay(200);
}
lcd.clear(); 

delay(1000);
}

void loop()
{
error = my_sds.read(&p25,&p10);
if (! error) {
  //Uncomment next two line for serial debugging output
  //Serial.println("P2.5: "+String(p25));
  //Serial.println("P10:  "+String(p10));
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("PM10: "+ String(p10,1));
  lcd.setCursor(11,0);
  lcd.print("ug/m3");

  // We display here the thresholds according to the atmo index: https://www.atmosud.org/article/comprendre-les-indices-pour-qualifier-lair
  if(p10<=20){ 
      lcd.setCursor(6,1);
      lcd.print("GOOD"); 
  }
   if(p10>20 && p10<=40){
      lcd.setCursor(5,1);
      lcd.print("FAIR"); 
  }
   if(p10>40 && p10<=50){
      lcd.setCursor(4,1);
      lcd.print("POOR"); 
  }
   if(p10>50 && p10<=100){
      lcd.setCursor(4,1);
      lcd.print("BAD"); 
  }
   if(p10>100 && p10<=150){
      lcd.setCursor(4,1);
      lcd.print("VERY BAD"); 
  }
  if(p10>150 ){
      lcd.setCursor(4,1);
      lcd.print("EXTRM. BAD"); 
  }
  
if(led_on){
    digitalWrite(LED_BUILTIN, LOW);
    led_on = false;
  }else{
    digitalWrite(LED_BUILTIN, HIGH);
    led_on = true;
  }
  }
delay(200);
}

                                
                        
Frequently Asked Questions

Charging the battery is very simple. On the left side of the battery, you will find a micro-USB or USB-C port for charging.

Charge states:
  • Red LED: Battery charging
  • Red + green LED: Battery fully charged
Battery charging

Charge indicators on the battery

The initial code has been optimized to display only the essential. We chose to display only PM10 because these are the particles most commonly measured in official air quality indices.

It is quite possible to display both measurements (PM2.5 and PM10) by modifying the code. Here is the modified code to use:


void loop()
{
error = my_sds.read(&p25,&p10);
if (! error) {
  lcd.clear();
  
  // PM10 display line 1
  lcd.setCursor(0,0);
  lcd.print("PM10:" + String(p10,1));
  lcd.setCursor(11,0);
  lcd.print("ug/m3");

  // PM2.5 display line 2
  lcd.setCursor(0,1);
  lcd.print("PM2.5:" + String(p25,1));
  lcd.setCursor(12,1);
  lcd.print("ug/m3");
  
  if(led_on){
    digitalWrite(LED_BUILTIN, LOW);
    led_on = false;
  }else{
    digitalWrite(LED_BUILTIN, HIGH);
    led_on = true;
  }
}
delay(200);
}
                                            
Result: With this code, the screen will display both types of particles simultaneously!

If your screen appears blank or has a very low brightness, it can be due to two main reasons:

Possible causes:
  • Battery is not sufficiently charged – ensure the battery is fully charged before powering the Arduino and screen.
  • Screen contrast is not adjusted properly – there is a small blue potentiometer screw under the LCD screen; turn it carefully to adjust the contrast.
Adjusting LCD contrast

Adjust the small blue screw under the LCD to modify the contrast.

The displayed thresholds follow the French ATMO index:

GOOD
0-20 μg/m³
FAIR
21-40 μg/m³
POOR
41-50 μg/m³
BAD
51-100 μg/m³
VERY BAD
101-150 μg/m³
EXTREMELY BAD
> 150 μg/m³

The SDS011 sensor uses laser light scattering to detect and count particles suspended in the air. A fan draws air through the measurement chamber where a laser beam illuminates the particles. A photodetector then measures the scattered light to calculate the concentration of PM2.5 and PM10 particles.

SDS011 Sensor

To modify the Arduino code, simply connect the Arduino to your PC and modify the code via the Arduino IDE. Here's how to proceed:

Basic steps:
  1. Download and install the Arduino IDE on your computer
  2. Connect the Arduino to your PC with a USB cable
  3. Open the Arduino IDE and select the correct board type and port
  4. Write or modify your code
  5. Click "Upload" to send the code to the Arduino
Recommended tutorial videos:
Arduino IDE - First Program

Complete tutorial to get started with Arduino IDE and upload your first code.

Arduino Programming for Beginners

Learn the basics of Arduino programming step by step.

If your sensor displays abnormally high fine particle readings, this can be due to two main causes:

Possible causes:
  • Low battery charge - A discharged battery poorly powers the PM sensor, which can distort measurements and give aberrant values.
  • Dirty sensor - The fine particle sensor may be dirty or clogged, which disrupts the laser operation and gives erroneous measurements.
Solutions:
  • Fully charge the battery before use
  • Gently clean the air inlet of the SDS011 sensor with a brush or compressed air
  • Restart the Arduino after performing these checks
Normal readings displayed

Example of normal readings displayed on screen