How to DIY Touchless Soap Dispenser

Touchless soap dispensers are innovative devices that dispense soap without physical contact, using sensors to detect the presence of hands. These dispensers are increasingly popular due to their ability to improve hygiene and minimize the spread of germs, particularly in environments like kitchens and bathrooms.

How to DIY Touchless Soap Dispenser

Additionally, they add a modern, tech-savvy touch to any space and offer unparalleled convenience by reducing the need for manual interaction.

This article aims to provide a comprehensive, step-by-step guide on how to DIY touchless soap dispenser using affordable and accessible components. Whether you’re a technology enthusiast or someone seeking a fun and practical project, this guide will help you create a functional device tailored to your needs.

By building your own touchless soap dispenser, you can enjoy the benefits of improved cleanliness while showcasing your creativity and technical skills.

Materials and Tools Needed

To build your own touchless soap dispenser, you’ll need a combination of essential components, additional supplies, and basic tools to assemble the device effectively. Below is a list of items required for this project:

Essential Components

  • Small DC pump or peristaltic pump: This component will be responsible for moving the soap from the container to the output nozzle.
  • Infrared (IR) sensor module: A motion or proximity sensor that detects hand movement near the dispenser and triggers the system.
  • Arduino board or microcontroller (e.g., Arduino Nano): The brain of the system that controls the sensor and pump operation.
  • 5V power supply or USB power bank: Provides power to the microcontroller and pump for smooth operation.
  • Tubing: Connects the pump’s output to the soap container, ensuring an uninterrupted flow of liquid soap.
  • Soap container or repurposed soap bottle to hold the liquid soap.

Additional Supplies

  • Wires and a breadboard (optional): Facilitates connections between components; soldering can be used for a more permanent setup.
  • Hot glue gun or double-sided tape for mounting and securing components in place.
  • Small plastic enclosure or case (optional): Enhances the appearance and protects the electronics.

Tools Required

  • Wire cutters/strippers to prepare the wiring for connections.
  • Screwdriver for assembling parts or securing components.
  • A drill (optional) for modifying the enclosure or container housing.

These materials and tools ensure a smooth DIY experience and set the stage for a fully functional touchless soap dispenser.

Understanding How It Works

A touchless soap dispenser operates through the seamless integration of sensors and microcontrollers, enabling automatic soap dispensing. Here’s a breakdown of its core working principles:

Enabling Automatic 
Soap Dispensing

Sensor Detection 

At its foundation, an infrared sensor detects hand motion or proximity. This type of sensor emits infrared light and monitors the reflection caused when an object, such as a hand, is nearby. When the sensor identifies this proximity, it generates a signal that starts the dispensing process.

Trigger Mechanism 

Once the infrared sensor detects a hand, it sends an electronic signal to the connected Arduino or microcontroller. This serves as the triggering mechanism, communicating that soap needs to be dispensed.

Pump Activation 

The signal from the microcontroller activates the small pump within the dispenser for a short, pre-programmed duration. This ensures the right amount of soap is dispensed efficiently, avoiding waste or mess.

Power Source 

The device is powered through a USB connection or batteries, making it versatile and portable. Users can enhance convenience by employing rechargeable batteries or connecting the device directly to a wall outlet for continuous power. This adaptable power design further supports its practicality in various settings, from homes to offices.

How to DIY Touchless Soap Dispenser: Assembling the Electronics

Step 1: Wiring the Sensor 

Begin by connecting the sensor’s VCC pin to the power supply (5V) and the GND pin to the ground terminal on the Arduino. Next, connect the sensor’s signal pin to one of the Arduino’s digital input pins. Ensure firm and proper connections to prevent any malfunction during operation.

Connect the Sensor’s 
Signal Pin to One

Step 2: Connecting the Pump 

Since the Arduino cannot directly power a motorized pump, you must switch to a transistor or relay. Connect the pump to the power supply through this transistor or relay. Additionally, attach a diode across the pump terminals. The diode is a protective element, preventing any backflow current that could harm the circuit when the pump is powered off.

Step 3: Power Connections 

The Arduino and sensor require a stable power source. Connect the Arduino to a computer or USB wall adapter using a USB cable. Alternatively, use a battery holder with rechargeable or disposable batteries to supply a 5V input. Ensure all components receive adequate, uninterrupted power.

Step 4: Uploading Code to Arduino 

Program the Arduino with sample logic code designed for the dispenser. For instance, include instructions to detect motion using the sensor, activate the pump for approximately one second to dispense soap, and incorporate a cooldown delay before the next operation. Test the code thoroughly to confirm the system functions as intended. With these steps, your electronic assembly will be complete.

Constructing the Soap Dispenser Body 

Step 1: Selecting a Container 

Begin by choosing a suitable container for your soap dispenser. You can use an existing soap bottle or repurpose a sturdy plastic container. Ensure it is large enough to house all components while maintaining a compact design. Drill or cut precise holes in the container to accommodate tubing and sensor placement. Avoid cracks or uneven edges, as these could compromise the structure.

Step 2: Integrating the Tubing 

Once the container is prepared, insert the tubing from the pump outlet into the nozzle or spout of the soap container. Ensure the tubing fits snugly to prevent leaks and maintain smooth liquid flow. You may need to seal around the tubing with hot glue or silicone to secure it in place and ensure a watertight connection.

Step 3: Mounting the Sensor and Pump 

Position the motion sensor prominently on the front side of the container for optimal hand detection. The sensor should have a clear, unobstructed view to ensure reliable operation. The pump should be securely placed inside or attached to the container, aligned with the tubing. Use hot glue, double-sided tape, or small brackets to mount the sensor and pump securely without damaging the components.

Securely Placed Inside or 
Attached to the Container

Step 4: Enclosing the Electronics (Optional) 

To protect the Arduino and circuit wires from moisture or accidental damage, consider placing them inside a waterproof enclosure or a sealed compartment. Ensure that any necessary openings for wires are properly sealed to prevent water ingress. This optional step will enhance the device’s durability and safety, especially when the dispenser encounters frequent spills or moisture.

Programming and Testing the System 

Arduino Code Sample Overview 

The system’s core functionality relies on detecting hand presence using a sensor and briefly activating the pump to dispense soap. Below is an overview of the logic involved in programming the system:

  1. Use an infrared (IR) or ultrasonic sensor to detect a hand approaching the dispenser.
  2. Once a hand is detected, trigger the pump to activate for a short duration, dispensing a measured amount of soap.
  3. Implement a delay or cooldown period to prevent the system from double-dispensing soap if the hand remains in the detection zone for too long.

Testing the Sensor and Pump Timing 

Test the sensor and pump functionality after uploading the code to the Arduino. Adjust the sensor’s sensitivity to ensure it correctly detects hands at the desired distance while ignoring other movements. Test and modify the pump’s runtime to regulate the amount of soap dispensed per activation. If the pump doesn’t respond, troubleshoot the wiring connections and verify the code for errors.

Final Calibration 

Perform a final calibration to enhance the system’s performance. Test the hand detection range and response time to ensure efficient operation. Fine-tune delay intervals to prevent excessive soap flow and optimize users’ dispensing experience.

Safety Tips and Maintenance 

Safety Considerations 

Safety should always be a priority when working with electronic soap dispensers. Use low-voltage components to minimize the risk of electrical shock or fire hazards. Additionally, ensure all electronic parts are adequately sealed and protected from water exposure to prevent damage and potential malfunction. Always disconnect power before performing any repairs or modifications to the system. 

Routine Maintenance 

Proper maintenance ensures the soap dispenser operates efficiently and reliably over time. Refill the soap reservoir as needed to prevent interruptions in use. Regularly clean the tubing and sensor lens to avoid blockages and ensure accurate detection.

Inspect all wiring connections periodically to ensure they remain secure, reducing the likelihood of performance issues. If the system uses batteries, routinely check their life span and replace them to maintain consistent operation and avoid downtime.

Reservoir as Needed to 
Prevent Interruptions

Conclusion

Building a functional, cost-effective DIY touchless soap dispenser is a rewarding project that combines creativity and practicality. You can create a dispenser that improves hygiene while reducing manual contact by utilizing a simple pump, sensor, and basic electronics.

The process of learning how to DIY touchless soap dispenser serves as an engaging maker project, offering an opportunity to hone your skills and personalize the design to suit your needs. It also allows for endless customization, including features like LED indicators to signal operation or adjustable flow settings for better usability.

Such enhancements can further elevate the dispenser’s functionality and aesthetic appeal. Whether for your home or as a thoughtful gift, this project is a valuable venture for any DIY enthusiast. Take the first step today and experiment with your ideas to make a touchless soap dispenser uniquely your own!

Photo of author

Jennifer Branett

Leave a Comment