Touchless hand sanitiser dispenser
Hold your hand under it and a metal-gear servo presses the pump for you.
Shop by category
Shop all componentsA 28BYJ-48 stepper with its ULN2003 driver board turns precisely and holds its position, which makes it ideal for a small curtain model or a window blind demo. The ESP32 serves a web page with Open, Close and Stop buttons. The sketch counts steps so it never over-runs, and it removes power from the coils when idle to keep the motor cool. This is a model for learning; a real curtain needs a much stronger motor.
Keep fingers away from the moving thread and spool.
Tick anything you already have and the total updates.
28BYJ-48 stepper motor with ULN2003 driver board
Follow the colours: red is power, dark grey is ground, blue is a signal.
Use a 5 V 1 A supply for the motor if you can. Powering it from the ESP32's USB works for a light demo.
stepper_curtain.inoVerify & upload in Electrolark#include <WiFi.h>
#include <WebServer.h>
#include <AccelStepper.h>
const char* WIFI_NAME = "YOUR_WIFI";
const char* WIFI_PASS = "YOUR_PASSWORD";
const long OPEN_STEPS = 8192; // two turns of the output shaft
// the sequence IN1, IN3, IN2, IN4 is needed for the 28BYJ-48
AccelStepper stepper(AccelStepper::HALF4WIRE, 14, 26, 27, 25);
WebServer server(80);
void page() {
String s = "<html><meta name='viewport' content='width=device-width,initial-scale=1'><body style='font-family:sans-serif;text-align:center'>";
s += "<h2>Curtain</h2><p><a href='/open'><button style='font-size:26px'>Open</button></a> ";
s += "<a href='/close'><button style='font-size:26px'>Close</button></a> ";
s += "<a href='/stop'><button style='font-size:26px'>Stop</button></a></p></body></html>";
server.send(200, "text/html", s);
}
void go(long target) { stepper.moveTo(target); server.sendHeader("Location", "/"); server.send(303); }
void setup() {
Serial.begin(115200);
stepper.setMaxSpeed(800);
stepper.setAcceleration(400);
WiFi.begin(WIFI_NAME, WIFI_PASS);
while (WiFi.status() != WL_CONNECTED) delay(300);
Serial.print("Open http://"); Serial.println(WiFi.localIP());
server.on("/", page);
server.on("/open", []() { go(OPEN_STEPS); });
server.on("/close", []() { go(0); });
server.on("/stop", []() { stepper.stop(); server.sendHeader("Location", "/"); server.send(303); });
server.begin();
}
void loop() {
server.handleClient();
stepper.run();
if (stepper.distanceToGo() == 0) stepper.disableOutputs(); // let the coils cool
}
The coil order is wrong. The sketch uses the pin order IN1, IN3, IN2, IN4 for the AccelStepper constructor; check your wiring matches.
It starts at 0 each time it powers on, so close the curtain fully before switching it off.
The motor draws more than USB gives. Use a separate 5 V supply with a common ground.
No. The 28BYJ-48 is small and slow, so it suits models and very light blinds.
Only by counting steps. A limit switch at the closed end would make it reliable.
Holding the coils warms the motor and wastes power.
4 parts: ESP32-WROOM-32 38-Pin Development Board, 28BYJ-48 Stepper Motor & ULN2003 Driver Kit, Solderless Breadboard and Dupont Jumper Wires (40 pcs). On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 2 hours. The build on this page has 6 steps.
No. This page has the complete, tested code (stepper_curtain.ino).
About ₹591 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Driving a stepper with a ULN2003 board; Counting steps and keeping a position; Handling web commands without blocking.
Keep fingers away from the moving thread and spool.
Ideas that reuse this build: ESP32 web server relay switch. They are listed under Take it further on this page.
Hold your hand under it and a metal-gear servo presses the pump for you.
Wave your hand and the lid lifts by itself, then closes after three seconds.
Your first motion project: turn the knob and the servo follows.
Dial in an exact servo angle, 2° per click, shown on screen.
Learning project. Check every circuit and the datasheet of each part before you power it up.