Smart Classroom
Assistant Robot
Build a robot that detects motion, reads temperature, shows messages on an LCD screen and even waves hello — using an Arduino UNO! Perfect for kids aged 10–16. 🎉
Project Overview
Imagine having a robot assistant in your classroom that knows when someone enters the room, displays the current temperature, waves hello with its arm, and sounds a buzzer when the class is about to start! That's exactly what we're going to build — a Smart Classroom Assistant Robot using an Arduino UNO.
This project combines five awesome electronic components: a PIR motion sensor (to detect movement), a DHT11 temperature sensor, a 16×2 LCD screen (to show messages), a servo motor (to wave the arm), and a buzzer (for alerts). Let's dive in! 🚀
✨ What Does It Do?
Detects Motion
PIR sensor spots when someone enters and wakes the robot up!
Reads Temperature
DHT11 measures room temperature & humidity every few seconds.
LCD Messages
Displays "Hello!" greetings and live temperature on the screen.
Waves Hello!
Servo motor sweeps back and forth — the robot actually waves! 👋
Alert Buzzer
Plays a 3-beep sound when motion is detected. Class is starting!
Auto Sleep Mode
Robot goes idle after 10 seconds of no movement. Saves power!
Components You Need
Gather these parts before starting. Most are available on Amazon, Robu.in or any local electronics shop. Everything is beginner-friendly!
| Component | Qty | Why We Need It | ~Price |
|---|---|---|---|
| 🧠Arduino UNO R3 | ×1 | The brain — runs all our code | ₹350 |
| 📡PIR Motion Sensor (HC-SR501) | ×1 | Detects people entering the room | ₹80 |
| 🌡️DHT11 Temperature Sensor | ×1 | Reads room temperature & humidity | ₹70 |
| 📺16×2 I2C LCD Display | ×1 | Shows messages (4 wires only!) | ₹120 |
| ⚙️SG90 Servo Motor | ×1 | Moves the robot's waving arm | ₹80 |
| 🔔Piezo Buzzer (Active) | ×1 | Makes alert beep sounds | ₹20 |
| 🧱Breadboard + Jumper Wires | ×1 set | Connect everything without soldering | ₹80 |
| 🔌USB Cable (Type A to B) | ×1 | Uploads code to Arduino from PC | Included |
This diagram shows how every component connects to the Arduino UNO. Study it carefully before wiring!
📌 Pin Connection Table
| Component | Component Pin | Wire Colour | Arduino Pin |
|---|---|---|---|
| PIR Sensor | VCC | Red | 5V |
| PIR Sensor | OUT (Signal) | Blue | D2 |
| PIR Sensor | GND | Black | GND |
| DHT11 | VCC | Red | 5V |
| DHT11 | DATA | Yellow | D3 |
| DHT11 | GND | Black | GND |
| I2C LCD | VCC | Red | 5V |
| I2C LCD | GND | Black | GND |
| I2C LCD | SDA | Purple | A4 |
| I2C LCD | SCL | Green | A5 |
| Servo SG90 | VCC (Red wire) | Red | 5V |
| Servo SG90 | Signal (Orange wire) | Orange | D9 |
| Servo SG90 | GND (Brown wire) | Brown | GND |
| Buzzer | + (Positive) | Pink | D10 |
| Buzzer | – (Negative) | Black | GND |
Step-by-Step Build Guide
Follow these steps in order. Click each step to expand it! 👇
Install Arduino IDE & Libraries
▼Download the Arduino IDE from arduino.cc/en/software and install it on your computer. It's free!
Next, open the IDE and go to Sketch → Include Library → Manage Libraries. Search for and install these 3 libraries:
- 🔵
LiquidCrystal_I2C— by Frank de Brabander - 🟡
DHT sensor library— by Adafruit - 🟢
Servo— already built-in, no install needed!
When installing DHT library, Arduino will ask to install dependencies. Click "Install All" — this also adds the Adafruit Unified Sensor library!
Wire the I2C LCD Display
▼The I2C LCD is the easiest to wire — just 4 connections! Place it on your breadboard and connect:
- LCD VCC → Arduino 5V (red wire)
- LCD GND → Arduino GND (black wire)
- LCD SDA → Arduino A4 (purple wire)
- LCD SCL → Arduino A5 (green wire)
Upload a simple test sketch (from File → Examples → LiquidCrystal I2C → HelloWorld) to check it works before adding more components.
If nothing shows on screen, try turning the small blue potentiometer on the I2C board with a screwdriver — it controls the contrast!
Connect the DHT11 Temperature Sensor
▼The DHT11 has 3 useful pins (some versions have 4 — ignore the blank/NC pin). Connect it like this:
- DHT11 VCC / + → Arduino 5V
- DHT11 DATA / OUT → Arduino D3
- DHT11 GND / – → Arduino GND
The DHT11 has a small grid on its face — that side faces YOU when looking at it. The leftmost pin is VCC.
Add a 10kΩ pull-up resistor between VCC and the DATA pin for the most reliable readings. It's optional but recommended!
Add the PIR Motion Sensor
▼The PIR sensor is the "eyes" of our robot. It detects body heat and movement! It has 3 pins on the bottom:
- PIR VCC → Arduino 5V
- PIR OUT → Arduino D2
- PIR GND → Arduino GND
Turn the two orange dials to adjust sensitivity (left dial) and time delay (right dial). Start with both in the middle position.
PIR sensors need 30–60 seconds to "warm up" after powering on before they detect reliably. This is totally normal!
Wire the Servo Motor (Waving Arm)
▼The SG90 servo comes with a 3-wire connector (brown, red, orange). Connect it directly:
- Servo Brown wire (GND) → Arduino GND
- Servo Red wire (VCC) → Arduino 5V
- Servo Orange wire (Signal) → Arduino D9
Attach one of the plastic arms (horn) to the servo shaft. This is what will wave! You can tape a small cardboard hand to it to make it look more fun! ✋
Never power multiple servo motors directly from Arduino 5V — it can burn the board. For 1 servo, it's fine. For more, use a separate 5V power supply!
Connect the Buzzer
▼The active piezo buzzer has 2 legs. The longer leg is positive (+) and the shorter leg is negative (–). Some buzzers have a "+" mark printed on top.
- Buzzer + (long leg) → Arduino D10
- Buzzer – (short leg) → Arduino GND
That's it! An active buzzer makes sound when you send it HIGH — no special frequency code needed.
Make sure you have an active buzzer (with a built-in oscillator), not a passive one. Active buzzers have a small circuit board visible from the bottom and beep with just digitalWrite(pin, HIGH).
Double-Check & Power Up!
▼Before uploading code, do a quick safety check:
- ✅ No bare wires touching each other
- ✅ VCC (red) wires all go to 5V, not 3.3V
- ✅ GND (black) wires all go to a GND pin
- ✅ SDA → A4, SCL → A5 for the LCD
- ✅ Servo signal on D9, Buzzer on D10
Connect your Arduino to your PC with the USB cable. The power LED (green) should light up. Now you're ready to upload the code!
Take a photo of your wired circuit before uploading — it's great for sharing on social media and for comparing if something goes wrong later!
Full Arduino Code
Copy this entire code into the Arduino IDE, select Tools → Board → Arduino UNO, choose your COM port, and click the → Upload button!
// green lines). Read them to understand what each part does!
/* ================================================ SMART CLASSROOM ASSISTANT ROBOT by MakeMindz | www.makemindz.com Arduino UNO · Beginner Friendly ✅ ================================================ Components: - PIR Motion Sensor → D2 - DHT11 Temp Sensor → D3 - Servo Motor → D9 (PWM) - Buzzer → D10 - I2C LCD 16x2 → A4(SDA), A5(SCL) ================================================ */ // ── LIBRARIES ────────────────────────────── #include <Wire.h> // For I2C communication #include <LiquidCrystal_I2C.h> // For the LCD screen #include <DHT.h> // For temperature sensor #include <Servo.h> // For servo motor // ── PIN DEFINITIONS ──────────────────────── #define PIR_PIN 2 // PIR motion sensor output #define DHT_PIN 3 // DHT11 data pin #define SERVO_PIN 9 // Servo signal pin (PWM) #define BUZZER_PIN 10 // Active buzzer #define DHT_TYPE DHT11 // DHT11 sensor model // ── OBJECT CREATION ──────────────────────── // LCD: I2C address 0x27, 16 columns, 2 rows LiquidCrystal_I2C lcd(0x27, 16, 2); // DHT sensor object DHT dht(DHT_PIN, DHT_TYPE); // Servo motor object Servo armServo; // ── CUSTOM LCD CHARACTERS ────────────────── // Smiley face for the LCD! byte smiley[8] = { B00000, B01010, B01010, B00000, B10001, B01110, B00000, }; // ── GLOBAL VARIABLES ─────────────────────── bool motionDetected = false; // Is someone here? bool robotAwake = false; // Is robot active? unsigned long lastMotion = 0; // Timestamp of last motion unsigned long lastTempRead = 0; // Timestamp of last temp read const unsigned long SLEEP_TIMEOUT = 10000; // Sleep after 10 seconds const unsigned long TEMP_INTERVAL = 3000; // Read temp every 3 seconds int waveCount = 0; // How many waves done // ════════════════════════════════════════════ SETUP — runs once at start ═══════════════════════════════════════════ */ void setup() { // Start serial monitor for debugging Serial.begin(9600); Serial.println("Smart Classroom Robot Starting..."); // Set pin modes pinMode(PIR_PIN, INPUT); // PIR is an input pinMode(BUZZER_PIN, OUTPUT); // Buzzer is an output // Attach servo to pin 9 armServo.attach(SERVO_PIN); armServo.write(90); // Start servo at 90° (neutral) // Start DHT11 sensor dht.begin(); // Start LCD and turn on backlight lcd.init(); lcd.backlight(); lcd.createChar(0, smiley); // Register smiley as custom char // Show startup screen lcd.setCursor(0, 0); lcd.print(" MakeMindz Bot! "); lcd.setCursor(0, 1); lcd.print(" Starting... "); delay(2000); // Play startup sound playStartupBeep(); // Show idle screen showIdleScreen(); Serial.println("Ready! Waiting for motion..."); } // ════════════════════════════════════════════ LOOP — runs forever ═══════════════════════════════════════════ */ void loop() { // ── Read PIR sensor ────────────────────── int pirValue = digitalRead(PIR_PIN); // ── MOTION DETECTED! ───────────────────── if (pirValue == HIGH) { lastMotion = millis(); // Record when motion happened if (!robotAwake) { // Robot just woke up! Do greeting sequence robotAwake = true; greetingSequence(); } // Read and show temperature every 3 seconds if (millis() - lastTempRead >= TEMP_INTERVAL) { lastTempRead = millis(); showTemperature(); } } // ── AUTO SLEEP ─────────────────────────── if (robotAwake && (millis() - lastMotion >= SLEEP_TIMEOUT)) { // No motion for 10 seconds — go to sleep robotAwake = false; waveCount = 0; goToSleep(); } delay(100); // Small pause to avoid overloading } // ════════════════════════════════════════════ GREETING SEQUENCE Plays when motion is first detected ═══════════════════════════════════════════ */ void greetingSequence() { Serial.println("Motion detected! Starting greeting..."); // Show "Hello!" on LCD lcd.clear(); lcd.setCursor(0, 0); lcd.print(" Hello! "); lcd.write(byte(0)); // Print smiley character lcd.setCursor(0, 1); lcd.print("Class starting! "); // Play 3 alert beeps for (int i = 0; i < 3; i++) { digitalWrite(BUZZER_PIN, HIGH); delay(150); digitalWrite(BUZZER_PIN, LOW); delay(150); } // Wave the arm 3 times! for (int w = 0; w < 3; w++) { armServo.write(30); // Wave down delay(300); armServo.write(150); // Wave up delay(300); } armServo.write(90); // Return to neutral } // ════════════════════════════════════════════ SHOW TEMPERATURE Reads DHT11 and displays on LCD ═══════════════════════════════════════════ */ void showTemperature() { float temp = dht.readTemperature(); // Celsius float humidity = dht.readHumidity(); // Check if reading is valid (NaN = sensor error) if (isnan(temp) || isnan(humidity)) { lcd.setCursor(0, 1); lcd.print("Sensor Error! "); return; } // Display on LCD row 0: temperature lcd.setCursor(0, 0); lcd.print("Temp: "); lcd.print(temp, 1); // 1 decimal place lcd.print(" C "); // Display on LCD row 1: humidity lcd.setCursor(0, 1); lcd.print("Humidity: "); lcd.print(humidity, 0); // No decimal for humidity lcd.print("% "); // Also print to Serial Monitor Serial.print("Temp: "); Serial.print(temp); Serial.print("°C | Humidity: "); Serial.print(humidity); Serial.println("%"); // Hot room warning! if (temp > 32) { digitalWrite(BUZZER_PIN, HIGH); delay(500); digitalWrite(BUZZER_PIN, LOW); lcd.setCursor(0, 0); lcd.print("TOO HOT! > 32C "); } } // ════════════════════════════════════════════ SHOW IDLE SCREEN Displayed when no one is around ═══════════════════════════════════════════ */ void showIdleScreen() { lcd.clear(); lcd.setCursor(0, 0); lcd.print(" Ready... "); lcd.setCursor(0, 1); lcd.print(" Walk in to say "); delay(1000); lcd.setCursor(0, 1); lcd.print(" hello! :) "); } // ════════════════════════════════════════════ GO TO SLEEP Robot goes idle, arm returns to rest ═══════════════════════════════════════════ */ void goToSleep() { Serial.println("No motion. Going to sleep..."); // Return servo to rest position armServo.write(90); // Show goodbye message lcd.clear(); lcd.setCursor(0, 0); lcd.print(" Goodbye! "); lcd.setCursor(0, 1); lcd.print(" See you soon! "); delay(2000); // Back to idle screen showIdleScreen(); } // ════════════════════════════════════════════ STARTUP BEEP Fun melody when robot powers on ═══════════════════════════════════════════ */ void playStartupBeep() { int pattern[] = {80, 80, 160}; // ON durations (ms) int gaps[] = {80, 80, 0}; // OFF durations (ms) for (int i = 0; i < 3; i++) { digitalWrite(BUZZER_PIN, HIGH); delay(pattern[i]); digitalWrite(BUZZER_PIN, LOW); delay(gaps[i]); } }
0x27. If your LCD shows nothing after uploading, run the I2C Scanner sketch from the Arduino IDE examples to find your LCD's address (it might be 0x3F).
How It All Works
Here's what happens every time the robot detects someone entering the classroom — step by step!
1. Someone Enters the Room
The PIR sensor detects body heat (infrared radiation). It sends a HIGH signal on pin D2 to the Arduino.
2. Arduino Wakes Up
The Arduino reads D2 and sees HIGH. If the robot was sleeping, it triggers the greeting sequence!
3. LCD Says "Hello!"
The Arduino sends text over I2C to the LCD. Row 1 shows "Hello! 😊" and Row 2 shows "Class starting!"
4. Buzzer Beeps 3 Times
Arduino sets pin D10 HIGH for 150ms, then LOW for 150ms — three times. Beep! Beep! Beep!
5. Servo Arm Waves Hello!
Arduino sends PWM signals to pin D9. The servo sweeps from 30° to 150° three times — the arm waves! 👋
6. Temperature is Displayed
Every 3 seconds, the DHT11 reads temperature and humidity. The LCD updates to show live data: "Temp: 28.4°C"
7. Robot Goes to Sleep
After 10 seconds of no motion, the robot shows "Goodbye!" and returns to idle mode, saving power.
Troubleshooting Guide
Something not working? Don't panic! Here are the most common problems and how to fix them. 🛠️
Upgrade Your Robot!
Finished the basic build? Here are 6 awesome ways to make your robot even smarter! 🔥
Voice Announcer
Add a DFPlayer Mini MP3 module and speaker to make the robot say "Good Morning, Class!" out loud!
EasyWi-Fi Control
Upgrade to an ESP32! Control the robot from your phone browser over Wi-Fi and see temperature online.
MediumRGB LED Eyes
Add 2 RGB LEDs as robot eyes. Green when happy, red when too hot, blue when idle — so expressive!
EasyTimetable Display
Add an RTC (DS3231) module to show the current time and display class periods on the LCD automatically.
MediumBluetooth App
Add an HC-05 Bluetooth module and build a MIT App Inventor app to control messages on the LCD remotely!
MediumFull Robot Body
3D print or cardboard-craft a full robot body with a head, torso and arms around all the components!
Advanced
Comments
Post a Comment