Touchless hand sanitiser dispenser
Hold your hand under it and a metal-gear servo presses the pump for you.
Shop by category
Shop all componentsRun the stepper as a factory conveyor: continuous motion, indexed batches, jams, and a live count of items processed. Real conveyors run in two ways. Continuous mode never stops, which suits bulk material; indexed mode advances a fixed distance, pauses for work to happen, and advances again, which suits assembly. Both are built here from the same primitive, a small batch of steps issued each pass through loop() rather than one long blocking move, so the sensor and buttons stay live. That is the same non-blocking discipline used throughout this manual, applied to a motor.
The ESP32 is a 3.3V board: never connect a 5V signal straight to a GPIO pin.
Charge 18650 cells only in a proper Li-ion charger and never short the holder's wires.
Every part for this build comes in the Geekobot Titan Kit box, a Geekobot exclusive, together with the parts for all 120 projects, from a first blinking LED to a smart fan and a reaction game. The wiring below is the kit's own wiring.
Tick anything you already have and the total updates.
ESP32 DevKit V1 (38-pin): the brain of every Titan Kit project, with Wi-Fi and Bluetooth
Male-to-female and female-to-female leads for the modules
IR obstacle sensor: OUT goes LOW when something is in front
28BYJ-48 stepper motor with its ULN2003 driver board
L298N board: its on-board regulator turns the 7.4V pack into 5V for the motor
ESP32 expansion board from the kit: every GPIO has its own S, V, G header
Follow the colours: red is power, dark grey is ground, blue is a signal.
The stepper's 5V comes from the L298N's on-board regulator, fed by the 2 x 18650 pack. The ESP32 only sends the four step signals.
titan_kit_105_automated_conveyor_simulat.inoVerify & upload in Electrolark#include <Stepper.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define STEPS_PER_REV 2048
Stepper belt(STEPS_PER_REV, 33, 5, 32, 23);
Adafruit_SSD1306 display(128, 64, &Wire, -1);
int sensorPin = 13;
int runButton = 12;
int modeButton = 14;
int buzzer = 27;
bool running = false;
bool indexed = false; // false = continuous, true = indexed
int batchSteps = 32; // Steps issued per pass - keeps loop responsive
long indexLength = 512; // Steps between pauses in indexed mode
long stepsThisIndex = 0;
unsigned long pauseUntil = 0;
unsigned long pauseLength = 1500;
long totalSteps = 0;
int itemsCounted = 0;
int speedRPM = 10;
bool lastSensor = HIGH;
unsigned long lastItem = 0;
unsigned long lastMovement = 0;
bool jammed = false;
void setup()
{
pinMode(sensorPin, INPUT);
pinMode(runButton, INPUT_PULLUP);
pinMode(modeButton, INPUT_PULLUP);
pinMode(buzzer, OUTPUT);
belt.setSpeed(speedRPM);
Serial.begin(9600);
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { while (true) { } }
display.setTextColor(SSD1306_WHITE);
display.setTextSize(1);
lastMovement = millis();
}
void loop()
{
if (digitalRead(runButton) == LOW)
{
running = !running;
jammed = false;
lastMovement = millis();
tone(buzzer, running ? 1400 : 700, 150);
Serial.println(running ? "Conveyor started" : "Conveyor stopped");
delay(300);
}
if (digitalRead(modeButton) == LOW)
{
indexed = !indexed;
stepsThisIndex = 0;
pauseUntil = 0;
Serial.println(indexed ? "Indexed mode" : "Continuous mode");
delay(300);
}
// Count items passing the sensor
bool sensor = digitalRead(sensorPin);
if (sensor == LOW && lastSensor == HIGH && millis() - lastItem > 250)
{
itemsCounted = itemsCounted + 1;
lastItem = millis();
tone(buzzer, 1800, 50);
Serial.print("Item ");
Serial.println(itemsCounted);
}
lastSensor = sensor;
// Move the belt in small batches so nothing blocks
if (running && !jammed && millis() > pauseUntil)
{
belt.step(batchSteps);
totalSteps = totalSteps + batchSteps;
lastMovement = millis();
if (indexed)
{
stepsThisIndex = stepsThisIndex + batchSteps;
if (stepsThisIndex >= indexLength)
{
stepsThisIndex = 0;
pauseUntil = millis() + pauseLength;
tone(buzzer, 1000, 100);
}
}
}
// A jam is the belt running with nothing reaching the sensor
if (running && !indexed && millis() - lastItem > 20000 && itemsCounted > 0)
{
if (!jammed)
{
jammed = true;
tone(buzzer, 400, 800);
Serial.println("JAM - no items detected");
}
}
display.clearDisplay();
display.setCursor(0, 0);
display.print("CONVEYOR LINE");
display.setCursor(74, 0);
display.print(indexed ? "INDEXED" : "CONTINUOUS");
display.setTextSize(2);
display.setCursor(0, 12);
if (jammed) display.print("JAMMED");
else if (!running) display.print("STOPPED");
else if (millis() < pauseUntil) display.print("PAUSED");
else display.print("RUNNING");
display.setTextSize(1);
display.setCursor(0, 32);
display.print("Items: ");
display.print(itemsCounted);
display.setCursor(64, 32);
display.print("Turns: ");
display.print(totalSteps / STEPS_PER_REV);
// Belt animation
display.drawRect(0, 42, 128, 12, SSD1306_WHITE);
if (running && millis() > pauseUntil && !jammed)
{
int offset = (totalSteps / 8) % 16;
for (int x = offset; x < 126; x = x + 16)
{
display.fillRect(x + 1, 44, 6, 8, SSD1306_WHITE);
}
}
display.setCursor(0, 56);
if (indexed && millis() < pauseUntil)
{
display.print("Work pause ");
display.print((pauseUntil - millis()) / 100 / 10.0, 1);
display.print("s");
}
else
{
display.print("D3 run D4 mode");
}
display.display();
}
Use a micro-USB data cable (some cables only charge), install the CP210x or CH340 driver if no port appears, pick Tools > Board > ESP32 Dev Module and hold the BOOT button on the board until the upload starts.
The sketch uses INPUT_PULLUP, so one leg goes to the GPIO and the other to GND. Use two legs on opposite sides of the button.
This project needs the passive buzzer (the one that plays notes), not the active one.
Check SDA on GPIO21 and SCL on GPIO22, power from 3V3, and that the sketch uses address 0x3C (some boards are 0x3D).
Real conveyors run in two ways. Continuous mode never stops, which suits bulk material; indexed mode advances a fixed distance, pauses for work to happen, and advances again, which suits assembly. Both are built here from the same primitive, a small batch of steps issued each pass through loop() rather than one long blocking move, so the sensor and buttons stay live. That is the same non-blocking discipline used throughout this manual, applied to a motor.
Press the first button and the belt turns continuously with a moving pattern on screen. Break the IR beam and the item counter increases with a click. Press the second button for indexed mode: the belt advances, pauses 1.5 seconds, then advances again.
Yes. It is project 105 of 120 in the Geekobot Titan Kit, in level 15 (Actuators). Every part on the list comes in the kit box, and you can also buy the parts one by one from the list above.
No. Every Titan Kit project is wired on the ESP32 expansion board and the breadboard with jumper wires.
13 parts: ESP32-WROOM-32 38-Pin Development Board, USB Cable, Solderless Breadboard, Dupont Jumper Wires (40 pcs), 2 × Tactile Push Button Switch, Buzzer Module 3.3–5V, 0.96" OLED Display 128x64, Generic Infrared Obstacle Avoidance Sensor Module (Active Low) – LM393 Comparator, 2-30cm Range, 28BYJ-48 Stepper Motor & ULN2003 Driver Kit, L298N Dual H-Bridge Motor Driver Module, plus 3 more. On this page you can tick the parts you already have and add only the rest to your cart.
It is a advanced project and takes about 1 hour. The build on this page has 9 steps.
No. This page has the complete, tested code (titan_kit_105_automated_conveyor_simulat.ino).
About ₹1,475 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Continuous motion loops; Batching steps to keep the loop responsive; Indexed advance-and-pause cycles; Detecting a fault from the absence of expected events; Combine levels, give the RFID access log a Bluetooth download, or let the gesture menu drive the stepper conveyor; Add a DS3231 real-time clock so every log entry carries a real date and time instead of seconds since power-up; Replace the simulated compass in Experiment 7 with a real magnetometer on the same I2C bus; Move the RFID and configuration data into EEPROM so cards can be enrolled without re-uploading the sketch; Try a proper FFT library on a faster board and compare it with the zero-crossing estimate from Experiment 25; Close the loop, add an end-stop switch to the conveyor so the stepper can home itself instead of trusting its count; Design your own project from scratch: write down the inputs, the outputs, and the decision in between, then wire and code it. Conclusion If you have worked through these experiments, you have travelled a very long way. You began by making one LED blink on a 3.3V dual-core microcontroller and ended by driving a conveyor line that counts its own output and notices when it jams. Along the way you met every core idea in physical computing, digital and analog signals, PWM, bitmapping, thresholds and state machines, and then the ideas that separate a working prototype from a demonstration: calibration, filtering, hysteresis, non-volatile storage, and protocols designed for a machine at the other end rather than a human. More importantly, you have seen the same techniques reappear in unrelated places. The rolling average that smoothed a temperature graph is the one that stopped a noise alarm firing at a door slam. The two-threshold hysteresis that steadied a hover switch is the one that stopped a gesture menu flickering. The parallel arrays behind a library catalogue are the ones behind an attendance register. Recognising a familiar technique wearing unfamiliar clothes is most of what engineering experience actually is.
The ESP32 is a 3.3V board: never connect a 5V signal straight to a GPIO pin. Charge 18650 cells only in a proper Li-ion charger and never short the holder's wires.
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.
Lessons are free to read. Maker (₹499/month) and Pro add quizzes, worked problems and certificates, paid with your Geekobot account. See plans
Learning project. Check every circuit and the datasheet of each part before you power it up.