Home

UNIVERSITI TEKNOLOGI MALAYSIA

image

Contents

1. PAGE 10 23 24 26 30 44 46 FIGURE 1 1 2 1 2 2 23 3 1 3 2 3 3 3 4 3 5 3 6 3 7 3 8 3 9 3 10 3 11 3 12 3 13 3 14 LIST OF FIGURES TITLE Project overview Pin diagram of PIC 18F452 General PC communication on the bus mikroC for PIC software Block diagram of the project Flow chart of the system Picture of the project Starter Kit SK40C Top view of SK40C 16X2 LCD JHD 162A LCD connection on project strip board UICOOA top view Connection of SK40C and UICOOA USB ICSP PIC programmer Physical dimension of LM35DZ Rainbow wire used to connect LM35DZ with PIC MCU on SK40C Schematic circuit of PIC 18F452 connected with added components other than components which are already on SK40C board Connection with central controller using PC communication Flow chart of microcontroller s main program PAGE 11 15 17 18 19 20 21 22 24 25 26 27 29 29 32 33 35 xi 3 15 3 16 3 17 4 1 4 2 4 3 4 4 4 5 Flow chart of feeding function interrupt MSSP block diagram C mode Timerl block diagram Red LED lights on at water temperature of 18 C Red LED lights off at water temperature of 25 C Red LED lights on at water temperature of 31 C Initial condition of the LCD and LEDs LCD and LEDs condition during fish feeding 36 37 39 42 43 43 46 46 xii xiii LIST OF APPENDICES APPENDIX TITLE PAGE A Suggested Microcontrolled Aquaculture System 2 52
2. B Schematic Circuit of Cytron SK40C Board 53 CHAPTER 1 INTRODUCTION 1 1 Background Recirculating Aquaculture System RAS is a set of organized complementary process that allow a part of the water to leave a fish culture tank to be reconditioned and then reused in the same tank or other fish culture tanks RAS rears fish at high densities in indoor tanks with a controlled environment There are several water quality parameters to be well controlled which are pH temperature dissolved oxygen salinity water flow and others RAS can maximize the production on a limited water supply and land It also can provide quick and effective disease control The system also has disadvantage where the water quality would face deterioration if the water treatment process within the system are not controlled properly This will cause disastrous losses within a short time Thus constant monitoring and reliable system is needed to minimize the losses due to failure in components of the system Precise measurements and controls are necessary for the success of an intensive RAS Properly controlled system will be energy efficient because it will minimize the use of man power especially when it comes to feeding time The controller would be very helpful to maintain the system To work this out the project entitled Water Temperature Sensor and Automatic Feeder Node for Recirculating Aquaculture System has been constructed 12 Objective of
3. a summary of works Theory and literature reviews that have been done were discussed in Chapter 2 The chapter introduces Recirculating Aquaculture System RAS the parameters of the system to be monitored the microcontroller and the software used for the project In Chapter 3 the discussion will be on the methodology hardware and software implementation of this project The result and discussion will be presented in Chapter 4 Last but not least Chapter 5 discusses the conclusion of this project and future work that can be done to improve the project in the future 1 5 Summary of Works Implementation and works of the project are summarized into the flow chart as shown in Figure 1 1 Gantt charts as shown in Table 1 1 and Table 1 2 show the detailed works of the project that had been implemented in the first and second semester Water Temperature Sensor and Automatic Feeder Node Circuit Design Circuit implementation on bread board Circuit programming using MikroC for PIC Error Correction Circuit implementation on stripboard Interfacing with central controller Figure 1 1 Project overview Table 1 1 Gantt chart of the project schedule for semester 1 WEEKS NO TASK ACT
4. and formulated specifically for the fish species being reared is necessary for fish production in the system It is recommended to feed a commercial feed of dry floating pellets so that the feeding activity and health of the fish can be easily observed at the water surface The size of the pellets should correspond with the size of the fish Cultured fish generally are fed three to five percent of their body weight or all the feed that they can consume in a short period of time say five minutes Feed remaining in the tank after five minutes is seldom eaten and overfeeding can seriously degrade water quality A good quick indicator of problems with water quality or disease is when fish go off feed or refuse to eat Feeding rates would reduce at very high and low water temperatures To maximize growth fish feeding must be done on a regular schedule at the same time each day More regular feedings several times per day have resulted in better growth rates and feed conversion efficiencies than a single daily feeding Automatic feeders and demand feeders can be used in commercial operation to reduce labor costs 2 5 Microcontroller Microcontrollers are general purpose microprocessors which have additional parts that allow them to control external devices A microcontroller is a very powerful tool that allows a designer to create sophisticated I O data manipulation algorithms The simplest microcontroller architecture consists of a micr
5. function The MSSP module implements the standard mode specification as well as 7 bit and 10 bit addressing Figure 3 16 shows the block diagram of MSSP in PC mode Internal Data Bus Write Match Detect h Addr Match ate SSPADD reg START and Set Reset STOP bit Detect gt S P bits SSPSTAT reg Figure 3 16 MSSP block diagram LC mode 38 The MSSP module has six registers for re operation which are MSSP Control Register SSPCON1 MSSP Control Register2 SSPCON2 MSSP Status Register SSPSTAT Serial Receive Transmit Buffer SSPBUF MSSP Shift Register SSPSR and MSSP Address Register SSPADD SSPCON SSPCON2 and SSPSTAT are the control and status registers in PC mode operation SSPSR is the shift register used for shifting data in or out SSPBUF is the buffer register to which data bytes are written to or read from SSPADD register holds the slave device address when the SPP is configured in PC Slave mode In receive operations SSPSR and SSPBUF together create a double buffered receiver When SSPSR receives a complete byte it is transferred to SSPBUF and the SSPIF interrupt is set During transmission the SSPBUF is not double buffered A write to SSPBUF will write to both SSPBUF and SSPSR c Initialization of TIMERI in Timer Mode The Timer module in PIC 18F452 is a 16 bit timer counter consisted of two 8 bit registers TMR1H and TMRIL which are readable and writable Figu
6. is shown in Figure 3 1 Master Controller Buzzer Buzzer Analog Converter Switch Green LED Microcontroller function indicator Yellow LED Red LED feeder temperature indicator indicator Figure 3 1 Block diagram of the project 19 PIC Microcontroller is the main component of this project The PIC Microcontroller is programmed to check the temperature of the water whether it is in the suitable range or not The sensor which would be in the water will sense the temperature of the water These data would then be received by the microcontroller Any out of range temperature would switch on the Red Light Emitting Diode LED The Liquid Crystal Display LCD would display the current temperature for every two seconds The feeder is indicated by the yellow LED and buzzer and it depends on the master controller to function as the master controller has the time set for automatic fish feeding The green LED indicates the functionality of the circuit The PIC Microcontroller would send the data to the master controller through Inter integrated Circuit PC serial bus Start Initialize System MENU Choice 13 1 2 3 m Tae 4 Feeder Auto mode 1 Flag 1 No Temp out Yes F ceding fange ee Go to 1 until _ Yes then go to Red LED Red LED Taia MENU MALU Li MARE S ur Go to MENU Go to MENU if Flag if Flag 0 _ else goto else go to 1 Figure 3 2 Flow chart of the system 20 Accord
7. of RAS The microcontroller chip that has been selected for the purpose of controlling the speed of DC motor is PIC 18F452 manufactured by Microchip This chip is selected based on several reasons a Its size is small and equipped with sufficient output ports without having to use a decoder or multiplexer b Its portability and low current consumption c It can be programmed and reprogrammed easily up to 1 000 000 cycles using UICOOA USB ICSP PIC Programmer d It has wide operating voltage range 2 0V to 5 5V Refer to Table 3 4 for the pin connection of PIC 18F452 in water temperature sensor and automatic feeder node for RAS Pins that are not stated in the table are not used and are left hanging Table 3 4 Pin connection of PIC 18F452 in the project Pin Name Pin No Description Application Positive supply VDD 11 32 5V Power supply to chip VSS 12 31 Ground reference Ground reference OSC1 13 For oscillator or Connected to resonator OSC2 14 resonator 20MHz MCLR 1 Reset input Always connected to 5V Input of Vour from RAO 2 Input Output pin LM35DZ as temperature sensor 19 22 RDO RD7 27 30 Input Output pin LCD data bus pin D0 D7 RB4 37 Input Output pin Pin Rs of LCD RB5 38 Input Output pin Pin E of LCD 3 Temperature level indicator RCO 15 Input Output pin Red LED Feeding time indicator RC1 16 Input Output pin Yellow LED Circuit funct
8. voltage to 5V 3 2 2 Liquid Crystal Display JHD 162A 16 characters X 2 rows Liquid Crystal Display LCD JHD 162A is used in the project to display the current water temperature value The LCD has 16 pins as shown in Figure 3 6 The function of each pin is shown in Table 3 2 24 Figure 3 6 16X2 LCD JHD 162A Supply voltage for this LCD is within 4 5 5 5V The LCD must be soldered until the joint is fully covered to make sure that the LCD is well functioned Sometimes the LCD cannot display the alphanumeric characters on its display because it is not well soldered onto the strip board Table 3 2 Pin connection of LCD JHD 162A Pin Name Pin function Connection 1 GND Ground GND 2 VDD Positive supply for LCD 5V 3 Con Brightness adjust pennies o i Na elea Pin RS of LCD instruction or data register 5 GND Ground GND 6 RBS Start data read or write Pin E of LCD 7 RDO LCD Data bus pin Pin DO of LCD 8 RDI LCD Data bus pin Pin D1 of LCD 9 RD2 LCD Data bus pin Pin D2 of LCD 10 RD3 LCD Data bus pin Pin D3 of LCD 11 RD4 LCD Data bus pin Pin D4 of LCD 12 RDS LCD Data bus pin Pin D5 of LCD 13 RD6 LCD Data bus pin Pin D6 of LCD 14 RD7 LCD Data bus pin Pin D7 of LCD 15 VDD Backlight positive input VDD 16 B L Backlight negative input Connect to JP8 25 SK40C provides ports for LCD connection but man
9. 2 5 1 PC Communication Inter integrated circuit TC is one of the operation modes of Master Synchronous Serial Port MSSP module The MSSP module is a serial interface which is useful for communicating with other peripheral or microcontroller devices These peripheral devices may be serial EEPROMs shift registers display drivers 33 A D converters etc The PC interface supports the master multi master and slave modes in hardware The water temperature sensor and automatic feeder node for RAS is the slave mode if it is combine with the central controller which is the master mode 4 Central 7 controller j l TC communication PC communication link in this project is built using rainbow wire Four lines of rainbow wire are needed where first two lines are connected to RC3 and RC4 pins of PIC 18F452 while two more lines are connected to Vpp and VSS The SCL and SDA pins must be configured as inputs TRISC lt 4 3 gt The link is needed to communicate with central controller of RAS on another board of PIC MCU The MSSP module will override the input state with the output data when required slave transmitter Through this link the data such as the current water temperature can be sent to the central controller The graph of the water temperature versus time can be plotted on the central controller Graphic LCD GLCD to see the fluctuation of the water temperature 34 3 3 Software Implementation For soft
10. IVITIES 8191101111121 13114115 1 FYP briefing 2 Student Supervisor name list out 3 Literature review 4 Proposal preparation and submission 5 Study on PIC Microcontroller 6 Survey on the price of components 7 Attend PIC Microcontroller class 8 Preparation for FYP 1 seminar 9 FYP 1 seminar 10 Preparation for FYP 1 report 11 FYP 1 report submission Table 1 2 Gantt chart of the project schedule for semester 2 WEEKS NO TASK ACTIVITIES 13 101111121 131141151 16 1 Design circuit diagram 2 Programming using related software 3 Hardware implementation 4 Circuit testing and error correcting 5 Preparation for FYP 2 seminar 6 FYP 2 seminar amp demo 7 Thesis writing 8 Thesis draft submission CHAPTER 2 THEORY AND LITERATURE REVIEW 2 1 Introduction This chapter discusses the Recirculating Aquaculture System water temperature and fish feeding time effects to the system It also discusses briefly the microcontroller PC port and mikroC for PIC 2 2 Recirculating Aquaculture System RAS In a Recirculating Aquaculture System RAS a good water supply in both quality and quantity is essential to a successful fish farming enterprise The required quantity of water needed to grow fish varies with the species of fish selected size of the culture system and investment size 1 Fish can be grown in tanks of nearly every shape and size Usua
11. PSZ 19 16 Pind 1 07 UNIVERSITI TEKNOLOGI MALAYSIA DECLARATION OF THESIS UNDERGRADUATE PROJECT PAPER AND COPYRIGHT Author s full name SITI HASUNAH BINTI MOHAMMAD Date of birth 31st JULY 1987 Title WATER TEMPERATURE SENSOR AND AUTOMATIC FEEDER NODE FOR RECIRCULATING AQUACULTURE SYSTEM Academic Session 2009 2010 declare that this thesis is classified as Contains confidential information under the Official Secret Act 1972 Contains restricted information as specified by the organisation where research was done OPEN ACCESS agree that my thesis to be published as online open access full text acknowledged that Universiti Teknologi Malaysia reserves the right as follows The thesis is the property of Universiti Teknologi Malaysia The Library of Universiti Teknologi Malaysia has the right to make copies for the purpose of research only The Library has the right to make copies of the thesis for academic exchange Certified by SIGNATURE SIGNATURE OF SUPERVISOR SITI HASUNAH BINTI MOHAMMAD 870731 52 6516 PUAN FATIMAH BINTI MOHAMAD Date NOTES If the thesis is CONFIDENTIAL or RESTRICTED please attach with the letter from the organisation 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 terms of scope and quality for the purpose of awarding the degree of Bachelor of Engine
12. Project One of the objectives of the project is to exchange analog and digital data between sensors and master controller Furthermore this project is constructed to send the data to automatic feeder at specific time The data sent is based on the scheduled time from master controller The third objective is to provide reliable data so that the relay can function automatically when there is a need to change the water quality 1 3 Scope of Project The scope of the project include the followings 1 31 Investigation Related work and projects were searched and studied By doing this the concept of RAS and the applications of its components could be understood Any problems on the previous projects were analyzed so that improvements could be applied in this project 1 3 2 Programming It comes to programming when dealing with PIC Microcontroller Suitable programming software such as MPLAB IDE and mikroC for PIC can be used as a compiler for PIC Microcontroller 1 3 3 Circuit Design and Simulation The circuit for the microcontroller would be designed and simulated using suitable software 1 3 4 Hardware Implementation During this stage the hardware is implemented and would be tested to detect any error Error correction would be done to fix any problem on the hardware 1 4 Outline of Thesis This thesis consists four chapters The first chapter discusses about the objectives and scopes of this project ending with
13. d temperature to LCD Test feederflag OXAB Red LED 1 Yes No Yes Test feederflag 0 Figure 3 14 Flow chart of microcontroller s main program 36 feederflag 0 e Send Feeding to LCD e Buzzer 1 e Yellow LED 1 Test feederflag OXAB e Clear LCD e Buzzer 1 e Yellow LED 1 Figure 3 15 Flow chart of feeding function interrupt 3 3 1 1 Processing Explanation of Microcontroller Program The main parts of main program in microcontroller are initialization of ports rc Timerl temperature reading and feeding function a Initialization of the Mode of Ports A B C and D In this project pin 0 of the PORT A RAO is used as analog input where it receives temperature from LM35DZ All PORT D are output for LCD data bus pin 37 while PORTB F4 and PORTB F5 are output for RS pin and E pin of the LCD accordingly Although pin R W of the LCD is grounded the PORT for LCD must be all configured where PORTB F6 is assigned as output PORTB F6 0 PORTC FO PORTC F1 and PORTC F2 are used as output for LEDs while PORTC F3 and PORTC F4 are used as input from master controller through PC communication link PORTC F6 is used as output for buzzer b Initialization of LC The MSSP module in IC mode fully implements all master and slave functions including general call support and provides interrupts on START and STOP bits in hardware to determine a free bus multi master
14. data between master controller and temperature sensor so that the water temperature for every two seconds are known and recorded Any degradation of the water quality due to insufficient water temperature and feeding time causes the master controller to instruct the microcontroller to send the reliable data to relay interfacing circuit connecting to the regulator devices which are indicated by Light Emitting Diodes LEDs The implemented water temperature sensor and automatic feeder node using microcontroller could improve the efficiency of Recirculating Aquaculture System vi ABSTRAK Penternakan hidupan air masin dalam persekitaran dalaman semakin mendapat perhatian pada masa kini Ikan akan diternak di dalam tong di dalam bangunan berbanding di laut atau kolam Apabila menternak ikan di kilang banyak faktor untuk memastikan kualiti air terjaga yang perlu diambil kira Sebagai contoh suhu air kemasinan air oksigen terlarut dan pH mesti dikawal dengan sebaiknya Ikan di dalam tong perlu diberikan makanan secara sistematik kerana ternakan tidak bebas mencari makanan sebagaimana di laut Projek ini dijalankan untuk memastikan kualiti air dan masa pemberian makanan yang terurus bagi Sistem Akuakultur Kitar Semula RAS Projek ini menggunakan mikropengawal PIC 18F452 sebagai otak sistem Mikropengawal ini berfungsi dalam penukaran data analog dan digital antara pengawal pusat dan penderia suhu supaya suhu air setiap dua saat diketahui dan dire
15. ee oO O VSS 3 o oH ae RD6 PSP6 OSC1 CLKI e 7 lt RDS PSP5 OSC2 CLKO RA6 a e RD4 PSP4 RCO TIOSO TICKI e RC7 RX DT RC1 T10SI CCP2 RCBITXICK RC2 CCP1 e e RCS SDO RC3 SCK SCL RC4 SDI SDA RDO PSPO e a RD3 PSP3 RD1 PSP1 f RD2 PSP2 Figure 2 1 Pin diagram of PIC 18F452 RAO RAI Bi directional port A pins Also analog input pins RA2 Bi directional port A pin Also analog input pin and analog negative reference voltage RA3 Bi directional port A pin Also analog input pin and analog positive reference voltage RA4 Bi directional port A pin Also clock input to Timer0 module 12 RAS Bi directional port A pin Also analog input and synchronous serial port slave select pin REO RE2 Bi directional port E pins Also analog inputs and parallel slave port control pins RDO RD7 Bi directional port D pins Also parallel slave bus I O pins VSS Ground reference VDD Positive supply voltage OSC1 OSC2 Oscillator crystal inputs RCO Bi directional port C pin Also Timer oscillator output or Timer clock input RC1 Bi directional port C pin Also Timer oscillator input or Capture2 input Compare2 output PWM2 output RC2 Bi directional port C pin Also Capture input Compare1 output PWM 1 output RC3 Bi directional port C pin Also synchronous serial clock input output for SP I C mode RC4 Bi directional port C pin A
16. eiver while a memory or I O chip can be both transmitter and receiver Consider the following setup in Figure 2 2 and assume the MCU wants to send data to one of its slaves Slaves Figure 2 2 General PC communication on the bus First the MCU will issue a START condition This acts as an Attention signal to all of the connected devices All ICs on the bus will listen to the bus for incoming data 16 Then the MCU sends the ADDRESS of the device it wants to access along with an indication whether the access is a Read or Write operation Write in our example Having received the address all IC s will compare it with their own address If it doesn t match they simply wait until the bus is released by the stop condition see below If the address matches however the chip will produce a response called the ACKNOWLEDGE signal Once the MCU receives the acknowledge it can start transmitting or receiving DATA In our case the MCU will transmit data When all is done the MCU will issue the STOP condition This is a signal that the bus has been released and that the connected ICs may expect another transmission to start any moment 2 7 mikroC for PIC Figure 2 3 shows the view of mikroC for PIC mikroC software used in the project mikroC is a powerful feature rich development tool for PIC microcontrollers It provides a successful match featuring highly advanced IDE ANSI compliant compiler broad set of hardwa
17. ering Electrical Telecommunication Signature Gr nga Shama trues heat inns an ga Name of Supervisor PUAN FATIMAH BINTI MOHAMAD Date Panen tala REA RAN RN cesses WATER TEMPERATURE SENSOR AND AUTOMATIC FEEDER NODE FOR RECIRCULATING AOUACULTURE SYSTEM SITI HASUNAH BINTI MOHAMMAD A report submitted in partial fulfillment of the reguirements for the award of the degree of Bachelor of Engineering Electrical Telecommunication Faculty of Electrical Engineering Universiti Teknologi Malaysia APRIL 2010 ii I declare that this thesis entitled Water Temperature Sensor and Automatic Feeder Node for Recirculating Aquaculture System is the result of my own research except as cited in the references The thesis has not been accepted for any degree and is not concurrently submitted in candidature of any other degree Signature PG ahs na ena Ep BN BB gag Name SITI HASUNAH BINTI MOHAMMAD Date ANN an NN NN NN DAN Pn dias esas sald iii Dedicated in thankful appreciation for support encouragement and understandings to my beloved mother father brother sisters and friends iv ACKNOWLEDGEMENT Alhamdulillah Praise to Allah s w t as He guided me throughout my project for all the help and ways He showed me till the end My heartily gratitude goes to my supervisor Puan Fatimah binti Mohamad for the guidance and enthusiasm given throughout the progress of this project I would also like to express my apprecia
18. fectly fit for 40 pins 16F and 18F PIC SK40C comes with additional features a 2 x Programmable switch b 2 x LED indicator c Turn pin for crystal d LCD display optional e UART communication f USB on board The function of PIC could be easily utilized by directly plugging in the I O components in whatever way that is convenient to user It also has the UICOOA connector on board which can help user to start developing project right away using the programmer Figure 3 5 shows the top view of SK40C and Table 3 1 shows the function of the components labeled in Figure 3 5 Figure 3 5 Top view of SK40C Table 3 1 Function of the labeled components of SK40C Label Function A DC power adaptor socket USB connector Toggle switch for power supply Power indicator LED Connector for UICOOA programmer LED indicator Header pin and turn pin UART connector Programmable push button Reset button LCD contrast JP8 for LCD backlight JP9 for USB 40 pin IC socket for PIC MCU Turn pin for crystal PIOIAlILSIClAlLSl Hel aAlalamlmlolalo LCD display 23 The starter kit SK40C is soldered onto the strip board to make connection with other components required in the project The voltage which is input through DC power adapter socket labeled by A should be ranged from 7 to 15V The already on board voltage regulator then regulates the
19. fore no power supply is required making it a portable programmer 8 UICOOA is compatible with Microchip s PICkit 2 programming software used to load the HEX code into the PIC MCU 27 Figure 3 9 shows the connection of SK40C with UICOOA The USB cable is connected as mentioned above before continuing with the software installation for first time usage The software installer also comes with UICOOA package One side of programming cable is connected to box header of UICOOA and the other side to box header of SK40C to be programmed External power is used to supply SK40C because UICOOA cannot support large power usage Programming cable Figure 3 9 Connection of SK40C and UICOOA USB ICSP PIC programmer 3 2 4 Temperature Sensor LM35DZ LM35DZ is one of precision centigrade temperature sensors The LM35 series are precision integrated circuit temperature sensors whose output voltage is nearly proportional to the Celsius Centigrade temperature It does not require any 28 external calibration to provide typical accuracies of 4 C at room temperature and 34 C over a full 55 to 150 C temperature range The features of LM35DZ are as follows a b c d e f g h i k Calibrated directly in Celcius Centigrade Linear 10 0 mV C scale factor 0 5 C accuracy guaranteeable at 25 C Rated for full 55 to 150 C range Suitable for remote applications Low cost due to wafer level trimmin
20. g Operates from 4 to 30 volts Less than 60 UA current drain Low self heating 0 08 C in still air Nonlinearity only 44 C typical Low impedance output 0 1 Q for ImA load Figure 3 10 shows the physical dimension of LM35DZ It can be glued or cemented to a surface and its temperature will be within about 0 01 C of the surface temperature In this project the rainbow wire is used to connect the temperature sensor with PIC MCU on SK40C as shown in Figure 3 11 The pins of LM35DZ must not be connected to each other by covering each of them with insulated tape to avoid short circuited 29 feo PLAHE 2 28 MAX CUNCONTROLLED LEAD DIA 1 2710 05 254101 DIMENSIONS ARE IN MILLMETERS TOP VIEW TO 92 Plastic Package Z Order Number LM35CZ LM35CAZ or LM35DZ NS Package Number Z03A Figure 3 10 Physical dimension of LM35DZ Figure 3 11 Rainbow wire used to connect LM35DZ with PIC MCU on SK40C 30 To immerse this temperature sensor in the water it must be mounted inside a sealed end metal tube or screwed into a threaded hole in a tank Alternatively there are many ways to make LM35DZ water proof and one of them is to use an empty modified pen tube As with any IC the LM35DZ and accompanying wiring and circuits must be kept insulated and dry to avoid leakage and corrosion 3 2 5 Microcontroller PIC 18F452 The microcontroller acts like the brain of the water temperature sensor and automatic feeder node
21. gister which contains the bit definitions for Timer clock source oscillator enable control bit and Timerl prescaler select bits 2 5 2 5 ADCONDO register This register controls the operation of the A D module The bits in this register select the A D clock source one of eight analog channels and the A D status 2 5 2 6 ADCONI register Register ADCONI configures the function of the A D port pins and selects the A D format 2 6 Inter integrated Circuit TC PC is a multi master computer bus which uses only two bidirectional open drain lines Serial Data SDA and Serial Clock SCL More than one IC capable of initiating a data transfer can be connected to it The LC protocol specification states 15 that the IC that initiates a data transfer on the bus is considered the Bus Master Thus at that time all the other ICs are regarded to be Bus Slaves Typical voltages used are 5 V or 3 3 V The PC reference design has a 7 bit address space with 16 reserved addresses so a maximum of 112 nodes can communicate on the same bus Common PC bus speeds are the 100 kbit s standard mode and the 10 kbit s low speed mode but arbitrarily low clock frequencies are also allowed Every device hooked up to the bus has its own unique address no matter whether it is an MCU LCD driver memory or ASIC Each of these chips can act as a receiver and or transmitter depending on the functionality Obviously an LCD driver is only a rec
22. he main program to stop for five seconds before continuing it back after feeding is done The central controller has set up the timer so that the feeding will only takes five seconds This timing can be changed in the program source code CHAPTER 5 CONCLUSION AND RECOMMENDATION 5 1 Conclusion Fish farming in Recirculating Aquaculture System RAS is risky business where an ounce of prevention is a worthy and important consideration It is important to make sure that the whole system is properly controlled to minimize damage to the aquaculture Therefore the need in constructing improved technologies is high demand as human population increases especially for older adults who proportionally eat more fish than youth do The goal of this project is to provide suitable water condition for Recirculating Aquaculture System RAS The system would be well managed using PIC 18F452 microcontroller The system will make sure that the temperature of the water in the tank is monitored constantly and the automatic feeder would make sure regular fish feeding based on the time set by the central controller The communication between the central controller and the slave controller using PC is one of the ways to transfer the data between both controllers This kind 49 of communication is rarely used today but it can be more applied in the future for small range product and applications The prospects for RAS are encouraging A number
23. ing to Jacgues Esparza Adrian Lopez and Karla Montejano in their research entitled Microcontroller based Aquatic Ecosystem the level for temperature is between 72 to 82 F which is 22 to 28 C Fish feeding must be done once or twice daily with five minutes amount per feeding time The system would make sure that the level of temperature would be within this range Any insufficient level of that parameter would direct the system according to the flow in Figure 3 2 Figure 3 3 shows the picture of the project The project is divided into two parts which are hardware and software implementation Each part of the project will be discussed in the following section DC Power Adaptor Le Communication Link Figure 3 3 Picture of the project 21 3 2 Hardware Implementation This section will discuss about components that had been used in the project The components included Starter Kit SK40C LCD UICOOA USB ICSP PIC programmer temperature sensor LM35DZ microcontroller PIC 18F452 and rc communication link 32 1 Starter Kit SK40C Figure 3 4 Starter Kit SK40C Figure 3 4 shows the starter kit SK40C used in this project It is an enhanced 40 pins PIC microcontroller start up kit created by Cytron Technologies Sdn Bhd It 22 is designed to offer an easy to start board for PIC MCU user This board comes with basic element for user to begin project development 7 With dimension of 85mm x 55mm it is per
24. input channels POR BOR RESET Instruction Stack Full Stack Underflow Jai oeri POR BOR RESETS and Delays Stack Full Stack Underflow PWRT OST RESET Instruction POR BOR RESET Instruction Stack Full Stack Underflow PWRT POR BOR RESET Instruction Stack Full Stack Underflow Programmable Low Voltage Detect Programmable Brown outReset Yes Ys yes Instruction Set 75 Instructions 75 Instructions 75 Instructions 75 E 28 pin DIP 28 pin SOIC 28 pin DIP 28 pin SOIC 40 pin DIP 44 pin PLCC 44 pin TQFP 40 pin DIP 44 pin PLCC 44 pin TQFP 11 2 5 1 Pin Description of the PIC 18F452 Basically this microcontroller is a 40 pin device with the following pins MCLR Master clear input RB4 RB7 Bi directional port B pins Some of these pins are also used as programming pins RBO RB2 Bi directional port B pin Also external interrupt pin INTO INT2 RB3 CCP2 Bi directional port B pin Also Capture2 input Compare2 output PWM2 output MCLRIveP 1 40 O RB7 PGD RAQ ANO e 39 J e RB6 PGC RAVAN1 e 3 RBS PGM RA2 AN2 VREF e f 4 RB4 RASIANNVREF e H5 RB3 CCP2 RA4 TOCKI 16 RB2 INT2 RAS AN4 SS LVDIN e 7 Sa Seda RB1 INT1 REORD ANS wo gt RBO INTO REWUWRIANG 2 VDD RE2 CSIAN7 e co vss VDD r ND 7 RD7 PSP7
25. ion indicator RC2 17 Input Output pin Green LED 2 RC3 18 Serial clock SCL pe One communication link 5 2 RCA 23 Serial data SDA SDA pit DI communication link RC6 25 Input Output pin Buzzer Figure 3 12 shows the schematic circuit of microcontroller PIC 18F452 connected with added components other than components which are already on SK40C board see APPENDIX B for schematic circuit of SK40C At the beginning microcontroller will receive temperature value from LM35DZ through RAO of PIC 18F452 The detected temperature from LM35DZ will feedback to Red LED through RCO of PIC 18F452 The microcontroller will operate as was programmed detail program at section 3 3 1 to display the temperature value on the LCD for every two seconds and to switch on Yellow LED and buzzer during feeding time 32 D3 D1 D2 amp LED RED amp LED YELLOW G LED GREEN OSCIICLKI RCOTIOSOTICK MCLRIVPP RCI TIOSYCCP2A RC2 CCP1 RADIAN RC3 SCK SCL RATIAN1 RC4 SDISDA RA2IAN2 VREF RCS SDO RAWANZ VREF RCS TXICK RAA TOCKI RCTIRXIDT RASIAN4 SS LVDIN RAG OSCZICLKO RDO PSPO RD1 PSP1 RBOVINTO RD2 PSP2 RB1 NT1 RDXPSP3 RB2 INT2 RB3VCCP2B RDS PSP3 R84 RDE PSPs RESIPGM RD7 PSP7 RBE PGC a RB7 PGD REDRDIANS RE 1 WRIANG RE2ICSIANT Lah Pem ara Ps Joo Pm Pen Jen t ra feo ho f AH 92w ou cg gt gt gt Figure 3 12 Schematic circuit of PIC 18F452 connected with added components other than components which are already on SK40C board 3
26. kodkan Penurunan kualiti air akibat daripada suhu air dan masa memberi makanan yang tidak sesuai akan menyebabkan pengawal pusat menghantar arahan kepada mikropengawal untuk menghidupkan peranti yang dilambangkan dengan Diod Pemancar Cahaya LED Nod penderia suhu air dan pemberi makanan automatik yang dibina menggunakan mikropengawal ini berpotensi dalam meningkatkan efisiensi Sistem Akuakultur Kitar Semula CHAPTER TABLE OF CONTENT TITLE DECLARATION OF THESIS DEDICATION ACKNOWLEDGEMENT ABSTRACT ABTRAK TABLE OF CONTENT LIST OF TABLES LIST OF FIGURES LIST OF APPENDICES INTRODUCTION 1 1 Background 1 2 Objective of Project 1 3 Scope of Project 1 3 1 Investigation 1 3 2 Programming 1 3 3 Circuit design and simulation 1 3 4 Hardware implementation 1 4 Outline of Thesis 1 5 Summary of Works THEORY AND LITERATURE REVIEW 21 Introduction vii PAGE ii iii iv vi vii xi xiii A A U N N N KF 2 2 2 3 24 2 3 2 6 2al Recirculating Aquaculture System RAS Water Temperature Fish Feeding Microcontroller 2 5 1 2 3 2 Pin Description of the PIC 18F452 PIC 18F452 Registers 2521 OPTION REG register 250 2 INTCON register 2322 EECONI register 2 5 2 4 TICON register 2 5 2 5 ADCONO register 2 5 2 6 ADCON I register Inter integrated Circuit C mikroC for PIC 3 METHODOLOGY 3 1 3 2 3 3 Introduction Hardware Implementation 3 2 1 3 2 2 3 2 3 3 2 4 325 S
27. lly fish tanks are rectangular circular or oval in shape and the shape influences the easiness in cleaning and water circulation 2 3 Water Temperature It is known that water temperature is the strong influencer in water quality feeding and growth rates of cultured fish In order to maximize production water temperature must be controlled accurately The range of temperature for optimum aquaculture production depends on the species being cultured The larger the volume of the water the easier it is to control the temperature This is because high specific heat of water creates a high thermal mass that resists rapid changes in temperature Energy saving is one of the major advantages of RAS Once the water tank is heated to the optimal temperature for fish growth only a small amount of heat energy is required to maintain the temperature However heat loss from the building and from the water via evaporation splash out or waste water must be minimized to assure economic success 1 Heat can be provided by heating the air in the building or directly heating the water and by using heat exchanges 2 Directly heating the water requires expensive insulated tanks with lids that maintain the heat but slow down feeding and observation of the fish Alternatives such as solar heating and heat exchangers are being considered 2 4 Fish Feeding A complete feed containing all the essential minerals and vitamins for healthy fish growth
28. lso the SPI Data In and PC Data I O RC5 Bi directional port C pin Also SPI Data Out RC6 Bi directional port C pin Also USART asynchronous transmit or synchronous clock RC7 Bi directional port C pin Also USART asynchronous receive or synchronous data The amount of program memory provided by the PIC 18F452 should be sufficient for many temperature monitoring and control applications These applications also need large data memories since most of the operations use non integer floating point arithmetic requiring several bytes to store a single variable in the data memory 13 2 5 2 PIC 18F452 Registers The device has a large number of registers with many options and some of the important registers are described below 2 5 2 1 OPTION REG register This is a readable and writable register which contains various control bits to configure the Timer0 watchdog prescaler Timer0 clock source port B pull up enable bits and external interrupt edge trigger 2 5 2 2 INTCON register INTCON register is a readable and writable register contained various enable and flag bits for the Timer0 register port B interrupt enable bits peripheral interrupt enable bit and the global interrupt enable bit 2 5 2 3 EECONI register This is the EEPROM memory control register The register contains the enable bits for EEPROM write read enable and EEPROM error flag bits 14 2 5 2 4 TICON register This is the Timerl control re
29. my APPENDIX A 52 Suggested microcontrolled aquaculture system 2 Personal Computer or other laput Device Alarm LCD Display TE Ho Makeup Walter Temp DO pH Water Level Sensors Microcontroller Electrical relays 02 Injection APPENDIX B Schematic Circuit of Cytron SK40C Board 7 53
30. o Red LED on PORTC FO The procedures and the result will be discussed in the following sections 42 421 Procedures 1 The circuit board is connected 2 Voltage of 5V is supplied to the circuit 3 The LM35DZ is put into the cool water 4 The temperature value is recorded in Table 4 1 Red LED is observed and recorded in the same table 5 The temperature value is increased in steps of 2 C until 40 C and Step 4 is repeated 42 2 Experimental Result Analysis From the experiment the data was recorded in Table 4 1 Some pictures of experiment are shown in Figure 4 1 Figure 4 2 and Figure 4 3 Figure 4 1 Red LED lights on at water temperature of 18 C Figure 4 3 Red LED lights on at water temperature of 31 C 43 44 Table 4 1 Variation of water temperature effects to Red LED Temperature Value C Red LED Condition 14 On 16 On 18 On 20 On 22 Off 24 Off 26 Off 28 On 30 On 32 On 34 On 36 On 38 On 40 On From the experiment it is cleared that the Red LED will turn on when the temperature of the water is out of the required range for RAS During the experiment the Red LED took two seconds to change its condition when the temperature started to increase or decrease beyond the range This is due to the delay in the program The delay must be taken into account because human eyes cannot see the rapid changes in the temperature and Red LED wi
31. of experts believe that the future trend in the aguaculture industry is toward intensive fish farming In conclusion the water temperature sensor and automatic feeder node using microcontroller could be implemented to improve the efficiency of RAS 5 2 Problems The controller has been able to function as expected but sometimes the LCD cannot display the temperature clearly It is because of the soldering which is not fully covering the LCD pins The strip board can also cause the problems as sometimes it does not function well as a result of manufacturing Besides there is also a problem when the temperature is monitored It takes about two seconds for the Red LED to react when the temperature is out of range It makes the Red LED still lights on even though the temperature has return to its required level 5 3 50 Recommendation The system performance can be improved in the future to overcome the problems Some recommendations have been listed in order to improve the performance of the system il Hardware Improvement Use Printed Circuit Board PCB to replace the strip board for better performance of main components The hardware also can be reduced in size if PCB is used Create the circuit instead of using SK40C board because not all of the components on the board are used This also can help to reduce the size of the hardware The hardware also can be improved so its communication with the central controller is wi
32. oprocessor memory and I O The microprocessor consists of a central processing unit CPU ant the control unit CU Memory is the important part of a microcomputer system There are basically five types of memories a Random Access Memory RAM b Read Only Memory ROM c Erasable Programmable Read Only Memory EPROM 10 d Electrically Erasable Programmable Read Only Memory EEPROM e Flash EEPROM The PIC families of microcontrollers are developed by Microchip Technology Inc PIC microcontrollers have simple architectures and there are many versions of them some with only small enhancements and some offering more features In this project the microcontroller used is PIC 18F452 please refer Figure 6 in Appendices for PIC 18F452 block diagram microcontroller are as stated in Table 2 1 Key features of this Table 2 1 Key features of PIC 18F452 compared to other PIC microcontrollers Features PIC18F242 PIC18F252 PIC18F442 PIC18F452 Operating Frequency DC 40 MHz DC 40 MHz DC 40 MHz DC 40 MHz Program Memory Bytes 32K 16K Program Memory Instructions 8192 16384 8192 16384 Data Memory Bytes 1536 768 1536 mes a TCT f a MSSP Addressable USART MSSP Addressable USART Serial Communications MSSP Addressable USART MSSP Addressable USART Paralel Communications J Pe psp 10 bit Analog to Digital Module 5 input channels Sinputchannels 8 input channels 8
33. re 3 17 shows the Timer1 block diagram which operate in timer mode The TMRI Register pair TMR1H TMRIL increments from 0000h to FFFFh decimal from 0 to 65535 and rolls over to 0000h The TMRI Interrupt if enabled is generated on overflow which is latched in interrupt flag bit TMRIIF PIR1 lt 0 gt This interrupt can be enabled disabled by setting clearing TMR1 enable bit TMRIIE PIE lt 0 gt Timer mode is selected by clearing the TMRICS T1CON lt 1 gt bit In this mode the input clock to the timer is Fosc 4 When Timer increases from 0000h to FFFFh it takes 65535 cycles and the time consumed is given by t 65535 0 x 13 107 ms 20 MHz 4 39 TMR1IF CCP Special Event Trigger Overfiow Interrupt TMR1 Synchronized Flag Bit CLR p Clock Input TMRIH TMRIL L TMR1ON TT 2 On Off TISYNC Internal Clock TICKIT10S0 mose gt 1 x gt VW iv tTIOSCEN Preacaler Synchronize Tiosi Enable Fosc 4 1 2 4 8 Fiet Oscillator J L ol Ml oc SLEEP Input T1CKPS1 T1CKPSO TMR1ICS Note 1 When enable bit T1OSCEN is cleared the inverter and feedback resistor are turned off This eliminates power drain Figure 3 17 Timer block diagram d Temperature Reading Temperature read from LM35DZ is analog input through port RAO of PIC 18F452 This analog input must be converted first into digital input so the actual temperature can be displayed on LCD For analog digital temperature conversion
34. re libraries comprehensive documentation and plenty of ready to run examples Cc mikroC compiler for PIC ile Edit View Project Debugger Run Tools Help De BeBe es san B Code Explorer QHelp Keyboard t Functions global helados Code Explorer Code Editor Project Setup Project Summary Device P18F452 v i Messages JJ Find GJ Convertor Line Column Message No Message Text Unit 100 Success Release Build 101 Used ROM 4558 132 Used RAM 147 92 102 Free ROM 28209 87 Free RAM 1364 912 C Documents and Settings Sunah Mohammad My Documents STUDY SEM LASTIPSM 1 PSM 2 LCD LCDTes Figure 2 3 mikroC for PIC software mikroC allows quick development and deployment of complex applications It enables C source code writing using highly advanced Code Editor The included mikroC libraries could be used to speed up the development of data acquisition memory displays conversions and communications Code Explorer helps user to monitor the program structure variables and functions Any programmers could be used to generate the commented human readable assembly and standard HEX Plenty of examples are also provided to be expanded developed and used as building bricks in user s projects 6 CHAPTER 3 METHODOLOGY 3 1 Introduction In this project microcontroller will be used as the controller to control the temperature sensor and feeder node The block diagram of the system
35. reless if larger farm is to be built It is suggested to change the LEDs to real devices where cooler and heater are used to replace Red LED and real feeder is used to replace Yellow LED Relays can be used to manage these devices Software Improvement It is suggested that Graphical User Interface GUI is built for user to record the temperature value in a computer as a reference for future research The feeding also can be set up in GUI saving energy and time for the workers if it is connected wirelessly to the hardware The use of Xbee helps in implementing this improvement 51 REFERENCES Louis A H and George L Fish farming in Recirculating Aquaculture Systems RAS Department of Fisheries and Wildlife Sciences Virginia Tech unpublished P Fowler D Baird R Bucklin S Yerlan C Watson and F Chapman 1994 Microcontrollers in Recirculating Aquaculture Systems University of Florida 1 7 Dogan I 2002 Microcontroller Based Temperature Monitoring and Control USA Newnes 1 24 Dogan I 2001 PIC Basic Programming and Projects USA Newnes John Morton 2007 The PIC Microcontroller Your Personal Introductory Course 3 edition USA Newnes mikroElektronika 2006 mikroC Making it simple User s manual www mikroe com Cytron Technologies 2009 SK40C User s Manual V1 0 www cytron com my Cytron Technologies 2009 UICOOA USB ICSP PIC Programmer V1 8 www cytron com
36. tarter Kit SK40C Liquid Crystal Display JHD 162A UICOOA USB ICSP PIC Programmer Temperature Sensor LM35DZ Microcontroller PIC 18F452 3251 IC Communication Software Implementation 3 3 1 Algorithm and Programming in mikroC for PIC 3 3 1 1 Processing Explanation of Microcontroller Program 4 RESULT AND DISCUSSION 4 1 4 2 Introduction Experiment Study on Variation of Water oOo Oo NN 13 13 13 14 14 14 14 16 18 21 21 23 25 27 30 32 34 34 35 41 41 viii 4 3 Temperature Effects to Red LED of Recirculating Aguaculture System 4 2 1 Procedures 4 2 2 Experimental Result Analysis Experiment Study on Feeding Time Control of Recirculating Aquaculture System 43 1 Procedures 4 3 2 Experimental Result Analysis 5 CONCLUSION AND RECOMMENDATION 5 1 5 2 5 3 REFERENCES APPENDICES Conclusion Problems Recommendation 42 42 45 45 45 48 49 50 51 52 ix TABLE 1 1 1 2 2 1 3 1 3 2 3 3 3 4 4 1 4 2 LIST OF TABLES TITLE Gantt chart of the project schedule for semester 1 Gantt chart of the project schedule for semester 2 Key features of PIC 18F452 compared to other PIC microcontroller Function of the labeled components of SK40C Pin connection of LCD JHD 162A Function of labeled components of UICOOA Pin connection of PIC 18F452 in the project Variation of water temperature effects to Red LED Feeding controller mechanism of RAS
37. the function used is ADC Read from RAO x 100 1023 5 tempbuf f The function is valid for supply voltage Vpp 5V The temperature for this project will varied between 0 5V where in digital value is 0 1023 The microcontroller will check whether the temperature is in the range of 22 28 C If the temperature value is under 22 C 45 in digital or above 28 C 57 in digital PORTC FO will be set to 1 which will switch on the Red LED The temperature in range will turn the Red LED off 40 e Feeding Function Interrupt This is the interrupt part of the program Feeding would only start operating when the microcontroller detects feederflag OXAB When it receives the data from the central controller using PC communication link to start the feeding the feederflag will automatically turn to 0 The LCD will display the word Feeding on the first row while the buzzer PORTC F6 and Yellow LED PORTC F1 will switch on The process will then return to the beginning of the loop CHAPTER 4 RESULT AND DISCUSSION 41 Introduction Some experiment and data collection are done at each temperature of water temperature sensor and automatic feeder node for Recirculating Aguaculture System to observe the ability of the system 42 Experiment Study on Variation of Water Temperature Effects to Red LED of Recirculating Aguaculture System An experiment is conducted to study the effects of varied water temperature t
38. thout it 45 4 3 Experiment Study on Feeding Time Control of Recirculating Aquaculture System An experiment is conducted to study the mechanism of fish feeding controller The main components in this experiment are central controller TC communication link Yellow LED buzzer and LCD The procedures and result will be discussed in the following sections 431 Procedures 1 The circuit board is connected 2 Initial condition of LCD display buzzer and Yellow LED is observed 3 The option to send the instruction to feeder node at central controller is clicked 4 The change in LCD display buzzer and Yellow LED is observed and recorded in Table 4 2 5 Red LED and Green LED are also observed and the change is recorded in Table 4 2 4 3 2 Experimental Result Analysis From the experiment the data was recorded in Table 4 2 Some pictures of experiment are shown in Figure 4 4 and Figure 4 5 Table 4 2 Feeding controller mechanism of RAS 46 Yellow Red Green LCD Display LED LED LED Buzzer Initial 5 es Condition Temperature 31 C Off On Blinking Off During na Feeding Feeding On Off Blinking On Figure 4 5 LCD and LEDs condition during fish feeding 47 From the experiment there are changes in LCD display buzzer and LEDs condition before and during feeding It is observed that the Red LED and buzzer are switched off during feeding The interrupt program caused t
39. tion to my family who has been so tolerant and supports me all these years Thanks for their encouragement love and emotional supports that they had given to me Thanks also to my fellow team members Faiz Asraf Ezla Najwa and Abdul Azim for being co operated project members The help and support provided throughout the progress are very precious and appreciated Nevertheless my great appreciation dedicated to my best friends Irdinians Miss J Hafiz Shin Shishio Yazif Nuzrul Fazli Kal Syahid Fath Aidil and SET member s batch 2006 and those who are involved directly or indirectly with this project There is no such meaningful word than Thank You So Much May Allah bless you ABSTRACT Rearing saltwater aguaculture indoor has becoming familiar these days Indoor means that the fish tanks would be inside a building instead of in the sea or outside ponds When farming fishes indoor many parameters must be considered to maintain the water quality For example the water temperature water salinity dissolved oxygen and pH must be properly controlled The time to feed the fishes also should be regularly monitored as they cannot find food for themselves like in the sea This project is constructed to provide a well managed water quality and feeding time for Recirculating Aquaculture System RAS The project uses PIC 18F452 microcontroller as the main brain of the system This microcontroller exchanges the analog and digital
40. ual connection using jumpers on strip board is preferred in this project as shown in Figure 3 7 The brightness of the display can be controlled by using potentiometer In this project the potentiometer used is variable resistor B10K S Brightness Ef Control Figure 3 7 LCD connection on project stripboard 3 2 3 UICOOA USB ICSP PIC Programmer Figure 3 8 shows the UICOOA USB ICSP PIC programmer built by Cytron Technologies Sdn Bhd with the components labeled function in Table 3 3 The programmer is designed to program popular Flash PIC MCU which includes PIC12F PIC16F and PICI8F family On board In Circuit Serial Programming ICSP connector offers flexible method to load program On board programming 26 helps eliminates the frustration of plug in and plug out of PIC MCU so the source code can be guickly programmed and debugged while the target PIC is on the development board A B Figure 3 8 UICOOA top view Table 3 3 Function of labelled components of UICOOA Label Function A Mini USB port socket Switch to initiate write device programming Main power supply indicator LED green Busy indicator LED red IDC Box Header for programming connector wI alw Mini USB socket at A is for USB connections to PC desktop or laptop Mini header of USB cable that comes with UICOOA package must be connected to this socket UICOOA obtained its power directly from USB connection There
41. ware implementation mikroC for PIC is used to program the microcontroller in C language 3 3 1 Algorithm and Programming in mikroC for PIC Microcontroller acts as a brain of the whole water temperature sensor and automatic feeder node for recirculating aquaculture system It will sense the temperature from LM35DZ through RAO pin of PIC 18F452 The current temperature will be compared with the required water temperature of RAS which is in between 22 to 28 C If the temperature is out of this range the microcontroller will instruct the Red LED to switch on through RCO pin of PIC 18F452 An algorithm has to be developed to make the microcontroller to read the input and respond accordingly Therefore the algorithm is established and represented by flow charts in Figure 3 14 and Figure 3 15 These flow charts are then translated into C language and compiled using mikroC for PIC the PIC 18F452 software development tool There are two parts of the program which are main program and interrupt program The microcontroller will always run the main program until there is an interrupt occurred When microcontroller receives an interrupt flag then it will jump to interrupt process 35 Initialization Initialize PORT Initialize LCD Initialize PC Initialize TIMERI in timer mode Set up timer Obtain temperature Na from LM35DZ at PORTA 0 Yes Is temperature in range 22 28 C Yes Red LED 0 Sen

Download Pdf Manuals

image

Related Search

Related Contents

MOGA Pocket FAQ & Troubleshooting Guide  Manuale Manager RevD..  Intel® Education Content Access Point  Cooler Master Eisberg Prestige Solo  

Copyright © All rights reserved.
Failed to retrieve file