
When we are talking about air pollution, dust and smoke are one of the many reasons for air pollution. Not only that, in recent years, due to climate change, wildfires have become more frequent. A recent report from the National Interagency Fire Center (NIFC) reported a total of 58,733 wildfires across the US that had burned more than 7.13 million acres in 2021 alone. With climate change driving more frequent wildfires—the National Interagency Fire Center (NIFC) reported 58,733 wildfires burning over 7.13 million acres in 2021 alone—having reliable dust sensor Arduino solutions is essential. That is why in this article, we are going to interface the GP2Y1014AU0F Dust Sensor with Arduino to add basic particle sensing to our project. But let's be real, this sensor is not as good as the Nova SDS110 Sensor, which can measure PM2.5 and PM10 in the air. However, for the price of only 5$ or approximately 400Rs, it can't be beaten. This comprehensive tutorial covers interfacing the GP2Y1014AU0F dust sensor with Arduino, including detailed pinout diagrams, programming code, and practical projects.
Table of Contents
Dust Sensor GP2Y1010AU0F Key Features
∗ Low Budget: An economical alternative to costly PM sensors
∗ Simple Interface: One analog output, making Arduino integration straightforward
∗ Dependable Detection: Dust and smoke optical sensing technology
∗ Compact Design: Small size ideal for mobile projects
∗ Versatile Uses: Air quality monitoring, HVAC, and industrial automation
GP2Y1014AU0F Dust Sensor Pinout
The GP2Y1014AU0F Dust Sensor module has 6 pins; those are V-LED, LED-GND, LED, S-GND, VOUT, and VCC. The output of this sensor is analog, and we need to connect this pin to the ADC of a microcontroller to measure the PM in the air. The Pinout of the GP2Y1014AU0F Dust Sensor is shown below:
Pin Connection Details
The GP2Y1014AU0F dust sensor pinout consists of 6 essential pins for proper Arduino interfacing:
V-LED This is the VCC pin of the LED. Connect this pin to the 5V pin of the Arduino with a 150Ω Current Limiting Resistor.
LED-GND This is the Ground Pin of the LED. Connect this pin to the Ground pin of the Arduino.
LED This Pin can be used to toggle the LED On/Off. Connect it to any digital pin of Arduino.
S-GND is the ground pin of the pulse Dust Sensor module, and it should be connected to the ground pin of the Arduino.
VoutThis is the output of the Dust Sensor Module; you can connect it to any analog pins of the Arduino.
VCC Power Pin of the Dust Sensor Module connects to the 5V or 3.3V pin of the Arduino.
How Does a GP2Y1014AU0F Dust Sensor Module Work?
The working of the GP2Y1014AU0F Dust sensor is simple and easy to understand. The GP2Y1014AU0F dust sensor employs optical detection technology with three core components they are the light-emitting diode(light source), the photodiode(detector), and a pair of lenses. The LED and the Photodiode inside the sensor are so placed that the two optical axis cross the detection area in the sensor. When dust or smoke enters the detection area of the sensor, the light inside the sensor gets reflected from the dust or smoke; as a result, the current generated by the photodiode varies in accordance with the amount of the detected light. And by converting and amplifying the current value to a voltage value with proper circuitry, we get the desired output from our sensor.
To work with the sensor, you need only two pins out of all six pins. The first one triggers the LED, and the second one puts out the analog signal from the sensor. Resistor, R1=150Ω, and capacitor, C1=220uF mentioned above are required for the pulse drive of the LED. Without the resistor and the capacitor, the module does not work. To get the desired data out of the sensor, you need to trigger the LED with a 10ms pulse, in which the pulse width should not be more than 0.32ms. And as recommended by the datasheet, we should sample the signal after 0.28ms, after the trigger pulse is provided to the LED.
GP2Y1014AU0F Dust Sensor Module – Parts
The construction of the sensor makes it difficult to mark all the major components of the sensor in one image, and that is why we have divided the parts marking of the GP2Y1014AU0F sensor into two.
In the above image, you can see the PCB inside the sensor module when the front cover is open. The PCB has the main processor IC to process the data out of the photodiode, a potentiometer, and a transistor that drives the LED. Other than that, we have a JST connector for VCC, ground, and output data.
The above image shows how the sensor looks when you tear it down. On the left-hand side, we have the enclosure of the sensor module, and on the right-hand side, we have the backside of the PCB. On the PCB, you can see the LED and the photodiode attached, and in front of both the LED and photodiode, you can see the lenses that focus the light beam.
Commonly Asked Questions about the Dust Sensor Module
⇥ What is the difference between a dust sensor and a PM2.5 sensor?
PM2.5 refers to particles that are 2.5 microns or smaller in diameter. This sensor uses laser scattering to radiate suspending particles in the air, then collects scattering light to obtain the curve of scattering light with time. The dust sensor uses a photodiode to detect the dust.
⇥ What is the difference between an optical dust sensor and a laser dust sensor?
A laser dust sensor is a kind of sensor that uses laser technology to measure dust concentration. It consists of a fan, a laser diode, a receiver, and a measuring circuit. But in an optical dust sensor, an infrared emitting diode and a phototransistor are diagonally arranged to allow it to detect the reflected light of dust in the air.
⇥ How do you test a dust sensor?
To test a dust sensor, you need to add in proper pulse driver circuitry that is recommended by the datasheet of the particular device that you are using, and then you need to sample and calculate output data with your microprocessor or microcontroller.
⇥ Can I wire multiple GP2Y1014AU0F sensors to one Arduino?
Yes, you can connect multiple sensors with each sensor wired to its own analog pin, and each to its own LED control pin. Then, to combat interference between the sensors, you'll implement time-division multiplexing. If you'll use more than 2-3 sensors, we recommend you use an Arduino Mega due to the limited number of pins.
⇥ What is the difference between GP2Y1014AU0F and PM2.5 sensors?
PM2.5 sensors are very accurate sensors that use laser scattering technology that specifically measure particles ≤2.5 microns. GP2Y1014AU0F is a general dust sensing component that detects the presence of dust using infrared LED detection with a far less approximation but lower cost, which makes GP2Y1014AU0F okay for basic Air Quality monitoring projects.
⇥ What is the accuracy of the sensor compared to a professional air quality monitor?
The GP2Y1014AU0F has a ±15% accuracy in ideal conditions, so it is fine for monitoring relative measurements and trends. Professional air quality monitors have a ±5% accuracy that uses a calibrated reference as part of their technology to provide accurate or "absolute" readings of air quality concentrations. If your research applications need to be scientifically rigorous, you should use certified instruments. This sensor is fine for educational aspects and basic monitoring.
Arduino GP2Y1014AU0F Dust Sensor Circuit Connection Diagram
Now that we have a complete understanding of how a GP2Y1014AU0F Dust Sensor works, we can connect all the required wires to the Arduino and then write our code to get the data out of the sensor module. The Connection Diagram of the GP2Y1014AU0F Dust Sensor with Arduino is given below.
Connecting the GP2Y1014AU0F Dust Sensor with Arduino is really simple and easy. As we know from the above discussion, this sensor gives out data by the varying voltage at the output pin. So we need to use the ADC of the Arduino to convert and compute the data into a recognisable value. We also need to connect the LED enable pin of the sensor to one of the GPIO pins of the Arduino; it's the white wire that is connected to the D7 of the Arduino. Finally, we need a 150R resistor and a 220uF capacitor. The resistor and the capacitor make an RC timer circuit, in our case, a pulse driver circuit that is absolutely mandatory for the stable operation of the device, and the values are recommended by the datasheet.
Wiring Connections Table
GP2Y1014AU0F Pin | Arduino Pin | Component |
Wiring Connections Table | 5V | Via 150Ω Resistor |
LED-GND | GND | Direct connection |
LED | D7 | Digital control |
S-GND | GND | Common ground |
VOUT | A0 | Analog input |
VCC | 5V | Power supply |
Dust Sensor Arduino Programming
The Arduino code to process data from the GP2Y1014AU0F Sensor is very simple and easy to understand. We just need to convert the analog voltage given by the sensor and convert it to digital data to get our result.
We start our code by defining the analog input pin of the device, and we also define a digital pin that will be used to control the LED. Next, we have defined three variables that will hold the necessary timing values required to calculate the dust measured by the sensor. Next, we have three float variables that will hold the result generated by the sensor.
#define measurePin = 0; //Connect dust sensor to Arduino A0 pin
#define ledPower = 7; //Connect 3 led driver pins of dust sensor to Arduino D2
int samplingTime = 280; // time required to sample signal coming out of the sensor
int deltaTime = 40; //
int sleepTime = 9680;
float voMeasured = 0;
float calcVoltage = 0;
float dustDensity = 0;
Next, we have our setup function. In the setup function, we enable the serial for debugging, and we make the LED pin an output.
void setup(){
Serial.begin(9600);
pinMode(ledPower,OUTPUT);
}
Next, we have our loop function; in the loop function, we start the measurement process that is recommended by the datasheet. The total measurement process takes around 10ms, but the sampling period is .28ms. First, we make the LED pin low that turns on the LED, and we use the delayMicroseconds() function to generate a 280 uS or 0.28ms delay that is recommended by the datasheet. Then we take our sample and add another delay of 40uS, this will ensure the pulse width remains at .32ms or 320us, and we sleep for the rest of the 9680uS.
digitalWrite(ledPower,LOW); // power on the LED
(samplingTime);
voMeasured = analogRead(measurePin); // read the dust value
delayMicroseconds(deltaTime);
digitalWrite(ledPower,HIGH); // turn the LED off
delayMicroseconds(sleepTime);
Next, we calculate the voltage value from the ADC value. Please make sure that your Arduino is powered with a proper +5V supply and not powered with USB. If so, you will get errors in your result.
calcVoltage = voMeasured * (5.0 / 1024.0);
Finally, we calculate the amount of suspended dust particles by using the linear equation provided by Chris Nafis; the unit is in ug/m3, and print the result in the serial monitor window.
dustDensity = 170 * calcVoltage - 0.1;
Serial.println(dustDensity);
delay(1000);
This is the end of our code section. We can move to the next section of this article.
Working of the GP2Y1014AU0F Dust Sensor Module
The GIF below shows the hardware circuitry of the GP2Y1014AU0F Dust sensor with Arduino in action. On the left-hand side, we have placed the Arduino with the GP2Y1014AU0F sensor connected to the ADC pin of the Arduino and on the right-hand side, we have the serial monitor window. And as you can see, when we place an incense close to the sensor, it detects the smoke, and the values of the sensor go up gradually. Defines analog input (A0) for sensor output and digital pin (D7) for LED control in this dust sensor Arduino code.
Dust Sensor Arduino Code and GitHub Repository
The following Arduino code has been developed to connect to a dust sensor for effective air quality measurement. Therefore, it processes the sensor output and gives you the PM concentration in real-time. You can find the complete code and the project files in the GitHub directory.
Troubleshooting GP2Y1014AU0F Dust Sensor
The sensor output is quite sensitive to the accurate timing of the LED power pulse, and it needs a few cycles to settle. The Arduino code ignores the time that analogread() takes to run and includes serial print in the loop, so it will be nowhere near what the spec sheet says it should be. That is why, for highly sensitive applications, a Flash ADC is recommended.
- First, check the power supply pin of the sensor; this sensor only works in the +5V range, and more or less than this voltage will render this device unusable.
- Check if the 150R resistor and the 220uF capacitor are connected properly with the sensor, as per the datasheet of the device; this sensor will not work without this capacitor and resistor.
- If you are having trouble reading the datasheet of the GP2Y1014AU0F Dust Sensor, you can check out the application note of the device for a better understanding.
Problem-Solution Table
Issue | Cause | Solution |
No readings | Power supply problems | Verify 5V supply stability |
Erratic values | Missing timing components | Check 150Ω resistor and 220μF capacitor |
Low sensitivity | Incorrect timing | Verify microsecond delays in code |
Negative readings | Voltage offset | Add baseline calibration |
Inconsistent data | Electrical noise | Improve grounding and shielding |
Conclusion
The GP2Y1014AU0F dust sensor provides an excellent entry point for dust sensor Arduino projects, offering reliable particle detection at an affordable price.
Success factors for dust sensor Arduino programming:
- Correct implementation of timing based on the datasheet;
- Correct design and stability of a 5V power supply and passive components;
- Use of proper calibration and data averaging methods; Knowledge of sensor limitations and correct applications.
This guide covers the fundamentals for developing more advanced air quality monitoring systems with Arduino and the GP2Y1014AU0F dust sensor.
Projects Using Arduino and GP2Y1014AU0F Dust Sensor Module
IoT-Based Air Quality Index Monitoring System
If you are searching through the internet for interesting IoT-based projects, this project can be for you because in this project, we have interfaced a Nova SDS011 PM Sensor and some gas sensors to build yourself an IoT-enabled Air quality monitoring system.
Air Quality Analyser using Arduino
In one of our previous projects, we interfaced this GP2Y1014AU0F dust sensor with Arduino to build a simple air quality analyser. If you are searching for a quick and easy tutorial on the GP2Y1014AU0F sensor, this project is for you.
Air Quality Analyser to Measure PM2.5 and PM10
In this project of ours, we have interfaced the popular SDS0011 sensor with an Arduino to build a simple air quality monitoring system, and we displayed the result on a 128X64 OLED Display.
Complete Project Code
/*
Interfacing Sharp Optical Dust Sensor GP2Y1014AU0F with Arduino
*/
#define measurePin = 0; //Connect dust sensor to Arduino A0 pin
#define ledPower = 7; //Connect 3 led driver pins of dust sensor to Arduino D2
int samplingTime = 280; // time required to sample signal coming out of the sensor
int deltaTime = 40; //
int sleepTime = 9680;
float voMeasured = 0;
float calcVoltage = 0;
float dustDensity = 0;
void setup(){
Serial.begin(9600);
pinMode(ledPower,OUTPUT);
}
void loop(){
digitalWrite(ledPower,LOW); // power on the LED
delayMicroseconds(samplingTime);
voMeasured = analogRead(measurePin); // read the dust value
delayMicroseconds(deltaTime);
digitalWrite(ledPower,HIGH); // turn the LED off
delayMicroseconds(sleepTime);
// 0 - 5V mapped to 0 - 1023 integer values
// recover voltage
calcVoltage = voMeasured * (5.0 / 1024.0);
// linear eqaution taken from http://www.howmuchsnow.com/arduino/airquality/
// Chris Nafis (c) 2012
dustDensity = 170 * calcVoltage - 0.1;
Serial.println(dustDensity); // unit: ug/m3
delay(1000);
}