undergraduate project - Faculty Home

advertisement
PSZ 19:16 (Pind. 1/07)
UNIVERSITI TEKNOLOGI MALAYSIA
DECLARATION OF THESIS/ UNDERGRADUATE PROJECT PAPER AND COPYRIGHT
Author's full name:
MOHD DINILHAQ BINSAHBUDIN
Date of birth
2 NOYEMBER 1986
Title
AUTOMATIC QUAIL EGGS INCUBATOR
Academic Session:
2009120102
I declare that this thesis is classified as :
D
D
[IJ
CONFIDENTIAL
(Contains confidential
Act 1972)*
RESTRICTED
(Contains restricted information as specified by the
organisation where research was done) *
OPEN ACCESS
I agree that my thesis to be published as on line open access
(full text)
I acknowledged
information
under the Official Secret
that Universiti Teknologi Malaysia reserves the right as follows:
1. The thesis is the property of Universiti Teknologi Malaysia.
2. The Library of Universiti Teknologi Malaysia has the right to make copies for the purpose
of research only.
3. The Library has the right to make copies of the thesis for academic exchange.
Certified by :
L~
~-TU-R-E-----
DR. MUHAMMAD NASIR BIN IBRAHIM
861102-38-5963
(NEW le NO./PASSPORT
Date:
NOTES
30 APRIL2010
*
NO.)
NAME Of SUPERVISOR
Date: 30 APRIL2010
If the thesis is CONFIDENTIALor RESTRICTED,
please attach with the letter from
the orqonisotion with period and reasons for confidentiality or restriction.
"I hereby declare that I have read this thesis and in
my opinion this thesis is sufficient in term of scope and
q4ality for tre 'fW~4 of'the degree of
Bachelor
of Engineering (Electrical- Electronics)".
1\
q 1
~,
!,
StgQ~tHre
Name of Supervisor :
Pflte
,
t'
'
,
........
~~.~
,2
.
..P~:.~.~~~.B.~~~I~.~~.!!~~~M
..
M.R.l.l:,~Q.\Q
,
"
"., ,.•....... ,.!' ..
AUTOMATIC QUAIL EGGS INCUBATOR
MOHD DINIL HAQ BIN SAHBUDIN
A report submitted in partial fulfillment of the
requirements for the award of the degree of
Bachelor of Engineering (Electrical – Electronics)
Faculty of Electrical Engineering
Universiti Teknologi Malaysia
APRIL 2010
ii
I declare that this thesis entitled "Automatic Quail Eggs Incubator" is the result of my
own research except as cited in the references. This thesis has not been accepted for any
degree and is not concurrently submitted in candidature of any other degree.
Signature.
:.~
.Name
:
~..QHP..P.lliI~J::!b:Q.~lli..§t.JI~Y.Plli
Date
:
.AP.R.lL.Z010
.
\'
::::::.
.=
.
.
.
iii Dedicated to my beloved parent,
Sahbudin bin Hj. Ismail
&
Maini bt. Kamal
Thank you for your support and love to guide me through this thesis.
My grandmother,
Hjh. Limah bt. Donik
Thank you for your loving and praying.
My siblings;
My brothers M. Fikhrul Hasani, M. Amni Fida’ey and M. DhiyaulHaziq
& my sisters Siti Nurul Hasanah, Siti Azimatun Husna and Nazhatul Suhanis
Hoping that you will be successful in whatever field you are involved in and may Allah
bless all of you.
My friends in university;
M. Fandy Ya Rahim, M. Yazif Jamaludin and M. Zuhairi Ismail
Without you and your strength this project would not be completed. I appreciate all
support and confidence I gained and I learned from you.
iv ACKNOWLEDGEMENT
As my first individual project, this project would not have been possible without
considerable guidance and support. I would like to knowledge those who have enable
me to complete this work and my years of graduate study.
To Dr. Muhammad Nasir bin Ibrahim, my supervisor, I am deeply indebted.
Here, I would like to grab this opportunity to express my sincere gratitude to him for
guidance, motivation, inspiration, encouragement and advice throughout the duration of
completing this project.
My sincere appreciation also extends to my entire course mates who have
provided assistance at various occasions. Not forgetting my fellow friends, who shared a
lot technical knowledge with me, encourage me to seek for more knowledge and
providing me some troubleshooting tips.
Last but not least, to my beloved family members who have always been there to
encourage, comfort and give fullest support when I most need them.
v ABSTRACT
The automated quail eggs incubator system is designed to reduce abnormal
quails and to reduce the risk of damage eggs caused by uncertain environment. The
principle of Analog to Digital Converter (ADC) is used to manipulate the temperature in
the incubator, then, regulate the system at specific temperature. The measured
temperature will be processed by using an embedded system, which controls the overall
system. The system is also equipped with security system to alert the user on the system
error. This system will take 17 days to hatch eggs by controlling the heating bulb. This
system consists of a moving floor to rotate the eggs to avoid the embryo adhere on the
shell. The system is an automated system, easy to handle and at low cost, thus, it achieve
the objective of the automatic quail eggs incubator.
vi ABSTRAK
Sistem pengeraman telur puyuh secara automatik direka untuk mengurangkan
penetasan anak puyuh yang cacat dan mengurangkan risiko kerosakan telur puyuh yang
disebabkan perubahan cuaca yang tidak menentu. Prinsip Penukar Analog ke Digit
(ADC) digunakan dalam system ini untuk memanipulasi suhu yang diukur dalam peti
pengeraman, kemudian mengekalkan system tersebut kepada suhu yang telah ditetapkan.
Suhu yang telah diukur akan diproses menggunakan system terbenam , yang mana ia
mengawal keseluruhan system penetasan tersebut. System ini turut disertakan dengan
system keselamatan untuk membri isyarat amaran kepada pengguna tentang ralat pada
system. System ini mengambil masa selama 17 hari untuk proses penetasan dengan
mengawal kepanasan lampu. Sistem ini terdiri daripada lantai bergerek utuk memutar
telur supaya embrio tidak melekat pada selaput tulur. System ini adalah system
automatik, mudah selia dan murah, dengan demikian, matlamat penghasilan peti
penetasan telur puyuh automatic tercapai. vii TABLE OF CONTENTS
CHAPTER
TITLE
DECLARATION
DEDICATION
ACKNOWLEDGEMENT
ABSTRACT
ABSTRAK
TABLE OF CONTENTS
LIST OF TABLES
LIST OF FIGURES
LIST OF ABBREVIATIONS
LIST OF APPENDICES
1
INTRODUCTION
1.1
Background Studies
1.2
Problem Statement
1.3
Objective
1.4
Scope of the Project
1.4.1 Temperature Sensor
1.4.2 Microcontroller
1.4.3 Light Bulb
1.4.4 Cooling Fans
1.4.5 Liquid Crystal Display (LCD) Screen
1.4.6 Push Button Switch
1.4.7 Red Bulb
1.4.8 Buzzer
1.4.9 ON / OFF Switch
2
LITERATURE REVIEWS
2.1
PIC16877A Microcontroller
2.1.1 Analog-To-Digital Converter (A/D) Module
2.2
The Single Pole Double Throw Relay
2.3
LM35
2.3.1 Features of LM35
2.4
Direct Current Motor
2.4.1 Basic DC Motor Operation
PAGE
ii
iii
iv
v
vi
vii
ix
x
xii
xiii
1
2
3
3
4
4
4
5
5
5
5
6
6
6
7
7
8
9
10
11
12
12
viii 2.5
2.6
2.7
3
4
5
Voltage Regulator
Mikroelektronika@mikroC
The Automatic Quail Eggs Incubator Versus the
Others Eggs Incubator.
RESEARCH METHODOLOGY
3.1
Project Descriptions
3.1.1 Block Diagram Descriptions
3.2
Software Development
3.2.1 Design Procedures
3.2.2 Software Tool
3.3
Hardware Implementation
3.3.1 12V DC Motor Circuit
3.3.2 LCD Display
3.3.3 Light Bulb Circuit
3.3.4 Fan, Red Bulb and Buzzer Circuit.
3.3.5 Switch Circuit
3.3.6 Voltage Regulator
3.3.7 LM35 Circuit
20
20
21
21
22
25
26
27
28
29
30
31
32
33
RESULT AND DISCUSSION
4.1
Liquid Crystal Display (LCD)
4.2
12 V DC Motor
4.3
LM35
4.4
7805 Positive Voltage Regulator
35
35
36
38
38
4.5
39
Cost
CONCLUSION
5.1
Project Conclusion
5.2
Project Limitations and Future Recommendations
15
16
18
41
41
42
REFERENCES
44
Appendices A
46
ix LIST OF TABLES
TABLE NO.
Table 1.1
Table 2.1
Table 3.1
Table 4.1
Table 4.2
TITLE
Hatching Time Table
Eggs Incubator Features
PIC16F877A pins configuration
LCD’s Output
Cost an Automatic Quail Eggs Incubator
PAGE
2
18
23
36
39
x LIST OF FIGURES
FIGURE NO.
Figure 2.1
TITLE
a) Schematic for an SPDT Relay
PAGE
10
b) SPDT Relay
Figure 2.2
a) Metal Can Package
11
b) Small Outline Molded Package
c) TO-92 Plastic Package
d) TO-220 Plastic Package
Figure 2.3
a) Magnetic diagram that explains the operation of a DC
13
motor. The rotating magnet moves clockwise because
like poles repel
b) The rotating magnet is being attracted because the poles
are unlike.
c) The rotating magnet is now shown as the armature coil,
and its polarity is determined by the brushes and
commutator segments.
Figure 2.4
a) LM78XX positive voltage regulator.
16
b) LM78XX circuit schematic.
Figure 2.5
mikroC IDE
16
Figure 3.1
Block Diagram
21
Figure 3.2
PIC16F877A pins schematic
23
Figure 3.3
Flow Chart of the Automatic Quail Eggs Incubator System
24
xi Figure 3.4
MicroC Software Tool
26
Figure 3.5
12V DC Motor Circuit Schematic
27
Figure 3.6
LCD Pin Assignment
28
Figure 3.7
LCD to Microcontroller Connection
29
Figure 3.8
Light Bulb Circuit Schematic
29
Figure 3.9
a) Fan Circuit Schematic
30
b) Red Bulb Circuit Schematic
c) Buzzer Circuit Schematic.
Figure 3.10
a) Picture of The Push Button
31
b) Switch Circuit Schematic
Figure 3.11
a) LM7805 Voltage Regulators
32
b) Voltage Regulator Circuit Schematic
Figure 3.12
a) Bottom View of LM35
33
b) LM35 Circuit Design
c)LM35 Temperature Sensor
Figure 3.13
LM35 Circuit Schematic
34
Figure 4.1
12V DC motor circuit configuration
37
Figure 4.2
Full-Range Centigrade Temperature Sensor Circuit.
38
xii LIST OF ABRREVIATIONS
HIGH, high
-
2.0V to 5.5V
LOW, low
-
0V to 1.9V
SPDT
-
Single Pole Double Throw
UTM
-
Universiti Teknologi Malaysia
FKE
-
Faculty of Electrical Engineering
F
-
Farad
A
-
Ampere
LCD
-
Liquid Crystal Display
DC
-
Direct Current
AC
-
Alternate Current
PIC
-
Programmable Interface Controller
ADC, A/D
-
Analog to Digital Converter
N.C.
-
Normally Close
N.O.
-
Normally Open
VSS, Vss
-
Negative supply, ground
VDD, Vdd
-
Positive supply voltage
xiii
LIST OF APPENDIX
APPENDIX
A
TITLE
Programming for the Project
PAGE
45
CHAPTER 1
INTRODUCTION
Malaysia is still a net food importer and has never achieved a food trade balance
surplus. Realizing the opportunity and potential for the development of this sector, an
improved eggs incubator system needs to be designed. Automatic quail eggs incubator is
an effective artificial intelligence algorithm with temperature sensor to measure the
current temperature in the incubator, then, the temperature is regulated at the specific
temperature using the microcontroller. A buzzer and a red bulb are used to alert the user
on the system error if the temperature in the incubator below or exceed the specified
temperatures.
1.1
Background Studies
The automatic quail eggs incubator takes 17 days to hatch the eggs at 38 degree
Celsius. The eggs rotational is significant for the first 15 days of the hatching process to
2
ensure the embryo not adhere on the shell. However, to optimize the hatching process,
the rotational eggs are not necessary anymore after the 15th days of hatching process.
The automatic quail eggs incubator will constantly monitor and maintain the
temperature in the incubator to ensure it remains at the preset temperature. The
monitoring system uses a temperature sensor to read the temperature in the incubator.
Then, the sensor provides an input to the microcontroller to compares the measured
values with the preset values. The microcontroller will control the operating of lightbulb, fans and DC motor. Table 1.0 shows the time taken and the suitable temperature
for hatching the quail eggs [4]. The red bulb will blinking and the buzzer will turn on
continuously if the temperature below or exceed from the preset value to alert the user
on the system error.
Table 1.1: Hatching Time Table [4].
Quail
Pigeon
Hen
Duck
Peacock
Turkey
Hatching
period
17
17
21
35-37
28-30
28
Temperature
(°C)
38
38
38
38
37.2
37.2
Temperature
(F)
100
100
100
100
100
99
15
15
18
31
25
25
Turn off
DC motor
at (day)
3
1.2
Problem Statement
According to speech release by secretary general Ministry of Agriculture &
Agro-based Industry “Malaysia though blessed with fertile soil, abundant rainfall and
suitable climate for food production is still a net food importer and has never achieved a
food trade balance surplus. Realizing the opportunity and potential for the development
of this sector, the Ministry of Agriculture and Agro-based Industry was entrusted with
the responsibility to develop the agro food sector into a competitive entity and contribute
significantly to national income. Efforts in transforming the sector is indeed a Herculean
task as it involve not only a change from traditional farming methods to advance and
modern farming methods but also entails the need for a mindset leap among the
community from the old stigma of agriculture being a backward and low skills activity”
[5]. Alternatively, the Automatic Quail Eggs Incubator is designed to improve the
available eggs incubator in order to change the traditional farming methods to advance
and modern farming methods. Besides, by introducing the automatic quail eggs
incubator may help our country achieve a food trade balance surplus. Other reason is to
change the mindset among community the old stigma of agriculture being a backward
and low skills activity.
1.3
Objective
The project focuses on the three main objectives. The first objective of this
project is to create an automatic quail eggs incubator system that can helps the user to
reduce number of abnormal quails. The second objective is to design an eggs incubator
at low cost and easy to handle. The third objective is to design an incubator system that
equipped with an error detection system.
4
1.4
Scope of the Project
The automated quail eggs incubator system is combining of hardware part and
programming part. This subtopic will discuss about the project’s requirements in order
to provide the system operate automatically.
1.4.1
Temperature Sensor
This sensor is used to measure the surrounding temperature and then send the
measured values to the microcontroller. The chosen of the right temperature sensor is
importance in order to provide the accurate measurement. This is because the
temperature is the most significant element in hatching process.
1.4.2
Microcontroller
The microcontroller, PIC16F877A, is needed to make conversion the analog
signal of the temperature to digital signal. The conversion process is significant to
ensure the microcontroller manipulate the temperature variable in order to control the
overall system. The PIC16F877A is programmed in C language.
5
1.4.3
Light Bulb
This device is needed to provide artificial heat when the temperature of the
incubator below than the specified temperature. This module includes a relay to switch
the light-bulb on and off, and a transistor to power the relay. A diode is used to prevent
the PIC from getting damaged by current flowing back into it.
1.4.4
Cooling Fans
One of two cooling fans is used to spread the heat in the incubator fairly. The
other one is used as a cooler of the circuit. This module includes a transistor to power
the fans as well as a diode to prevent the PIC from getting damaged by current flowing
back into it.
1.4.5
Liquid Crystal Display (LCD) Screen
The LCD screen is used to display the current temperature in the incubator. It
also displays a process of the incubator.
1.4.6
Push Button Switch
The system is using 2 button switches to stop the moving motor. When the
moving floor touches the switch, the moving floor will stop automatically for a duration
time. After that duration time, the moving floor will turn until touch the other push
button switch. The process is done repeatedly for first 15 days of hatching process.
6
1.3.7 Red Bulb
The red bulb is used to alert the user on the system error. It will blink
continuously when the system below or exceed the specified temperature.
1.4.8
Buzzer
Buzzer will turn on when the system is error. The system is consider error when the
temperature of the incubator below or exceed of the specified temperature.
1.4.9 ON / OFF Switch
One of the two ON/ OFF switches is used to turn off the moving motor after the 15th
days of the hatching process. The other one switch is used to turn on or to turn off the
full system, work as main switch.
CHAPTER 2
LITERATRURE REVIEW
This chapter reviews on the theory of all the existing technologies related to this
project, PIC16F877A with some of the important modules in the MCU, then the theory
of temperature sensor, operational of DC motor, the Single Pole Double Throw(SPDT)
relay, the MikroC software tool and also voltage regulator theory are discuss in this
chapter. The chapter also discuss on the other design of eggs incubator for comparison
purpose.
2.1
PIC16877A Microcontroller
The PIC16877A microcontroller unit (MCU) is a 40-pin and 44-pin packages.
The special feature of microcontroller is it can be used until 100,000 erase/write cycle
using enhanced flash program memory and can also be used to 1,000,000 erase/write
cycle data EEPROM memory typical. Self-reprogrammable under software control
8
single-supply 5V In-Circuit Serial Programming, Watchdog Timer (WDT) with its own
on-chip RC oscillator for reliable operation, programmable code protection, Power
saving Sleep mode, Selectable oscillator options, In-Circuit Debug (ICD) via two pins
can be done for the microcontroller. The PIC16877A microcontroller unit (MCU) uses
CMOS Technology such as:
I.
II.
Low-power, high-speed Flash/EEPROM technology
Fully static design
III.
Wide operating voltage range (2.0V to 5.5V)
IV.
Commercial and Industrial temperature ranges
V.
2.1.1
Low-power consumption
Analog-To-Digital Converter (A/D) Module
ADC (Analog to Digital Converter) module is available with a number of PIC
MCU models. The Analog-to-Digital (A/D) Converter module has five inputs for the 28pin devices and eight for the 40/44-pin devices. The conversion of an analog input signal
results in a corresponding 10-bit digital number. The A/D module has high and lowvoltage reference input that is software selectable to some combination of VDD, VSS,
RA2 or RA3.
The A/D converter has a unique feature of being able to operate while the device
is in Sleep mode. To operate in Sleep, the A/D clock must be derived from the A/D’s
internal RC oscillator. The A/D module has four registers. These registers are:
I.
A/D Result High Register (ADRESH)
9
II.
2.2
A/D Result Low Register (ADRESL)
III.
A/D Control Register 0 (ADCON0)
IV.
A/D Control Register 1 (ADCON1)
The Single Pole Double Throw Relay
A relay is an electrically operated switch used to isolate one electrical circuit
from another. In its simplest form, a relay consists of a coil used as electromagnets to
open and close switch contacts. Since the two circuits are isolated from one another, a
lower voltage circuit can be used to trip a relay, which will control a separate circuit that
requires a higher voltage or amperage. Relays can be found in early telephone exchange
equipment, in industrial control circuits, in automobiles, on water pumps, in high-power
audio amplifiers and as protection devices.
As shown in Figure 2.1, a single pole double throw (SPDT) relay configuration
switches one common pole to two other poles, flipping between them. As shown in the
schematic diagram, the common point E completes a circuit with C when the relay coil
is at rest, that is, no voltage is applied to it. This circuit is "closed." A gap between the
contacts of point E and D creates an "open" circuit. When you apply power to the coil, a
metal level is pulled down, closing the circuit between points E and D and opening the
circuit between E and C. A single pole double throw relay can be used to alternate which
circuit a voltage or signal will be sent to.
10
Figure 2.1: a) Schematic for an SPDT Relay b) SPDT Relay
2.3
LM35
The LM35 series are precision integrated-circuit temperature sensors, whose
output voltage is linearly proportional to the Celsius (Centigrade) temperature. The
LM35 thus has an advantage over linear temperature sensors calibrated in ° Kelvin, as
the user is not required to subtract a large constant voltage from its output to obtain
convenient Centigrade scaling. The LM35 does not require any external calibration or
trimming to provide typical accuracies of ±1⁄4°C at room temperature and ±3⁄4°C over a
full −55 to +150°C temperature range.
Figure 2.2 shows the verity package of the LM35 and its connection diagram.
Based on the Figure 2.2, there are 3 main pins connection which are Vs pin, VOUT pin
and GND pin. The N.C pins in the Small Outline Molded Package stand for no
connection.
11
Figure 2.2: a) Metal Can Package b) Small Outline Molded Package c) TO-92 Plastic
Package d) TO-220 Plastic Package
2.3.1
Features of LM35
LM35 comes with several features that desired in industry. It provides high output
accuracy and linearity, wide temperature range and low power dissipation. The
following are the features of LM35 in detail
I.
II.
Calibrated directly in ° Celsius (Centigrade)
Linear + 10.0 mV/°C scale factor
III.
0.5°C accuracy guaranteeable (at +25°C)
IV.
Rated for full −55° to +150°C range
V.
VI.
VII.
VIII.
IX.
Suitable for remote applications
Low cost due to wafer-level trimming
Operates from 4 to 30 volts
Less than 60 μA current drain
Low self-heating, 0.08°C in still air
12
X.
XI.
2.4
Nonlinearity only ±1⁄4°C typical
Low impedance output, 0.1 W for 1 mA load
Direct Current (DC) Motor
A direct current or DC motor, converts electrical energy into mechanical energy.
It is one of two basic types of motors: the other type is the alternating current or AC
motor. Among DC motors, there are shunt-wound, series-wound, compound-wound and
permanent magnet motors. A DC motor consists of a stator, an armature, a rotor and a
commutator with brushes. Opposite polarity between the two magnetic fields inside the
motor cause it to turn. DC motors are the simplest type of motor and are used in
household appliances, such as electric razors, and in electric windows in cars.
2.4.1
Basic DC Motor Operation
Figure 2.3 shows three diagrams that explain the DC motor's operation in terms
of the magnetic interaction. In Figure 2.3a shows that a bar magnet has been mounted on
a shaft so that it can spin. The field winding is one long coil of wire that has been
separated into two sections. The top section is connected to the positive pole of the
battery and the bottom section is connected to the negative pole of the battery. It is
important to understand that the battery represents a source of voltage for this winding.
In the actual industrial-type motor this voltage will come from the DC voltage source for
the motor. The current flow in this direction makes the top coil the north pole of the
magnet and the bottom coil the south pole of the magnet.
13
The bar magnet represents the armature and the coil of wire represents the field.
The arrow shows the direction of the armature's rotation. Notice that the arrow shows the
armature starting to rotate in the clockwise direction. The north pole of the field coil is
repelling the north pole of the armature, and the south pole of the field coil is repelling
the south pole of the armature.
Figure 2.3: a) Magnetic diagram that explains the operation of a DC motor. The rotating
magnet moves clockwise because like poles repel. b) The rotating magnet is being
attracted because the poles are unlike. c) The rotating magnet is now shown as the
armature coil, and its polarity is determined by the brushes and commutator segments.
As the armature begins to move, the north pole of the armature comes closer to
the south pole of the field, and the south pole of the armature is coming closer to the
north pole of the field. As the two unlike poles near each other, they begin to attract.
14
This attraction becomes stronger until the armature's north pole moves directly in line
with the field's south pole, and its south pole moves directly in line with the field's north
pole (Figure 2.3b). When the opposite poles are at their strongest attraction, the armature
will be "locked up" and will resist further attempts to continue spinning. For the
armature to continue its rotation, the armature's polarity must be switched. Since the
armature in this diagram is a permanent magnet, stated that it would lock up during the
first rotation and not work. If the armature is an electromagnet, its polarity can be
changed by changing the direction of current flow through it. For this reason the
armature must be changed to a coil (electromagnet) and a set of commutator segments
must be added to provide a means of making contact between the rotating member and
the stationary member. One commutator segment is provided for each terminal of the
magnetic coil. Since this armature has only one coil, it will have only two terminals, so
the commutator has two segments. Since the armature is now a coil of wire, it will need
DC current flowing through it to become magnetized. This presents another problem;
since the armature will be rotating, the DC voltage wires cannot be connected directly to
the armature coil. A stationary set of carbon brushes is used to make contact to the
rotating armature. The brushes ride on the commutator segments to make contact so that
current will flow through the armature coil.
In Figure 2.3c, the DC voltage is applied to the field and to the brushes. Since
negative DC voltage is connected to one of the brushes, the commutator segment the
negative brush rides on will also be negative. The armature's magnetic field causes the
armature to begin to rotate. This time when the armature gets to the point where it
becomes locked up with the magnetic field, the negative brush begins to touch the end of
the armature coil that was previously positive and the positive brush begins to touch the
end of the armature coil that was negative. This action switches the direction of current
flow through the armature, which also switches the polarity of the armature coil's
magnetic field at just the right time so that the repelling and attracting continues. The
armature continues to switch its magnetic polarity twice during each rotation, which
causes it to continually be attracted and repelled with the field poles.
15
2.5
Voltage Regulator
The LM78XX series of three terminal positive regulators are available in the TO220 package and with several fixed output voltages, making them useful in a wide range
of applications. Each type employs internal current limiting, thermal shut down and safe
operating area protection, making it essentially indestructible. If adequate heat sinking is
provided, they can deliver over 1A output current. Although designed primarily as fixed
voltage regulators, these devices can be used with external components to obtain
adjustable voltages and currents. A voltage regulator is an electrical regulator designed
to automatically maintain a constant voltage level. It may use an electromechanical
mechanism, or passive or active electronic components. Depending on the design, it may
be used to regulate one or more AC or DC voltages. With the exception of shunt
regulators, all modern electronic voltage regulators operate by comparing the actual
output voltage to some internal fixed reference voltage. Any difference is amplified and
used to control the regulation element.
For some regulators if the output voltage is too high, the regulation element is
commanded to produce a lower voltage; however, many just stop sourcing current and
depend on the current draw of whatever it is driving to pull the voltage back down. In
this way, the output voltage is held roughly constant. The control loop must be carefully
designed to produce the desired tradeoff between stability and speed of response. Figure
2.4 shows the typical connection of the positive voltage regulator.
16
Figure 2.4: a) LM78XX positive voltage regulator. b) LM78XX circuit schematic
2.6
Mikroelektronika (mikroC)
mikroC is a powerful, feature rich development tool for PICmicros. It is designed
to provide the programmer with the easiest possible solution for developing applications
for embedded systems, without compromising performance or control.
Figure 2.5: mikroC IDE
17
PIC and C fit together well: PIC is the most popular 8-bit chip in the world, used
in a wide variety of applications, and C, prized for its efficiency, is the natural choice for
developing embedded systems. mikroC provides a successful match featuring highly
advanced IDE, ANSI compliant compiler, broad set of hardware libraries,
comprehensive documentation, and plenty of ready-to-run examples. Figure 2.5 shows
the mikroC IDE window apperence.
mikroC come out with several features that allows you to quickly develop and
deploy complex applications. The following discuss about it features:
I.
Write the C source code using the built-in Code Editor (Code and
Parameter Assistants, Syntax Highlighting, Auto Correct, Code
Templates, and more…)
II.
Use the included mikroC libraries to dramatically speed up the
development: data acquisition, memory, displays, conversions, and
communications.
III.
Monitor the program structure, variables, and functions in the Code
Explorer
IV.
Generate commented, human-readable assembly, and standard HEX
compatible with all programmers.
V.
Inspect program flow and debug executable logic with the integrated
Debugger.
VI.
Get detailed reports and graphs: RAM and ROM map, code statistics,
assembly listing, calling tree, and more…
VII.
mikroC have provided plenty of examples for beginners to expand,
develop, and use as building bricks in their projects. Copy them entirely
if they deem fit.
.
.
18
2.7
The Automatic Quail Eggs Incubator versus the Others Eggs Incubator
There are many eggs incubators at market nowadays. They come with several
features that differentiate their product with other. However, they use the same principle
in creating their product. For example, Automatic Forced-Air Incubator [4] uses a light
bulb to increase the temperature in the incubator, while, Mini Eco Eggs Incubator [15],
uses heater coil for the same purpose. In this project, the automatic quail eggs incubator
makes the other eggs incubator as literature review in order to provide an automatic eggs
incubator at low cost and easy to handle. The Table 2.1 below summarize several
features that provided by two different companies.
Table 2.1: Eggs Incubator Features
Title
Features
Automatic Quail Eggs Incubator
a. Using light bulb for heating process.
b. Using 12V DC motor for eggs rotational
purpose.
c. Using LCD screen to display the
temperature in the incubator.
d. The system equipped with security system.
e. Using the LM35 to measure the
temperature.
f.
Using 16F877A microcontroller to control
the hatching process.
Automatic Forced-Air Incubator & Forced-Air
a. Using light bulb for heating process.
Incubator
b. 12V DC motor for eggs rotational purpose.
c. Using the digital thermometer to display
the temperature in the incubator.
d. The thermostat is used to manipulate
temperature values.
e. Using control box to control the hatching
process.
19
Mini Eco Eggs Incubator, Mini Advance Eggs
a. Using heater coil for heating process.
Incubator & Octagen 20 Advance
b. Using digital thermometer to display the
temperature in the incubator.
c. Thermostat is used to measure temperature
in the incubator.
CHAPTER 3
METHODOLOGY
This chapter describes the methodology employed and considerations taken into
account for this project. It begins with the discussion of the project methodology,
followed by the system design procedure, techniques and tools utilized in this work.
3.1
Project Descriptions
This project involved the development of the software, interface circuit design
and hardware design. Hence, it calls for embedded software system design, in which the
software are developed and downloaded in an embedded system, to provide overall
system functionality. The project block diagram is shown in Figure 3.1 to illustrate the
overall design.
21
Figure 3.1: Block Diagram
3.1.1
Block Diagram Descriptions
The Automatic Quail Eggs Incubator consists of input part, process part and
output part. The combination the three parts is important to ensure the system operate
automatically. The input part consists of a temperature sensor, two ON / OFF switches
and two push button switches. PIC 16F877A microcontroller is used to process data.
While, a LCD displays, a buzzer, a light bulb, a red bulb, a fan and a 12V DC motor are
used in the output part.
In the input part, the temperature sensor will measure the temperature in the
incubator continuously, then, the values of the measurement are sending to the
microcontroller. One of the ON / OFF switches is used as a main switch, which is to turn
on and to turn off the overall system, while, the other one is a switch to change the mode
of the incubator. The push button switches are used to stop the motor.
22
The PIC16F877A microcontroller is used to process the input and output signals.
It work as ADC, process the analog data by convert the analog signal to digital signal.
Then, the appropriate signals are sending to the outputs of the system to ensure the
system work accordingly. The microcontroller also responsible to send abounds of data
to the LCD screen to tell the user on the operational of the system.
Buzzer and red bulb are used to alert the user on the system error. Red bulb will
blink and buzzer will turn on continuously when the microcontroller detect there are
error happened on the system. The error system can detect on the broken temperature
sensor and the broken of light bulb. When light bulb is broke, the temperature in the
incubator will decrease rapidly, in other hand, the temperature sensor gives a large
measurement values when the device is broken. 12V DC motor is used to rotate the eggs
by moving the floor right and left. The light bulb will turn on when the system below
from the desired temperature or exceed the setting temperature.
3.2
Software Development
This section discusses about the development tools that are used during this
project like programming software and also debugging software.
3.2.1
Design Procedures
There are several steps to be taken in order to ensure the project done properly.
The first step is deciding the series number of the microcontroller that will be used for
23
the project. This step is very important to let the designer know what number of pins in
the microcontroller will be used as inputs and outputs. Besides, it also required the
designer to learn the language that will be use for the software development. In the
design the Automatic Quail Eggs Incubator, PIC16F877A microcontroller is used based
on several reasons. The Figure 3.2 shows the pin schematic of the PIC16F877A used in
designing the Automatic Quail Eggs Incubator. While, Table 3.1 shows the pins
configuration of the microcontroller.
Figure 3.2: PIC16F877A pins schematic
Table 3.1: PIC 16F877A pins configuration
24
The next step is drawing the flow chart of the system. The designing the flow
chart provides the designer with brief ideas on programming flow for software
development. The flow chart becomes a guide during writing the programming for the
system. The flow chart in Figure 3.3 shows there are two modes used in the automated
quail eggs incubator system. First mode is satisfied before 15th of the hatching process,
while the second mode is satisfy after 15th days of the hatching process.
Figure 3.3: Flow Chart of the Automatic Quail Eggs Incubator System
25
3.2.2
Software Tool
The development software that is used in this project is microC for PIC16F877A.
MicroC provides a successful match featuring a highly advanced IDE, ANSI compliant
compiler, broad set of hardware libraries, comprehensive documentation, and plenty of
ready-to-run examples. MicroC allows the developing and deploying of complex
applications such as:
a. Writing C source code using the built-in Code Editor (Code and Parameter
Assistants, Syntax Highlighting, Auto Correct, Code Templates)
b. Using the included mikroC libraries to dramatically speed up the development:
data acquisition, memory, displays, conversions, and communications.
c. Generate commented, human-readable assembly, and standard HEX compatible
with all programmers. Inspect program flow and debug executable logic with the
integrated Debugger.
The figure below shows the starting of the programming process using the
microC IDE compiler. MicroC software is much easier to be used compare to other
software because the clock set and different kind of PIC can be used to program the
microcontroller. In addition, the elements that can be used for the PIC can also be
selected and changed by custom default. The microC software can also be used to
generate the .HEX file that need to be uploaded into the PIC
26
To chose the PIC
type for the project
Type of Crystal used
in the PIC
Element that can be
selected in the PIC
Figure 3.4: MicroC Software Tool
3.3
Hardware Implementation
This section will discuss about circuits are used in developing the Automatic
Quail Eggs Incubator. The circuits includes bidirectional motor circuit, temperature
sensor circuit, LCD display circuit, light bulb circuit, buzzer circuit, red bulb circuit, fan
circuit, voltage regulator circuit and switches circuits.
27
3.3.1
12V DC Motor Circuit.
Figure 3.5 shows the 12V DC motor circuit schematic that been used in the
developing the Automatic Quail Eggs Incubator. The 12V DC motor also known as
bidirectional motor circuit. This is because opposite polarity between the two magnetic
fields inside the motor cause it to turn.
Figure 3.5: 12V DC Motor Circuit Schematic
Two Single Pole Double Throw (SPDT) relays are used to ensure the 12V dc
motor work as desired. RD0 and RD1 of the PIC pins are used as input to 12V DC
motor. Either one of the inputs is high (5V), the motor can be activated. When RD0 is
low and RD1 is high, motor will be in forward bias. While, RD0 is high and RD1 is low,
the motor will be in reverse bias. The motor deactivate when both RD1 and RD0 are low
or high. A diode is used to prevent the PIC from getting damaged by current flowing
back into it.
28
3.3.2
LCD Display
The LCD display is used to display the current temperature in the incubator and
the condition in the incubator. This LCD with alphanumeric easily be interfaced with the
PIC microcontroller and also produces low power consumption. The LCD pin
assignment in figure 3.6 and the interfacing with the microcontroller is shown in figure
3.7. The LCD screen will display the “SYSTEM ERROR…BULB MAY BURNED”
when the microcontroller detect the temperature in the incubator below 32 degree
Celsius. The LCD display will display “HATCHING PROCESS” for temperature
between 32 degree Celsius and 38 degree Celsius. While, the LCD screen will display
“SYSTEM ERROR.. OVER HEATING..” when the temperature in the incubator
exceed 38 degree Celsius.
Figure 3.6: LCD Pin Assignment 29
Figure 3.7: LCD to Microcontroller Connection
3.3.3
Light Bulb Circuit
Figure 3.8 below shows the light bulb circuit connection. Known that relay is an
electrically operated switch used to isolate one electrical circuit from another. In its
Figure 3.8: Light Bulb Circuit Schematic
simplest form, a relay consists of a coil used as electromagnets to open and close switch
contacts. Since the two circuits are isolated from one another, a lower voltage circuit can
30
be used to trip a relay, which will control a separate circuit that requires a higher voltage
or amperage. The light bulb needs 240V ac supply voltage to provide 25watt. The light
bulb is chosen based on the power consumption. The chosen of the light bulb is
depending to size of the incubator. This is because the power of the light bulb is
significant in providing the sufficient heat for the hatching process.
In the design, a transistor is used to turn on the relay. When the RD4 of PIC pin
is activating, the base of the transistor is triggered, then it activate the relay to turn on the
light bulb. This is because the base of the transistor needs very small current to allow the
current flows from collector to emitter of the transistor.
3.3.4 Fan, Red Bulb and Buzzer Circuit.
The Figure 3.9 shows the circuit design for fan, buzzer and red bulb. All of them
use the same principle and the same theory. Use a relay as a switch, a transistor to turn
on the relay when the base of the transistor is triggered by output of PIC pin and 12V dc
voltage source to supply the loads.
Figure 3.9: a) Fan Circuit Schematic b) Red Bulb Circuit Schematic c) Buzzer Circuit
Schematic.
31
RD5 of the PIC16F877A microcontroller’s pin is an input to the base of the
transistor for the fan circuit. When RD5 is logic high, the transistor will turn on, as a
result, the relay also turn on. The relay is in normally open (NO) condition, means the
fan circuit is become a complete circuit when the transistor turn on.
To turn on the red bulb and the buzzer, the RD2 and RD3 are activated with high
logic respectively. The relays are normally open condition for these circuits. The circuits
is open circuit when there are no current fed to the base of the transistor, thus, the load is
turn off until the base of the transistor fed with an amount of sufficient current.
3.3.5
Switch Circuit
Figure 3.10: a) Picture of the Push Button b) Switch Circuit Schematic.
The figure 3.10 above shows the circuit schematic of the switch. In the project,
push button switch and ON/ OFF switches are used. All the switches are in normally
open condition to ensure there are no current flows when the switches are not activated.
When the switch is pressed, the current from 5V source will flow through the switch to
the PIC microcontroller. Thus, it provides the 5V to the PIC. However, when the switch
32
is not pressed, open condition, the PIC’s pin is connected to the ground directly, thus it
provides the pin with 0V.
3.3.6
Voltage Regulator
In this part, the voltage regulator circuit will convert the 9V adapter output
voltage into a constant 5V voltage, as a source for the microcontroller, sensor, push
button and the LCD display. For application requirements up to 150mA, 78LXX can be
used. The device has three legs: Input leg which can hold up to 36VDC, common leg
(GND) and an output leg with the regulated voltage. Before the 9V adapter is asserted,
all points on the circuit are at 0V (ground)
Figure 3.11: a) LM7805 Voltage Regulators b) Voltage Regulator Circuit Schematic
To eliminate the ripple in output voltage, adding a capacitor in parallel between
the common leg and the output leg is usually recommended. The capacitor is a device
that stores electrical charges. The principle of the capacitor is significant in this circuit to
provide the output voltage of the regulator to keep constant over a time. The rate of
change of the voltage across a capacitor is proportional to the current flowing through it
and divided by the capacitance value. Therefore, the large capacitance value gives the
small change at the output of the regulator over a time at a fixed drain current. Typically
a 10uF capacitor is used. The figure 3.11 above shows the circuit configuration of
voltage regulator and the picture of regulator.
33
3.3.7LM35 Circuit
Figure 3.12 a) Bottom View of LM35 b) LM35 Circuit Design c) LM35 Temperature
Sensor
The figure 3.12 above shows the picture of LM35, the bottom view of LM35 and
the LM35 circuit design for Full-Range Centigrade Temperature Sensor. In this project,
the plastic package of LM35 was choosing. This is because the package is easy to
construct, small size and easy to get. From the figure3.12b, the value of R1 can
determine by using the following equation.
R1 = −VS/50 μA.
Once the temperature in the incubator was measured, the output voltage of the
LM35 shows as below. As conclusion, the output voltage of LM35 is linearly
proportional to the temperature measured.
V OUT =+1,500 mV at +150°C
= +250 mV at +25°C
= −550 mV at −55°C
34
Figure 3.13: LM35 Circuit Schematic.
To produce a smooth output voltage without ripple, a 0.1μF capacitor is added
between pin 2 and pin 3 of the LM35. Figure 3.13 shows the LM35 circuit schematic for
that purpose.
CHAPTER 4
RESULT AND DISCUSSION
This chapter reveals some simulation results and discussions for the Automatic
Quail Eggs Incubator system as a whole.
4.1
Liquid Crystal Display (LCD)
The LCD screen will display the current temperature in the incubator. It also displays the
condition of the incubator and some suggestion if the system under error condition. The
table 4.1 below shows the output of the LCD screen at the specified temperature range in
the incubator.
36
Table 4.1: LCD’s Output
Temperature
LCD’s output
SYSTEM ERROR
Temperature <32°C
BULB MAY BURNED
TEMP:
32°C <Temperature < 40°C
HATHING PROCESS
TEMP:
Temperature > 40°C
31
35
SYSTEM ERROR
TEMP:
41
The LCD screen has limitation number of word to display on the screen, means
there are not allow displaying more than 18 words including spacing on the screen. In
term of writing programming, there are limitations to write more than five LCD function
calls in order to display more condition and recommendation on the screen. If we do so,
the debugger will tell “demo limit” happened in the programming.
4.2
12 V DC Motor.
The figure 4.1 above shows the 12V DC motor circuit configuration. The figure
shows, the circuits are constructed by two transistors, four resistors and two diodes.
37
However, there are different circuit configurations between them. In figure 4.1a, the
motor will turn in forward or reverse direction, if and only if, the bases of the both
transistors are either low (0V) or high (5V). While, in figure 4.1b, the motor will turn in
forward or reverse direction, if and only if, one of the two bases of the transistors is high
(5V) and the other one base of the transistor is low(0V). In the design of Automatic
Quail Eggs Incubator system, the circuit in figure 4.1b is preferred compared to the
circuit in figure 4.1a. This is because the circuit in figure 4.1a cause that circuit exceeds
the PIC’s current limitation when both the base of the transistors are required to be high.
Figure 4.1: 12V DC Motor Circuit Configuration
38
4.3
LM35
Figure 4.2: Full-Range Centigrade Temperature Sensor Circuit.
Referring to the Figure 4.2 above, the value of VOUT can be determined by
choose the appropriate value of the R1. R1 is choose based on the value Vs, R1 =
−VS/50 μA. Practically, the accurate value of R1 is impossible to get in the market.
Thus, the chosen value of R1 cause the inaccuracy of the VOUT, as well as cause
inaccuracy in the temperature values measured.
4.4
7805 Positive Voltage Regulator
The 7805 emit heat while conducting. The heat emitted is proportional to the
conduction time. The overheating may cause the device broke and may cause the system
error. To ensure the system work properly, the problem can be solve by putting the heat
sink on the voltage regulator and also provide good air flow for the system.
39
4.5
Cost
Table 4.2: Cost an Automatic Quail Eggs Incubator
Table 4.2 shows the cost involved in producing an Automatic Quail Eggs
Incubator system. The grand cost of the incubator is RM 196.40 and the cost can
consider low compared to the other incubator at the market. This is because the
Automatic Quail Eggs Incubator system developed by using the chipper components
40
compared to the other eggs incubators. For example, the systems using a light bulb
instead of using a heater coil for heating process in the incubator. The cost of heater coil
is RM 220, while the cost of a light bulb is less than RM10.
CHAPTER 5
CONCLUSION
This final section contains three main elements which are conclusion,
recommendation and limitation of the study. The conclusion gives the overview of the
study as well as the main points of the findings. Even though this study had
accomplished its objectives, still there is certain limitation that restricted the research.
Finally, recommendations for future project are also discussed.
5.1
Project Conclusion
The grand cost of producing the Automatic Quail Eggs Incubator is considered
low compared to the available incubators in the market nowadays. This is because the
eggs incubator system is developed by using the chipper components compared to the
other eggs incubators. Thus, the objective to produce an eggs incubator at low cost is
achieved.
42 The Automatic Quail Eggs Incubator system is equipped with security system to
alert the users on the error system. Thus, the Automatic Quail Eggs Incubator can be
considered as a user friendly product and a reliable product. By providing the security
system in the eggs incubator system, the percentage of broken eggs can be reduced. As a
result, the objective to help the user to reduce number of abnormal quails and to design
an incubator equipped with an error detection system are achieved.
5.2
Project Limitations and Future Recommendations
There are several project limitations in the Automatic Quail Eggs Incubator
system design and there are some suggestions can be considered for future design. The
Automatic Quail Eggs Incubator system is used for hatching the quail eggs only, thus,
the future design is recommended to improve the design by equipping the system with
variety modes of hatching eggs. By equipped the verity modes of hatching eggs, all kind
of eggs can be hatching by switch to the available modes.
Instead of using PIC16F877A for control the system, monitoring the system
using computer is preferred. This is because there are more application can be equipped
such as correction the error when the system under error condition can be done by the
system. The use of PIC16F877A is not preferred for future design based on the
limitation of inputs and outputs pins of the integrated circuit (IC).
The other limitation of this project is it not fully automatic functional system.
This is because user needs to press a switch at day 15 of the hatching day to stop the
moving motor. For future design, the system should equip with the fully automatic
functional design to be more user friendly product. Means, the user need to press a
switch at first day of hatching to start the overall system. This can be done by editing the
43 previous programming part and considering the actual time involve during develops the
programming.
44 REFERENCES
1. Thomas E. Kissell, Industrial Electronics: Applications for Programmable
Controllers, Instrumentation and Process Control, and Electrical Machines and
Motor Controls, 2nd edition. United State of America: Prentice Hall. 2004.
2. T. R. Kuphaldt, Lessons In Electric Circuits: Volume III: Semiconductors,
Chapter 4: Bipolar Junction Transistors, “Transistor as a switch”, Design
Science License, 2003, http-://www.allaboutcircuits.com/vol_3/chpt_4/2.html
3.
http-://www.datasheetcatalog.org/datasheets/228/74575_DS.pdf
4. Automatic Forced-Air Incubator, January 2010, http://nizamspace.tripod.com/
5. http://www.moa.gov.my/home
6. https://courses.ece.uiuc.edu
7. PIC 16F87X Data Sheet, 28/40-Pin 8-Bit CMOS FLASH, Microcontrollers,
2001, http-://ww1.microchip.com/downloads/en/DeviceDoc/30292c.pdf
8. LM35 Precision Centigrade Temperature Sensors, LM35 datasheet, November
2000, www.national.com/ds/LM/LM35.pdf
45 9. R. L. Boylestad and L. Nashelsky: Electronic Device and Circuit Theory, 8th
edition. New Jersey: Prentice Hall. 2002.
nd
10. Iovine John. PIC Microcontroller Project Book. 2 edition. Singapore: Mc
Graw-Hill. 121-123; 2000.
11. Johari Kasim, A. Hamid and Camalil,: Sisitem Elektronik, 2nd edition, Malaysia:
Universiti Teknologi Malaysia.2006
12. Muhammad H. Rashid. Power Electronics Circuits, Devices and Applications.
rd
3 edition. United States of America: Prentice Hall. 200
nd
13. Lawrence A. Duarte. The Microcontroller Beginner’s Handbook. 2 Edition.
United States of America: Prompt Publication. 3-5; 1998.
14. PCL/PCH series 3A, 5A, 10A,15A General Purpose Miniature Relay, March
2004, http-://relays.tycoelectronics.com/datasheets/PCL-PCLH.pdf
15. http://www.brinsea.com/products/mini.html
46 APPENDIX A: Programming for the Project
Unsigned char
ch;
unsigned int
a
long
tlong;
dc_rd;
void init_main()
{
ADCON1
= 0x80;
// Configure analog inputs and Vref
TRISA
= 0xFF;
// PORTA is input
TRISB
= 0;
// PORTB is output LCD
TRISC
=0XFF;
//INPUT
TRISD
=0;
PORTD
=0x01;
}
void STemp()
{
adc_rd
= ADC_read(0);
// get ADC value from 2nd channel
tlong
= (long)adc_rd * 5000;
// covert adc reading to milivolts
tlong
= tlong / 1023;
// 0..1023 -> 0-5000mV
}
47 void SW()
{
PORTD
=0x31;
}
else if (PORTC.F1=255)
{
PORTD
=0x32;
}
}
void LCD2()
{
Lcd_Custom_Out(2, 1, "TEMP =
ch
= (tlong / 100) % 10;
");
// Print text at LCD
// extract 0.1 volts digit
Lcd_Custom_Chr_Cp(48+ch);
ch = (tlong / 10) % 10;
// extract 0.01 volts digit
Lcd_Custom_Chr_Cp(48+ch);
Lcd_Custom_Chr_Cp('.');
ch = tlong % 10;
Lcd_Custom_Chr_Cp(48+ch);
Lcd_Custom_Chr_Cp('C');
Delay_ms(1);
}
// extract 0.001 volts digit
48 void LCD1()
{
Lcd_Custom_Out(1, 1, " SYSTEM ERROR ");
}
void LCD3()
{
Lcd_Custom_Out(1, 1, "BULB MAY BURNED");
}
void LCD4()
{
Lcd_Custom_Out(1, 1, " OVER HEATING ");
}
void LCD5 ()
{
Lcd_Custom_Out(1, 1, "
");
}
void LCD6 ()
{
Lcd_Custom_Out(1, 1, "HATCHING PROCESS
}
");
49 void main()
{
init_main();
Lcd_Custom_Config(&PORTB,3,2,1,0,&PORTB,4,6,5);
// Initialize LCD on PORTB
Lcd_Custom_Cmd(Lcd_CURSOR_OFF);
// Turn off cursor
while (1)
{
STemp();
LCD2();
if (tlong<320)
{
LCD3();
Delay_ms(1000);
LCD1();
PORTD=0x1c;
Delay_ms(1000);
PORTD=0x18;
}
else if ((tlong>=320)&&(tlong<=370))
{
LCD6();
if (PORTC.F2=255)
{
PORTD=0x30;
}
//berhenti
50 else {
SW();
}
}
else if ((tlong>=380)&&(tlong<=390))
{
LCD6();
ORTD=0x00;
}
else
{
LCD4();
PORTD=0x3c;
Delay_ms(1000);
PORTD=0x34;
}
}
}
Download