The relevant equipment and shells of the project are customized in Moko, and I am quite satisfied with Moko's electronic manufacturing service.
The circuit diagram of contactless hand sanitiser dispensing system is shown in Fig. 2. It includes 12V power supply, Arduino Uno (Board1), ultrasoic sensor HC-SR04 (US1), 5V single-changeover relay module (RM1), and 12V DC motor (M1).
Ultrasonic sensor. Ultrasonic sensors are widely used to detect obstacles in robotic systems. They provide excellent non-contact range detection between 2cm and 400cm with an accuracy of 3mm.
The ultrasonic sensor used is shown in Fig. 3. Since it operates on 5 volts, it can be used directly with an Arduino or any other 5V logic microcontroller. Its technical specifications are listed in Table 1.
The VCC pin is used to give power supply to the ultrasonic sensor. So, it needs to be connected to 5V pin of the Arduino. Trig pin triggers the ultrasonic sound pulses. Here, it is connected to pin D3 (digital I/O pin 3) of Arduino. Echo pin produces a pulse when the reflected signal is received back. The length of the pulse produced by Echo pin is proportional to the time it takes for the transmitted signal to be detected. This pin is connected to pin D2 (digital I/O pin 2) of Arduino. GND pin should be connected to ground.
HC-SR04 ultrasonic sensor has an inbuilt ultrasonic transmitter and receiver. When pulse is provided to its Trig pin for 10µs or more, the ultrasonic transmitter sends sonic burst of eight pulses at 40kHz frequency. These pulses travel through the air and after colliding with the object get reflected back. The receiver gets the reflected signal. Meanwhile the Echo pin goes high to start forming the beginning of the echo-back signal. The time for which the Echo pin remains high (width of the Echo pulse) gives the time taken for generated ultrasonic sound to travel to the object and return. Using this time and the speed of sound in air, the distance of the object can be found using the simple relationship:
Distance=Speed×Time
The speed of sound in air at room temperature is 340 metres per second, or 0.034 centimetres per microsecond. So, assuming time taken to return is 300µs,
Total Distance Covered=0.034cm /µs×300µs
This is the total distance covered by the pulse during its forward and return movement. The actual distance is half of it. So,
Distance=(0.034cm/µs×300µs)/2
=5.115cm
Here, the ultrasonic sensor is used to detect hands that may be only 10cm from the sensor. So, variable resistor VR1 is connected at analogue pin A0 of Arduino to set the desired range of distance.
When hands are detected, signal from the sensor is sent to Arduino Nano. The Arduino’s nano microcontroller is the main controller, which is programmed to access data from the ultrasonic sensor. The microcontroller performs some logical operations and sends signal to control relay RL1.
5V relay module. The 5V relay module comprising interface board SRD-05VDC-SL-C can be controlled directly by an Arduino board, or an AVR or PIC microcontroller. Its input signal voltage range is 0-5V. A 2-channel relay module has been used in the prototype, but a single-channel relay module (shown in Fig. 4) is recommended. Pin descriptions of the single-changeover relay module are listed in Table 2.
The normally-open (NO) relay contact is open and the normally-closed (NC) contact is closed when the relay is not energised. The relay module (dotted lines box in Fig. 2) comprises an optocoupler, switching transistor, capacitor, and resistor connected to status LED, freewheeling diode, and inductive coil.
Optocoupler IC(4N25)
The optocoupler’s true function is to provide proper isolation between the DC power of relay and the input signal. It has an internal LED across its pins 1 and 2, which is used to trigger base of the transistor to produce the same signal across output terminals 4 and 5 of 4N25. In this way, we get the...
Read more »