Touchless hand sanitiser dispenser
Hold your hand under it and a metal-gear servo presses the pump for you.
Shop by category
Shop all componentsAn electromagnet only holds while current flows, so an Arduino can grab and release steel parts by switching it. A MOSFET module switches the 12 V coil, and a 1N4007 diode across the coil absorbs the voltage kick when it switches off. A 30-second timer and a buzzer turn it into a game; a joystick or two buttons on a simple frame move the magnet.
Keep the magnet away from phones, cards and pacemakers.
Do not hold it on for long periods; the coil heats up.
Tick anything you already have and the total updates.
Follow the colours: red is power, dark grey is ground, blue is a signal.
12 V adapter for the magnet; the Nano can share it through VIN.
crane_game.inoVerify & upload in Electrolarkconst int MAG = 9, GRAB = 2, START = 3, BEEP = 5;
const unsigned long GAME_MS = 30000;
unsigned long startAt = 0;
bool playing = false;
void setup() {
pinMode(MAG, OUTPUT); pinMode(BEEP, OUTPUT);
pinMode(GRAB, INPUT_PULLUP); pinMode(START, INPUT_PULLUP);
}
void loop() {
if (!playing && digitalRead(START) == LOW) { playing = true; startAt = millis(); tone(BEEP, 1500, 200); }
if (!playing) { digitalWrite(MAG, LOW); return; }
unsigned long left = GAME_MS - (millis() - startAt);
digitalWrite(MAG, digitalRead(GRAB) == LOW ? HIGH : LOW);
static unsigned long lastBeep = 0;
if (left < 5000 && millis() - lastBeep > 1000) { tone(BEEP, 2000, 80); lastBeep = millis(); }
if (millis() - startAt > GAME_MS) { playing = false; digitalWrite(MAG, LOW); tone(BEEP, 400, 800); }
}
Some steel stays magnetised; a thin tape layer on the magnet face helps.
The flyback diode is missing or backwards.
The prize is not flat steel; aluminium and brass do not stick.
Rated force is for a thick flat steel plate; small washers hold far less.
Yes if held on for a long time; the game timer limits that.
Yes, but a MOSFET is silent and lasts longer with frequent switching.
9 parts: 12V Lifting Electromagnet, MOSFET Switch Module, Relay Replacement (D4184 / LR7843), 1N4007 Rectifier Diode (Pack of 10), Generic Nano CH340 Development Board (Soldered), 2 × Tactile Push Button Switch, Buzzer Module 3.3–5V, DC Power Adapter (5.5x2.1mm), 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 3 hours. The build on this page has 6 steps.
No. This page has the complete, tested code (crane_game.ino).
Electromagnets and holding force; Switching an inductive load with a MOSFET; Why a flyback diode is needed.
Keep the magnet away from phones, cards and pacemakers. Do not hold it on for long periods; the coil heats up.
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.