Page 1
CHAPTER 1
INTRODUCTION OF THE PROJECT
1.1 Introduction
We had made a major modification of our final project, the amazing Water
Recycle System in previous entry with something which is more useful. Thus,
our current activity was set up to refining our prior project into something that
give meaningful effect to us as a students, as a designer and a human being.
The main reason of building this Water Recycle System is to encourage
young people to pay respect to environment.
1.2 Synopsis
This project shows the basic of developing a simple system recycle using
microcontroller and can be further developed for more advanced application.
This project will be use to reuse water from two source that come from rain
water and river water. And, this system also will display it on LCD display.
We used the PIC16F877A system to operate the circuit. This PIC system will
control the program. Beside that, we also using IC Clock and LCD 20x4
(LM004L) to display real time and date.
1
Page 2
1.3 Objective
Objective for project subject that compulsory to be taken by all student of
Diploma in Electronic Engineering at POLYTECHNIC TUANKU
SULTANAH BAHIYAH are:
The main objective of this project can be described as:
Reuse the contaminated water.
Prevent pollution.
To reduce organisation's operating cost
To make a technology as a way for solving a human problem.
1.4 Scope of Project
This project using the PIC 16F877A that have 8-bit microcontroller with 34
I/O, that operate with 5V supply and their output baud rate is 9600 bps, LCD
(20x4character display), LED as the output for PIC microcontroller, PCB
circuit board and also related electronic circuits.
This project will use following main hardware:
PIC 16F877A
Clock IC (DS1307)
LCD Alphanumeric 20x4 (LM004L)
Water Sensor
Buzzer
Motor Pump
2
Page 3
1.5 System Overview
Figure 1.1 System Overview
1.6 Problem Statement
A study was being conducted our upper project that entitled Water Recycle
System taken based on with sparked idea from our monitoring and
observation on human way of life nowadays. This project coined to ease
consumer to engage of water quickly and easy and save cost organize.
Furthermore, with the existence of this project it able facilitate more work to
carried out with long distance area perimeter and condition getting more
complicated if uncertain weathers lately. To overcome the problem with run it
at anytime is wanted.
3
SENSOR 1
SENSOR 2
PIC
PUMP 2
PUMP 1
BUZER
LCD
Page 4
CHAPTER 2
LITERATURE REVIEW
2.1 Introduction
A literature review is a body of text that aims to review the critical points of
current knowledge and or methodological approaches on a particular topic.
Literature reviews are secondary sources, and as such, do not report any new
or original experimental work.
Most often associated with academic-oriented literature, such as theses, a
literature review usually precedes a research proposal and results section. Its
ultimate goal is to bring the reader up to date with current literature on a topic
and forms the basis for another goal, such as future research that may be
needed in the area. A well-structured literature review is characterized by a
logical flow of ideas; current and relevant references with consistent,
appropriate referencing style; proper use of terminology and an unbiased and
comprehensive view of the previous research on the topic.
The report that we want to be produced needed a few factor that should be
taken consideration until that project implemented. To get a quality project
result, we need to study about the type of material, design , components that
we used, framework installation , installation method and maintenance ,level
of product safety, structural strength, project size and so on that we need
make it and consider the result that we get. This is all ensure that no any
4
Page 5
problems would arise during the completion or even when presenting the
project.
Hence, systematic and detailed planning must be arranged for produce a
complete and perfect project. First step that we need made it, was design daub
(sketching) for get the real image of machine that we want to be produced.
Due to this, the work design and study that we made is a continuing process
and it involving problem solving activity creatively namely which is known
as literature study.
2.2 MOTOR DC PUMP
Description:
KNF's NMP08 miniature diaphragm pump is capable of transferring the
largest volume of water in this size range with high efficiency and
contamination-free operation. It is ideal for use in portable, battery operated
equipment where performance, power consumption, minimal weight, and size
are important. KNF's “OEM Project Pump” program provides a variety of
cost reductions and affordable modifications that will optimize our product to
match your design’s performance requirement.
2.2.1 Pump Features:
• Oil-Free, Contamination-Free Transfer:
Retains pumped medium purity and increases system reliability as
they are maintenance-free and have no sliding seals to wear away.
• Patented, Multi-Port Valves:
KNF’s multi-port valve system maximize flow rate for high
5
Page 6
efficiency. An integral sealing-ridge reduces back flow to
negligible levels.
• Fits Into The Smallest Devices:
KNF's engineers combined high performance with precision
miniature packaging to produce an efficient, compact unit.
Portable instruments can be made smaller and lighter, and run
longer between recharges. A brushless DC model is available as
standard product for high reliability and continuous-duty
applications.
• Excellent Mechanical Stability and Chemical Resistance:
Ryton® heads exhibit consistent performance throughout the life
of the pump. Ryton® also has excellent chemical resistance.
Other diaphragm and valve materials are available.
• Flexible Mounting Options:
Optimally placed mounting holes in the compressor housing
enable you to mount this pump in any position.
• Low Noise Level
An enclosed compressor housing minimizes noise transmission
and keeps dirty away from critical components.
2.2.2 Applications:
6
• Asbestos Particle
Counters
• Portable Dosimeters
• Gas or Odor Leak
Detectors
• Gas Chromatography
• Portable Analytical
Instruments
• Portable Analytical
Instruments
• Blood Pressure Monitors • Medical Diagnostic
Equipment
Page 7
Table 2.1: Applications of motor
2.2.3 Electric Usage
Motor
Voltage
6 VDC, 12 VDC 6 VDC, 12 VDC,
24 VDC
6 VDC
Motor
Current @
Free-Flow
85 mA, 40 mA 50 mA, 40 mA,
20 mA
175 mA
Motor
Type
Brushless:
DC/Integrated
driver
Brushless:
Type DC
Brushless:
Type DC
Table 2.2: Electric Usage
2.2.4 Performance Characteristic
7
Page 8
Figure 2.1: Performance Characteristic
2.3 PIC16F877A
8
Page 9
Microcontroller PIC16F877A is one of the PIC Micro Family microcontroller
which is popular at this moment, start from beginner until all professionals.
Because it is very easy using PIC16F877A and use FLASH memory
technology so that can be write-erase until thousand times. The superiority
this Risc Microcontroller compared to with other microcontroller 8-bit
especially at a speed of and his code compression. PIC16F877A have 40 pin
by 33 path of I/O.
PIC16F877A perfectly fits many uses, from automotive industries and
controlling home appliances to industrial instruments, remote sensors,
electrical door locks and safety devices. It is also ideal for smart cards as well
as for battery supplied devices because of its low consumption. EEPROM
memory makes it easier to apply microcontrollers to devices where
permanent storage of various parameters is needed (codes for transmitters,
motor speed, receiver frequencies, etc.). Low cost, low consumption, easy
handling and flexibility make PIC16F877A applicable even in areas where
microcontrollers had not previously been considered (example: timer
functions, interface replacement in larger systems, coprocessor applications,
etc.).In System Programmability of this chip (along with using only two pins
in data transfer) makes possible the flexibility of a product, after assembling
and testing have been completed. This capability can be used to create
assembly-line production, to store calibration data available only after final
testing, or it can be used to improve programs on finished product.
Figure 2.2: PIC16F877A
9
Page 10
Figure 2.3: PIC16F877A Pin Diagram
Figure 2.4: Schematic Diagram Of Microcontroller Connections
10
Page 11
2.3.1 Benefit of PIC
Lower Cost:
Pic were originally create to decrease the cost of the user of it
compare with the plc that weremore expensive that pic. Therefore
in this project we choose pic as the brain in this project.
Sizes:
The pic is the smallest that other programming control that has
many types of input and output pin such as 16 pin to 40 pin.
Communication Capability:
A pic can read and program all the input that has to program
with it and easy to to program with any programmer and
software.
Faster Respond Time:
Pic are design for high-speed and real-time applications. It can
operate in real times, which mean that an even taking place in
the field will result in the execution of an operation or output.
2.3.2 Characteristic of PIC
NO. FEATURES PIC16F877A
1. Operating Frequency DC – 20 MHz
2. Resets and delays POR, BOR (PWRT,
OST)
3. Flash Program Memory (14-bit words) 8K
4. Data Memory (bytes) 368
11
Page 12
5. EEPROM Data Memory (bytes) 256
6. Interrupts 15
7. I/O Ports Ports A, B, C, D, E
No. features Pic16f877a
8. Timers 3
9. Capture/Compare/PWM modules 2
10. Serial Communications MSSP, USART
11. Parallel Communications PSP
12. 10-bit Analog-to-Digital Module 8 input channels
13. Analog Comparators 2
14. Instruction Set 35 Instructions40-pin
PDIP
15. Packages 44-pin PLCC
44-pin TQFP
44-pin QFN
Table 2.3: Features of PIC16F877A
2.4 LCD (4 x 20 Character)
Recently, a number of projects using intelligent Liquid Crystal Display
(LCD) modules have been featured in EPE. Their ability to display not just
numbers, but also letters, words and all manner of symbol, makes them a
good deal more versatile than the familiar 7-segment light emitting diode
(LED) display.
12
Page 13
Figure 2.5: LCD (2 x 20 Characters)
2.4.1 Connections of LCD
Most LCD modules conform to a standard interface specification. A
14-pin access is provided (14 holes for solder pin insertion or for an
IDC connector) having eight data lines, three control lines and three
power lines. The connections are laid out in one of two common
configurations, either two rows of seven pins, or a single row of 14
pins. The two layout alternatives are displayed in figure 2.5.
Figure 2.6: Two Layout Alternatives
13
Page 14
Table 2.4: Pin Outs Functions for All the LCD Types
Pins 1 and 2 are the power supply lines, Vss and Vdd .The Vdd pin
should be connected to the positive supply, and Vss to the 0V supply
or ground. Although the LCD module data sheet specify a 5V DC
supply (at only a few milliamps), supplies of 6V and 4.5 both work
well, and even 3V is sufficient for some modules. Consequently,
these modules can be effectively, and economically, powered by
batteries. Pin 3 is a control pin, Vee, which is used to alter the
contrast of the display. Ideally, this pin should be connected to a
variable voltage supply.
A preset potentiometer connected between the power supply lines,
with its wiper connected to the contrast pin is suitable in many
cases, but be aware that some modules may required a negative
potential; as low as 7V in some cases. For absolute simplicity,
connecting this pin to 0V will often suffice. Pin 4 is the Register
Select (RS) line, the first of the three command control inputs. When
this line is low, data bytes transferred to the display are treated as
commands, and data bytes read from the display indicate its status.
14
Page 15
By setting the RS line high, character data can be transferred to and
from the module.
Pin 5 is the Read/ Write (R/W) line. This line is pulled low in order
to write commands or character data to the module, or pulled high to
read character data or status information from its registers.
Pin 6 is the Enable (E) line. This input is used to initiate the actual
transfer of commands or character data between the module and the
data lines. When writing to the display, data is transferred only on the
high to low transition of this signal. However, when reading from the
display, data will become available shortly after the low to high
transition and remain available until the signal falls low again.
Pins 7 to 14 are the eight data bus lines (D0 to D7). Data can be
transferred to and from the display, either as a single 8-bit byte or as
two 4-bit “nibbles”. In the latter case, only the upper four data lines
(D4 to D7) are used. This 4-bit mode is beneficial when using a
microcontroller, as fewer input/output lines are required.
2.5 Diode
In electronics a diode is a two-terminal electronic component which conducts
electric current asymmetrically or unidirectional; that is, it conducts current
more easily in one direction than in the opposite direction. The term usually
refers to a semiconductor diode, the most common type today, which is a
crystal of semiconductor connected to two electrical terminals, a P-N
junction. A vacuum tube diode, which was the first type of diode invented but
is now little used, is a vacuum tube with two electrodes; a plate and a cathode.
15
Page 16
The most common function of a diode is to allow an electric current in one
direction (called the forward direction) while blocking current in the opposite
direction (the reverse direction). Thus, the diode can be thought of as an
electronic version of a check valve. This unidirectional behavior is called
rectification, and is used to convert alternating current to direct current, and
remove modulation from radio signals in radio receivers.
Figure 2.7: Diode
Figure 2.8: Diode Symbols
16
Page 17
2.6 Crystal
A crystal is an electronic circuit that uses the mechanical resonance of a
vibrating crystal of piezoelectric material to create an electrical signal with a
very precise frequency.
This frequency is commonly used to keep track of time (as in quartz
wristwatches), to provide a stable clock signal for digital integrated circuits,
and to stabilize frequencies for radio transmitters and receivers. The most
common type of piezoelectric resonator used is the quartz crystal, so
oscillator circuits designed around them were called "crystal oscillators".
Standard frequency crystals - use these crystals to provide a clock input to our
microprocessor. Rated at 20pF capacitance and +/- 50ppm stability.
Figure 2.9: Crystal
17
Page 18
CHAPTER 3
METHODOLOGY
3.1 Introduction
Methodology can be the ‘analysis of the principles of methods, rules, and
postulates employed by a discipline’, ‘the systematic study of methods that
are, can be, or have been applied within a discipline’ or ‘a particular
procedure or set of procedures’.
Methodology includes a philosophically coherent collection of theories,
concepts or ideas as they relate to a particular discipline or field of inquiry.
Methodology refers to more than a simple set of methods, rather it refers to
the rationale and the philosophical assumptions that underlie a particular
study relative to the scientific method. This is why scholarly literature often
includes a section on the methodology of the researchers.
Each step of project is a process to complete the project. Every step must be
followed one by one and must be done carefully. If some error occurs it can
make
a project probably could not operate or do not look neat and perfect.
Before the project finish, various process needs to be done according to
proper procedures to ensure that projects do not have any problems. Among
the measures the work done in preparing this project are:
18
Page 19
Process of designing circuits
Circuit board trace
Soldering process in circuit board.
Programming process in programes and so on
3.1.1 Flow Chart Plan Of Project Of E4006 And E5006
19
Page 20
Flow Chart 1.0: Plan Of Project For E4006 And E5006
20
Page 21
3.1.2 Flow Chart Preparation Of E4006
21
Page 22
Flow Chart 1.1: Flow Chart Preparation Of E4006
22
Page 23
3.1.3 Flow Chart Of Water Recycle System
Flow Chart 1.2: Flow Chart Of Water Recycle System
23
Page 24
3.2 Gantt Chart
SEMESTER 5
WEEK / ACTIVITY
Week 1
Week 2
Week 3
Week 4
Week 5
Week 6
Week 7
Week 8
Week 9
Week 10
Week 11
Week 12
Week 13
Week 14
Week 15
Week 16
Week 17
Week 18
Students Registration Project Briefing
Submission of Project Title
Submission of ProposalAssistance and Discussion Progress The Project and First Draft of The Report
50% Progress The Project and
Second Draft of The Report 75%
Preparation for presentation
Submission of Final Report
Presentation
Table 3.1: Gantt Chart
3.3 Draw Schematic Diagram Of Water Recycle System Using Proteus
PROTEUS VSM 6.9 allows professional engineers to run interactive
simulations of real designs, and to reap the rewards of this approach to circuit
simulation. And then, a range of simulator models for popular micro-
controllers and a set of animated models for related peripheral devices such as
PIC and LCD displays, resistor, and more. It is possible to simulate complete
micro-controller systems and thus to develop the software for them without
access to a physical prototype. In a world where time to market is becoming
24
Page 25
more and more important this is a real advantage. Structurally, Proteus 6
Professional separated into two main components, which are ISIS 6
Professional and ARES 6 Professional. ISIS 6 Professional mainly involved
on circuit designing and simulation. In our project we use Proteus to design a
schematic diagram.
Figure 3.1: ISIS 6 Professional User Interface
3.3.1 Simulate The Circuit Using Proteus
After completing the circuit assembly and configuration, now its time
to verify whether the source code compiled is virtually accurate or not.
Proteus offer a whole lot of variety virtual devices. In fact, simulation
using oscilloscope and function generator can be done using Proteus.
Even virtual hyperterminal is provided to demonstrate how your code
performs in real world without really doing the hardware section yet.
Figure 3.2 : Toolbar Of Proteus Simulation
25
Page 26
3.4 Process Of The Circuit Designing
3.4.1 Design The Circuit Diagram
After decide what kind of project that we want to build. We need to
make a research about the circuit, electronic component that we need
to used, hardware and so on. These things actually can help us to
make a better in designing circuit. For example, we need to know the
size, foot of component, polarity of the component, the component
method compilation and etc to make a circuit diagram.
In the first step in Circuit Designing process is make a circuit diagram
that can be use in the next process. Among steps in the circuit diagram
are:-
i. Before the circuit is produced, the things that we need to be
emphasized are the position of symbols and components used in the
Schematic circuit. Once we know the entire production circuit, the
circuit can be drawn using special software, namely Proteus ISIS
Professional.
ii. Then, make sure that the connection of the component is correct.
26
Page 27
Figure 3.3: Water Recycle System Circuit Diagram
3.5 Etching
Etching is a "subtractive" method used for the production of printed circuit
boards. Acid is used to remove unwanted copper from a prefabricated
laminate. This is done by applying a temporary mask that protects parts of the
laminate from the acid and leaves the desired copper layer
untouched. Etching is where the excess copper is removed to leave the
individual tracks or traces as they are sometimes called. Buckets, bubble
tanks, and spray machines lots of different ways to etch, but most firms
currently use high pressure conveyerised spray equipment. Many different
chemical solutions can be used to etch circuit boards. Ranging from slow
controlled speed etches used for surface preparation to the faster etches used
for etching the tracks. Some are best used in horizontal spray process
equipment while others are best used in tanks.
27
Page 28
3.5.1 Risk Of Etching
i. There is a risk of injuries due to the chemicals involved.
ii. The quality of the results depends on several factors which you
won't be able to master completely the first time. This can be
somewhat compensated by using good machinery.
iii.There is the problem of waste disposal. Toxic chemicals require a
proper disposal service.
3.5.2 Safety
Since the work involves dangerous chemicals and power tools, we
will need to take the necessary safety precautions:
i. Wear safety equipment during the whole process - gloves,
protection glasses, and an apron
ii. Work near an emergency eyewash station, a first aid box and a
phone
iii.Familiarize yourself with the proper use of all equipment and tools
in the lab - if you are unsure of anything, ask a supervisor of the
project.
3.5.3 Etching Process
Etching is the process of using acid to remove coppers that not need
on the PCB (PRITED CIRCUIT BOARD). This acid is Acid Ferric
Chloride III. Acid Ferric Chloride III is used to remove that coppers.
The steps of the etching process are:
i. Print the schematic onto transparent paper and cut it with the
same size of PCB board.
28
Page 29
Figure 3.4 Transparent Paper That Have Cut
ii. Stick the schematic diagram on PCB board.
iii. Paste the etching circuit onto transparent paper with UV Board
using expose machine. It’s to make PCB paper joined with
board.
iv. This process takes about 30 second.
Figure 3.5. UV Expose Process
v. Dilute the acid with a little hot water and make sure that the
mixture is not too liquid and too concentrated.
vi. Then, put the board into the mixed (Acid Ferric Chloride III +
Hot water) to remove the useless copper.
Figure 3.6: Process To Remove Unused Chopper
29
Page 30
vii. When PCB was soaked into this mix, we must always shake
the container with the acid so that the unwanted copper will
remove.
viii. After Acid remove unused copper, take the PCB to wash with
clean water.
ix. Then, use sand paper to rub the lines colors. In addition,
detergent powder can also be used to remove the ink. Next,
just leave only the desired circuit PCB only.
3.6 Drilling Process
3.6.1 Material and Equipments :
Bench clamp or support
Dot punch or sharp tool
Drilling machine or hand drill
1mm bits
3.6.2 Introduction of Drilling Process
After the etching process finished, the PCB will be punched using hand
drilling machine. Hole is necessary to mount component (example:
resistor, capacitor, inductor, tip 122, crystal, PIC base and etc). Before
drilling, a dot punch is used to mark the hole position. This serves as a
shallow guide for the drill bit to align easily while drilling. Any other
sharp pointed tool can be use to do the marking. Points/eye drill used
must be appropriate to the hole to be punched between 0.75 to 1.0 mm.
The purpose of this process is to facilitate the installation work on the
circuit components of the PCB. During drilling, do not be pressed too
strong because it may cause eye drill broken up and dangerous for the
30
Page 31
people around. Hold the drill steady and drill in straight slowly. The
hole will be drilled with little force applied.
3.7 Insert the Component
Foot of component was inserted into the drilled hole that has been completed.
It is easier if started with the low component first. Components that are
installed must be inspected prior to use multimeter to find out whether these
components are in good condition or not. This process is quite important
because we should insert the component correctly to avoid from circuit
failure. Besides, some components have their own pole like diode, capacitor
and other else. After finished the inserting process, we check it once again
with the schematic to make sure all the component were at the position or
holes.
3.8 Soldering Process
Soldering is defined as "the joining of metals by a fusion of alloys which
have relatively low melting points". In other words, we use a metal that
has a low melting point to adhere the surfaces to be soldered together.
Soldering is more like gluing with molten metal than anything else.
Soldering is also a must have skill for all sorts of electrical and electronics
work. It is also a skill that must be taught correctly and developed with
practice.
Steps to Solder :
i. Quickly remove the tip of the soldering iron from Heat up the
soldering iron for five to 10 minutes, allowing the iron to reach
maximum operating temperature. If the soldering iron has two
31
Page 32
temperature settings selectable with a switch, select lower temperature
when soldering small electronic components to a board and select the
higher temperature when soldering heavier wires. Apply a small
amount of solder to the tip and rotate so the entire tip becomes lightly
covered with a thin layer of solder. This is called "tinning" the tip.
ii. Connect the two surfaces to be soldered together so the metal parts are
touching. If soldering wires, simply twist the two wire ends together
so they don't pull apart while being soldered. If soldering electronic
components, simply seat the component wires into the holes of the
circuit board where the component is to be placed.
iii. Touch the hot tip of the soldering iron to all metal parts touching
together so they are evenly heated. Allow the surface to heat for just
three to five seconds, then touch the tip of the solder to the heated
metal objects, not directly to the tip of the soldering iron. Allow a
small amount of solder to flow onto the metal components or wires
until just enough solder has been applied to cover the entire surface of
the wires or components.
iv. the soldered surface and wipe the tip of the iron on a wet sponge
immediately to remove solder. Wiping the solder off the tip will
prevent it from burning and forming a black coat on the soldering iron
tip.
v. Allow the solder joint to cool for several minutes before applying
power to the wires or the device soldered.
32
Page 33
3.9 Circuit Testing
For testing and improvement process, we took almost four weeks to make it
work. In the calendar project activities, we were given four weeks to settle all
the testing and improvement process. The purpose of testing the electric was
to determined and located any of the following conditions :
1) An open circuit
2) A short circuit with another conductor in the same circuit.
3) A ground, which is a short circuit between the conductor and
circuit.
4) Leakage ( a high resistance path across a portion of the circuit, to
another circuit, or to ground ).
5) A cross ( a short circuit or leakage between conductors of different
circuit )
As a first step, we have done the short circuit testing using an analog
multimeter. Before used the multimeter, we set up the multimeter to zero. To
pointer the meter exactly on the zero line, we rotate the adjusting screw, Then
we connect the multimeter probes to the circuit being tested. After that, we
observed the meter needle movement. Luckily the needle does not move, this
means circuit was not short.
Then we move on the second step, which is testing an open circuit. Open circuit
test, sometimes called no – load test, is one of the method in electrical
engineering order to determine a break exists in a complete conducting
pathway. Open circuit can cause by excessive current. Again, multimeter was
used to check
whether the circuits are open or in normal condition. We only gave the required
current to the circuit, so we did not face an open circuit problem. This mean our
circuits were in normal condition.
33
Page 34
3.10 Troubleshooting
The most problem like the fault soldering. Check all the soldering joint
suspicious. If you discover the short track or the short soldering joint, re-
solder at that point and check other the soldering joint. Check the position of
all component on the PCB. See that there are no components missing or
inserted in the wrong places. Make sure that all the polarised components
have been soldered the right way round.
3.11 Project Designation
3.11.1 Research and Analysis Project
Research is important to ensure the project that is yet to progress can
have a good start so that it would not cost any problem during the
project development. So, the vital information such as the circuit, the
component usage ,the commercial needs and much are indeed
important . It is as the circuit, ensure the can understand more on how
important is the project. The source can be obtained from lectures,
books and also internet.
3.11.2 The Project Reformation
We must read and understand all data that we have. Data and
information have to be compiled and all information we had got had to
be arranged systematically for progress. From time all information and
data must to upgrade for information and follow the project’s
progression.
34
Page 35
3.11.3 Session Discussion and Problem Settle
Discussion session were held every week to discuss the project
development. All the problem are discussed so that it can be solved
quickly. Problem that can’t be handled were too addressed quickly to
the project supervisor. To make the project difficult everything that is
going to be done must be planned properly (proper planning). This can
ensure the project flow is smooth without any interruptions.
3.12 Software Part
3.12.1 Identify Every Software Components Inside The Schematic
Diagram
i. Proteus VSM 6.9 to design schematic diagram
ii. Eagle to design PCB
3.13 Study About The PIC16F877A That Has Been Use
Microcontroller PIC16F877A is one of the PIC Microcontroller Family
microcontroller which is popular at this moment, start from beginner until all
professionals. Because very easy using PIC16F877A and use FLASH
memory technology so that can be write-erase until thousand times. The
superiority this Risc Microcontroller compared to with other microcontroller
8-bit especially at a speed of and his code compression. PIC16F877A have 40
pin by 33 path of I/O.
PIC16F877A is a small piece of semiconductor integrated circuits. The
package type of this integrated circuits is DIP package. DIP stand for Dual
Inline Package for semiconductor IC. This package is very easy to be
35
Page 36
soldered onto the strip board. However using a DIP socket is much more
easier so that this chip can be plugged and removed from the development
board. PIC16F877A is very cheap. Apart from that it is also very easy to be
assembled. Additional components that you need to make this IC work is just
a 5V power supply adapter, a 20MHz crystal oscillator and 2 units of 22pF
capacitors. The advantage of this IC can be reprogrammed and erased up to
10,000 times. Therefore it is very good for new product development phase.
Figure 3.7: Structure and Diagram of PIC16F877A
3.13.1 PIC16F877A Microcontroller Features
Special Microcontroller Features
i. 100,000 erase/write cycle Enhanced Flash program memory typical
ii. Self-reprogrammable under software control
iii. Single-supply 5V In-Circuit Serial Programming
iv. Watchdog Timer (WDT) with its own on-chip RC oscilloscope
v. Programmable Code Protection
vi. Power-Saving Sleeping mode
36
Page 37
Peripheral Features
i. Two 8-bit (TMR0, TMR2)timer/counter with Pre-scalar
ii. One 16-bit timer/counter
iii. Brown-out detection circuitry
iv. Parallel Slave Port (PSP): 40/44 pin-device only
High-Performance RISC CPU
i. Only 35 single-word instructions to learn
ii. DC-20MHz clock input
iii. Up to 8K x 14 words of Flash Program Memory
iv. Pin out Compatible to other 28-pin or 40/44-pin
Analog Features
i. 10-bit, up to 8-channel Analog-to-Digital Converter (A/D)
ii. Brown-out Reset(BOR)
iii. Two analog comparators
iv. Programmable on-chip voltage reference (VREF) module
CMOS Technology
i. Low-power, high-speed Flash/EEPROM technology
ii. Fully static design
iii. Wide operating voltage range (2.0V to 5.5V)
iv. Low-power consumption
37
Page 38
3.13.2 PIC16f877A Block Diagram
Figure 3.8 : PIC16F877A block diagram
38
Page 39
3.13.3 PIC16F877A Register File Map
Figure 3.9 : PIC16F877A Register File Map
39
Page 40
3.13.4 Function Of PIC16f877A Pin Out
No
.
Pin
Descriptions
1 MCLR / VPP Master Clear (input) or programming voltage (output).
This is an active low RESET to the device.
2 RA0 / AN0 can also be analog input 0.
3 RA1 / AN1 can also be analog input 1.
4 RA2 / AN2 / VREF – can also be analog input 2 or A/D reference
voltage ( LOW ) input.
5 RA3 / AN3 / VREF + can be also analog input 3 or A/D reference
voltage ( HIGH ) voltage.
6 RA4 / T0CK1 / C1OUT can also be timer 0 external clock input.
Comparator 1 output.
7 RA5 / AN4 / SS can also be analog input4 or the salve Select. for the
synchronous serial port
8 RE0/RD/AN5 can also be analog input4 or the salve Select.
for the synchronous parallel port5
9 RE1/WR/AN6 can also be analog input4 or the salve Select. for the
synchronous serial port6
10 RE2/CS/AN7 can also be analog input4 or the salve Select for the
synchronous serial port7
11 VSS can also be ground reference for logic and i/o pins
12 VDD can also be positive supply for logic and i/o pins.
13 OSC1/CLKIN oscillator crystal input/external clocsk source input.
14 OSC2/CLKOUT oscillator crystal output
15 RC0 / T1OSO / T1CKI can also be Timer 1 oscillator output. Timer1
external clock input
16 RC1/ T1OSI / CCP2 can also be Timer1 oscillator input. Capture2
input, Compare2 output, PWM2 output
17 RC2 / CCP1 can also be Capture1 input, Compare1 output, PWM1
40
Page 41
output.
18 RC3 / SCK / SCL can also be synchronous serial clock input/output for
SPI mode. Synchronous serial clock input/output for IC mode.
19 RD0/PSP0
20 RD1/PSP1
21 RD2/PSP2
22 RD3/PSP3
23 RB3 / PGM can also be low-voltage ( single supply ) ICSP
programming enable pin.
24 RC5 / SDO can also be SPI data out
25 RC6 / TX / CK can also be USART asynchronous transmit. USART 1
synchronous clock
26 RC7 / RX / DT can also be USART asynchronous receive. USART
synchronous data.
27 RD4/PSP4
28 RD5/PSP5
29 RD6/PSP6
30 RD7/PSP7
31 RC4 / SDI / SDA can also be SPI data in. IC data i/o.
32 VSS can also be ground reference for logic and i/o pin
33 VDD can also be positive supply for logic and i/o pins
34 RBO / INT can also be external interrupt
35 RB1 can also be digital i/o.
36 RB2 can also be digital i/o.
37 RB4 can also be digital i/o.
38 RB6 / PGC can also be In-circuit debugger and ICSP programming
clock.
39 RB5 can also be digital i/o.
40 RB7 / PGD can also be In-circuit debugger
Table 3.2: Function Of PIC16f877A Pin Out
41
Page 42
3.14 Programming
3.14.1 Source Code
Define OSC 8 ' Core is running at 48MHz
Define LCD_DREG PORTbDefine LCD_DBIT 4Define LCD_RSREG PORTBDefine LCD_RSBIT 1Define LCD_EREG PORTBDefine LCD_EBIT 3DEFINE LCD_RWREG PORTB DEFINE LCD_RWBIT 2 DEFINE I2C_SLOW 1' Alias pinsSDA Var PORTc.7SCL Var PORTc.6 TRISd = %00001111 TRISC = %00101111' Allocate variablesRTCYear Var ByteRTCMonth Var ByteRTCDate Var ByteRTCDay Var ByteRTCHour Var ByteRTCMin Var ByteRTCSec Var ByteRTCCtrl Var Bytemybcd var bytemybyte var bytemybcd1 var bytemybyte1 var byteb2 var byte j var byteTEMPHOUR VAR BYTETEMPMIN VAR BYTEHOURBTN VAR PORTD.0MINBTN VAR PORTD.1ENTERBTN VAR PORTC.3SETBTN VAR PORTC.2buzzer var portd.5alarmhour var byte alarmmin var byteportd = %00000010sensor_water var portd.2sensor_rain var portd.3pump_siram var portd.7pump_water var portd.6 sensor var portc.5 i var word Pause 500 ' Wait for LCD to startupsensor1 var word
42
Page 43
sensor2 var word' Set initial time to 8:00:00AM 06/21/05 RTCYear = $05 RTCMonth = $06 RTCDate = $21 RTCDay = $02 RTCHour = $08 RTCMin = 2 RTCSec = 4 RTCCtrl = 0
low pump_siramlow pump_waterlow buzzerpause 2000 Gosub settime ' Set the time mainloop:
if sensor_water = 0 thensensor1 = 0low pump_waterpause 10endif
if sensor_water = 1 thensensor1 = 1high pump_waterhigh buzzer pause 100low buzzerpause 100endif
if sensor_rain = 1 thensensor2 = 1endif
if sensor_rain = 0 thensensor2 = 0endif
if enterbtn= 0 thenhigh pump_sirampause 1000endif
if enterbtn = 1 thenlow pump_sirampause 100endif
43
Page 44
gosub set_time Gosub gettime gosub compare_alarm
Lcdout $fe, 1 LCDOUT $FE, 2 LCDOUT " TIME: ", hex2 RTCHour, ":", hex2 RTCMin, ":", hex2 RTCSec LCDOUT $FE, $C0 LCDOUT "RAIN= ",DEC SENSOR2, " WATER= ", DEC SENSOR1 Pause 200 IF SETBTN =0 THEN GOTO SET_ALARM ENDIF Goto mainloop End SET_TIME: IF HOURBTN = 0 THEN GOSUB GETTIME 'MYBCD= RTCHOUR TEMPHOUR = ((RTCHOUR >> 4 ) * 10 ) + (RTCHOUR & 15 ) TEMPHOUR = TEMPHOUR + 1 IF TEMPHOUR >=24 THEN TEMPHOUR = 0 ENDIF RTCHOUR = ((TEMPHOUR / 10 ) << 4 ) + (TEMPHOUR // 10 ) I2CWrite SDA, SCL, $D0, $00, [00] I2CWrite SDA, SCL, $D0, $02, [RTCHOUR] pause 10 gosub gettime Lcdout $fe, 1, " TIME: ", hex2 RTCHour, ":", hex2 RTCMin, ":", hex2 RTCSec pause 300 endif IF MINBTN = 0 THEN GOSUB GETTIME ' MYBCD= RTCMIN TEMPMIN = ((RTCMIN >> 4 ) * 10 ) + (RTCMIN & 15 ) TEMPMIN = TEMPMIN + 1 IF TEMPMIN >=60 THEN TEMPMIN = 0 ENDIF RTCMIN = ((TEMPMIN / 10 ) << 4 ) + (TEMPMIN // 10 ) I2CWrite SDA, SCL, $D0, $00, [00] I2CWrite SDA, SCL, $D0, $01, [RTCMIN] pause 10 gosub gettime Lcdout $fe, 1, " TIME: ", hex2 RTCHour, ":", hex2 RTCMin, ":", hex2 RTCSec pause 300 endif
44
Page 45
RETURN gettime: I2CRead SDA, SCL, $D1, $00, [RTCSec] pause 10 I2CRead SDA, SCL, $D1, $01, [RTCMin] pause 10 I2CRead SDA, SCL, $D1, $02, [RTCHour] pause 10 Return settime: I2CRead SDA, SCL, $D0, $00, [RTCSec] I2CRead SDA, SCL, $D0, $01, [RTCMin] I2CRead SDA, SCL, $D0, $02, [RTCHour] Return
SET_ALARM: for i = 1 to 10 gosub set_alarm1 next i RETURN set_alarm1: loop1: read i,b2 temphour = b2 alarmhour = ((tempHOUR >> 4 ) * 10 ) + (tempHOUR & 15 ) read (i+20),b2 tempmin= b2 alarmmin = ((tempMIN >> 4 ) * 10 ) + (tempMIN & 15 ) IF HOURBTN=0 THEN AlarmHOUR = AlarmHOUR +1 IF AlarmHOUR =>24 THEN AlarmHOUR = 0 ENDIF b2= ((alarmHOUR / 10 ) << 4 ) + (alarmHOUR // 10) write i,b2 endif IF minBTN=0 THEN Alarmmin = Alarmmin +1 IF Alarmmin =>60 THEN Alarmmin = 0 ENDIF b2= ((alarmmin / 10 ) << 4 ) + (alarmmin // 10)
45
Page 46
write (i+20),b2 endif if enterbtn = 0 then pause 600 goto exit_loop endif
Lcdout $fe, 1, " ALARM",dec i,": ", DEC2 AlarmHOUR, ":", DEC2 alarmmin pause 700 goto loop1 exit_loop: return compare_alarm: if rtcsec = 05 then gosub gettime TEMPHOUR = ((RTCHOUR >> 4 ) * 10 ) + (RTCHOUR & 15 ) TEMPMIN = ((RTCMIN >> 4 ) * 10 ) + (RTCMIN & 15 ) for i = 1 to 20 read i,b2 alarmHOUR = ((b2 >> 4 ) * 10 ) + (b2 & 15 ) read i+20,b2 alarmmin = ((b2 >> 4 ) * 10 ) + (b2 & 15 ) if temphour = alarmhour and tempmin = alarmmin and sensor_rain = 1 then Lcdout $fe, 1, " ALARM ON" high pump_siram pause 5000 low pump_siram pause 500 endif next i endif return
46
Page 47
3.14.2 Burning The PIC16F877A
1. Open the PIC programmable and chose the PIC that you want to burn.
Figure 3.10: PIC Programmable Start Up
2. Click file and click open. Find the location of the source code that have been compile. Then click the HEX file.
Figure 3.11: PIC programmable HEX.file
47
Page 48
Figure 3.12: To Drag Source Code
3. The program will run.
Figure 3.13: Run HEX. file
48
Page 49
3.14.3 Hex File
:10000000B2019A29B216B21EB212B2190B28B21559
:100010004420031832280830A3005920A20DA30B56
:100020000D28B21E3D2063205F20B21A32203720F7
:10003000220803109529B216B21EB21232192528D1
:10004000FE39B300321503109529321A2D28A60067
:10005000321644200318322826084C200318322870
:10006000B21E95293D20632032113212B21136089A
:100070008400340884178004432836088400340937
:1000800080058417800595293720632099213D201C
:100090005F203308B2190138A2000830A300A20D76
:1000A00003183720031C3D2063205F20A30B4F283B
:1000B000372063203608840034080005FF3E3708E7
:1000C0008400350940283708840035083A28040898
:1000D000A700861186100611831686118610061158
:1000E0000F30860583122708B21894283A30A100F1
:1000F00098301C213330A600A8201330A10088308E
:100100001C21A82064301B21A82064301B21223030
:10011000A600A820283093200C309320063093208E
:10012000B214270894283214A600321CA228861084
:10013000033C031CA728A7200730A100D0301C21B6
:10014000031408003214FE3C031995298614321C4E
:10015000321086150F3086052608F0398604861180
:10016000A60E3218A82832301B2103140800B3133E
:1001700029080319B3170430A800250EC420250848
:10018000C420240EC42024080F39F63E0318073E6D
:100190000A3EE728B31329080319B3170530A8004E
:1001A0002730A3001030E0200330A300E830E02027
:1001B000A3016430E020A3010A30E0202408E728EE
:1001C000A2002508A1002408A0005E212008A000AC
:1001D000A8030319B31329080319F12828020318E7
49
Page 50
:1001E00008002008031DB313B31B0800303E9029FC
:1001F00003178D0083168C130C1483120C08952999
:1002000003178C0083168C130C1555308D00AA3003
:100210008D008C148C180A290C119529A301A200B9
:10022000FF30A207031CA307031C95290330A1007C
:10023000E3301C211029A101F43EA000A109FE30E9
:10024000031C2529A00703182229A0076400A10F79
:100250002229000020182C2920182E29080003101C
:10026000A00DA10DFF3E03182F292008952903108A
:10027000A10CA00CFF3E0318372920089529A101E5
:10028000A301A20002304729A20001304729A8009B
:1002900023082102031D4E292208200204300318DE
:1002A0000130031902302805031DFF30952900385D
:1002B000031DFF300405031DFF309529A501A4018E
:1002C0001030A600210DA40DA50D2208A4022308BC
:1002D000031C230FA502031874292208A40723086E
:1002E0000318230FA5070310A00DA10DA60B62296B
:1002F000200895291030A800A101A001A70CA60C88
:10030000031C88292208A00723080318230FA1072C
:10031000A10CA00CA50CA40CA80B7E2924089529DF
:10032000840031088A00300882008313031383128B
:100330006400080083160F3088002F308700831276
:10034000023088000130A300F4308A010F2105300B
:10035000D3000630D1002130CD000230CE0008306D
:10036000CF000230D0000430D200CC0188138316B5
:1003700088138312081383160813831288128316B6
:10038000881283120730A300D0308A010F218A110E
:100390000A12752464008A110A120819D829BA01B0
:1003A000BB010813831608130A3083128A010E2139
:1003B00064008A110A12081DF2290130BA00BB013B
:1003C0000817831608138312881683168812643060
:1003D00083128A010E2188128316881264308312D8
50
Page 51
:1003E0008A010E2164008A110A12881DFA2901303F
:1003F000BC00BD0164008A110A128819012ABC01DF
:10040000BD0164008A110A1287190F2A8817831602
:10041000881383120330A300E8308A010F2164009F
:100420008A110A12871D1B2A8813831688136430C9
:1004300083128A010E218A110A12BD228A110A1220
:1004400038248A110A12DB25FE308A016820013027
:100450008A016820FE308A01682002308A01682003
:1004600020308A01682054308A01682049308A018E
:1004700068204D308A01682045308A0168203A3072
:100480008A01682020308A0168200230A9004F08C4
:10049000A400A5016730B000B1018A01B7203A304D
:1004A0008A0168200230A9005008A400A501673025
:1004B000B000B1018A01B7203A308A0168200230C9
:1004C000A9005208A400A5016730B000B1018A015B
:1004D000B720FE308A016820C0308A01682052307F
:1004E0008A01682041308A01682049308A016820E9
:1004F0004E308A0168203D308A01682020308A0110
:100500006820A9013C08A4003D08A5006730B000A0
:10051000B1018A01CA2020308A01682057308A013F
:10052000682041308A01682054308A0168204530B3
:100530008A01682052308A0168203D308A01682093
:1005400020308A016820A9013A08A4003B08A500D0
:100550006730B000B1018A01CA20C8308A010E217B
:1005600064008A110A120719B82A8A110A12A92CE2
:100570008A01CA2963008A01BA2A64008A110A1210
:1005800008187A2B8A110A1238244F08A000A101FA
:1005900004308A013A21BE002108BF003E08A600AF
:1005A0003F08A7000A30A200A3018A017A21BE00F9
:1005B0002508BF000F304F05C000C1013E084007AD
:1005C000D400D40A6400183054028A110A12031CA1
:1005D000EA2AD4015408A000A1010A30A200A30114
51
Page 52
:1005E0008A015E21BE002108BF003E08A0003F082E
:1005F000A10004308A013221BE002108BF00540846
:10060000A000A1010A30A200A3018A015E212408F2
:10061000C0002508C1003E084007CF000730B600E3
:100620008030B4000730B7004030B500D0308A01C8
:100630001D2000308A011D2000308A011B20073058
:10064000B6008030B4000730B7004030B500D0307D
:100650008A011D2002308A011D204F088A011B20BB
:100660000A308A010E218A110A123824FE308A01CA
:10067000682001308A01682020308A0168205430C7
:100680008A01682049308A0168204D308A0168203B
:1006900045308A0168203A308A01682020308A017A
:1006A00068200230A9004F08A400A5016730B000FF
:1006B000B1018A01B7203A308A0168200230A900CE
:1006C0005008A400A5016730B000B1018A01B7202D
:1006D0003A308A0168200230A9005208A400A5011E
:1006E0006730B000B1018A01B7200130A3002C307F
:1006F0008A010F2164008A110A128818372C8A1186
:100700000A1238245008A000A10104308A013A21BD
:10071000BE002108BF003E08A6003F08A7000A301F
:10072000A200A3018A017A21BE002508BF000F3074
:100730005005C000C1013E084007D500D50A64003D
:100740003C3055028A110A12031CA72BD50155080B
:10075000A000A1010A30A200A3018A015E21BE000F
:100760002108BF003E08A0003F08A10004308A0114
:100770003221BE002108BF005508A000A1010A30A7
:10078000A200A3018A015E212408C0002508C1003F
:100790003E084007D0000730B6008030B400073074
:1007A000B7004030B500D0308A011D2000308A01EA
:1007B0001D2000308A011B200730B6008030B400B5
:1007C0000730B7004030B500D0308A011D2001301D
:1007D0008A011D2050088A011B200A308A010E213F
52
Page 53
:1007E0008A110A123824FE308A01682001308A01F9
:1007F000682020308A01682054308A0168204930FE
:100800008A0168204D308A01682045308A016820BD
:100810003A308A01682020308A0168200230A9001D
:100820004F08A400A5016730B000B1018A01B720CC
:100830003A308A0168200230A9005008A400A501BE
:100840006730B000B1018A01B7203A308A016820D0
:100850000230A9005208A400A5016730B000B10120
:100860008A01B7200130A3002C308A010F21080033
:100870000730B6008030B4000730B7004030B50014
:10088000D1308A011D2000308A011D208A010220FA
:10089000D2000A308A010E210730B6008030B40041
:1008A0000730B7004030B500D1308A011D2001303B
:1008B0008A011D208A010220D0000A308A010E21FF
:1008C0000730B6008030B4000730B7004030B500C4
:1008D000D1308A011D2002308A011D208A010220A8
:1008E000CF000A308A010E2108000730B6008030A0
:1008F000B4000730B7004030B500D0308A011D2069
:1009000000308A011D208A010220D2000730B60083
:100910008030B4000730B7004030B500D0308A01D5
:100920001D2001308A011D208A010220D0000730DD
:10093000B6008030B4000730B7004030B500D0308A
:100940008A011D2002308A011D208A010220CF0069
:1009500008000130B800B9013808A0003908A1002A
:10096000A3010A308A0144218A110A12031DC22CF4
:100970008A110A12C324B80A0319B90A8A110A1281
:10098000031DAC2C080038088A01F820C600460870
:10099000D4005408A000A10104308A013A21BE000D
:1009A0002108BF003E08A6003F08A7000A30A200A9
:1009B000A3018A017A21BE002508BF000F3054052B
:1009C000C000C1013E084007C40014303807BE0013
:1009D00039080318013EBF003E088A01F820C6000E
53
Page 54
:1009E0004608D5005508A000A10104308A013A212B
:1009F000BE002108BF003E08A6003F08A7000A303D
:100A0000A200A3018A017A21BE002508BF000F3091
:100A10005505C000C1013E084007C50064008A11A9
:100A20000A120818472DC40A6400183044028A11BB
:100A30000A12031C1C2DC4014408A000A1010A30A5
:100A4000A200A3018A015E21BE002108BF003E086A
:100A5000A0003F08A10004308A013221BE00210815
:100A6000BF004408A000A1010A30A200A3018A012E
:100A70005E212408C0002508C1003E084007C600CA
:100A8000380803178D00031346088A01002164000B
:100A90008A110A128818872DC50A64003C30450265
:100AA0008A110A12031C552DC5014508A000A10199
:100AB0000A30A200A3018A015E21BE002108BF0006
:100AC0003E08A0003F08A10004308A013221BE0088
:100AD0002108BF004508A000A1010A30A200A3011F
:100AE0008A015E212408C0002508C1003E08400795
:100AF000C60014303807BE0039080318013EBF0095
:100B00003E0803178D00031346088A010021640084
:100B10008A110A128719942D0230A30058308A01D5
:100B20000F218A110A12DA2DFE308A016820013065
:100B30008A01682020308A01682041308A016820BB
:100B40004C308A01682041308A01682052308A0185
:100B500068204D308A016820A9013808A4003908AE
:100B6000A5006730B000B1018A01CA203A308A017D
:100B7000682020308A0168200230A9004408A400BF
:100B8000A5016730B000B1018A01CA203A308A015C
:100B900068200230A9004508A400A5016730B00014
:100BA000B1018A01CA200230A300BC308A010F21A2
:100BB0008A01C32C080064005208053C8A110A12FD
:100BC000031DD62E8A0138244F08A000A10104304D
:100BD0008A013A21BE002108BF003E08A6003F0856
54
Page 55
:100BE000A7000A30A200A3018A017A21BE002508CD
:100BF000BF000F304F05C000C1013E084007D400C0
:100C00005008A000A10104308A013A21BE00210849
:100C1000BF003E08A6003F08A7000A30A200A301BB
:100C20008A017A21BE002508BF000F305005C000A0
:100C3000C1013E084007D5000130B800B9013808AD
:100C4000A0003908A100A30114308A0144218A11AF
:100C50000A12031DD62E38088A01F820C60046085D
:100C6000A000A10104308A013A21BE002108BF0082
:100C70003E08A6003F08A7000A30A200A3018A018F
:100C80007A21BE002508BF000F304605C000C10113
:100C90003E084007C40014303807BE003908031866
:100CA000013EBF003E088A01F820C6004608A000A9
:100CB000A10104308A013A21BE002108BF003E088C
:100CC000A6003F08A7000A30A200A3018A017A21EA
:100CD000BE002508BF000F304605C000C1013E0818
:100CE0004007C5005408A00044088A013F21BE0007
:100CF0005508A00045088A013F21C0003E08840035
:100D000040088A015721C000C10000308819013015
:100D1000A00001308A013F21C20040084104840044
:100D200042088A015721C200C300640042084304FC
:100D30008A110A120319CF2EFE308A016820013071
:100D40008A01682020308A01682041308A016820A9
:100D50004C308A01682041308A01682052308A0173
:100D600068204D308A01682020308A0168204F3089
:100D70008A0168204E308A016820881783168813FC
:100D800083121330A30088308A010F218813831641
:100D9000881383120130A300F4308A010F21B80AAE
:0E0DA0000319B90A8A110A12031D1F2E08003A
:02400E007A3FF7
:00000001FF
55
Page 56
CHAPTER 4
FINDING AND ANALYZING
4.1 Introduction
Finding and analyzing is a research to get the information about the project.
In this chapter we will discusses on the result, findings and the assessment
from the analysis conducted in this project.
After the development of the Water Recycle System, this project will be
analyzed to measure the effectiveness and to ensure the objectives of the
project successfully achieved. Throughout the analysis stage, strengths and
weakness of the Water Recycle System were identified.
Generally, there are three aspects stressed in the analysis, which are the
behavior, ability and sensitivities of the Water Recycle System.
4.2 Water Recycle System
This Water Recycle System runs off of using 12VDC plug in of power
supply. It communicates with the PIC16F877A, simplifying development.
This particular Water Recycle System use a copper plate sensor that will
transmit signal to these system to operate. We use IC LM 324 as a receiver
and as a transmitter for Water Recycle System. A water pump 12VAC used to
control and pump water from the tank.
56
Page 57
In order to accomplish its designated purpose the system must meet the
following requirements:
Physical
I.It should be lighter.
II.Must be able to have microcontroller, battery(s), pump, sensors, and
other electronics mounted on it.
Electronics
I.Must be able to execute or solving commands.
II.Must process input from several devices (sensors, switches/buttons)
III.Must communicate with sensor
IV.Must output control signals to pump
Feedback/Sensors
I.Must be able to detect a presence of water.
4.2.1 The Behavior Of Water Recycle System
The first step in the analysis process is to identify the character and
functionality of the Water Recycle System. Analysis were conducted
based on the objectives of the project that have been created last
semester which is the ability to detect the presence of water, This
system will also have overrides that can be received from the base
station or from onboard switches and executed.
57
Page 58
Figure 4.0: Pump Controller
Pump controller is used to manage the use of water from the main
tank in a day. The uses is depends on the individual, example he
wanted to use the water three times in the day, he just need to set the
time at the pump controller.
How to use pump controller:
i. Press ‘SET’ button to set time in 24 Hour.
Figure 4.1: Pump Controller Setting
58
Page 59
Use ‘HOUR’ button and ‘MINUTE’ button to adjust the time of
water uses.
ii. Press ‘ENTER’ button after set the first uses to set the next uses.
Figure 4.2: Second Step Pump Controller Setting
4.2.2 The Water Recycle System Abilities
Once the system characteristics have been identified, the next step is
the analysis for identification of strengths and weakness of this system
when it’s have been complete build. This system is tested by . From
this experiment conducted, this system will not allow the water level
in the main tank is dry, because the height of the water level will be
controlled by a sensor
59
Page 60
Figure 4.3: Main Tank
4.2.3 Project’s evaluation
4.2.3.1 Problem in the Project
Through out the development of the Water Recycle System,
some problem and obstacles are encountered involving
software, hardware and mechanical parts the problems are
summarized.
Many problems that occur when we build this Water Recycle
System. There are:
I. Water pump don’t have any respond.
II. When want to choose the types of programming
language.
III. The display panel do not function properly.
IV. When we want to design of the Water Recycle System.
V. System stuck when pump running.
60
Page 61
4.2.3.2 Way to Solve the Problem
i. Water pump don’t have any respond.
This water pump is operating at a high rate of current
flow. Either way, the motors provide plenty of power to
drive any small component. Caused by the overall state
of the problem, this system will be interrupted called
distortion. To solve the problem, a capacitor 104
(0.1uF) was placed between the positive terminal and
negative terminal of water pump. This aims to reduce
the distortion that occurs and the smooth flow of
current. Because this problem can be solved some other
problems also completed example system stuck when
pump running and the display panel do not function
properly.
Figure 4.4: Water Pump 12VDC
61
Page 62
Figure 4.5: Capacitor 104 (0.1uF)
ii. Programming Language
It took a long time to choose the suitable programming
language either PIC Basic programming or assembly
language or C++ programmer. After some
consideration took place, the PIC BASIC is chosen to
program this project. PIC instruction set is limited.
4.3 Project Costing
4.3.1 Hardware Listing
ITEMS QUANTITY PRICE (RM)
Prospect 1x1 1 20
20 Foot Steel 2 28
Screws And Bolt 35 20
Span 1 1
Vessels Of The Large 1 6
Vessels Of The Small 2 10
Ex-Pam 2 6
Boards 4x2 1 13
62
Page 63
Small Pipes 1 13
Small Water Divider 1 1
Large Water Divider 1 7
Big Casing Box 1 30
Small Casing Box 1 15
Power Supply 12vdc 1 20
Wire 5 15
Normally End Switch 1 10
Cable Tie 20 2
Small Binder Screws
Wire
16 12
Glue 502 1 3
Grass Carpet 1 5
Mosquito Nets 1 5
TOTAL 248
Table 4.0: Hardware Listing
4.3.2 Electronic Components Listing
COMPONENTS QUANTITY PRICE (RM)
PIC 16F877A 1 21
PLAT SENSOR 4 2
IC COMPARATOR 1 4
VARIABLE
RESISTOR
3 1.5
RESISTOR 10K 10 2
CYRSTAL (H49U) 1 2.5
IC CLOCK DS1307 1 12.5
BATERY 1 5
CAPACITOR 104 2 1
63
Page 64
(O.4UF)
CERAMIC
CAPACITOR 3.3Pf
2 1
PUMP VIPER 12V 2 20
BUZZER 1 4.50
LCD DISPLAY 20X4 1 46
RESISTOR BAR
A1035
1 1.5
TIP122
TRANSISTOR
2 3
PCB BOARD 1 28
PCB CONNECTOR 2
WAY
5 2.5
PCB CONNECTOR 3
WAY
1 1
PCB CONNECTOR 4
WAY
2 2.5
PCB CONNECTOR 5
WAY
1 1.5
PCB CONNECTOR
12 WAY
1 4
TOTAL 53 167
Table 4.1: Electronic Components Listing
4.3.3 Overall Costing
= Total Hardware + Total Electronic Components= RM 248.00 + RM 167= RM415.00
64
Page 65
CHAPTER 5
DISCUSSION
5.1 Introduction
After a long time to complete our final project, finally we have successfully
completed the project Water Recycle System followed by the schedule of
Semester 6.
All plans that have completely done with difficult and trouble what we get
during do this project. But we still patient and give full commitment to do this
project. After finding an idea to another idea of project suggestion, all the
process has done with full-commitment. For the results, full of the project of
water recycle system done successfully.
5.2 Problem Of Material
In our project we decided our project chasing must in lightweight, this is
because it’s easy to carry over to anywhere. So we having a problem to
choose what kind of material that we need to use in our project. Solution to
this problem is that we have select plastic casings that have outstanding
shrink ability for a smooth-surfaced, tight finish and are available in a wide
range of standard colors and sizes. From stuffing to the finished package, the
multi-layered construction makes them an excellent choice for all types of
applications.
65
Page 66
Figure 5.0: Plastic Casings
5.3 Problem To Wiring And Programming
The problem that we faced is to create wiring and programming that include
water pump and PIC controller because we never done it before. After we
have learned and research, finally we find the way to create the wiring with
cooperation of Electrical Department Lecture and senior.
66
Page 67
CHAPTER 6
CONCLUSION
6.1 Introduction
We can conclude that this project had fulfilled and achieve our objective and
this project operated in good condition. We also learn how the hardware and
software will communicate each other. Beside that, we learn how to wiring,
how to create a program, and other hardware component.
6.2 Conclusion
This chapter will explain about conclusion and suggestion based on analyzing
and discussion chapters. We make conclusion after make some research about
our objective of creating this project. Otherwise, suggestion is about an
improvement that we had done to our project.
This final project is one of the subjects in our Diploma, we need to take this
subject to our diploma. This subject is very important to the polytechnic
student to train the student how to handle a project and how to cooperate each
others to implement this project. This will help the student can working well
or good performance in the future when they go out to the industry. For this
semester, we already done a part of our project, we already learn many thing
from beginning until now. For our experience in this few months, we think
67
Page 68
that the most important thing in this project is the cooperation between the
project partner and the communication with the project supervisor.
We gained a lot of practical experience. We learned how to take ideas and
knowledge and apply them to solve problems and design real world
applications. We learned a lot about circuit design, project design, testing,
and assembly part. We also learned about working as a team, working around
people's schedules, communicating with each other, and other practical social
work skills. In addition we can see how actually software, PIC communicate
with the hardware that before this we just do practically in Polytechnic
laboratory.
This is most important experience to us. Therefore, we admit that our project
still have many weakness that must to improve. In the future, we hope us or
some one else can make the improvement to our project.
We also believe a word of thanks is due at this time. We would like to first of
all thank to our advisor and supervisor Mrs Rosmani Bt Ramli who has been
a big help to us during the whole year. Also we would like to thank to our
friends that for help and encouragement non-stop to us. Thank you very much
for all.
68
Page 69
REFERENCE
http://en.wikipedia.org/wiki/Smoke_detector
http://chemistry.about.com/cs/howthingswork/a/aa071401a.htm
http://www.systemsensor.com/pdf/A05-1003.pdf
http://sensors-transducers.globalspec.com/
http://www.safetyresource.org/fire_safety/smoke_detector_types.html
http://electrical.about.com/od/electricalsafety/a/smoke-detector.htm
http://en.wikipedia.org/wiki/Junction_box
http://pdf1.alldatasheet.com/datasheetpdf/view/82341/MICROCHIP/PIC16F876A.html
http://www.microchip.com
http://www.cytron.com
69
Page 70
APPENDIX
A. PIC 16F877A
B. LCD DISPLAY 20X4
70
Page 71
C. IC COMPARATOR
D. IC CLOCK DS1307
71