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 hobby servo turns to the angle you ask for and holds it. It reads the angle from the width of a pulse sent 50 times a second, and the built-in Servo library makes those pulses for you: myServo.write(90) means 90 degrees. Two for loops step the angle one degree at a time, which gives a smooth sweep.
Every part for this build comes in the Geekobot Spark Kit box, a Geekobot exclusive, together with the parts for all 24 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.
The brain of every Spark Kit project
Female-to-female or male-to-female leads for the modules
Sensor Shield v5.0 from the kit: every pin has its own G, V, S header, so modules plug in with female jumpers
Follow the colours: red is power, dark grey is ground, blue is a signal.
spark_kit_15_servo_motor_sweep.inoVerify & upload in Electrolark// Spark Kit 15: servo sweep
#include <Servo.h>
Servo myServo;
void setup() {
myServo.attach(9);
}
void loop() {
for (int pos = 0; pos <= 180; pos++) {
myServo.write(pos);
delay(15);
}
for (int pos = 180; pos >= 0; pos--) {
myServo.write(pos);
delay(15);
}
}
Use the kit's USB cable (some phone cables carry power only), install the CH340 driver on Windows if the port does not appear, and pick Tools > Board > Arduino Uno.
The servo draws current spikes. Use a good USB port, or power the shield from a 7-12 V adapter on the UNO's DC jack.
Some SG90s reach their stop before 0 or 180. Sweep from 5 to 175 instead.
No, it comes with the Arduino IDE.
The servo and the Arduino must share a ground so the signal pulse has a reference.
Yes. It is one of the 24 projects in the Geekobot Spark Kit, and every part on the list comes in the kit box. You can also buy the parts one by one from the list above.
No. Every Spark Kit project is wired on the breadboard or the Sensor Shield with jumper wires.
5 parts: Uno R3 CH340G ATmega328p Compatible Development Board, Arduino USB-A to USB-B Data Cable for UNO/MEGA, TowerPro SG90 9g Micro Servo (180°), Dupont Jumper Wires (40 pcs) and Arduino Sensor Shield V5 Expansion Board. On this page you can tick the parts you already have and add only the rest to your cart.
It is a beginner project and takes about 20 minutes. The build on this page has 5 steps.
About ₹490 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
PWM pulses and servo control; Servo positioning with the Servo library; Robotics basics.
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.