What it shows
An LDR measures daylight, the Arduino decides open or closed, and an L298N driver runs a geared DC motor in either direction to pull a string curtain across a model window. Two limit switches stop the motor at each end.
The science
The LDR and fixed resistor form a voltage divider on A0, so the reading rises with light. The L298N is an H-bridge: two pairs of transistors that can connect the motor either way round, so setting IN1 high and IN2 low turns one direction and the reverse turns the other. The limit switches tell the sketch when the curtain reaches an end so the motor stops instead of stalling. A dead band between the open and close thresholds stops the curtain from twitching at dusk.
Materials
Cost: under Rs 1,500. Many items come from home or from waste; spare parts such as LEDs, motors and wire are in the store.
- An Arduino Uno clone and USB cable
- An LDR and a 10 kΩ resistor
- An L298N motor driver module
- A geared DC motor (BO or TT, 3 to 6 V)
- Two micro limit switches
- A cardboard window frame, a cloth curtain, string and a thread spool for the pulley
- A 6 V battery pack (4 AA)
Safety
For this project: Battery power only. Keep fingers away from the string and spool while the motor runs. Small parts: keep away from young children.
Never use mains electricity: power models with cells, batteries or a low-voltage adapter. Sharp and hot tools, flames and lab chemicals need an adult or your teacher beside you. Keep magnets, button cells and small parts away from young children, and wash your hands after making.
All the safety rulesStep by step
9 steps. Do them in order, and test each part before you go on to the next. Write what you notice in a notebook as you go.
Wire the LDR from 5 V to A0 and the 10 kΩ resistor from A0 to GND.
Wire the L298N: IN1 to pin 5, IN2 to pin 6, ENA jumper on, motor to OUT1 and OUT2, 6 V pack to the 12V and GND terminals, and GND to Arduino GND.
Mount the motor at one top corner of the window with the spool on its shaft; run the string across the top to a free pulley and back, tying the curtain edge to the string.
Fix a limit switch at each end so the curtain edge presses it; wire each between a pin (2 and 3) and GND, using INPUT_PULLUP.
Print the LDR value by day and after dark, then choose an open threshold and a close threshold about 100 apart.
Write a sketch: if light is above the open threshold and the open switch is not pressed, run the motor open; if light is below the close threshold and the close switch is not pressed, run it closed; otherwise stop.
Cover the LDR with your hand to make night and watch the curtain close until the switch clicks.
If the motor runs the wrong way, swap the two motor wires on the L298N.
Add a manual override push button that toggles the curtain regardless of light.
What you should see
The curtain closes fully when the LDR is shaded and opens when uncovered, stopping cleanly at each limit switch without the motor straining.
Viva questions
A teacher or a judge will ask how it works. Try to answer each question before you open it, then compare.
1What does an H-bridge do?
It lets a single supply drive a motor in both directions by switching which side is connected to positive.
2Why two thresholds instead of one?
To avoid the motor flipping back and forth when the light sits right at the switching level.
3What is INPUT_PULLUP?
An internal resistor that holds the pin high so a switch to ground gives a clean low when pressed.
4Why not run the motor straight from an Arduino pin?
A motor needs far more current than a pin can give and produces voltage spikes; the driver handles both.
Take it further
Add a DS3231 clock so the curtain also closes at a set bedtime regardless of light.
Change one thing, measure what happens, and add a table or chart of your readings: that is what turns a model into your own investigation.
Free ebooks for this project
Robotics
Motors, Gears and Motor Drivers
Make things move: DC motors, servos, steppers and how to drive them
