Smart Home Sensors: PIR Motion, MQ-2 Gas & DHT11
📌 Quick Definition (Answer-First)
School Smart Home projects typically pair three sensors with Arduino: the PIR (Passive Infrared) motion detector, the MQ-2 gas/smoke analog sensor, and the DHT11 temperature & humidity sensor.
How It Works & Why It Matters
A PIR sensor outputs a clean digital HIGH when warm motion enters its Fresnel lens dome.
The MQ-2 outputs a continuous analog value (0–1023 on A0) and requires ~20–30 seconds of warm-up before stabilizing.
💻 Smart Home Sensor Logic
int motion = digitalRead(pirPin); // HIGH when person detected int gasLevel = analogRead(A0); // Alert threshold e.g. > 400 if (gasLevel > 400) tone(buzzerPin, 1000);
🏫 Classroom Example
Combine a PIR sensor with an LDR light sensor so hallway LEDs only light up when someone walks by at night.
⚖️ DO (Digital Out) vs. AO (Analog Out)
DO outputs binary 0/1 based on the onboard potentiometer; AO delivers the full 0–1023 measurement to Arduino.
⚠️ Common Mistake in Exams & Homework
Testing an MQ-2 immediately in the first second or cranking the PIR time-delay knob to maximum so it stays stuck HIGH for 5 minutes.
🚀 Practice in ArkyEdu Labs & Related Guides
🎮 Launch Interactive Lab →
Sisteme Inteligente, Smart Home & Proiectul Integrator IoT
📖 Full Lesson & Curriculum →
Clasa a VIII-a · Smart Home & Robotică IoT
🏫 Grade 8 Hub →
All modules & guides for this grade
📚 Arduino Smart Home & millis() →
Practical Grade 7–8 Arduino Uno robotics guide: digital vs analog A0–A5 pins, Ohm’s Law 220 Ω LED resistors, PIR motion, HC-SR04 distance, MQ-2 gas alarm, and non-blocking millis().
❓ Quick Questions & Answers
What does PIR stand for?
Passive Infrared—it senses changing infrared heat signatures rather than emitting waves.
Related Glossary Terms
← Back to Full Glossary (A–Z)Arduino UNO & Sketch Structure (setup & loop) →
Arduino UNO is an open-source microcontroller board (ATmega328P) widely used in school robotics and IoT projects. Every Arduino C++ sketch requires two functions: setup(), which runs once on power-up, and loop(), which repeats forever.
Digital, Analog (ADC) & PWM (~) Arduino Pins →
Digital pins (0–13) read or output strictly two states: HIGH (5V) or LOW (0V). Analog input pins (A0–A5) measure continuous sensor voltages from 0 to 1023, while PWM (~) pins output 0–255 duty cycles to dim LEDs or control motor speed.
HC-SR04 Ultrasonic Distance Sensor →
The HC-SR04 uses four pins (VCC, Trig, Echo, GND) to measure distance from 2 cm to 400 cm by sending a 10 µs ultrasonic pulse on Trig and timing the reflected sound wave return on Echo.
Current-Limiting Resistor & Ohm’s Law (V = I · R) →
A resistor limits electrical current in a circuit to protect LEDs and microcontroller pins from burning out. Using Ohm’s Law (V = I · R), an LED wired to a 5V Arduino pin requires a 220 Ω to 330 Ω series resistor.