low maintenance aquarium: automatic...
TRANSCRIPT
i
LOW MAINTENANCE AQUARIUM: AUTOMATIC CONTROLLER SYSTEM FOR WATER LEVEL SENSOR,TEMPERATURE AND FOOD DISPENSER SYSTEM.
C.PREM ANAND S/O CHANDIA SEKHARA
This report is submitted in partial fulfillment of the requirement for the award of Bachelor of Electronic Engineering (Industrial Electronics) With Honors
Faculty of Electronic and Computer Engineering
Universiti Teknikal Malaysia Melaka
May 2011
ii
UNIVERSTI TEKNIKAL MALAYSIA MELAKA
FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER
BORANG PENGESAHAN STATUS LAPORAN
PROJEK SARJANA MUDA II
Tajuk Projek : Low maintenance aquarium :Automatic controller system for water level sensor, temperature and food dispenser system
Sesi Pengajian : 2010/ 2011
Saya C.PREM ANAND S/O CHANDIA SEKHARA mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan syarat-syarat kegunaan seperti berikut:
1. Laporan adalah hakmilik Universiti Teknikal Malaysia Melaka.
2. Perpustakaan dibenarkan membuat salinan untuk tujuan pengajian sahaja.
3. Perpustakaan dibenarkan membuat salinan laporan ini sebagai bahan pertukaran antara institusi
pengajian tinggi.
4. Sila tandakan ( √ ) :
SULIT*
*(Mengandungi maklumat yang berdarjah keselamatan atau kepentingan Malaysia seperti yang termaktub di dalam AKTA RAHSIA RASMI 1972)
TERHAD** **(Mengandungi maklumat terhad yang telah ditentukan oleh organisasi/badan di mana penyelidikan dijalankan)
TIDAK TERHAD
Disahkan oleh:
__________________________ ___________________________________
(TANDATANGAN PENULIS) (COP DAN TANDATANGAN PENYELIA)
Tarikh: ________________________ Tarikh: ________________________
iii
“I hereby declare that this report is the result of my own work except for quotes as cited
in the references.”
Signature : ……………………
Author : C.PREM ANAND S/O CHANDIA SEKHARA
Date : ……………………
iv
“I hereby declare that I have read this report and in my opinion this report is sufficient in
terms of the scope and quality for the award of Bachelor of Electronic Engineering
(Industrial Electronics) With Honours.”
Signature : ……………………………………...
Supervisor’s Name : Engr. Zarina Binti Mohd Noh
Date : ……………………………………...
v
To my beloved father, mother, and all my siblings and friends.
vi
ACKNOWLEDGEMENT
First and foremost, I would like to praise God for HIS blessing. He gave me
physical and mental to carry on my final year project from the beginning up to
completion. I would like to express gratitude and thanks to my supervisor, Engr. Zarina
Binti Mohd Noh for her support and unfailing patience throughout the duration of the
project. Her encouragement and guidance are truly appreciated. Otherwise, this project
has not been possible. I have learnt a lot under her guidance, be it practically or
theoretically. Other than that, I am also grateful to my all friends who help me and
giving me opinion along implementation of this project. I would like to thanks my parent
and my girlfriend on their moral support as I can count on them whenever I am upset or
down. Finally, I would like to offer thanks and deepest gratitude from the bottom of my
heart for all the support, encouragement and inspirations I obtained throughout the
duration of this project. The help rendered to me priceless, be it from the smallest of its
kind to the largest.
vii
ABSTRACT
LOMAQ (Low Maintenance Aquarium) project is built for fish farming with less
human interface. The project is based on a microcontroller circuit to control the circuit
of equipment used on fish farming. The microcontroller (PIC) has a keypad to act as
input made to set the timer to control the equipment. All equipment used is controlled by
timer. Equipments controlled are light, water pump and food dispenser. There is a timer
sensor to show the temperature of the environment and the data is shown on LCD screen.
The system would supply the oxygen and food according to the need of the aquarium
and cleans the aquarium periodically. The cutting edge of this system is that human can
always give the input according to the needs. There would be input interface in the
system where it could be altered according to the current needs. Where else the lighting
would be pre set to operate in the given timing. The main idea is to make it as a selling
product using PIC as the controller .The advantage of this project is that it’s very
versatile and very flexible. The system could be integrated with on the market appliance
without regarding the brand, type or size. It’s also flexible via its need of use. It can be
used for large scale or small scale. The project would be done in small scale as a
prototype. Main purpose of this project is reducing human interference in maintaining an
aquarium. Besides that it would also help to cut cost of electricity usage.
viii
ABSTRAK
Projek LOMAQ (Low Maintainance Aquarium) adalah untuk penternakan ikan
dengan kurang pendedahan manusia iaitu separa automatic.Projek ini dicipta berasaskan
mikropengawal untuk mengendalikan litar serta peralatan dalam penternakan ikan.Litar
mikropengawal PIC mempunyai keypad sebagai input masa untuk mengedalikan
peralatan.Kesemua peralatan yang gunakan dikawalkan menggunakan pemasa
(timer).Peralatan yang dikawal adalah lampu neon,pam air/oksigen dan kotak
pengagihan makanan.Selain itu,terdapat sensor suhu untuk menunjukkan suhu sekitar
dan kesemua data akan dipaparkan pada skrin LCD. Bagi pengagihan makanan,sela
masa yang diperlukan perlu disetkan menggunakan keypad yang telah
disediakan.Apabila sudah disetkan,pengagihan makanan sudah menjadi aktif.Maka ia
akan mula aktif dan menyalurkan makanan pada sela masa yang telah disetkan dalam
tempoh minit. Had operasi pengeluaran makanan adalah 10 saat sahaja. Maksudnya
motor didalam pengagih makanan akan berfungsi selama 10 saat sahaja dan makanan
akan keluar dalam 10 saat sahaja. Bagi pembekal oksigen dan penapis oksigen,
prosesnya juga sama. Sela masa yang diperlukan disetkan menggunakan keypad yang
disediakan. Prosesnya akan aktif mengikut sela masa yang talah ditetapkan. Oksigen
akan dibekalkan dan air juga akan mula ditapiskan. Sela masa yang ditetapkan adalah
dalam minit.
ix
TABLE OF CONTENTS
CHAPTER CONTENT PAGE
TITLE i
DECLARATION ii
ACKNOWLEDGEMENT vi
ABSTRACT vii
ABSTRAK viii
TABLE OF CONTENTS ix
LIST OF FIGURES xiii
LIST OF TABLES xv
LIST OF ABBREVIATION xvi
LIST OF APPENDIX xvii
CHAPTER 1
1.0 Introduction 1
1.1 Objective of project 2
1.2 Problem Statements 2
1.3 Scope of Project 3
1.4 Methodology 3
1.5 Expected outcome of the project 5
1.6 Thesis outline 5
x
CHAPTER 2
2.0 Literature Review 6
2.1 Introduction 6
2.2 The Process 8
2.3 Maintaining the nitrogen cycle 8
2.4 Biological Loading 10
2.4.1 Calculating aquarium capacity 10
2.4.2 Factors affecting capacity 11
2.5 Water 12
2.5.1 Water Privileges 13
2.5.2 Water Quality 13
2.5.3 Dissolved Material 13
2.5.4 General Parameters 14
2.5.5 Hardness 14
2.6 Temperature 14
2.7 Lighting 15
2.8 Water Level 15
2.9 The component and devices 16
2.9.1 Temperature Sensor (LM 35) 16
2.9.2 Water Level Sensor (LM 324 18
2.9.3 Light Sensor (LDR-Light Dependent Resistor) 19
2.9.4 PIC1F452 Microcontroller 20
2.9.5 Oscillator 26
2.9.6 Reset 27
2.9.7 Memory Organization 28
2.9.8 Flash Program Memory 30
2.9.9 Interrupt 31
xi
CHAPTER 3
3.0 Methodology 33
3.1 Overview 33
3.2 Main Board 33
3.2.1 Microcontroller – PIC 18F452 34
3.2.2 Temperature Sensor 36
3.2.3 Water Level Sensor 37
3.2.4 Lighting Sensor 39
CHAPTER 4
4.0 Result and Analysis 44
4.1 Project Result 44
4.2 Analysis of Result 45
4.3 Software Implementation 46
4.3.1 MPLAB Software 46
4.3.2 PICkit 2V 2.55 Software with USB 7CSP PIC Programmer 50
4.4 Flow Chart 51
4.5 Programming Development 52
4.5.1 Initialization Part 53
4.5.2 Main Programming Part 56
4.5.3 Subroutine Part 58
4.6 Circuit Diagram 60
4.7 Circuit Layout 61
4.8 Discussion 63
xii
CHAPTER 5
5.0 Future Recommendation And Conclusion 64
5.1 Future Recommendation 64
5.2 Project Conclusion 65
REFFERENCES 66
APPENDIXS 68
xiii
LIST OF FIGURES
NO TITLE PAGE 1.1 The block diagram of the system 4 2.1 The project design of Robert Warrington who builds the first 7 Aquarium. 2.2 19 liter aquarium 12 2.3 The LM35 package 17 2.4 LM324 pin connection. 18 2.5 Light dependent resistor figure and symbol. 19
2.6 Graph resistance vs. Illumination. 20 2.7 Microcontroller PIC18F452 pin diagram. 22 2.8 PIC18F452 block diagram. 25 2.9 Crystal/Ceramic Resonator Operation 26 2.10 External Power-On reset Circuit 28 2.11 Shows the Program and Stack for PIC18F452. 28 2.12 Data Memory Map for Pic18f252/452 30 3.1 PIC18F452 schematic circuit 35 3.2 Temperature Sensor Schematic 36 3.3 Water level sensor schematic diagram. 38 3.4 LM324 pin connection. 39 3.5 Lighting sensor circuit schematic. 40 3.6 Graph resistance vs. Illumination. 40 3.7 System flowchart 42
xiv
4.1 MPLAB window after done create a project 47 4.2 MPLAB window after add file. 48 4.3 MPLAB window after write the programming 48 4.4 MPLAB window when programming successfully builds 49 4.5 MPAB window when programming unsuccessfully builds 49 4.6 PIC kit2 software window before and after successful download 50 hex file 4.7 USB ICSP PIC programmer diagram 51 4.8 Circuit diagram for the main board 60 4.9 Circuit layout for the main board, using EAGLECADD software. 61
4.10 Circuit layout for the main board, using EAGLECADD software 62 (Basic view.)
xv
LIST OF TABLES
No TITLE PAGE
2.1 PIC18F452 Specification. 22
2.2 Capacitor Selection for Crystal Oscillator 27
4.1 The sensor and the voltage output 45
xvi
LIST OF ABREVATIATION
ADC ANALOG TO DIGITAL CONVERTER
ALU ARITHMETIC LOGIC UNIT
BCD BINARY CODED DECIMAL
CCW CONTER CLOCKWISE
CH CLOCK HERTZ
CP CODE PROTECTION
CW CLOCKWISE
GND GROUND
IC INTEGRATED CIRCUIT
ICSP IN CIRCUIT SERIAL POGRAMMING
INDF INDIRECT FILE
LED LIGHT EMMITING DIODE
PC PROGRAM COUNTER
PWRT POWER UP TIMER
PIC PROGRAMMABLE INTEGRATED CIRCUIT
SQW SQUARE WAVE
xvii
LIST OF APPENDIX
NAME TITLE PAGE
A PIC16F877 68
B PROGRAM FOR LCD 72
C PROGRAM FOR KEYPAD 90
D MPLAB IDE and HI-TECH PICC-Lite Installation 96
1
CHAPTER 1
INTRODUCTION
1.0 Introduction
Human is needed to maintain the aquarium where the maintenance could be
neglected if human forget about it or busy with other chores. Besides that, the
electricity cost would increase if the aquarium appliances keep on running without
any usage. Due to the heat the water will vaporize easily[1]. Besides that, there’s no
system at the market that could integrate on the market appliance into a single
system. Feeding the fish is another problem where need to be on time and for fish
breeders need to be there to feed their fish every day, so it makes them bonded to
their routine life and they can’t left it for a longer journey.
The system would supply the oxygen and food according to the need of the
aquarium and cleans the aquarium periodically. The cutting edge of this system is
that human can always give the input according to the needs. There would be input
interface in the system where it could be altered according to the current needs.
Where else the lighting would be pre set to operate in the given timing.
LOMAQ (Low Maintenance Aquarium) project is built for fish farming with
less human interface. The project is based on a microprocessor circuit to control the
circuit of equipment used on fish farming. The microprocessor (PIC) has a keypad to
act as input made to set the timer to control the equipment. All equipment we used is
controlled by timer. Equipments controlled are light, water pump and food dispenser.
There is a timer sensor to show the temperature of the environment and the data is
shown on LCD screen
2
1.1 Objective of Project
The objective of this project is to build a prototype aquarium system that can
detect, monitor and control three important aspects to maintaining a healthy
aquarium. The prototype system will control water temperature water level and
lighting hence the aquarium environment are always at normal condition for the fish
in the aquarium.
Able to integrate the controller system with the on the market appliance thus create a system that is very flexible and user friendly. Besides that it could
Able to save time and cost by supplying the oxygen and filter system periodically, and humans have not to worry about it.
Able to reduce human interference. Able to pre set the feeding timing so it will be operating
automatically. Able to monitor the water level in the tank. Able to pump in and out the water to tank according to the need.
1.2 Problem Statement
There are many important aspects inside the aquarium environment need to
be controlled and three of the aspects are lighting, temperature and water level. The
factor why fish inside the aquarium always die because the fish owners do not care
about the quality of aquarium environment..Fish owners don’t have time to monitor
water temperature, water level that is suitable for aquarium environment. Fish
owners don’t know how to control the parameter of aquarium environment that are
suitable for aquarium environment.
3
1.3 Scopes of Project
The scopes of this project are electronic component, electrical devise,
computer software and mechanical design. The electronic components used in this
project were PIC18F452 as a microcontroller, LM35 as a temperature sensor, light
dependent resistor (LDR) as a lighting sensor, LM324N as a water level sensor, LCD
16x2, 5V relay and basic electronic component such as resistor, capacitor and others.
The electrical devices used in this project were pump, 200 watt heater, lamp
and fan (12V). This project used microC language to program the microcontroller
and MPLAB v8.10 as a compiler to create the source code and hex file for the
microcontroller. Besides that Altium 2004 is used to design the circuit layout for the
printed circuit board (PCB).
1.4 Methodology
This project can be divided to hardware and software. The hardware parts
consist of four systems. The systems are monitoring system, control system, display
system and output system. The monitoring system consists of temperature sensor
circuit, water level sensor circuit and lighting sensor circuit. Temperature sensor will
sense the water temperature inside the aquarium. The function of water sensor is to
detect low water level inside main aquarium and reserve tank. Besides that the
function of lighting sensor is to detect light intensity outside the aquarium. All
sensors will send analog data to microcontroller.
The Control System consists of PIC18f452 as a microcontroller, Crystal
H49S 20MHz as oscillator, 5V regulator used to regulate high voltage to 5V, reset
button and other basic components. The control systems functions to process data
analog receive from monitoring system and send digital data to display system and
output system.
4
The Display system consists of LCD 16x2, LED, Buzzer and push button.
The LCD 16x2 has 2 rows and each row can display 16 characters. First row displays
temperature value while second row displays the condition of the output. There are
five LEDs used inside the display system. One of the LEDs wills ON if the pump is
ON or the heater is ON or the lamp is ON or the fan is ON. Besides that the buzzer
and the LED will ON if the water level inside reserve tank is low.
Figure 1.1: The block diagram of the system
There are two push button used to ON the pump and heater manually. The
output system consists of relay circuits. There are four relay used to control the
pump, the heater, the lamp and the fan. The control system will control the relay by
sending 5V output to the relay. UIC00A USB ICSP PIC PROGRAMMER is used to
download the hex file to the microcontroller.
5
1.5 Expected outcome of the project
A system that is able to monitor and carry out the maintenance of an
aquarium automatically with less human interference. Where human could key in the
data or settings required through an interface. A system that is so flexible and user
friendly where it’s easy to use and able to change the configuration as user defines.
1.6 Thesis Out Line
Chapter 1 explain about the, objective of the project, scope of the project and
problem that must be solve while doing this project.
In Chapter 2, the explanation is focusing about the components that have
been use in the circuit to create a standard control system . This chapter also explains
the function of each component in detail.
In Chapter 3, the explanation is about the methodology of the project. The
explanation is more to the operation of the system , sensors application and flow
chart of control sequence before creating a PIC program.
Chapter 4 explains about the simulation and result from the simulation.
Before simulating the circuit, the source code programming for PIC18f452 must be
burn into the PIC using the PIC burner.
Finally , the last chapter explanation about the future recommendation and
the conclusion for the project.
6
CHAPTER 2
LITERATURE REVIEW
2.1 Introduction
The origins of aquarium keeping have been around for about as long as
keeping food fishes, although the methodology and understanding of aquarium
filtration has varied considerably. The first known formal study of fish was
conducted by the Greek philosopher Aristotle (384-322 B.C.). Studying their
structure and other characteristics, he carefully recorded accurate information on 115
species of fish then living in the Aegean Sea. Today, scientists have classified more
than 20,000 species of fish around the world.
Based on the works of Chemist Priestley and Zoologist Johnson, who realized
the plant oxygen relation, Robert Warrington builds the first aquarium. His theory
was, by building a glass structure filled with sand on the bottom, snails, and plants
that can provide oxygen, fish can live forever. The plants would provide oxygen to
the fish, snails eat decaying plants and lay eggs, and the fish feed off of the snail
eggs. The perfect contained cycle. From there on, the hobby flourished. Fueled by
shorter transportation (air traffic was in its infant years), more and more breeders and
the enthusiasts helped make the hobby more popular. The inventions and the
7
understanding of water chemistry and fish within the past 30 years has enabled just
about anyone to enjoy fish-keeping with little to no problem.
According to book Common Fish Diseases by Lance Jepson and The
Tropical Aquarium by Gina Sandford, both of these books discussed about the
Aquarium environment. The contents include the aspects in aquarium environment,
the importance of water quality and the effects of bad water quality to the fish.
Temperature or Heat is important to drive fish metabolic process. If the temperature
is too high enzymes will stop working and if too low the enzymes will damage. On
average, most tropical aquariums do best with temperatures ranging from 26ºC to
29ºC.Aquarium not only consist fish but it also consists plant. Light is essential to
promote healthy plant growth and allow you to see your fish. Fish inhale oxygen and
exhale carbon dioxide.
Water level also one of the important aspect. Fish inside the aquarium needs
wide space to swim. If the space is too small space and many fish inside the
aquarium, this situation can make the fishes stress and frightened at last the fish will
die.
Figure 2.1: The project design of Robert Warrington who builds the first aquarium