Introduction: Hand Sanitizer Dispenser Circuit/DIY [Non Contact]
By Hesam Moshiri, firstname.lastname@example.org
- High stability and no sensitivity to the ambient light
- Laser-cut acrylic (plexiglass) enclosure
- Flow control capability of the hand-sanitizer/alcohol (efficiency)
- Through-hole components (easy to solder)
- Single-layer PCB board (easy to fabricate)
- Single and cheap ATTiny13 microcontroller
- Low standby current consumption
As we all know, the COVID-19 outbreak hit the world and changed our lifestyle. In this condition, alcohol and hand sanitizers are vital, expensive, and in some areas hard to find fluids, so, they must be used properly and efficiently. In the second version of the hand sanitizer dispenser device, I have addressed the previous design problems and introduced a device with no sensitivity to the ambient light and flow control capability of the alcohol/sanitizer. Therefore just enough amount of liquid will be poured on each request. The design uses a cheap ATTiny13 microcontroller.
[A] Circuit Analysis
figure 1 shows the schematic diagram of the device. The task could be fulfilled by a variety of sensors and design methods, however, my focus was to design an efficient, cheap, and simple circuit.
Step 1: Figure 1, Schematic Diagram of the Automatic Hand Sanitizer Dispenser
P2 is a 2-pin male XH connector. It is used to connect a 5mm blue LED that should be mounted on the enclosure and the hand sanitizer/alcohol container. R5 limits the LED’s current.
U1 is the TSOP1738  or HS0038 IR receiver module. It is a complete unit that is used for detecting and decoding IR signals. Figure 2 shows the block diagram of this component.
Step 2: Figure 2, Block Diagram of the TSOP1738 (HS0038) IR Receiver Module
The module can accept 5V at the supply rail and it consumes around 5mA. Low current consumption of the component allows us to use a simple RC filter (C1 and R3) to eliminate possible instabilities (false IR signal detection) that might be introduced by the supply noise.
The cut-off frequency of the above-mentioned RC filter can be both simulated (such as LTSpice) or examined in practice. To test the filter’s behavior in practice, I used a Siglent SDS1104X-E oscilloscope and a Siglent SDG1025 waveform generator. These two devices must be connected using a USB cable. Figure 3 shows the bode plot of the filter’s behavior. The calculations confirm that the cut-off frequency of the filter is around 112Hz in practice. For more details please watch the video.
Step 3: Figure 3, Testing the RC Filter’s Behavior in Practice by Bode Plot and the SDS1104X-E Oscilloscope
R4 is a pull-up resistor and C2 reduces the U1 output noises. D1 is a 5mm IR transmitter diode and R1 limits the current to the diode. The R1 value could be in the range of 150R to 220R. Lower resistance means higher detection range and vice versa. I used a 180R resistor for the R1. Q1 is the 2N7000  N-Channel MOSFET that used to switch ON/OFF the D1 IR diode. R2 limits the gate’s current.
IC1 is the ATTiny13  microcontroller. It is a known and cheap microcontroller that provides adequate peripherals for this application. PORTB.4 generates a square wave pulse for the IR transmitter diode and PORTB.3 senses the activate-low signal. PORTB.1 used to send the activation signal to the pump. The duty cycle of this single pulse defines the flow of alcohol or hand sanitizer. Q2 is the BD139  NPN transistor that used to switch ON/OFF the pump. D3 eliminates the reverse inductor currents (DC motor of the pump) and C5 reduces the pump noises. D2 indicates the pump activation. R7 limits the LED’s current. C3, C4, and C6 used to reduce the supply noises.
[B] PCB Layout
Figure 4 shows the PCB layout of the automatic hand sanitizer dispenser. It is a single-layer PCB board and all component packages are through-hole.
Step 4: Figure 4, PCB Layout of the Automatic Hand Sanitizer Dispenser Device
I used the SamacSys component libraries for Q1 , Q2 , and IC1 . The SamacSys libraries always help me to avoid unwanted mistakes and bypassing the time-consuming process of designing the component libraries from scratch. There are two options to install and use the libraries. First, downloading and installing them from componentsearchengine.com or second by installing them directly using the provided CAD plugins . SamacSys has provided plugins for almost all electronic designing CAD software. In my case, I used the Altium Designer plugin (Figure5).
Step 5: Figure 5, the Selected Components in the SamacSys Altium Designer Plugin
Figure 6 shows a picture of the first working prototype of the hand sanitizer dispenser board. Do you see the cut-out in the PCB board? It is necessary to prevent any unwanted IR signal reception by the U1 module. This gap gets filled with a piece of the enclosure.
Step 6: Figure 6, the First Working Prototype Board of the Hand Sanitizer Dispenser
[C] Source Code of the Microcontroller
The code has been written in C. The important part of the code which you “might” need to modify is the Timer-0 overflow interrupt routine.:
“case 15” defines the preactivation delay. A short delay is necessary for the user to fix his hand below the sensor and nozzle. “case 23” defines the pump activation time and “case 372” defines the delay before the next possible activation. This delay allows enough time for the user to gather all hand-sanitizer/alcohol drops. Also, it prevents misusing the device and wasting the expensive liquid by children or some individuals. Fusebits must be set on the 9.6MHz internal clock source with no clock division.
[D] Laser-Cut Corel Draw Enclosure Design
Figure 7 shows the designed enclosure in Corel Draw. You just need to send the “sanitizer.cdr” file to a laser-cutting workshop/company and order the laser-cut for 2mm matt black plexiglass (acrylic). Thin plywood is also okay.
Step 8: Figure 7, the Hand Sanitizer Dispenser Enclosure Design in Corel Draw
Figure 8 shows the complete automatic hand sanitizer dispenser unit. You can mount the enclosure on your desired container. I used a glass container.
Step 9: Figure 8, Automatic Hand Sanitizer Dispenser With a Glass Container
[E] Bill of Materials
Step 10: Bill of Materials
: TSOP1738 datasheet: https://www.batronix.com/pdf/tsop17xx.pdf
: 2N7000 datasheet: https://www.onsemi.com/pub/Collateral/NDS7002A-D....
: ATTiny13 datasheet: https://componentsearchengine.com/Datasheets/1/AT...
: BD139 datasheet: https://www.st.com/resource/en/datasheet/bd140.pd...
: 2N7000 schematic symbol and PCB footprint: https://componentsearchengine.com/part/1011182/mo...
: BD139 schematic symbol and PCB footprint: https://componentsearchengine.com/part/1041398/mo...
: ATTiny13 schematic symbol and PCB footprint: https://componentsearchengine.com/part/235118299/...
: CAD Plugins: https://www.samacsys.com/library-loader-help