Projects / Dust storm alert for Rajasthan homes

Dust storm alert for Rajasthan homes

Intermediate2 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. NANOGP2Y1014

    Wire the dust sensor

    Resistor and capacitors on the LED supply.

  2. NANO

    Pulse the LED

    0.32 ms low.

  3. NANO

    Sample at 0.28 ms

    Read A0.

  4. NANOGP2Y1014

    Convert to dust

    Datasheet formula.

  5. NANO

    Add the wind counter

    Interrupt on D2.

  6. NANO

    Calibrate the wind

    Against a reference.

  7. NANO

    Set the alarm

    Both high together.

In short

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

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
Dust sensor pin 1 (V-LED)150 Ω to 5V, with two 100 µF capacitors to groundLED supply network
Dust sensor pins 2 and 4GNDLED ground and signal ground
Dust sensor pin 3 (LED)Nano D7Pulse the LED (LOW = on)
Dust sensor pin 5 (Vo)Nano A0Dust signal
Dust sensor pin 6 (Vcc)Nano 5VPower
Speed sensor OUTNano D2Wind pulses
Speed sensor VCC and GNDNano 5V and GNDPower
BuzzerNano D8 and GNDAlarm

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.

CheckExpected
Clean airDust near zero
Puff of dustReading rises
Spin the anemometerWind speed changes
Both highBuzzer 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 →

Ask Lark AI

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.