Soap Dispenser Circuit Design

During my internship I worked in a company that had fitted automated soap dispenser units in their canteens. However, some of these soap dispensers would always malfunction. So I took on the task to build a circuit to replicate this circuit as the existing circuit was microcontroller driven and could not be repaired.

Project Image
Project Owner:

John N. G. Samarasinghe

Project End Date:


Project tags:

electronics, soap dispenser

Dive in to details

During my internship I worked in a company that had fitted automated soap dispenser units in their canteens. However, some of these soap dispensers would always malfunction. So I took on the task to build a circuit to replicate this circuit as the exisiting circuit was microcontroller driven and could not be repaired.

Soap Dispenser

The mechanical system associated with the Soap Dispenser has been built on a simple machine design. The motor connected to three free running gears and one press fit gear, increases the torque of the motor. The gear connected to the motor is the press fit 16 tooth pinion gear. This is cascaded with two 14/54 tooth pinion gears. The final gear contained 80 teeth and it is used for two different purposes. In a single revolution the gear would drive the pump through one of its cycles to dispense the liquid soap. During the cycle, the pump is pulled back and pushed in again. When the pump is pulled back, the liquid soap added to the top of the enclosure gets sucked in to the nozzle of the system. On the second half of the revolution the pump is pushed forward to eject the liquid soap through the nozzle.

The second purpose of the 80 tooth gear is to control a lever at the end of its cycle. The lever is pushed to energize a Single Pole Single Throw (SPST) push button. This push button on the electronic circuit stops the motor and keeps the system on standby mode until the dispenser is activated by the next user.

Soap Dispenser

Soap Dispenser

The original Soap Dispenser circuit had used certain integrated circuits and other components which could not be identified to simulate the circuit. One of the integrated circuits was a 20 pin micro-controller unit. The program used by the micro-controller unit could not be obtained.

The existed electrical system contained an Infrared Light-Emitting Diode (LED) and an Infrared detector to detect the presence of the user hand beneath the Soap Dispenser. Infrared beams shot from the Infrared LED were reflected by the user hands and were picked by the Infrared detector. This reduced the resistance within the detector, enabling the voltage provided to it, to pass through to the Integrated circuit on the system. The Integrated Circuit then sent out a constant voltage through a series of electronic components to drive the motor. The motor does not have any driver control and runs at maximum torque. When the mechanical pump completed a single cycle, a lever is pushed which energised a push button which was used to discontinue the motor and reset the circuit.

The product manual of the Soap Dispenser and datasheets for the items found on the circuit were not available. The faults identified were from system checks carried out on the system.
- Sensor did not respond to dark surfaces
- Surface had to be adjusted to different angles to be detected
- The dispense of soap was not immediate

To rectify the faults the following features were agreed upon.
- A sensitive sensing system was needed to detect the hand.
- A fail-safe button to dispense soap was required when sensor failed.
- Use of non programmable integrated circuits with minimum power

Texas Instruments 4013BE D-type flip-flop was selected as the main control IC. A special application was used Instead of connecting the flip flop in its usual application method.

Soap Dispenser

The description of the application in Figure 3 is as follows.
- The HIGH voltage is represented by +6V while LOW is represented by 0V.
- The IC accepted a voltage above +2.75V relative to the LOW voltage as a HIGH input.
- The Data pin (D) and the Power pin were wired to +6V (VCC).
- The IC output was restricted from manually setting as HIGH by connecting the set pin (S) to ground (GND).
- The clock (CLK) was wired to the sensor such that when the voltage was given to clock the value in data was registered.
- The value in data was connected to HIGH.
- When the sensor voltage was received, the flip-flop output (Q) was energised.
- The reset (RST) was wired to a single pole single throw button to clear the flip-flop memory.

The sensor used for this project was an Infrared LED and Infrared detector package. The package has the number TCRT5000.

The TCRT5000 infrared sensor symbol was not included in the Computer Aided Design software used to draw schematic of the circuit. Therefore an individual LED and a SPST push button is used to represent the infrared LED and the infrared detector

Soap Dispenser

The infrared LED is wired from +6V to ground through a 100Ω 1/2W resistor. The infrared detector is wired from +6V to ground through a 100kΩ variable resistor. Another wire is taken from in between the variable resistor and the detector as the input for the flip flop. The reset of the circuit is wired with a pull down resistor of 240Ω. This reset button when pressed causes the output of the flip-flop to reset to LOW. The clock needed a voltage of +2.2V to be detected as a logical HIGH. The circuit was tested with different surfaces by varying the pull down variable resistor on the infrared detector. A chart was drawn to identify the value of the resistor at which the maximum range was obtained for the least reflective surface. The pull down variable resistor of the detector adjusted to 95kΩ yielded the best results.

Soap Dispenser

The motor driver circuit consists of two transistors that act as protection for the flip-flop. The output of the flip flop is wired to the base of the first transistor (C1815) which is a very sensitive transistor that biases the emitter and collector with a small voltage. The second transistor is a high current rated transistor (D313). Its base is wired to the collector of the first transistor. The motor is connected between the collector of the D313 transistor and the ground terminal.

Soap Dispenser

The failsafe circuit for this automatic Soap Dispenser consisted of a button mounted to the bottom of the Soap Dispenser. When the button was pushed the soap was dispensed as it would when the infrared detector was energised. To append the circuit with the fail safe, the push button was wired in parallel with the infrared detector

Soap Dispenser

Initially the circuit was simulated on ISIS 7 Proteus Professional. The circuit was then tested on a breadboard and all currents and voltages were rechecked by the National Instruments myDAQ device

Soap Dispenser

Soap Dispenser

Soap Dispenser

A Vero board was shaped to fit in to the space available on the enclosure. The positions of the battery terminals, TCRT5000 Package and the Reset push button could not be changed. The remaining items were added to a suitable position that is effortless to wire.

Soap Dispenser

Soap Dispenser

Soap Dispenser


The Automated Soap Dispenser was set up in the cafeteria and its use was observed during all meal times. The sensor responded appropriately during all times of the day and night and was not affected by any reflections of sun light.

Out of the number of people who used the new automated Soap Dispenser, the percentage of people who used the used the sensor were compared with that of the old Soap Dispenser. A total of 97% of the users found the Soap Dispenser useful. This was an increase of 67% compared to the old system

Soap Dispenser

The electronic circuit was designed for the already existed mechanical system of the Soap Dispenser so that it is automated by the presence of hand. A list of specifications was decided on to meet the required function of automation.
- The circuit must detect an object at close range, which is about 2 – 5 centimetres from the bottom of the enclosure.
- Once an object is detected the pump should work for a whole cycle even if the object is removed. A cycle includes many turns of the motor as it is connected to a cascade of gears to increase the torque.
- The cycle should not be a timed function as there may be disturbances during operation which will cause the dispenser to work incorrectly. A Reset mechanism is included in the mechanical system. It is much easier, simpler and stable to use it.
- The pump should halt after a single cycle and wait for the object to be removed and restart when an object has re-entered its range of detection.

The circuit that was selected was one of many ideas that were put forward during the brainstorming session with the team. The reason for selecting this circuit is discussed further is this discussion.

The main control unit of the circuit is a D-type Flip Flop. The Flip Flop is a synchronous register which retains a certain logical value as long as a power supply is given to the Flip Flop. The Flip Flop has a data input (D) which takes in and stores the logical value given to it on the rising edge of the Clock (CLK) input. The stored value will not change till another rising edge is detected on the clock pin. The circuit also consists of an asynchronous reset (RST) and set (SET) feature which allow the stored value to be changed irrespective of the clock input. In the Soap Dispenser circuit the clock and the reset inputs are connected to the sensor and reset button respectively. The data input is connected to a constant +6V supply. The rising edge of the sensor voltage will represent the arrival of an object to the detection range of the sensor. This will cause the data value of +6V to be registered in the flip flop. The value is the output (Q) that drives the motor. When the reset switch is clicked, the flip flop will reset even though the object is still detected by the sensor. This gives an output of 0V which stops the motor. The flip flop will not be energised again till another rising edge is detected on the sensor.

There are many other registers that could have been used instead of the D-type flip flop, such as the S-R, J-K flip flop and the latch. However the D-type flip flop was the most ideal register identified in the study as its output can be easily controlled for this function using very little additional components.

The infrared sensor package TCRT5000 used for the Soap Dispenser is one of the commonly used infrared sensors in robotics. The package consists of an infrared LED and a detector. The beam of infrared light emitted from the LED is reflected by an object and will be picked up by the detector. By limiting the amount of collector current on the detector, the range of sensor can be adjusted.

The best sensor that can be used for this type of application is passive infrared (PIR) sensor. It does not need an additional infrared beam. Instead it detects the natural infrared radiation given off from a warm object like a human hand. However this type of sensor by itself was not readily available in markets in Sri Lanka. The company has decided to find an international dealer and purchase these sensors for future circuit for Soap Dispensers. The PIR sensor could also cause different problems such as reacting to the environmental radiation which is often greater than the human radiation in countries such as Sri Lanka. These problems will be addressed in the future if more Soap Dispenser circuits are designed with the PIR sensor.

The resistors added to the circuit must be able to reduce the power consumption and optimize the performance. The main resistors added are the pull down resistor for the reset button, the current limiting resistor for the emitter of the sensor and the pull down resistor of the detector. The power consumed should also be calculated for each resistor as the appropriate resistor should be added to avoid damage to the circuit.

The motor used in the circuit is a brushed DC motor for its torque generation. The DC motor's torque is proportional to the product of the armature current and the machine's total flux strength.

It is seen in the equation that EMF and Flux are constants. Thus to change the Torque of the motor the only solution is to increase the Armature Current. The current given by the Flip Flop is not sufficient to provide enough Torque for the motor. To overcome this two transistors are used in the circuit. The first transistor is a C1815 transistor whose base is very sensitive to current. The Transistor will completely bias almost immediately when a small current is supplied to the base. The current flowing from the emitter to the Collector of the C1815 Transistor is used to bias the base of the D313 Transistor. This transistor has a high current rating and will allow the motor to draw the necessary current to control the mechanical system of the Soap Dispenser.

The circuit was created in such a way that it will be able to replace damaged components easily.
- None of the components are pre programmed.
- The components that have a potential to be damaged are mounted on a base
- The sensor can be recalibrated if a new sensor is added simply by adjusting the variable pull down resistor.

hen conducting the initial research on the circuit for the Soap Dispenser another circuit was found that worked similar to that of the Soap Dispenser. The circuit comprised of two 555 timers connected together to hold the value similar to an NOR latch. However when this circuit was prototyped it was not as reliable as the D-type flip flop and required more than twice as much space on the Vero board.

If more space was available within the enclosure of the Soap Dispenser many improvements could have been made to the circuit. Such as,
- Adding a comparator for the sensor to control the output signal
- Adding another sensor to cancel background infrared radiation
- Adding a circuit dispense more soap if needed

The project was successfully completed. The electro-mechanical circuit functioned correctly using the 4013B D-Type flip flop and the TCR5000 sensor. The new system increased the percentage of employees who used the Automatic Soap Dispenser by a 67%.

Similar Posts

See other projects and posts in the same category as this post

blog item CoViD-19 Social Distance Enforcing Device
Social distancing is one of the top recommended ways to stop the spread of CoViD-19 disease by the WHO. It is also important to make sure that this is enforced at all times as people can be absent minded or accidentally come close to each other. This is especially true in crowded areas like hospitals and work places.
CoViD-19, Electronics, ESP8266, NodeMCU, Project, WeMos 2020-05-06 | Read More....
blog item Project Spider Web
Wifi Mesh Network
wifi,mesh 2019-02-28 | Read More....
blog item Soap Dispenser Circuit Design
During my internship I worked in a company that had fitted automated soap dispenser units in their canteens. However, some of these soap dispensers would always malfunction. So I took on the task to build a circuit to replicate this circuit as the existing circuit was microcontroller driven and could not be repaired.
electronics, soap dispenser 2014-03-07 | Read More....
blog item Edge Lit Display
edge lit display, LED 2013-11-23 | Read More....
Comment Box is loading comments...