The problem
An IoT smart curtain controller is a motorized curtain system that opens and closes curtains — by ambient light, by schedule, or from a phone app. Curtains left open through peak sunlight overwork fans and air conditioners, while elderly people and those with limited mobility struggle with heavy or high curtains. This project builds the engineering answer: an ESP32 microcontroller reads a GL5528 light-dependent resistor, drives a 28BYJ-48 stepper motor through a ULN2003 driver board, and moves a curtain carriage from fully open to fully closed. MQTT messaging links the controller to a mobile app with manual controls, four schedule slots and a light-threshold auto mode, while end-stop switches mark both travel ends. Bench testing set the real numbers: full travel takes 18 seconds (design target), and the motor's 34.3 mN·m pull-in torque (datasheet) suits standard curtain tracks — builder note: a track bent past about 5° stalls the motor, so a straight mounting rail is the fix.
LDR in a voltage divider reads ambient light once per second.
Follow the working sequence
How it works
End to end, the IoT smart curtain controller works like this: a GL5528 light-dependent resistor sits near the window in a voltage divider, so its resistance — about 10 kΩ at 10 lux, rising toward 1 MΩ in darkness — converts ambient light into a voltage the ESP32's ADC samples once per second. The firmware compares that reading against a user-set threshold with a hysteresis band, then lets auto mode, a scheduled slot, or a manual app command win — a manual stop always takes priority. The ESP32 pulses the ULN2003 driver in half-step sequence to rotate the 28BYJ-48 stepper, which pulls a toothed-belt carriage along a straight curtain rail. End-stop limit switches at both ends mark fully open and fully closed, and the position publishes over MQTT so the app's indicator stays honest. Full travel takes about 18 seconds (design target), and every schedule and threshold lives in the ESP32's flash, so daily routines run without the phone.
- The GL5528 LDR and a fixed resistor form a voltage divider near the window; the ESP32's ADC samples the resulting voltage once per second and smooths it with a moving average.
- The firmware compares the smoothed reading against the user-set light threshold with a hysteresis band — separate open and close points — so passing clouds don't cause constant motion.
- The scheduler checks up to four daily open/close slots against NTP time; a scheduled move overrides auto mode, while a manual stop always wins.
- Commands from the mobile app arrive over MQTT (separate topics for command, status and telemetry); the local push buttons drive the motor even when Wi-Fi is down.
- The ESP32 pulses the ULN2003 driver in half-step sequence, rotating the 28BYJ-48 through 4,096 steps per output revolution to pull the belt carriage along the straight rail.
- When a limit switch trips at either end, motion stops and the position counter re-zeros; the final position publishes back to the app over MQTT.
- Thresholds, schedules and last position persist in the ESP32's flash, so daily routines resume after a power cut without reconfiguration.
Tech stack:
- ESP32-WROOM-32 · Arduino framework
- 28BYJ-48 5 V stepper motor · ULN2003 driver board
- GL5528 LDR light sensor · voltage divider
- MQTT over Wi-Fi (PubSubClient) · NTP time sync
- Companion mobile app (control + schedules + telemetry)
- End-stop limit switches for position homing
- Straight curtain rail · toothed belt + carriage
- 5 V regulated power supply · flash settings storage
| Parameter | Value |
|---|---|
| Controller | ESP32-WROOM-32, dual-core with Wi-Fi (datasheet) |
| Motor | 28BYJ-48 5 V stepper, pull-in torque ≥ 34.3 mN·m (datasheet) |
| Steps per output revolution | 4,096 (datasheet, 1:64 gearbox) |
| Light sensor | GL5528 LDR, ~10 kΩ at 10 lux (datasheet) |
| Full open-to-close travel | ~18 s (design target) |
| Schedule slots | 4 per day (implemented) |
| Position feedback | 2 end-stop limit switches (implemented) |
| Control protocol | MQTT over Wi-Fi (implemented) |
| Motor current draw | ~200 mA peak at 5 V (datasheet) |
| Rail straightness | Bend ≤ ~5° (builder note — more stalls the motor) |
Project features
This controller is built around four working capabilities: light-driven automation, schedule control, mobile app control with live telemetry, and position-accurate motion. Light-driven automation reads the GL5528 LDR through a voltage divider, applies a hysteresis band around a user-set threshold, and opens or closes the curtain as daylight changes — the hysteresis band stops the jitter a single threshold would cause on cloudy days. Schedule control stores up to four daily open/close slots on the ESP32, checked against NTP-synced time, so curtains open at sunrise and close at bedtime without the phone in the loop. The mobile app talks to the controller over MQTT with one-tap open, close and stop buttons plus a live light-level readout and a position indicator. Position-accurate motion comes from 4,096 steps per motor revolution combined with end-stop switches at both rail ends, so the firmware always knows where the curtain actually is, even after a power cut.
Implemented
- [Light-threshold auto mode] The GL5528 LDR feeds a voltage divider into the ESP32's ADC; when light crosses the user-set threshold, the curtain opens or closes automatically. A hysteresis band between the open and close points stops the motor from jittering on cloudy days.
- [Four daily schedule slots] Up to four open/close times per day, stored in flash and checked against NTP-synced time, so curtains follow a daily routine without the phone in the loop.
- [Mobile app control and live telemetry] The companion app sends open, close and stop commands over MQTT and shows live light level, curtain position and motor state.
- [End-stop position feedback] Limit switches at both rail ends mark fully open and fully closed, re-zero the step counter on every homing pass, and stop the motor exactly at the travel ends.
- [Local manual buttons] Push buttons on the enclosure drive the curtain directly, so basic control survives a Wi-Fi outage.
- [Soft start and stop] The firmware ramps step speed up and down at the start and end of travel, which keeps the carriage from jerking and reduces belt slip.
Optional add-on
- [Voice assistant control] Google Assistant or Alexa triggers via an MQTT bridge can be added for hands-free open and close commands.
Future scope
- [Obstruction sensing] A current-sense or IR break-beam module could stop the carriage if something blocks the curtain's path.
What is included
- Assembled prototype: ESP32 controller, ULN2003 driver, 28BYJ-48 stepper, GL5528 LDR, 2 limit switches, belt carriage on a straight rail segment
- Complete firmware source with comments (Arduino IDE)
- Companion mobile app for manual control, schedules and live telemetry
- Wiring diagram and full component list
- Calibration procedure for the light threshold and end-stop setup
- Project report PDF, PPT presentation and viva Q&A document
Limitations & prerequisites
- Wi-Fi is required for app control, MQTT telemetry and schedule time sync — without it only the local buttons and the last-saved auto mode work.
- The 34.3 mN·m motor moves standard curtains only; heavy blackout drapes and long track spans are out of scope.
- The rail must stay straight (bend ≤ ~5°); a bent track stalls the motor — a design constraint, not a defect.
- The LDR gives a relative reading, not calibrated lux; the threshold is set by trial at install time.
- Remote control from outside the home needs the MQTT broker reachable on the internet, which is the buyer's own network setup.
- A power cut mid-travel loses the position estimate until the next end-stop homing pass.
- There is no obstruction sensing on the carriage path in the base build — listed as future scope.
- The 5 V supply must hold the motor's ~200 mA peak draw; weak chargers cause missed steps (covered in the setup guide).
Frequently Asked Questions
How does the controller measure light?
A GL5528 light-dependent resistor sits near the window in a voltage divider, so brighter light lowers its resistance and changes the voltage the ESP32's ADC reads once per second, and the firmware smooths those readings with a moving average before comparing them against your set threshold. Because the LDR reads relative light rather than calibrated lux, you set the threshold by trial at install time — point it at your window, note the day and evening readings, and pick a value between them.
What happens when the Wi-Fi goes down?
The mobile app and remote control stop working, but the controller keeps running its last-saved auto mode and schedules, and the physical push buttons on the enclosure still drive the curtain directly. Once Wi-Fi returns, the controller reconnects to the MQTT broker and resyncs its clock over NTP by itself. Schedules and thresholds live in flash, so nothing needs to be re-entered after an outage.
Can it move heavy blackout curtains?
Not as built — the 28BYJ-48's 34.3 mN·m pull-in torque is sized for standard-weight curtains on a short straight rail, and heavier drapes would stall the motor mid-travel. A higher-torque motor with a reinforced carriage can be specified as a customization for heavier curtains. The base prototype's torque and rail geometry are documented in the report so the sizing logic is defensible in the viva.
Does it remember my schedules after a power cut?
Yes — thresholds, schedule slots and the last known position are stored in the ESP32's flash memory, so daily routines resume automatically when power returns without any reconfiguration. If the outage happened mid-travel, the controller re-homes against the end-stop switches on its next move to recover exact position. Nothing is lost and no app interaction is needed.
Is this project suitable for a final-year project?
Yes — for Electronics, Electrical and IoT/Embedded programs, where it demonstrates sensor interfacing, stepper motor control, embedded networking over MQTT and a companion mobile app in one working build. Its calibration procedure and honest limitations — torque sizing, rail straightness, Wi-Fi dependence — make strong, defensible viva material.
Components & software requirements
- ESP32-WROOM-32 · Arduino framework
- 28BYJ-48 5 V stepper motor · ULN2003 driver board
- GL5528 LDR light sensor · voltage divider
- MQTT over Wi-Fi (PubSubClient) · NTP time sync
- Companion mobile app (control + schedules + telemetry)
- End-stop limit switches for position homing
- Straight curtain rail · toothed belt + carriage
- 5 V regulated power supply · flash settings storage
Delivery information
Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.
Support terms
Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.
Download free synopsis (PDF)
Enter your name and WhatsApp number — the synopsis PDF downloads immediately. We may send occasional project updates on WhatsApp; no spam.