Professional Documents
Culture Documents
I hereby declare that I carried out the work reported in this thesis in the department of
Mechanical Engineering, Covenant University, under the supervision of Prof. Christian Bolu. I also
solemnly declare that to the best of my knowledge, no part of this report has been submitted
elsewhere in a previous application for award of a degree. All sources of knowledge used have
_______________________________________
ii
CERTIFICATION
This is to certify that the project titled “Construction of an Automated Paper Towel Dispensing
James (11CE012794), meets the requirements and regulations governing the award of Bachelor
of Engineering (Mechanical Engineering) degree of Covenant University and is approved for its
Name:_________________ Date
iii
DEDICATION
I dedicate this project to GOD Almighty who made it possible for me to achieve all I set out from
the beginning of this project, despite the difficult situations encountered, my Supervisor Prof.
Christian Bolu, my parents Mr. and Mrs C.O. Ochiobi and lastly to my mentor and big brother
Kelechi Fidelis.
iv
ACKNOWLEDGEMENT
I deeply appreciate the Holy Spirit for his divine inspiration during the course of this project, to
God Almighty for the grace to start this project, the wisdom to go about implementing it and the
Special thanks to my Supervisor, Prof. Christian Bolu, whose guidance, patience and continuous
To my parents Mr. and Mrs C.O. Ochiobi, I say thank you for their constant encouragement,
To Prof. Christian Bolu and my siblings who helped me with experiences and made themselves
v
ABSTRACT
Toilet paper holders have been in use for years and are routinely located in a toilet seat for a user
An automated paper dispenser consists of an Ultrasonic sensor that can detect a user’s hand or
hand movement. When the user is detected by the sensor, the DC motor inside the dispenser is
activated. The motor is coupled to the paper roll and advances a paper segment out of the
hospitals and conveniences used by physically challenged persons. This provides flexibility over
This project attempts to develop an automated paper dispenser with some intelligence. It uses a
microcontroller that serves as the brain of the system to which all the operating procedures of
vi
Table of Contents
DECLARATION ............................................................................................................................................... ii
CERTIFICATION ............................................................................................................................................ iii
DEDICATION................................................................................................................................................. iv
ACKNOWLEDGEMENT .................................................................................................................................. v
ABSTRACT .................................................................................................................................................... vi
LIST OF FIGURES ........................................................................................................................................... x
LIST OF TABLES ........................................................................................................................................... xii
LIST OF SYMBOLS........................................................................................................................................xiii
CHAPTER 1 .................................................................................................................................................... 1
INTRODUCTION.............................................................................................................................................. 1
1.1 Project Background .............................................................................................................................. 1
1.2 STATEMENT OF THE PROBLEM............................................................................................................. 2
1.3 AIM AND OBJECTIVES ........................................................................................................................... 3
1.3.1 AIM ............................................................................................................................................... 3
1.3.2 The Objectives............................................................................................................................... 3
1.4 SIGNIFICANCE AND IMPACT OF THE DESIGN ........................................................................................ 4
1.5 Scope of Project ................................................................................................................................... 4
1.6 DEFINITION OF IMPORTANT TERMS ..................................................................................................... 5
LITERATURE REVIEW ...................................................................................................................................... 7
2.1 Basic Definitions of Mechatronics ........................................................................................................ 7
2.1.1 Historical Perspective of Mechatronics ...................................................................................... 9
2.1.2 Mechatronic System Components............................................................................................... 12
2.2 Sensors, Signals, and Systems ............................................................................................................ 13
2.2.1 Sensor Classification .................................................................................................................... 16
2.3 Ultrasonic Definition .......................................................................................................................... 17
2.3.1 Ultrasonic distance measurement principle ................................................................................ 18
2.3.2 Ultrasonic Application ................................................................................................................. 18
2.3.3 Photo Interrupter ........................................................................................................................ 19
2.4 MICROCONTROLLERS ......................................................................................................................... 19
2.4.1 PWM OUTPUT AND RESET OPERATIONS ..................................................................................... 20
2.4.2 PROGRAMMING LANGUAGE ....................................................................................................... 21
2.4.3 COMPILER MIKROC PRO FOR PIC................................................................................................. 23
vii
2.4.4 PROGRAMMERS .......................................................................................................................... 23
2.5 Theory of DC Motor ........................................................................................................................... 24
2.7 LCD DISPLAY ....................................................................................................................................... 26
2.8 Previous Works .................................................................................................................................. 28
2.9 Contribution....................................................................................................................................... 30
3 METHODOLOGY ........................................................................................................................................ 32
3.1 PROTOTYPE USING LEGO MINDSTORM .............................................................................................. 32
3.2 Hardware implementation ................................................................................................................. 38
3.2.1 The Microcontroller .................................................................................................................... 38
3.2.2 Power Supply .............................................................................................................................. 39
3.2.3 SETTING THE ULTRASONIC SENSORS ........................................................................................... 40
3.2.4 LCD Connecting ........................................................................................................................... 42
3.2.5 Using the BUZZER ........................................................................................................................ 45
3.2.6 Using the LDR and LED to create a photo interrupter .................................................................. 45
3.4 CONCEPTUAL DESIGN ........................................................................................................................ 48
3.4.1 Weight Estimation ....................................................................................................................... 48
3.4.2 Modular Design ........................................................................................................................... 53
3.5 Programming Microcontrollers .......................................................................................................... 54
3.6 Modeling of DC Motor ................................................................................................................... 56
CHAPTER 4 ................................................................................................................................................... 58
RESULTS AND DISSCUSION ........................................................................................................................... 58
4.1 Introduction ....................................................................................................................................... 58
4.2 SYSTEM SIMULATION ......................................................................................................................... 58
4.3 Hardware system ............................................................................................................................... 60
4.3.1 User detecting function by the ultrasonic sensor ........................................................................ 61
4.4 BLOCK TESTING .................................................................................................................................. 61
4.4.1 Power Supply .............................................................................................................................. 61
4.4.2 Ultrasonic sensor testing ............................................................................................................. 62
4.4.3 Photo Interrupter Testing............................................................................................................ 62
4.4.4 Actuator Testing .......................................................................................................................... 64
4.5 SUMMARY.......................................................................................................................................... 68
CHAPTER 5 ................................................................................................................................................... 69
CONCLUSION ........................................................................................................................................... 69
viii
5.1 ACHIEVEMENTS.................................................................................................................................. 69
5.2 FUTURE WORK ................................................................................................................................... 70
5.3 LIMITATIONS ...................................................................................................................................... 70
5.4 RECOMMENDATION .......................................................................................................................... 71
5.5 PROBLEMS ENCOUNTERED & SOLUTIONS.......................................................................................... 71
5.6 SUMMARY.......................................................................................................................................... 71
REFERENCES ................................................................................................................................................ 74
APPENDIX A ................................................................................................................................................. 79
APPENDIX B ............................................................................................................................................ 84
APPENDIX C ................................................................................................................................................ 85
ix
LIST OF FIGURES
x
Figure 43: Snapshots showing the design body .......................................................................................... 67
Figure 44: Snapshot of the support base .................................................................................................... 68
xi
LIST OF TABLES
xii
LIST OF SYMBOLS
DC - Direct Current
RF - Radio Frequency
V - Voltage
I/O - Input/Output
MHz - Megahertz
GHz - Gigahertz
m - metre
cm - centimetre
AM - Amplitude Modulation
FM - Frequency Modulation
xiii
CHAPTER 1
INTRODUCTION
The introduction gives a general overview of the design project, giving the reader the background
Paper towel dispensers were a very common hand drying method used in the early 1990’s. These
hand dryers consist of a long roll paper located inside the dispenser which loops back into the
machine when the user would pull down on the paper in sheets so that they can dry their hands
on dry unused paper. New paper dispensers no longer require the user to pull down on the paper;
instead an infrared sensor used in conjunction with a motor provides a fresh section of the paper
An automated paper dispenser consist of a proximity or motion sensor that can be able to detect
a user’s hand or hand movement. When the user is detected by the sensor, the DC motor inside
the dispenser is activated. The motor is coupled to the paper roll and advances a paper segment
out of the dispenser. The use of an automated paper dispenser has become common in the
It is designed to dispense metered length paper without requiring the user to touch any part of
the dispenser other than the leading edge of the paper roll.
1
It uses a microcontroller that serves as the brain of the system to which all the operating
programmed to control and monitor the quantity of paper to be dispensed, and it controls the
LCD which displays status of the dispenser. The LCD display indicates when the system is active,
when the paper is unwinding, when the battery is low and the paper roll is small. It will alert the
microcontroller and this will also be displayed in the LCD as well. The combined features make
The typical toilet paper dispenser has two major problems: sanitation and convenience.
Normally, a manual paper dispenser enables the user to pull a portion of the roll from the
dispenser and if the paper roll is perforated, then the user can be able to unwind a desired
number of perforated segments from the roll then tears the segments away from the roll along
one of the perforations. Alternatively, the toilet may not be perforated in which the user in this
case will be forced to press down the paper roll portion against a knife or other severing means
to separate the user-selectable portion from the roll. In both cases, the user still has unlimited
access to the paper roll in the dispenser. Wastage will then occur as the user pulls a long portion
of the roll from the dispenser and does not use it thereby allowing the portion hanging out of the
Another problem with known paper dispensers is that the users typically have to reach under
the dispensers to grab the leading edge of the toilet paper roll, then pull the leading edge
downwards in order to extract paper from the dispenser. This can be highly frustrating especially
2
if the dispenser is mounted low, or if there is an insufficient tail protruding under the dispenser
for the user to obtain a firm grip. Persons with disabilities or restricted mobility can find operating
A few dispensers are provided with a rotary knob on the outside of the dispenser to help the
client in dispensing paper. However, numerous clients are hesitant to touch the dispenser, as
such dispensers can be messy and can contain microscopic organisms or other unhygienic
material.
In view of the above, it would be desirable to provide a toilet paper dispenser that can solve
1.3.1 AIM
The aim of the project is to build a cost-effective automated paper dispenser that uses an
The general objective pertains to the main purpose of the design which addresses the statement
of the problem. The specific objective identifies the functionalities and features that the device
should possess.
General Objectives
1. To build an automated paper dispenser that uses a motion sensor to prevent physical
3
2. To provide an improved automatic paper dispenser that can automatically advance
4. To signal when the paper roll in the dispenser is empty or almost empty.
The proposed design is intended to provide the lowest risk of cross-contamination and shall be
used for drying hands. Design is made such that only the dispensed paper is touched during
removal of paper for use. Unlike other automated paper dispensing design, this design contains
a sensor that detects when the paper roll is below low or close to empty.
The design emulates the functionality of a manual paper dispenser and matches the normal
automated paper dispenser already created and also improves the flexibility for the change of
paper.
I. The microcontroller that has been used for this project is PIC 18F4520
III. The design has sensors that would detect when the paper roll is empty or almost empty.
IV. The design provides a base platform for the paper to rest on after unwinding. This will
fold the paper roll making it more flexible for the user.
4
1.6 DEFINITION OF IMPORTANT TERMS
accepting feedback signal as the input, and by generating as an output, the input signal
3. Dispenser - container so designed that the contents can be used in prescribed amounts.
4. Incremental Encoders: They are capable of providing both positional measurements and
velocity measurements.
6. Block Diagram - a diagram of a system, in which the principal parts or functions are
represented by blocks connected by lines that show the relationships of the blocks.
by a dielectric (insulator). When there is a potential difference (in voltage) across the
conductors, a static electric field develops in the dielectric that stores energy and
11. Resistors are normally designed and operated so that, with varying levels of current,
variations of their resistance values are negligible. Power supply reaches its steady-state
5
12. Power Supply - a device that supplies electrical energy to one or more electric loads.
14. DC Motor – It’s an electrical machines that converts direct current electrical power into
mechanical power.
16. Ultrasonic Transducer - it is a device that converts energy into ultrasound, or sound waves
17. Rotary Encoder - It is an electro-mechanical device that converts the angular position or
18. PICkit Programmer/Debugger - They are used to program and debug microcontrollers.
6
CHAPTER TWO
LITERATURE REVIEW
Literature review was an ongoing process throughout the whole process of the project. It is very
essential to refer to the variety of sources in order to gain more knowledge and skills to complete
this project. These sources include Reference books, thesis, journals and also the materials
obtained from internet. This chapter includes theory about the DC motor, incremental encoder,
Ultrasonic sensor, microcontroller, LCD display and previous work that has been done.
The meaning of mechatronics has evolved since the original definition by the Yasakawa Electric
Company. In trademark application archives, Yasakawa defined mechatronics in this way : The
word, mechatronics, is made out of "mecha" from mechanism and the "tronics" from electronics.
In other words, innovations and created products will be incorporating electronics more into
mechanisms, intimately and organically, and making it difficult to tell where one closures and
alternate starts (Kyura et al,2000). The meaning of mechatronics kept on advancing after
Yasakawa recommended the first definition. One of cited meaning of mechatronics was exhibited
of mechanical system, with electronics and intelligent computer control in the configuration and
assembling of modern items and procedures. That same year, another definition was proposed
by Auslander & Kempf. (1996): Mechatronics is the utilization of complex decision making to the
operation of physical frameworks. Shetty& Kolk. (1997) defined mechatronics as: Mechatronics
7
More recently, we discover the proposal by Bolton, W. (1999): A mechatronic framework is not
only a marriage of electrical and mechanical system and is more than only a control framework;
it is a finished incorporation of every one of them. These definitions and articulations about
mechatronics are precise and useful, yet everyone all by itself neglects to catch the totality of
assessment on a widely inclusive portrayal of "what is mechatronics" escapes us. This absence of
agreement is a sound sign. It says that the field is alive, that it is an energetic subject. Indeed,
the definitions given above and from their very own encounters the embodiment of the logic of
mechatronics. For some practicing engineers on the cutting edge of building configuration,
mechatronics is nothing new. Numerous engineering products of the most recent 25 years
coordinated mechanical, electrical, and computer system, yet were outlined by engineers that
were never formally prepared in mechatronics essentially. It appears that modern concurrent
engineering design practices, now formally saw as a major aspect of the mechatronics specialty,
are normal outline forms. What is apparent is that the investigation of mechatronics gives a
procedure to characterize, order, compose, and coordinate numerous parts of item plan into an
intelligible bundle. As the past divisions between 'mechanical, electrical, aerospace, chemical,
civil, and computer engineering turn out to be less obviously characterized, we ought to enjoy
the presence of mechatronics as a field of study in the scholarly world. The mechatronics
specialty gives an instructive way, that is, a guide, for engineering students examining inside the
8
conventional structure of most engineering schools. Mechatronics is for the most part perceived
worldwide as a lively range of study. Undergrad and graduate projects in mechatronic designing
are currently offered in numerous colleges. Refereed diaries are being distributed and committed
gatherings are being composed and are by and large exceptionally gone to.
It should be understood that mechatronics is not only a convenient structure for investigative
microprocessor in the early 1980s and the steadily expanding craved execution to cost proportion
changed the worldview of engineering design. The quantity of new items being produced at the
crossing point of customary orders of engineering, software engineering, and the normal sciences
is always expanding. New improvements in these conventional orders are being retained into
mechatronics plan at a regularly expanding pace. The ongoing information technology revolution,
and embedded systems engineering guarantees that the engineering design worldview will keep
Attempts to construct automated mechanical systems has a fascinating history. Actually, the
expression "automation" was not popularized until the 1940s when it was instituted by the Ford
starting with one station then onto the next and afterward positioned the item precisely for
occurred long before then. For instance, early utilizations of automatic control systems appeared
9
in Greece from 300 to 1 B.C. with the improvement of float regulator mechanisms (Mayr, O.,
1970). Two essential illustrations incorporate the water clock of Ktesibios that utilized a float
regulator, and an oil lamp devised by Philon, which likewise utilized a float regulator to keep up
a steady level of fuel oil. Later, in the primary century, Heron of Alexandria distributed a book
entitled Pneumatica that depicted distinctive sorts of water-level instruments utilizing float
regulators.
In Europe and Russia, somewhere around seventeenth and nineteenth centuries, numerous
devices were invented that would in the long run add to mechatronics. Cornelis Drebbel (1572–
1633) of Holland conceived the temperature regulator speaking to one of the main criticism
frameworks of that period. In this manner, Dennis Papin (1647–1712) invented a pressure safety
regulator for steam boilers in 1681. Papin's pressure regulator is like a current pressure-cooker
valve. The first mechanical calculating machine was invented by Pascal in 1642 (Tomkinson &
Horne, 1996). The principal verifiable criticism framework guaranteed by Russia was produced
by Polzunov in 1765. Polzunov's water-level float regulator employs a float that rises and brings
in connection down to the water level, thereby controlling the valve that covers the water inlet
theory traced back to the Watt flyball governor of 1769. The flyball governor was utilized to
control the rate of a steam motor (Dorf et al, 2000). Utilizing an estimation of the pace of the
yield shaft and using the movement of the flyball to control the valve, the measure of steam
entering the motor is controlled. As the rate of the motor expands, the metal circles on the
representative contraption rise and broaden far from the pole pivot, along these lines shutting
the valve. This is a case of a criticism control framework where the input signal and the control
10
activation are totally coupled in the mechanical equipment. These early fruitful mechanization
improvements were accomplished through instinct, utilization of down to earth abilities, and
of programmed control.
The precursor to the numerically controlled (NC) machines for mechanized assembling (to be
created in the 1950s and 60s at MIT) showed up in the mid-1800s with the innovation of food
forward control of weaving looms by Joseph Jacquard of France. In the late 1800s, the subject
now known as control theory was initiated by J. C. Maxwell (1964) through investigation of the
arrangement of differential equations depicting the flyball governor. Maxwell researched the
effect various system parameters had on the system performance. At about the same time,
Faraday depicted the law of induction that would frame the basis of the electric motor and the
electric dynamo. Subsequently, in the late 1880s, Nikola Tesla invented the alternating-current
induction motor. The fundamental thought of controlling a mechanical system automatically was
firmly established by the end of 1800s. The evolution of automation would accelerate significantly
discovering applications in the process industries. However, prior to 1940, the design of control
systems remained an art generally characterized by trial-and-error methods. During the 1940s,
proceeded with advances in scientific and explanatory strategies set the idea of control building
as a free designing order. In the United States, the improvement of the phone framework and
electronic input enhancers impelled the utilization of criticism by Bode, Nyquist, and Black at Bell
11
Telephone Laboratories. The operation of the criticism intensifiers was depicted in the
recurrence area and the following outline and investigation practices are presently for the most
part named "established control." During the same time frame, control hypothesis was likewise
creating in Russia and Eastern Europe. Mathematicians and connected mechanicians in the
previous Soviet Union commanded the field of controls and focused on time space details and
differential condition models of frameworks. Further improvements of time space plans utilizing
state variable framework representations happened in the 1960s and led to design and analysis
software hardware developments and co-design, intelligence, decision making, advanced control
(including self-adaptive, robust, and intelligent motion control), signal/image processing, and
virtual prototyping. The mechatronic paradigm utilizes the fundamentals of electrical, mechanical,
and computer engineering with the ultimate objective to guarantee the synergistic combination of
precision engineering, electronic control, and intelligence in the design, analysis, and optimization
servomechanisms, pointing systems, assemblers) are highly nonlinear systems, and their accurate
actuation, sensing, and control are very challenging problems. Actuators and sensors must be
designed and integrated with the corresponding power electronic subsystems. The principles of
matching and compliance are general design principles, which require that the electromechanical
system architectures should be synthesized integrating all subsystems and components. The
12
electronics compliance must be satisfied. Electromechanical systems must be controlled, and
controllers should be designed. Robust, adaptive, and intelligent control laws must be designed,
examined, verified, and implemented. The research in control of electromechanical systems aims
to find methods for devising intelligent and motion controllers, system architecture synthesis,
deriving feedback maps, and obtaining gains. To implement these controllers, microprocessors and
DSPs with ICs (input-output devices, A/D and D/A converters, optocouplers, transistor drivers)
must be used. Other problems are to design, optimize, and verify the analysis, control, execution,
It was emphasized that the design of high-performance mechatronic systems implies the
subsystems and components developments. One of the major components of mechatronic systems
are electric machines used as actuators and sensors. The following problems are usually
software; design of high-performance electric machines, actuators, and sensors for specific
applications; integration of electric motors and actuators with sensors, power electronics, and ICs;
control and diagnostic of electric machines, actuators, and sensors using microprocessors and
DSPs.
A sensor is frequently characterized as a "device that receives and responds to a signal or stimulus".
This definition is expansive. In fact, it is broad to the point that it covers nearly everything from a
human eye to a trigger in a gun. The administrator alters the level of liquid in the tank by
controlling its valve. Varieties in the channel stream rate, temperature changes (these would
modify the liquid's thickness and subsequently the stream rate through the valve), and comparative
13
unsettling influences must be made up for by the administrator. Without control, the tank is prone
to surge, or run dry. To act suitably, the administrator must acquire convenient data about the level
of liquid in the tank. In this illustration, the data is created by the sensor, which comprises of two
fundamental parts: the sight tube on the tank and the administrator's eye, which delivers an electric
reaction in the optic nerve. The sight tube by itself is not a sensor, and in this specific control
system, the eye is not a sensor either. Only the combination of these two segments makes a narrow-
purpose sensor (detector), which is specifically delicate to the liquid level. In the event that a sight
tube is planned legitimately, it will rapidly reflect varieties in the level, and it is said that the sensor
has a quick speed reaction. On the off chance that the inward breadth of the tube is too little for a
given liquid consistency, the level in the tube may fall behind the level in the tank. At that point,
we need to consider a stage normal for such a sensor. Sometimes, the slack might be entirely
adequate, while in different cases, a superior sight tube outline would be required. Thus, the
framework. This world is separated into normal and human-made articles. The common sensors,
similar to those found in living life forms, for the most part react with signs, having an
electrochemical character, that is, their physical nature depends on particle transport, as in the
nerve filaments, (for example, an optic nerve in the liquid tank administrator). In synthetic gadgets,
data is additionally transmitted and handled in electrical structure, in any case, through the vehicle
of electrons. Sensors that are utilized as a part of the manufactured frameworks must talk the same
This dialect is electrical in its tendency and a man-made sensor ought to be equipped for reacting
with signs where data is conveyed by relocation of electrons, as opposed to ions.1 Thus, it ought
14
to be conceivable to associate a sensor to an electronic framework through electrical wires instead
degree smaller meaning of sensors, which might be stated as a sensor is a gadget that gets a jolt
The term stimulus is utilized all through this book and should be plainly caught on. The boost is
the amount, property, or condition that is gotten and changed over into an electrical sign. A few
writings utilize an alternate term, measurand which has the same significance, however with the
The reason for a sensor is to react to some sort of an info physical property (stimulus) and to
change over it into an electrical sign that is good with electronic circuits. We may say that a sensor
is an interpreter of a by and large nonelectrical esteem into an electrical quality. When we say
"electrical," we mean a sign, which can be diverted, enhanced, and altered by electronic gadgets.
The sensor's output signal might be as voltage, current, or charge. These might be further depicted
as far as amplitude, polarity, frequency, phase, or advanced code. This arrangement of attributes
is known as the yield signal organization. Hence, a sensor has information properties (of any kind)
and electrical yield properties. Any sensor is a vitality converter. Regardless of what you attempt
to gauge, you generally manage vitality exchange from the object of estimation to the sensor. The
procedure of detecting is a specific instance of data exchange, and any transmission of data requires
transmission of vitality. Obviously, one ought not be befuddled by an undeniable reality that
transmission of vitality can stream both ways – it might be with a positive sign and in addition
with a negative sign; that is, vitality can stream either from an article to the sensor or from the
15
sensor to the item. An uncommon case is the point at which the net vitality stream is zero, which
likewise conveys data about presence of that specific case. For instance, a thermopile infrared
radiation sensor will deliver a positive voltage when the item is hotter than the sensor (infrared
flux is streaming to the sensor) or the voltage is negative when the article is cooler than the sensor
(infrared flux streams from the sensor to the item). At the point when both the sensor and the article
are at the same temperature, the flux is zero and the yield voltage is zero. This conveys a message
Sensor arrangement plans range from very simple to the complex. Depending on the classification
purpose, different classification criteria may be selected. Here, I offer several practical ways to
1. All sensors might be of two kinds: passive and active. A passive sensor does not require any
extra vitality source and specifically creates an electric signal because of an external stimulus. That
is, the input stimulus energy is converted by the sensor into the output signal. The cases are a
The active sensors require outer force for their operation, which is called an excitation signal. That
signal is changed by the sensor to create the output signal. The active sensors here and there are
called parametric because their own particular properties change in reponse to an outer impact and
these properties can be in this way changed over into electric signals. It can be expressed that a
sensor's parameter regulates the excitation signals and that tweak conveys data of the deliberate
quality. For instance, a thermistor is a temperature delicate resistor. It doesn't create any electric
sign, however by passing an electric current through it (excitation signal) its resistance can be
measured by identifying varieties in current and/or voltage over the thermistor. These varieties
16
(displayed in ohms) specifically identify with temperature through a known exchange capacity.
Another case of a dynamic sensor is a resistive strain gauge in which electrical resistance identifies
with a strain. To gauge the resistance of a sensor, electric current must be connected to it from an
2. Depending on the selected reference, sensors can be characterized into absolute and relative. An
absolute sensor detects a stimulus in reference to an absolute physical scale that is independent of
the measurement conditions, whereas a relative sensor produces a signal that relates to some
electrical resistance directly relates to the absolute temperature scale of Kelvin. Another very
popular temperature sensor thermocouple is a relative sensor. It produces an electric voltage, which
is a function of a temperature gradient across the thermocouple wires. Thus, a thermocouple output
signal cannot be related to any particular temperature without referencing to a known baseline.
Another example of the absolute and relative sensors is a pressure sensor. An absolute pressure
sensor produces signal in reference to vacuum – an absolute zero on a pressure scale. A relative
pressure sensor produces signal with respect to a selected baseline that is not zero pressure, for
3. Another way to look at a sensor is to consider some of its properties that might be of a specific
interest.
The human ear can hear sound frequency around 20HZ ~ 20KHZ, and ultrasonic is the sound wave
17
2.3.1 Ultrasonic distance measurement principle
Ultrasonic transmitter emitted an ultrasonic wave in one direction, and began timing when it
launched. Ultrasonic spread noticeable all around, and would return instantly when it experienced
obstacles in transit. Finally, the ultrasonic collector would quit timing when it got the reflected
wave. As Ultrasonic spread speed is 340m/s in the air, based on the timer record t, we can solve
the distance (s) between the impediment and transmitter, namely: s = 340t/2, which is so-called
time difference distance estimation principle the rule of ultrasonic distance estimation utilized the
definitely known air spreading speed, measuring the time from dispatch to reflection when it
experienced obstacle, and afterward compute the distance between the transmitter and the obstacle
as indicated by the time and the speed. Thus, the rule of ultrasonic distance estimation is the same
with radar. Distance measurement recipe is shown as: L = C X T In the equation, L is the measured
distance, and C is the ultrasonic spreading speed in air, also, T represents time (T is half the time
Ultrasonic Application Technology is the thing which developed in recent decades. With the
semiconductor device technology matures, the application of ultrasonic has become increasingly
widespread:
Ultrasonic testing;
Ultrasound imaging;
Ultrasonic cleaning;
18
Ultrasonic welding;
A phototransistor and an LED are packaged together to make optical sensors that can be used to
detect objects. The LED provides light that is received by the phototransistor. An interruption of
the light received by the phototransistor causes the phototransistor to change state, thus indicating
the presence of an object in the path between the LED and the phototransistor.
2.4 MICROCONTROLLERS
Microcontroller is a highly integrated chip that contains all the components comprising a
controller. Typically this includes a CPU, RAM, some form of ROM, I/O ports, and timers. Unlike
designed for a very specific task which to control a particular system. As a result, the parts can be
simplified and reduced, which cuts down on production costs. Microcontrollers are sometimes
called embedded microcontrollers, which just mean that they are part of an embedded system that
is, one part of a larger device or system. Microcontroller is the best choice to be the control system
in controlling a DC motor because of its ability to store and run unique programs. Besides, the
relatively low cost of the microcontroller made it a wise choice in implementing it in the DC motor
speed and position control system. The microcontroller’s ability is to run and store unique
programs and microcontroller is very flexible to work with. As an example, user can program a
microcontroller to carry out a series of functions based on predetermined situations (I/O-line logic)
and selections. Its capability on carrying mathematical and logical functions allows it to imitate
complicated logic and electronic circuit. Higher level microchip PIC18F family can be used to
integrate large amounts of code in a single IC. PIC microcontrollers are one of the fastest growing
19
parts of the embedded integrated circuit market in recent times and suitable for fast implementation
PIC microcontrollers designed by Microchip Technology are likely the best choice for beginners.
Controller), but it is better known as PIC. Its ancestor, called the PIC1650, was designed in 1975
by General Instruments. It was meant for totally different purposes. Around ten years later, this
circuit was transformed into a real PIC microcontroller by adding EEPROM memory. Today,
Microchip Technology announces the manufacture of the 5 billionth sample. All PIC
microcontrollers use Harvard architecture, which means that their program memory is connected
to the CPU over more than 8 lines. Depending on the bus width, there are 12-, 14- and 16-bit
microcontrollers.
None of the MCUs in the PIC16 or PIC18 families have a digital-to-analog conversion capability,
but many PIC MCUs have a built-in module to generate pulse width modulated (PWM) output. A
PWM signal is a square-wave signal of fixed amplitude and frequency, but the width of the on and
off parts of the signal (or duty cycle) can be varied. The PWM output can be used to conveniently
drive H-bridge drives and digital amplifiers. The PWM output mode is one of the three modes of
operation of the Capture/Compare/PWM (CCP) module or enhanced CPP (ECCP) module on the
MCU. The other modes are capture and compare. In the capture mode, the value of the particular
timer associated with the CCP module is copied to a particular register when an input event occurs
on a designated CCP pin. Thus, the capture mode can be used for timing input events. In the
compare mode, an action is triggered when the value in the CCP registers matches the value stored
20
Figure 1: Illustration of PWM signal
There are different reset operations that are available on a PIC MCU. These include power-on reset
(POR), brown-out reset (BOR), watchdog timer reset, and external MCLR reset. These are
discussed next. A POR occurs whenever the power (VDD line) is turned off and then on to the
chip. After a POR, the code on the chip starts executing at the first program memory instruction,
and some of the registers on the chip will reset to their "Reset" state. A BOR (if enabled) produces
the same result as a POR and occurs whenever the VDD voltage level falls below the rated voltage
(between 2 to 5.5 V for most chips). The BOR does not occur unless certain registers on the chip
were set to detect this condition. This feature is useful in battery-powered applications to detect
low voltage conditions. The watchdog timer reset occurs whenever the counter associated with the
watchdog timer overflows, while a MCLR Reset occurs whenever the MCLR pin line goes to low.
Note that the PIC MCU has a special register (called PCON or power control) that can indicate
The microcontroller executes the program loaded in its Flash memory. This is the so called
executable code comprised of seemingly meaningless sequence of zeros and ones. It is organized
21
in 12-, 14- or 16-bit wide words, depending on the microcontroller’s architecture. Every word is
considered by the CPU as a command being executed during the operation of the microcontroller.
For practical reasons, as it is much easier for us to deal with hexadecimal number system, the
executable code is often represented as a sequence of hexadecimal numbers called a Hex code. It
used to be written by the programmer. All instructions that the microcontroller can recognize are
together called the Instruction set. As for PIC microcontrollers the programming words of which
are comprised of 14 bits, the instruction set has 35 different instructions in total. As the process of
writing executable code was endlessly tiring, the first ‘higher’ programming language called
The truth is that it made the process of programming more complicated, but on the other hand the
process of writing program stopped being a nightmare. Instructions in assembly language are
represented in the form of meaningful abbreviations, and the process of their compiling into
executable code is left over to a special program on a PC called compiler. The main advantage of
this programming language is its simplicity, i.e. each program instruction corresponds to one
memory location in the microcontroller. It enables a complete control of what is going on within
the chip, thus making this language commonly used today. However, programmers have always
needed a programming language close to the language being used in everyday life. As a result, the
higher programming languages have been created. One of them is C. The main advantage of these
languages is simplicity of program writing. It is no longer possible to know exactly how each
command executes, but it is no longer of interest anyway. In case it is, a sequence written in
assembly language can always be inserted in the program, thus enabling it.
22
2.4.3 COMPILER MIKROC PRO FOR PIC
The first thing needed to write a program for the microcontroller is a PC program which
understands the programming language used, C in this case, and provides a window for writing
program. Besides, the software must 'know' the architecture of the microcontroller in use. In this
case, you need a compiler for C language. There is no compiler to be used for only one concrete
microcontroller as there is no compiler to be used for all microcontrollers. It’s all about software
used to program a group of similar microcontrollers of one manufacturer. MikroC PRO for PIC
compiler is intended for writing programs for PIC microcontrollers in C language. It is provided
with all data on internal architecture of these microcontrollers, operation of particular circuits,
instruction set, names of registers, their accurate addresses, pinouts etc. When you start up the
compiler, the next thing to do is to select a chip from the list and operating frequency and of course
- to write a program in C language. The installation of mikroC PRO for PIC is similar to the
2.4.4 PROGRAMMERS
The process of transferring a compiled binary code to the MCU is called "programming" a chip.
Originally, Microchip provided the PICStart Plus programmer, in which the user plugs the chip to
be programmed into the device. Then, through a serial line from the PC to the PICStart Plus, the
MPLAB IDE is used to transmit the binary code to the chip. Once the chip is programmed, the
chip is removed from the programmer and transferred into the target system in which it will be
used. More recently, Microchip introduced the PICkit 2 and then the PICkit 3 Microcontroller
Programmer. These are low-cost development programmers that can be conveniently used to
23
Figure 2: PICkit 3 programmer
DC motors are used in closed loop control systems as control variable shown in Figure 2.1. The
DC motor controller normally control using directs operation by sending velocity command
signals to the amplifier, which drives the DC motor. An integral feedback device (resolver) or
devices (encoder and tachometer) are either incorporated within the DC motor or are remotely
mounted, often on the load itself. These provide the DC motor position and velocity feedback that
the controller compares to its programmed motion profile and uses to alter its velocity signal. DC
motors feature a motion profile, which is a set of instructions programmed into the controller that
defines the DC motor operation in terms of time, position, and velocity. The ability of the DC
motor to adjust to differences between the motion profile and feedback signals depends greatly
24
Figure 3: Typical DC Motor System with Encoder or Resolver Feedback.
DC motor is one of the devices that have the applications where precise positioning and speed
required. The big advantage of the DC motor is it’s operated as closed loop system. This means
feedback is required from the motor, it make this system is sensitivity to disturbances and have
Advantages of using PIC over other controlling devices for controlling the DC motor are given
below:
Speed: The execution of an instruction in PIC IC is very fast (in micro seconds) and can be
changed by changing the oscillator frequency. One instruction generally takes 0.2
microseconds.
EPROM program memory: Program can be modified and rewritten very easily.
Inbuilt hardware support: Since PIC IC has inbuilt programmable timers, ports an
Powerful output pin control: Output pins can be driven to high state, using a single
Integration of operational features: Power on reset and brown/out protection ensures that
the chip operates only when the supply voltage is within specification. A watchdog timer
resets PIC if the chip ever malfunctions and deviates from its normal operation.
This component is specifically manufactured to be used with microcontrollers, which means that
miniature liquid crystal display. The model described here is for its low price and great capabilities
most frequently used in practice and it is used in this project. It is based on the HD44780
microcontroller (Hitachi) and can display messages in two lines with 16 characters each. It can
display all the letters of alphabet, Greek letters, punctuation marks, mathematical symbols etc. It
is also possible to display symbols made up by the user. Other useful features include automatic
message shift (left and right), cursor appearance, LED backlight etc.
26
Along one side of the small printed board of the LCD display there are pins that enable it to be
connected to the microcontroller. There are in total of 14 pins marked with numbers (16 if there is
Ground 1 Vss - 0V
8 D1 0/1 Bit 1
9 D2 0/1 Bit 2
10 D3 0/1 Bit 3
Data/commands
11 D4 0/1 Bit 4
12 D5 0/1 Bit 5
27
13 D6 0/1 Bit 6
LCD Memory
Simon et al (2014) achieved Robotic Pill dispenser rotation by attaching cylinder to the stepper
motor which is controlled by microcontroller through a micro stepper driver that provide precise
Ruize et al (2012) built Grill-making machine using the global position feedback capability of the
BLUX drive. The machine builder was able to close the Position loop with the load- mounted
encoder, while the velocity feedback was provided by the motor-mounted encoder and signal
processing. The two-encoder providing both position and velocity feedback. The load mounted
encoder was coupled to friction drive nip-rollers close to the cut head.
28
In a recent project published by (Jouaneh , 2013) , The toilet paper roll is pulled between two
spring loaded rollers, one of which is driven by a geared permanent magnet brush DC motor with
an incremental encoder and a VBE user interface is programmed to specify the number of sheets
Time – pressure dispensing which is regarded as the most widely used dispensing technology
due to its low cost, simple operation, ease of maintenance and flexibility for different applications
and it was estimated that about 70% of the dispensing machines or systems currently use the
time-pressure approach, (Cong-Ping Chen, 2007). DC motors are often used in various industrial
applications where a wide range of Reponses are required to follow a predetermined trajectory
29
The wheel encoders provide inputs to the DE controller to control the drive speed and
estimation of the current position. The data of the wheel encoders are based on rotational data
obtained by a dynamic tire model that takes into consideration the vertical, lateral and
2.9 Contribution
In the course of this project, the 18F4520 microcontroller is used to control the DC motor,
Ultrasonic sensor, LCD display, Buzzer and photo interrupter. The DC motor will be connected
indirectly to a roller drive which is designed to pull the tissue paper. The system will be
programmed for the user to activate the ultrasonic sensor for the DC motor to actuate thereby
dispensing metered length of paper. The LCD display will be able to display when the system is
on standby, when the tissue in the system is low and when it is dispensing. So instead of using an
LED indicator, the LCD display was used for it makes the system more user friendly and flexible.
The buzzer serves as a sound indicator as various activities is been done on the system. The photo
Interrupter consists of a phototransistor and LED packaged together to make optical sensors that
can be used to detect objects. In this project, a LDR which serves a phototransistor was used with
an LED placed facing the surface of the LDR with a potentiometer connected to the LED to
regulate the intensity. These was put together to create a photo interrupter used to detect
30
Basic Flow Diagram describing the feedback system
STANBY
IS MOTION
NO
SENSOR
ACTIVE?
Yes
No
DISPENSE PER
PROGRAM
TOWEL DELAY
31
CHAPTER THREE
3 METHODOLOGY
This chapter will describe the method that will be used for this project in order to achieve the
desire objectives. It involves the system prototype, modeling, design and analysis.
The first step I took in achieving the desired design and mechatronics functions, was to construct
a simple prototype to analyze the system design and functionality problem. The prototype
consists of LEGO parts assembled in a desired way that keeps the toilet paper, large motor, Colour
sensor, touch sensor and the ultrasonic sensor in place. The base has dimensions of 20cm X 18cm,
and is constructed so that there is a bar through the middle of the paper to hold the roll in place.
The toilet paper rests on a stand and the large motor was connected to a rod that serves as the
roller drive located below the stand of the toilet paper as shown in figure a. The roller contains
four gripped tires which was arranged side by side to hold the tissue and dispenses the paper
Firstly, I programmed the large motor to run for one rotation by pressing the touch sensor which
sends the output data to the microprocessor which then sends feedback to the large motor and
it runs for one rotation which it worked right. I used it to note the length of paper to be dispensed
and for one rotation, 36cm length of paper was rolled out by the large motor. Next, I changed
the mode of rotation to timing which I set it to six seconds and 148cm was dispensed which was
too long. I then reduced the time of rotation to two seconds and 92cm length of paper was
32
dispensed which was more preferred. The use of touch sensor worked as programmed but it still
required the user to touch the system for the metered length of paper to be dispensed.
33
Figure 10: Advanced Blocks
Next, I removed the touch sensor block on the program and replaced it with the ultrasonic sensor
block and set the threshold frequency to 6cm. The sound block to say hello was added with a
delay block of 1 second to make it more user friendly and flexible. The aim to replace the touch
sensor for the ultrasonic sensor was for user to activate the system without the need to touch it.
It worked to dispense the tissue paper but for the user to cut the desired length of paper being
dispensed, it requires holding of the system for balance so a tear bar will be placed in the real
34
Figure 12: block programming for ultrasonic sensor
In the prototype, I programmed the color sensor which was located just above the tissue paper
to detect if the tissue paper was finished. The color sensor was programmed in such a way that
if the color detected was white, meaning there’s tissue paper else for other colors detected, it
sounds error to alert the user and there’s a delay of 0.5 seconds before it says goodbye.
Figure 13: block programming with colour sensor and ultrasonic sensor
35
After finishing the first iteration, of the automated toilet paper dispenser and beginning work on
the second iteration, I have cemented my specifications for the design project. The main goal of
our project is to create a sensor operated toilet paper dispenser that works easily with the wave
of the user’s hand, in order to create a no touch toilet paper experience. In addition to this goal,
we plan to have simple and intuitive toilet paper loading design with little to no touch, as well as,
36
A Flow Chart describing the feedback system
STAND BY
NO
IS ULTRASONIC
SENSOR ACTIVE?
YES
NO
DISPENSE PER
PROGRAM
DELAY MODE
37
3.2 Hardware implementation
Ultrasonic sensor information based on the programming, reads data of the LDR, controls the
PWM of the DC motor, displaying information on LCD display and controlling the buzzer. The
microcontroller used in this project is the PIC 18F452 family. Below shows the features and
descriptions:
Features PIC18F4520
Operating Frequency DC- 40 MHz
Program Memory (Bytes) 32768
Program Memory (Instructions) 16384
Data Memory (Bytes) 1536
Data EEPROM Memory (Bytes) 256
I/O Ports Ports A, B, C, D, E
Timers 4
Capture/Compare/PWM Modules 1
Enhanced 1
Capture/Compare/PWM Modules
Serial Communications MSSP, Enhanced USART
Parallel Communications (PSP) Yes
10-bit Analog-to-Digital Module 13 Input Channels
Resets (and Delays) POR, BOR,
RESET Instruction,
Stack Full, Stack
Underflow (PWRT, OST),
MCLR (optional), WDT
Programmable Yes
High/Low-Voltage Detect
Programmable Brown-out Reset Yes
Instruction set 75 Instructions;
83 with Extended
Instruction Set enabled
Packages 40-pin PDIP
44-pin QFN
44-pin TQFP
38
Figure 15: Diagram of the Microcontroller from Proteus Simulation
In order to do all the activities, a program (sequence of instruction) is written for the
Microcontroller requires basic configuration like 5V regulated power supply, clock and reset
circuit.
on packaging and other requirements. The justification for the voltage regulator used I s related
to the fact that it simply supplies the voltage level we need in a discrete package. The power
supply supplies +5v for the Ultrasonic sensor, LCD display, the microcontroller and +3v for the DC
motors.
39
3.2.3 SETTING THE ULTRASONIC SENSORS
The sensor used by the user to activate the system in this project was the Ultrasonic ranging
module HC-SR04 and it provides 2cm-400cm non-contact measurement function with ranging
accuracy reaching 3mm. It consists of the ultrasonic transmitters, receiver and control circuit.
Working Voltage DC 5V
Max Range 4m
Echo Output Signal Input TTL lever signal and the range in
proportion
Dimension 45*20*15mm
5V supply
40
0v ground
After wire connection, to get a suitable non-contact distance between the user and the sensor,
the microcontroller was programmed for the LCD to display the non-contact measurement
distance. I first set the non-contact distance at 11cm, but noticed the distance was not suitable
for use because a user can trigger the sensor unconsciously. The distance I set for this project
According to the formula : distance = (high level time*ultrasonic spreading velocity in air) / 2, to
calculate the high level time since the test distance used in this project is 6cm,
340𝑡
𝑆= (I)
2
2𝑆 2 × 0.06
𝑡= = = 0.000353 𝑠𝑒𝑐𝑜𝑛𝑑𝑠
340 340
41
Figure 16: Ultrasonic sensor during testing
Depending on how many lines are used for connecting an LCD to the microcontroller, there are
8-bit and 4-bit LCD modes. The appropriate mode is selected at the beginning of the operation in
the process called 'initialization'. The 8-bit LCD mode uses outputs D0- D7 to transfer data as
The main purpose of the 4-bit LCD mode is to save valuable I/O pins of the microcontroller. Only
4 higher bits (D4-D7) are used for communication, while others may be left unconnected. Each
piece of data is sent to the LCD in two steps- four higher bits are sent first (normally through the
lines D4-D7), then four lower bits.
The LCD display used in this project was the 16x2 LCD display to illustrate the use of an
alphanumeric LCD display. The function libraries simplify this program, which means that the
effort made to create software pays off in the end.
The first message written in two lines as the system is switched on appears on the display as:
“Automated paper”
42
“Dispensing Sys “
Three seconds later, the message in both lines is changed and displays the standby message as:
“Final Yr Project”
“By James O.”
43
Once the Ultrasonic sensor is activated and there’s no tissue paper, the LCD display is
programmed to display;
If there is tissue, before the system dispenses tissue the LCD display shows thus;
“Pls wait……”
“Dispensing”
After a given metered length of tissue paper finish dispensing, the LCD display shows;
“Take ur Tissue”
44
Figure 21: LCD display 5
The buzzer serves as a sound indicator as various activities is been done on the system. As the
system is turned on, it buzzes for one second. Once the ultrasonic sensor is activated, it buzzes
for one second and goes silent till the tissue is dispensed then it buzzes for one second and goes
standby. If there is no tissue in the system, it buzzes for five second. The programming in C is
shown in Appendix A.
resistor whose resistance increases or decreases depending on the amount of light intensity. It
serves as a light sensor to detect the light intensity. A photo Interrupter consists of a
phototransistor and LED packaged together to make optical sensors that can be used to detect
objects.
45
POTENTIOMETER
LDR LED
In this project, the LDR which serves a phototransistor was used with an LED placed facing the
surface of the LDR with a potentiometer connected to the LED to regulate the intensity. These
was put together to create a photo interrupter used to detect whether there is tissue paper in
the system or not. The tissue paper goes in between the LDR and LED thereby blocking the light
on the LED for the LDR not to detect the light dissipated. This will indicate that there’s tissue
paper in the system. When no tissue paper is between the photo interrupter, light of the LED falls
on the semi conductive material it absorbs the light photons and the energy transferred to the
electrons. The Threshold frequency set for the LDR was threshold>160. The programming in C
is shown in appendix A.
The circuit system of the project was designed using Proteus 8 professional. All components were
put in place as well as the microcontroller and the C programming was added to the Proteus
program for simulation as .asm file. The figure below shows the full circuit design.
46
Figure 23: Circuit design using Proteus 8 Professional
47
3.4 CONCEPTUAL DESIGN
In this design phase, the overall shape, dimensions and weight of the tissue dispenser is
determined. Factors like dimensions and size are determined considering structural constrains.
However factors like the shape of the system was determined based on non-structural
considerations. For instance, the base firm covering the tissue was chosen according to the tissue
The breakdown of the weight for the tissue paper dispenser is estimated and shown in Appendix
B. The total weight of the system is estimated by adding up the total weight of all the components
To account for changes or improvements or additions to the system, an additional 25% of the
weight is added.
≈ 5.06 kg
48
Conceptual design drawing
49
Automated Tissue Dispenser
50
Final Conceptual Design
51
Automated Tissue Paper dispenser
52
3.4.2 Modular Design
A modular designed automated paper dispenser of the two design is also intended for to allow
for the disassembly and interchangeability of parts. This accommodates for the changing of parts
as well as easy maintenance, transportation and testing. This ability for the disintegration of the
The first conceptual design consists of the roller drive and gear train as calculated previously, but
The main goal of our project is to create a sensor operated toilet paper dispenser that works
easily with the wave of the users hand, in order to create a no touch toilet paper experience and
first conceptual design gave me difficulty in trying to construct it in a short space of time. The
The final design was chosen to be used in this project because it have a simple and intuitive toilet
paper loading design with little to no touch, as well as, a sleek and aesthetically pleasing, non-
industrial design and still meet user friendly ergonomic design that one would want in a private
bathroom.
The automated tissue paper dispenser was designed to be able to be separated into modular
units.
They are:
1. 1x Tissue firm
2. 1x base
3. 1x Support firm
4. 1x LCD display
5. 1x Ultrasonic sensor
6. 3x DC motor
7. 1x Main firm
53
Total number of parts: 9
The programming is written in embedded C. The MikroC for PIC compiler was used in this project
to program the microcontroller. The MikroC for PIC is a free, integrated GCC-based toolset for
application on Microsoft, and includes several free software components for application
development, hardware simulation and debugging. C programming language is used with MikroC
for PIC. Figure 19 shows the image of a program written using MikroC for PIC.
54
PICkit 3 Programming Software is a software which is used to write a program directly to the
targeted microcontroller together with the UIC00A. By importing a HEX file that contains a
specific program for desired microcontroller, this software will automatically recognized the type
of the targeted microcontroller and easily program it by clicking the „Write‟ button. Figure 23
shows the detail of each function inside the PICkit 3 Programming Software.
55
3.6 Modeling of DC Motor
A DC motor is used in a control system where an appreciable amount of shaft power is required.
This DC motors used in instrument employ a fixed permanent-magnet field, and the control signal
is applied to the armature terminals. Figure 24 show the DC motor wiring diagram and the Table
Symbol Description
Ra Armature resistance
La Armature inductance
56
Va(t) Armature input voltage
57
CHAPTER 4
4.1 Introduction
In this chapter, all the result of experiments carried out in this project and interpretation
experiments both on the hardware and software part. The automated paper towel dispenser
system was successfully integrated to produce desired result which fulfill this project objective.
Based on the result, the system has three main functions which were User detecting function by
the ultrasonic sensor, paper towel detecting function by the photo interrupter and the
mechanical actuating function by the DC motors. Everything regarding of this final result and
The entire circuit could not be simulated on the Proteus software due to the ultrasonic sensor,
so the system simulation excluded the Ultrasonic sensor part because it can only be tested by
physically indicating the physical presence of an object. The power supply circuit was also
removed from system simulation for its insignificance to software simulation. A code was written
into the Microcontroller to carry this operation. The simulation is as shown in Figure 1. The Source
58
Figure 32: Proteus simulation of the circuit design
Figure 33: The .asm file program used as source code in Proteus 8
59
4.3 Hardware system
In this project, the PIC 18F452 based project is designed to develop the automated paper
dispensing system which consists of the buzzer circuit, power supply circuit, Ultrasonic circuit,
LCD display circuit, DC motor circuit and photo interrupter (LED and LDR) circuit shown in figure
11. All the circuit designs were done using Proteus and simulated as well before implementing
60
4.3.1 User detecting function by the ultrasonic sensor
Based on the hardware description above, the automated paper towel dispenser stays on
standby when the ultrasonic sensor is not activated by presence of a user. The threshold function
of the sensor has to be met for it to sense human presence (i.e: the non-contact distance of 6cm
has to be met to activate the system). When the sensor is activated by a user, The LCD will display
a message ‘pls wait… dispensing’. But when there’s no paper towel in the system, the LCD will
Here, the circuit components were physically tested to assure compliance with design.
A ready power supply circuit was used which contained all components of the power supply
circuit on a PCB except the 7805 Voltage Regulator. Wires were welded onto the inputs and
outputs of the board (for case of connection) and the outputs were connected to the regulator.
61
4.4.2 Ultrasonic sensor testing
The sensor is used by the user to activate the system. During the course of testing, the
microcontroller was programmed for the LCD to display the non-contact measurement distance.
I first set the non-contact distance at 11cm and ran series of tests. It was noticed that the distance
was not suitable for use because the sensor was triggered unconsciously during testing. After
series of distance testing, 6cm of non-contact distance was finally used for the project because it
was closer.
After getting the non-contact distance to use, I then connected the ultrasonic sensor to the
system to test for compliance with design. At first, the body design was blocking the sound waves
thereby making the system to trigger continuously before the problem was resolved.
Figure 36: Ultrasonic sensor during testing and Ultrasonic sensor in the system
The photo Interrupter consists of Light Dependent Resistor (LDR) and LED packaged together to
make optical sensors that can be used to detect objects. These was put together to create a photo
interrupter used to detect whether there is tissue paper in the system or not. The tissue paper
62
goes in between the LDR and LED thereby blocking the light on the LED for the LDR not to detect
the light dissipated. This will indicate that there’s tissue paper in the system. When no tissue
paper is between the photo interrupter, light of the LED falls on the semi conductive material it
absorbs the light photons and the energy transferred to the electrons. The Threshold frequency
Figure 37: LDR & LED placed facing each other to form the Photo interrupter
63
4.4.4 Actuator Testing
The DC motors were connected to the microcontroller (to control the speed and time of
rotation by a 5V signal from the microcontroller). The DC motor was attached to a shaft
constructed using LEGO mindstorm component, these offers the grip to the paper roll for
rotation. This enables the system to dispense the paper roll for the user. The DC motor
implemented in this project was the RF-300FA-11420 model with speed of 2900 rev/min when
I first connected just one DC motor to the system but the load of the paper roll and the shaft
was too much for just one DC motor. I had to connect two motor at both ends of the shaft to
produce more force required to push the paper roll hence dispensing the required length of
paper.
Figure 38: Two motors at both ends of the shaft to form the actuator
64
The final design was chosen to be used in this project because it have a simple and intuitive toilet
paper loading design with little to no touch, as well as, a sleek and aesthetically pleasing, non-
industrial design and still meet user friendly ergonomic design that one would want in a private
bathroom. Wood material was used in constructing the body of the system because it’s less
65
Figure 40: Snapshot of the system showing the LCD display
Figure 41: Snapshot showing the position of the LCD display and Ultrasonic sensor
66
Figure 42: Snapshots of the system after dispensing the paper roll
67
Figure 44: Snapshot of the support base
4.5 SUMMARY
In this chapter, the various testing and implementation were discussed. All the units and sub
systems of the entire automated system were properly tested. The challenges encountered
68
CHAPTER 5
CONCLUSION
The system design and software implementation have proven to be effective and efficient. The
more hygienic way of dispensing paper towel to various users, since it is a technology that
minimizes the risk of direct contact by the users. The use of the system helps to control the
amount of paper towel dispensed by each user so as to minimize cost in buying paper roll. The
implementation of automated paper dispensing operations are bound to increase in the future.
The advantages, efficiency and reliability of the system have made it manifest itself over the
5.1 ACHIEVEMENTS
The project successfully designed and implemented a system that can dispense metered length
of paper roll using a proximity sensor known as Ultrasonic sensor. The project objectives fully
met are:
To build an automated paper dispenser that uses a motion sensor to prevent physical
To design a photo interrupter using LED and LDR to sense when the paper roll is empty or
almost empty
69
Providing a non-industrial design that still meet user friendly ergonomic design that one
Further improvements can be implemented on this system to enhance its features and
functionality:
1. The use of roller drive and gear train can be implemented for an improved dispensing
system.
2. A battery back-up of 12v would be a possible feature for continuous operation of the
4. The system is also compatible for the future upgrades like a mechanism that automatically
5.3 LIMITATIONS
Finding the right component required for the device production. Several alternations had
components.
Time constraint.
70
5.4 RECOMMENDATION
I recommend that this project should be well implemented as it will help to improve flexibility in
using a paper dispensing system. However, for this study to be relevant in the society and publicly
Further research should be made on this project by studying its applicability and
During soldering, many of the connections become short circuited, so I desoldered the
A leg of the crystal oscillator was broken during mounting, so it had to be replaced.
Care should be taken while soldering so that there would be no shorting of joint and proper
5.6 SUMMARY
The project was a very interesting one as it expanded my knowledge based on Mechatronics
and its means of application. This project could be marketed anywhere in the world because it is
a trending technology and it’s necessity is geared towards the elimination of poor hygiene in our
society.
71
Table 5: Cost of Project Materials
6 LED 4 10 40
10 Mechanical switch 1 50 50
72
13 Wooden construction 7000
73
REFERENCES
Albert, J., Anu, S., Arun, C., Neethu, J., Nisha, V., & Yuvaraj, V. (2014). Robotic pill
Allen, Y., Roozbeh, J., Shankar, S., & Ruzena, B. (2009). Distributed recognition of
human actions using wearable motion sensor networks. Journal of Ambient Intelligence
Basturk, O., & Namazov, M. (2010). DC motor position control using fuzzy proportional-
Budynas, R., & Nisbett, K. (2010). Shigley's Mechanical Engineering Design. McGraw-
Hill.
Christo, B., & Sheeba, M. (2016). A survey on automatic liquid dispensing and database
Craig, K., & Roger, J. (2005). On hardware optimization of stepper motor system
Delpoux, R., & Bodson, M., & Floquet, T. (2014). Parameter estimation of permanent
74
Elecfreaks. (n.d.). HC-SR04 User Guide. Retrieved from
http://elecfreaks.com/estore/download/EF03085-HC-SR04_Ultrasonic_Module_User_Guide.pdf.
from http://www.micropik.com/PDF/HCSR04.pdf.
Elsodany, N., Rezeka, S., & Maharem, N. (2010). Adaptive PID control of a stepper motor
Fleming, W. (2001). Overview of automotive sensors. Journal of IEEE Sensors, 1(4), 296-
308.
Fraden, J. (2010). Handbook of modern sensors: Physics, Designs and Applications (4th
José, C., Ernesto, V., & Jaime, G. (2010). Position and speed control of brushless DC
motors using sensorless techniques and application trends. The Journal of Sensors, 10,
6901-6947. doi:10.3390/s100706901
Jumaa, A. (2005). Hand hygiene: simple and complex. International Journal of Infectious
Kang, H., Hanxu, S., Qingxuan, J., & Yanheng, Z. (2012). An autonomous positioning and
navigation system for spherical mobile robot. Journal of Procedia Engineering, 29, 2556
– 2561.
75
Lisjak, A., Grasselli, G. (2014). A review of discrete modeling techniques for fracturing
Engineering, 6, 301-314.
Martin, C., Larsen, P., & Rasmus, J. (2015). Robotic Design Choice Overview Using Co-
Simulation and Design Space Exploration. The Journal of Robotics, 4, 398-421. doi:
10.3390/robotics4040398
from ww1.microchip.com/downloads/en/DeviceDoc/51795B.pdf
http://www.xinpian.net/pic/PIC18/PIC18F4520.pdf
Milan, R., Zarko, C., & Dragan, L. (2012).Intelligent control of DC motor driven
Mondal, R., Arumay, M., & Basak, D. (2013). Embedded System of DC Motor Closed
Loop Speed Control based on 8051 Microcontroller. Journal of Procedia Technology, 10,
840-848.
Normanyo, E., Stephen, S., & Boadi, S. (2012). Domestic power efficiency using sensors
and a programmable logic controller. The Journal of Engineering and Technology, 2(5),
775-786.
76
Provincial Infectious Diseases Advisory Committee.(2008). Best practices for hand
https://www.publichealthontario.ca/en/eRepository/2010-12%20BP%20Hand%20Hygiene.pdf.
Ravi, R., & Dipa, T., (2015). Microcontroller based automatic paint marking machine. The
Ruize, X., Shengli, Z., & Wen, J. (2012). MEMS Accelerometer Based Nonspecific-User
Samarth, V., Marco, B., John, B., Brendan, O., Nicholas, H., & Paul, D. (2015). Low-power
Shetty, D., & Kolk, R. A. (2011). Mechatronics System Design (SI ed.). Cengage
Learning.
Siripala, P., & Sekercioglu, Y. (2013). A generalized solution for generating stepper motor
Wyrowol, B., & Hrynkiewicz, E. (2015). Implementation of the FITA fuzzy inference
Yaxin, L., Liguo, C., & Lining, S. (2009). Design and fabrication of MEMS flow sensor and
its application in precise liquid dispensing. The Journal of Sensor, 9, 4138-4150. doi:
10.3390/s90604138
77
Yaziz, N. H. B. (2014). Digital Speed and Position Control System Incorporating an
http://eprints.uthm.edu.my/6672/1/NOR_HIDAYAH_YAZIZ.pdf.
Zeina, B., Samih, J., & Imad, K. (2014). Modeling and simulation of series DC motors in
Zagade, S., & Kawitkar, R. (2012). Wireless sensor network for greenhouse. The Journal
78
APPENDIX A
float read_sensor();
char thres=0;
79
sbit echo at RD7_bit;
float distance ;
char distance_txt[5];
void main() {
PORTA=0;
PORTB=0;
PORTC=0;
PORTD=0;
TRISA=0b11111111;
TRISB=0;
TRISC=0;
TRISD=0b10000000;
ADCON1=0b00000000;
T1CON=0b00110000;//1:8
delay_ms(3000);
Lcd_Cmd(_LCD_CURSOR_OFF);
buzzer=1;
delay_ms(1000);
buzzer=0;
lcd_out(1,1,text1);
lcd_out(2,1,text2);
delay_ms(3000);
Lcd_Cmd(_LCD_CLEAR);
80
while(1){ //main loop
lcd_out(1,1,texta);
lcd_out(2,1,textb);
distance=read_sensor();
delay_ms(500);
if(distance <=range){
// Lcd_Cmd(_LCD_CLEAR);
// do{
thres=adc_read(1)>>2;
////inttostr(thres,distance_txt); distance_txt[4]=0;
//lcd_out(1,1,distance_txt);
//delay_ms(1000);
//}while(1);
if(thres<160){
buzzer=1;
delay_ms(1000);
buzzer=0;
Lcd_Cmd(_LCD_CLEAR);
lcd_out(1,1,text3);
lcd_out(2,1,text4);
tissue_roller_motor=1;
delay_ms(2000);
tissue_folding_motor=1;
delay_ms(3000);
81
tissue_roller_motor=0;
delay_ms(2000);
tissue_folding_motor=0;
delay_ms(1000);
tear_motor =1;
delay_ms(2000);
tear_motor =0;
Lcd_Cmd(_LCD_CLEAR);
lcd_out(1,1,text5);
delay_ms(3000);
Lcd_Cmd(_LCD_CLEAR);
else {
Lcd_Cmd(_LCD_CLEAR);
buzzer=1;
lcd_out(1,1,text6);
delay_ms(5000);
buzzer=0;
else{ distance=0;
} //main loop
82
float read_sensor(){
float sensor_value;
int m;
float asn;
TMR1ON_bit=0;
TMR1H=0;
TMR1L=0;
Trigger=0;
delay_us(2);
Trigger=1;
delay_us(10);
Trigger=0;
m=0xffff;
while(!echo&& m--);
m=0xffff;
TMR1ON_bit=1;
TMR1ON_bit=0;
asn=(TMR1L|(TMR1H<<8 ));
sensor_value=(0.175*asn/0.625);
sensor_value=sensor_value/10;
return sensor_value;
83
APPENDIX B
84
APPENDIX C
PIC 18F452 40-44 PIN BLOCK DIAGRAM. SOURCE FROM MICROCHIP PIC 18F SERIES DATA
SHEET.
85