Introduction: Automatic Hand Sanitizer Dispenser

This automatic hand sanitizer dispenser has been designed to be a relatively low cost option that is easy to assemble. Most of the required items can be purchased from your local hardware and electronics retailers. There is the option to 3d print a housing that contains the circuit, sensor and motor. For those without a 3d printer, a housing may also be made from a simple electronics box available at most electronics retailers.


The components are outlined below. To see the exact items used in this project, please view the bill of materials by clicking this link. Note: all prices are in AUD.

For the 3D printed housing:

  • 280g of filament is required if using PETG filament, or 250g if using PLA
  • 3x 2.5mm Cable Ties

For the non 3D printed version:

  • Jiffy Box
  • 4x M6x100 Hex Head Bolt
  • 8x M6 Nut
  • Drill
  • 6.5mm drill bit (7mm drill can be used)
  • 10-30mm step drill (It is necessary to drill a 14mm and 18mm hole)
  • 8mm Adhesive Rubber Feet (Optional)
  • 4-8mm Cable Gland (Optional)

The following supplies are required to build either model of the hand sanitizer dispenser

  • IR Sensor
  • Peristaltic Pump
  • 3mm (inner diameter) vinyl tubing (silicone or similar tubing may also be used)
  • Mini Breadboard
  • 2.5mm Cable Tie
  • Circuitry items (see BOM)

Step 1: The Circuit

The circuit can be made from a few simple components sold by most electronics retailers. No soldering is required to build the main circuit as it can be built on a single mini breadboard. The circuitry layout is provided in the first image. Important notes for building the circuit:

  • All resistors are 100kΩ
  • All capacitors are 10uF (tantalums are preferable)
  • The V+ and V- connections come from a 9V battery terminal. You may also use a DC barrel jack from a 9V or 12V wall plug such as this one. The plugs are common with many appliances. If using this method, ensure you get the polarity correct. For more information, see the 'barrel jack' section of this tutorial.
  • When plugging in the pump motor, it may pump in the wrong direction. This can be fixed by reversing the direction the wires are plugged in.
  • Take careful note of the orientation of the 555 timer, MOSFET and 5v linear regulator.
  • Check the wiring colours for whichever IR sensor you buy. The one we used had brown at +5v, black as the signal out and blue as GND. This may vary between manufacturers.
  • Your pump may not have wires attached to its tabs. You may either solder wires onto the tabs or wires can be wrapped through the holes and around the tabs to achieve a solder-free electrical connection.

For those interested in customizing the circuit build, the schematic has also been provided. The circuit operated by triggering a pulse from a 555 timer when the IR proximity sensor is tripped. The pulse then activates the MOSFET which drives the motor.

Step 2: Assembly (3D Printed Housing)

This step includes the assembly of the 3D printed housing. If you are interested in building your own housing, please continue to the next step.

STL files are attached to this step for 3D printing. Solidworks files have also been made available for the parts to be modified if desired. We have had success with the following settings:

  • Material: PETG
  • Layer height: 0.2mm
  • Infill: 100%
  • Supports: None

The second image provides a clear representation of where all items sit in the 3D printed housing. The IR sensor has a plate for the nuts to lock around positioning it flush with the face of the print. After installing the IR sensor, the peristaltic pump can be installed above the IR sensor. It is secured by 2x 2.5mm zip ties passing through the 2 holes on the inclined faces of the print. The breadboard sits at the back of the housing on the flat section and can just be stuck down with the double sided tape that is pre-installed on the breadboard.

The pump must be primed when first installing a bottle of hand sanitiser. This is done by running your hand past the sensor until liquid begins to flow out the nozzle.

Step 3: Assembly (Alternative Housing)

Pictures 3 and 4 depict the hole placement used in the jiffy box. Exact positioning of holes is not critical, but it is important to ensure there is enough clearance around each hole for the nut to fit on. Securing the pump with screws is not necessary, but recommended if using a pump with a right angle mounting bracked. When drilling the holes for the pump, place the pump into the enclosure and drill one hole using the mounting bracket as a guide. Insert a nut and bolt into the first hole, then drill the second hole directly through the mounting bracket. If you are using a very tall sanitizer bottle, it may be better to drill a hole into the lid of the enclosure for the hose to pass through. This will, however, make it more difficult to remove the lid in the future.

If using rubber feet, you may need to sand or file off any markings from the top of the bolt to ensure they stick well. After doing so, stick an adhesive pad on the head of each bolt (see image 5). After doing so, insert a nut onto each bolt and screw it on leaving about 1cm of thread sticking out (see image 6). Pass the thread of each bolt through a corner hole in the enclosure and screw another nut on the top of each bolt (see image 7). Adjust the feet as necessary to level the unit so it doesn't rock.

Next, install the pump, IR sensor and circuit into the housing and connect tubing as necessary. See image 8 for the interior of the completed assembly. Plug in a battery to power the system and ensure it works. After testing, install the lid of the enclosure. The pump must be primed when first installing a bottle of hand sanitiser. This is done by running your hand past the sensor until liquid begins to flow out the nozzle.