Lock your phone away for a set time to beat distractions.
Built and tested by Shahan Fathima K · Industrial Robotics Institute

A phone-locking box that helps you focus. Put your phone inside and press the button: a servo locks the lid, the LED lights and the buzzer beeps. The box stays locked for the set time, then unlocks itself with another beep.
| Component | Qty |
|---|---|
| ESP8266 NodeMCU | 1 |
| Servo Motor (SG90) | 1 |
| Push Button | 1 |
| Buzzer | 1 |
| LED | 1 |
| Resistor 220Ω (for LED) | 1 |
| Box with lid | 1 |
| Jumper Wires | As needed |
| Power Supply | 1 |
| From | Connect to |
|---|---|
| Push button | D1 and GND |
| Servo signal | D2 |
| Servo VCC | 5V (VIN) |
| Servo GND | GND |
| LED + (via resistor) | D3 |
| LED − | GND |
| Buzzer + | D4 |
| Buzzer − | GND |
Complete, tested Arduino C++ code for this project. Copy it into Arduino IDE and upload it to the ESP8266 NodeMCU.
#include <Servo.h>
#define buttonPin D1
#define servoPin D2
#define ledPin D3
#define buzzer D4
Servo lockServo;
bool locked = false;
unsigned long lockStartTime = 0;
unsigned long lockDuration = 10000; // 10 s for demo
void beep()
{
digitalWrite(buzzer, HIGH);
delay(500);
digitalWrite(buzzer, LOW);
}
void setup()
{
pinMode(buttonPin, INPUT_PULLUP);
pinMode(ledPin, OUTPUT);
pinMode(buzzer, OUTPUT);
lockServo.attach(servoPin);
lockServo.write(0); // unlocked
}
void loop()
{
if (digitalRead(buttonPin) == LOW && !locked)
{
locked = true;
lockStartTime = millis();
lockServo.write(90); // lock
digitalWrite(ledPin, HIGH);
beep();
}
if (locked && millis() - lockStartTime > lockDuration)
{
locked = false;
lockServo.write(0); // unlock
digitalWrite(ledPin, LOW);
beep();
}
delay(200);
}A phone-locking box that helps you focus. Put your phone inside and press the button: a servo locks the lid, the LED lights and the buzzer beeps.
You need: ESP8266 NodeMCU (1), Servo Motor (SG90) (1), Push Button (1), Buzzer (1), LED (1), Resistor 220Ω (for LED) (1), Box with lid (1), Jumper Wires, Power Supply (1). Software: Arduino IDE, Servo library.
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-063). Message IRI on WhatsApp at +91 86060 82634 for the kit price and delivery details.