Dust storm alert for Rajasthan homes
Build it step by step
0 of 7 doneWire the dust sensor
Resistor and capacitors on the LED supply.
Pulse the LED
0.32 ms low.
Sample at 0.28 ms
Read A0.
Convert to dust
Datasheet formula.
Add the wind counter
Interrupt on D2.
Calibrate the wind
Against a reference.
Set the alarm
Both high together.
How do you build a dust storm alert for Rajasthan homes?
A GP2Y1014AU dust sensor and a wind speed sensor warn when a dust storm is coming so windows can be shut in time. You need Arduino Nano, GP2Y1014AU dust sensor, Electrolytic Capacitor 100 µF × 2, Resistor 150 Ω, Optical encoder speed sensor (slot, LM393) and Active buzzer 5 V. It takes 7 steps and about 120 minutes.
- Level
- Intermediate
- Time
- About 120 min
- Parts
- 6
Parts list
- Development BoardsBuyArduino Nano × 1
- SensorsBuy
- PassivesBuy
- PassivesBuyResistor 150 Ω × 1
- SensorsBuy
- Motors & ActuatorsBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Dust sensor pin 1 (V-LED) | 150 Ω to 5V, with two 100 µF capacitors to ground | LED supply network |
| Dust sensor pins 2 and 4 | GND | LED ground and signal ground |
| Dust sensor pin 3 (LED) | Nano D7 | Pulse the LED (LOW = on) |
| Dust sensor pin 5 (Vo) | Nano A0 | Dust signal |
| Dust sensor pin 6 (Vcc) | Nano 5V | Power |
| Speed sensor OUT | Nano D2 | Wind pulses |
| Speed sensor VCC and GND | Nano 5V and GND | Power |
| Buzzer | Nano D8 and GND | Alarm |
Code
The GP2Y1014AU measures dust by pulsing an infrared LED and reading the scattered light; the LED must be on for only 0.32 ms of every 10 ms, and the reading must be taken 0.28 ms after it switches on, which the sketch does with microsecond delays. The 150 Ω resistor and the capacitor network feed the LED pulse; without them the reading is noisy. The conversion 0.17 times the voltage minus 0.1 is the typical figure from the datasheet graph, so each sensor is a little different, and the numbers show a trend rather than a calibrated mass. The slotted optical sensor counts the turns of a cup anemometer, and a reference wind meter can set the calibration constant. A dust storm gives a quick rise of both dust and wind together, and that combination sets off the buzzer. This is an advisory gadget only; it is not a substitute for the weather department's warnings, and in a storm follow official advice and shelter indoors. Mount the sensor in a sheltered, ventilated box and clean its air path often. Arduino IDE, board "Arduino Nano" (try the Old Bootloader option if the upload fails).
Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
// Dust storm alert: pulsed dust sensor plus anemometer pulses. Board: Arduino Nano.
const int LEDPIN = 7, VO = A0, BUZ = 8, WIND = 2;
const int SLOTS = 20; // slots in the anemometer disc
const float MS_PER_HZ = 0.35; // metres per second for each revolution per second: calibrate against a reference
volatile unsigned int pulses = 0;
void onPulse() { pulses++; }
float dustMgm3() {
digitalWrite(LEDPIN, LOW); // LED on
delayMicroseconds(280);
int adc = analogRead(VO); // sample 0.28 ms into the 0.32 ms pulse
delayMicroseconds(40);
digitalWrite(LEDPIN, HIGH); // LED off
delayMicroseconds(9680);
float v = adc * 5.0 / 1024.0;
float d = 0.17 * v - 0.1; // typical conversion from the datasheet graph
return d < 0 ? 0 : d;
}
void setup() {
pinMode(LEDPIN, OUTPUT); digitalWrite(LEDPIN, HIGH);
pinMode(BUZ, OUTPUT); pinMode(WIND, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(WIND), onPulse, FALLING);
Serial.begin(9600);
}
void loop() {
float dust = 0; unsigned long t0 = millis();
int n = 0;
while (millis() - t0 < 1000) { dust += dustMgm3(); n++; }
dust /= n;
noInterrupts(); unsigned int p = pulses; pulses = 0; interrupts();
float wind = (p / (float)SLOTS) * MS_PER_HZ; // pulses per second to metres per second
Serial.print("Dust mg/m3 "); Serial.print(dust, 2); Serial.print(" Wind m/s "); Serial.println(wind, 1);
if (dust > 0.30 && wind > 8.0) { tone(BUZ, 2000, 3000); } // both high together: warn
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
Dust mg/m3 0.32 Wind m/s 0.0 Dust mg/m3 0.33 Wind m/s 0.0
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Clean air | Dust near zero |
| Puff of dust | Reading rises |
| Spin the anemometer | Wind speed changes |
| Both high | Buzzer sounds |
If it does not work
Dust always zero
Check the LED pulse wiring and polarity of pin 3.
Noisy
Check the capacitors and average more samples.
Wind reads zero
Check the slot sensor output and the pull-up.
False alarms
Raise the thresholds.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the dust storm alert for Rajasthan homes?
Arduino Nano, GP2Y1014AU dust sensor, Electrolytic Capacitor 100 µF × 2, Resistor 150 Ω, Optical encoder speed sensor (slot, LM393) and Active buzzer 5 V.
How long does the dust storm alert for Rajasthan homes take to build?
About 120 minutes for a intermediate maker, in 7 steps.
How do I know the dust storm alert for Rajasthan homes works?
Clean air: Dust near zero. Puff of dust: Reading rises. Spin the anemometer: Wind speed changes.
Dust always zero: what should I check?
Check the LED pulse wiring and polarity of pin 3.
Noisy: what should I check?
Check the capacitors and average more samples.
Wind reads zero: what should I check?
Check the slot sensor output and the pull-up.
False alarms: what should I check?
Raise the thresholds.
