Notices when you leave your desk or stop moving, and nudges you back to study.
Built and tested by Shahan Fathima K · Industrial Robotics Institute

A study helper that tracks whether a student is at the desk and active. An ultrasonic sensor measures how far the student is from the desk and a PIR sensor watches for movement. When the student is close and active, the green focus LED stays on; if they move away or go still, the buzzer sounds to bring their attention back.
| Component | Qty |
|---|---|
| ESP8266 NodeMCU | 1 |
| Ultrasonic Sensor (HC-SR04) | 1 |
| PIR Motion Sensor | 1 |
| LED | 1 |
| Resistor 220Ω (for LED) | 1 |
| Buzzer | 1 |
| Jumper Wires | As needed |
| Power Supply | 1 |
| From | Connect to |
|---|---|
| Ultrasonic VCC / GND | 5V (VIN) / GND |
| Ultrasonic TRIG | D1 |
| Ultrasonic ECHO | D2 |
| PIR VCC / GND | 5V (VIN) / GND |
| PIR OUT | D3 |
| LED + (via resistor) | D4 |
| Buzzer + | D5 |
| LED − / Buzzer − | GND |
Complete, tested Arduino C++ code for this project. Copy it into Arduino IDE and upload it to the ESP8266 NodeMCU.
#define trigPin D1
#define echoPin D2
#define pirPin D3
#define ledPin D4
#define buzzer D5
long duration;
int distance;
void setup()
{
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(pirPin, INPUT);
pinMode(ledPin, OUTPUT);
pinMode(buzzer, OUTPUT);
}
void loop()
{
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = duration * 0.034 / 2;
int motion = digitalRead(pirPin);
if (distance < 100 && motion == HIGH)
{
digitalWrite(ledPin, HIGH); // Focused
digitalWrite(buzzer, LOW);
}
else
{
digitalWrite(ledPin, LOW); // Distracted
digitalWrite(buzzer, HIGH);
}
delay(500);
}A study helper that tracks whether a student is at the desk and active. An ultrasonic sensor measures how far the student is from the desk and a PIR sensor watches for movement.
You need: ESP8266 NodeMCU (1), Ultrasonic Sensor (HC-SR04) (1), PIR Motion Sensor (1), LED (1), Resistor 220Ω (for LED) (1), Buzzer (1), Jumper Wires, Power Supply (1). Software: Arduino IDE.
Yes. It is rated beginner and takes about 1–2 hours to build, using the ESP8266 NodeMCU. The guide on this page explains every connection and step.
The complete, tested Arduino C++ code is free on this page. Copy it into Arduino IDE and upload it to the board.
Yes. IRI sells a kit with the parts for this project (PRJ-049). Message IRI on WhatsApp at +91 86060 82634 for the kit price and delivery details.