DIY Automatic Hand Sanitizer Dispenser

DIY Automatic Hand Sanitizer Dispenser

The COVID-19 disease is spreading like wildfire into our communities. It important now more than ever to listen to health experts and medical officers on ways we can cut down the spread of the virus.


WHO officials recommend people to wash hands with soap and water regularly or use alcohol based sanitizers. As we live in the times of the COVID-19 pandemic, we are forced to rethink ways we normally live through our lives.


Sanitizing our hands and wrists with alcohol based sanitizers, especially when we interact with the public environment, is used and proven to be effective in controlling the spread of the virus. Therefore, it is our responsibility to continue this social measure and use electronics and technology to ensure that dispensing sanitizer is done in a safe and a non-contact way.


Using sanitizers in automatic dispensers helps in creating a touch less ecosystem that is essential in cutting down the spread of cross infections. By reducing physical contact, automatic sanitizer dispensers help in containing the virus from spreading around in communal areas.


Therefore, in this blog we’ll be taking a look at how to make your own DIY automatic sanitizer dispenser for relatively cheap without involving any sort of programming or having microcontroller hardware. Most expensive off-the-shelf sanitizer dispenser work in exactly or close to the way described here, but packaged in a more sophisticated way to charge premium to the end consumer. With the help of the DIY kit for automatic dispenser, you can make your own hand sanitizer dispenser at home. The components and materials we’ll be using for this project is as follows

  • 5V Single Channel Relay
  • IR Proximity Sensor
  • Small DC Pump
  • 5V 1A power adaptor or USB to DC power cable
  • A few single or multi strand wires
  • A plastic Jar
  • A plastic tube
  • Pen cap for nozzle
  • Scotch tape, electrical tapes and scissors

Alternatively, you can also get a Sanitizer Dispenser Module from this, which is a custom made PCB designed to do dispense sanitizer. It has an added advantage of dispensing the Sanitizer for a fixed amount of time, rather than dispensing the sanitizer as long as hand is detected. The instructions of how to use the module is given under Method 2. The components you’ll require for this approach are

  • Sanitizer Dispenser Module
  • Small 5V DC Pump
  • 5V Source (we used a USB brick and cut USB cable)
  • A plastic Jar
  • A plastic tube
  • Pen cap for nozzle
  • Scotch tape, electrical tapes and scissors 

Method 1: With Relay and IR Proximity Sensor

5V Single Channel Relay

5V Single Channel Relay

5V Single Channel Relay is used here as an electrically controlled electromechanical switch. The Relay has six connection points in total, three on each side. The appliance to be controlled that is in this case a DC pump is to be connected to the left side of the relay as shown in the image above. The appliance must be connected to the common, while the positive VCC cable must be connected to Normally Open (N/O) or Normally closed (N/C) depending on whether you want your appliance to be always OFF or always ON. For our case, we require the DC pump to be always OFF, so we will connect the VCC wire to N/O.


The connections on the right side of the relay, is for the relay module itself. 5V and GND must be connected to power on the relay and signal pin is the pin that will control the output of the relay. When a logic high (5V) is given to the signal pin, a connection establishes between N/O and Common pin but if the there’s’ no signal at signal pin, i.e. logic low, the connection gets disconnected between the N/O and the common terminal, thus giving us the ability to electrically control the relay as an ON/OFF switch.

IR Proximity Sensor

IR Proximity Sensor

The IR proximity sensor will be used to detect a hand near the nozzle and will be controlling the position of the relay in the sanitizer dispenser kit. The IR proximity sensor uses the IR emitter to emit out signal and listens on in the receiver side. The module is tuned to receive and detect the emitted signal. If an object blocks the emitted signal, the signal bounced off the object and falls on the receiver side. This is how the module detects if an object is placed in front of the sensor. The built in potentiometer can be used to adjust the sensitivity of the module and can be adjusted with a star screwdriver based on the user needs. You can tune the sensor using the potentiometer to vary it's sensitivity. You can turn it all the way towards the opposite end and ensures it turns off. You can then keep your hand below it.


VCC and GND pins on the left side of the module is used to power up the module itself while the OUT pin gives the output of the sensor. When an object is detected, it gives, out HIGH signal, otherwise low. This will be connected to the relay signal pin, so that the relay can be switched on/off depending on whether an object is detected at the sensor side or not.

A Small DC Pump

DC Pump

A small DC pump is also used in the DIY sanitizer dispenser kit. The DC pump will be connected to the Common terminal of the relay, and it is the pump the relay will switch on and off based on whether the IR sensor detects something.

Working and Connections

The set-up of the DIY sanitizer dispenser kit with the components described above is a fairly straightforward. The IR proximity sensor will be the sensor used to detect if a hand is detected under the nozzle. When the IR detects an object, it will output a high (5V signal) to the relay, opening up the relay channel and turning on the DC pump, thereby releasing the sanitizer through the nozzle.

The full connection diagram is as follows:



After the above connections are made, the pump with plastic tube attached can be placed inside the plastic jar while the electronic components can be taped on top of the lid of the Jar.


Two holes are made on top of the jar such that plastic pipe and the electrical wires can be brought out of the jar.


Make sure all exposed wires are covered with electrical tape so as to avoid short circuits. A nozzle can also be added to the end of the plastic tube connected to the pump, to restrict the flow of the sanitizer. 


Once all the connections and set up is ready, the main power can be given and you should see the relay and the IR having their power LEDs glow on.


If everything went smoothly and correctly, when powered on, as soon as the IR detects an object, you should be able to hear the pump turning on.


In case it doesn’t, verify the connections and try again. Once ensured that the system works as it is supposed to, the jar can be filled with sanitizer and the set up can be deployed wherever necessary.

Method 2: With Sanitizer Dispenser Module

Sanitizer Dispenser Module

The Sanitizer Dispenser Module is a custom PCB made for this specific purpose. It contains the main board and a daughter board which contains the IR module to detect the presence of a hand. The main board has four connectors, two inputs and two outputs – two inputs being 5V and GND from the 5V source, and two outputs being the pump outputs. There’s also a built in potentiometer which can be used to adjust the amount of time the pump turns on upon sensing.


The power source is connected to the two inputs and the pump is connected to the output terminal. Once you turn on the power source, an LED should light on the main board indicating it is powered on. Once the daughter board detects a hand presence another LED turns on in the main board, and the pump turns on for a set amount of duration. The main board and daughter board is appropriately mounted on the Jar.

Sanitizer Dispenser Module


The IR proximity sensor being used here have two major limitations in day to day use cases

  1. The IR sensor will be unable to detect black objects as black objects absorbs all the emitted frequencies, hence there will be no reflection
  2. IR sensor can also falsely trigger if it is exposed to direct sunlight

Alternative sensors like ultrasonic or more advanced IR sensors can be used to replace the sensor used in this project, to overcome these limitations in case it’s unavoidable.


The DIY project described here is simplest form of DIY automatic sanitizer dispenser.You can add a control board to the DIY Sanitizer kit for features like dispensing time and long range distance. For an enhanced version, we can further add a microcontroller into the DIY kit, to control the dispensing and add features like timing, low sanitizer level detection, continuous object detection, etc. which can further enhance the functionality of the dispenser and make it more user friendly for the end user. Any simple microcontroller like the Arduino Nano or ESP8266 can be used would be placed between the relay module and the IR sensor.


If you still have any doubts regarding the construction or connections of the DIY Sanitizer kit, you can check out our video where we explain to you the step by step construction of the automatic sanitizer dispenser.

You may also like to read

Frequently Asked Questions

Back to blog

1 comment

Thankyou for showing us these Automatic Sanitiser Dispenser. These Sanitiser Dispenser available with highest capacity in class with Nil Evaporation loss.

Sanitiser Solutions

Leave a comment

Please note, comments need to be approved before they are published.

You may also like to read