Introduction: Non-contact Switch for Public Water Dispenser - Arduino

About: Maker, DIYer, Opensource Hardware Enthusiast


Maintaining hand hygiene and washing hands are the most important personal hygiene measures to prevent the new coronavirus. In daily life, we inevitably touch various public facilities, such as the switch of the company's water dispenser. Since drinking water is everyone's daily and you need to touch the switch of the dispenser many times a day. In order to avoid cross infection caused by bacterial virus transmission as much as possible, I made the simplest automatic sensor switch on my Arduino and shared it with you.


Arduino Uno Rev3 X1

Grove Base Shield V2.0 for Arduino X1

(Could replace arduino uno rev3 and grove base shield V2.0 to Seeeduino Lotus, less hardware, less cost)

Grove - IR Distance Interrupter v1.2 X1

Grove - Servo X1

Grove - Rotary Angle Sensor X1

USB Cable X1

Power Bank X1


Arduino IDE

Step 1: Hardware Connection

Step 2: Upload the Code

Quick Note on Servo Control:

Standard servos allow the shaft to be positioned at various angles, usually between 0 and 180 degrees. Continuous rotation servos allow the rotation of the shaft to be set to various speeds.

"servo.write(angle)" writes a value to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft (in degrees), moving the shaft to that orientation. On a continuous rotation servo, this will set the speed of the servo (with 0 being full-speed in one direction, 180 being full speed in the other, and a value near 90 being no movement).

Step 3: Install the Device to a Suitable Location

Install the device to a suitable location and test to the perfect. Enjoy the results of your work!

I guess you cannot wait showing off your great work to your families and friends already! Run and go shooting some great pictures and videos now! You are very welcomed to also share your unique work with us. Should you have any further question about this project, or want to share your work with me, feel free to drop an email to I am Makerming from Shenzhen, China. Finally, thanks for reading, your comments are the biggest support to my work.

Step 4: