Smart Classroom assistant robot

Smart Classroom Assistant Robot | Arduino Robotics Project for Kids | MakeMindz
🤖
Section 1

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! 🚀

⏱️
2–3 hrs
Build Time
🧩
7
Components
💡
5
Cool Features
🟢
Easy
Difficulty
💰
~₹800
Est. Cost

✨ 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!

🖥️ No hardware yet? You can simulate this entire project online for FREE using Wokwi.com — just copy the code below and wire it up virtually!
🛒
Section 2

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
💡 Tip: Buy the I2C version of the LCD (it has a tiny blue PCB on the back with 4 pins). It's easier to wire and uses only 4 jumper wires instead of 16!
🔌
Section 3

Circuit Diagram

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
🔧
Section 4

Step-by-Step Build Guide

Follow these steps in order. Click each step to expand it! 👇

1

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!

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!

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!

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!

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!

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).

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!

💻
Section 5

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!

Every line of code is explained with comments (the // green lines). Read them to understand what each part does!
SmartClassroomRobot.ino
/*
 ================================================
   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]);
  }
}
🔍 LCD Address: Most I2C LCD modules use address 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).
⚙️
Section 6

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.

🚑
Section 7

Troubleshooting Guide

Something not working? Don't panic! Here are the most common problems and how to fix them. 🛠️

📺
LCD screen is blank / shows random boxes
Turn the small blue potentiometer on the I2C module with a tiny screwdriver to adjust contrast. Also check that SDA→A4 and SCL→A5, not A4→SCL and A5→SDA (they're easy to swap!)
🌡️
DHT11 shows "nan" or "Sensor Error!"
Check your DATA wire is on D3 (not D2). Try adding a 10kΩ resistor between VCC and DATA. Sometimes the sensor needs 2 seconds after power-on before reading. If it still fails, your DHT11 might be damaged.
👁️
PIR sensor always triggers or never triggers
Wait 60 seconds for the PIR to warm up after powering on! Then adjust the sensitivity dial (left knob) — turn clockwise for more sensitivity. Make sure the dome is facing the room, not the wall.
⚙️
Servo motor doesn't move or shakes/jitters
Make sure the orange signal wire is on D9 (a PWM pin). If the servo shakes, the Arduino's 5V might not supply enough current — try powering the servo with an external 5V supply while sharing GND with Arduino.
🔔
Buzzer makes no sound
Check the polarity — the long leg (+) must go to D10, short leg (–) to GND. Make sure it's an ACTIVE buzzer (not passive). Test it by just running: digitalWrite(10, HIGH); delay(500); digitalWrite(10, LOW);
📤
"Port not found" when uploading code
Go to Tools → Board → Arduino UNO. Then Tools → Port and select the COM port that appeared when you plugged in the USB. If no port shows, reinstall the CH340 USB driver (Google "CH340 driver download").
📚
"LiquidCrystal_I2C.h: No such file" error
The library isn't installed. Go to Sketch → Include Library → Manage Libraries → search "LiquidCrystal I2C" → Install the one by "Frank de Brabander". Same for DHT — search "DHT sensor library" and install Adafruit's version.
🚀
Section 8

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!

Easy
📶

Wi-Fi Control

Upgrade to an ESP32! Control the robot from your phone browser over Wi-Fi and see temperature online.

Medium
🔴

RGB LED Eyes

Add 2 RGB LEDs as robot eyes. Green when happy, red when too hot, blue when idle — so expressive!

Easy

Timetable Display

Add an RTC (DS3231) module to show the current time and display class periods on the LCD automatically.

Medium
🤳

Bluetooth App

Add an HC-05 Bluetooth module and build a MIT App Inventor app to control messages on the LCD remotely!

Medium
🦿

Full Robot Body

3D print or cardboard-craft a full robot body with a head, torso and arms around all the components!

Advanced
🎓
Section 9

What You'll Learn

🏆 Skills You'll Gain from This Project

🧠 Arduino C++ Coding
📡 PIR Motion Sensing
🌡️ DHT11 Temperature
📺 I2C LCD Display
⚙️ Servo Motor Control
🔔 Buzzer & Alerts
⏱️ millis() Timers
🔌 Circuit Wiring
🐛 Debugging & Testing
🏗️ Prototyping Basics
🌟 Share Your Build! Made this robot? Share a photo or video in the MakeMindz community and tag #MakeMindz — we love seeing your creations! Visit www.makemindz.com for more awesome projects!

🤖 Smart Classroom Assistant Robot — A MakeMindz Robotics Project

Visit www.makemindz.com for more Arduino, Robotics & Coding projects for kids!

Arduino™ is a trademark of Arduino SA. Made with ❤️ to inspire young makers.

Comments

Product Cards
Buddy Bot eBook
⭐ New 2026 Release
Build Your
Own Robot!
3D design, wiring &
Arduino coding.
Young inventors love it!
🖨️
3D Print
All parts
Wire it
Circuit guide
💻
Code it
Arduino IDE
🤖
Watch it
Walk & react
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Website Offer
₹499 300
🌍 International: $5 USD
One-time · Instant digital delivery
🔒 Secured by Razorpay · Your data is safe
📄 Download Free Sample Copy
🔒 Secured by Razorpay · Your data is safe
🍓
Raspberry Pi Pico Mastery
21 Projects
⚡ Launch Price — 80% OFF
Learn Pico
Build 21 Projects!
MicroPython · Wokwi
IoT · Certificate
Perfect for beginners!
🖥️
Wokwi
No hardware
🐍
MicroPy
From zero
🔨
21 Projects
IoT + sensors
📄
Certificate
Verified cert
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Launch Offer
₹999 200 80% OFF
🌍 International: $5 USD
One-time · Lifetime access · No subscription
🔒 Secured by Razorpay · UPI · Cards · NetBanking
🎉

You're in!

Payment successful! Your Buddy Bot eBook is ready. Time to build!

📖 Access Your eBook Now
🎉

Enrolled!

Payment successful! Lifetime access to all 21 Pico Projects is yours!

🍓 Go to My Course