Introduction: Touching a sanitizer bottle pump repeatedly increases the risk of spreading germs. In this project, we’ll use a micro:bit, an IR sensor, and a servo motor to create an automatic hand sanitizer dispenser.
When your hand is detected, the servo motor will push the sanitizer pump — no contact needed!
Learning Outcomes:
By completing this project, you’ll learn to:
- Detect object using an IR sensor.
- Control a servo motor with a Bit-Z.
- Apply basic automation logic to a real-world hygiene problem.
Components Needed:
- BBC micro:bit
- Bit-Z
- IR Sensor Module
- SG90 Servo Motor
Circuit Connection:
On the Bit-Z board, we’ll connect:
IR Sensor Module to P0/P1/P2 and SG90 Servo motor with S1/S2 pin of Bit-Z
How It Works
- The IR sensor continuously checks for a hand near the dispenser.
- When it detects something, it sends a LOW signal to the Bit-Z.
- The Bit-Z moves the servo motor to press the sanitizer pump.
- The servo then returns to its original position, ready for the next use.
Code:

Possible Improvements:
- Add a buzzer to beep when sanitizing.
- Show count of uses on the Bit-Z LCD display.
- Add LED indicators for detection and dispensing.
- Use a larger servo or motor for bigger bottles.
Conclusion:
With just a micro:bit, an IR sensor, and a servo motor, you can build a fully functional automatic sanitizer dispenser.
It’s a great beginner-friendly project that solves a real hygiene problem — and it’s a fun way to learn about automation.