Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 SIM UNIVERSITY SCHOOL OF ELECTRONICS Design of Single Axis Solar Tracking System STUDENT : FOO SEY YAU (PI NO. Q0300044) SUPERVISOR : MR CHANDRAN AYYANARAPPAN PROJECT CODE : JAN09/BEHE/06 A project report submitted to SIM University in partial fulfilment of the requirements for the degree of Bachelor of Engineering NOV 2009 I Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 ACKNOWLEDGEMENTS This Thesis submitted as part of Final Year Project, was completed with appreciation to the generous collaboration and support from one person. He enabled the author to learn more than the scholastic aspects of the project and developed various skills. The author would like to acknowledge his supervisor, Mr. Chandran for his kind assistance throughout the year and help in defining the thesis. His recommendations and support have provided me with valuable insights and great improvement on my project. II Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 TABLE OF CONTENTS ACKNOWLEDGMENTS LIST OF FIGURES LIST OF TABLES ABSTRACT II V VI VII 1. INTRODUCTION 01 1.1 1.2 1.3 1.4 PROJECT OBJECTIVE OVERALL OBJECTIVE APPROACHES AND METHODS TO BE EMPLOYED 1.3.1 Project requirement 1.3.2 Project Planning 1.3.3 Project conclusion SKILLS REVIEW 1.4.1 Projects targets and criteria 1.4.2 Skills identifications 2. INVESTIGATION OF PROJECT BACKGROUND 2.1 MOTIVATION FOR THE RESEARCH 2.2 PROJECT BACKGROUND 2.2.1 Properties of solar cell 2.2.2 Different types of silicon solar cells 2.3 MOTORS REVIEW 2.4 SENSORS REVIEW 2.5 POSITION OF SOLAR PANEL VERSUS POWER 3. METHODOLOGIES AND DESIGN 3.1 INTRODUCTION 3.2 HARDWARE SELECTION 3.2.1 Choice of sensors 3.2.2 Choice of motors and motor drivers 3.2.3 Choice of Microcontroller chip 3.2.4 Voltage regulation 3.2.5 Choice of Axis 3.2.6 Solar battery charger III 01 01 02 02 03 04 05 06 06 09 09 09 10 13 14 15 15 16 16 17 18 19 20 20 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 3.3 SOFTWARE SELECTION 3.3.1 Choice of programming language and compiler 3.3.2 PIC programmer 3.3.3 Programmer software 3.2.4 Outline of the system 3.2.5 Automatic alignment 3.2.6 Manual alignment 23 23 25 31 33 34 35 4. DESIGN ANALYSIS 4.1 INTRODUCTION 4.2 UNEXPECTED PROBLEMS WITH THE DESIGN 4.3 RESULTS OF COMPLETED DESIGN 38 38 38 39 5. CONCLUSION 5.1 INTRODUCTION 5.2 CONCLUSIONS REGARDING THE SYSTEM 5.3 APPLICATIONS FOR THE SYSTEM 5.4 AREAS OF FURTHER RESEARCH 41 41 41 41 42 BIBLIOGRAPHY 43 APPENDICES: APPENDIX A: PIC16F84A PINOUT DESCRIPTION APPENDIX B: UCN5804B DATASHEET APPENDIX C: SCHEMATIC DIAGRAM APPENDIX D: SOURCE CODE 44 44 45 46 47 IV Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 LIST OF FIGURES Figure 2.01: Single-axis solar-tracker Figure 2.02: Double-axis solar-tracker Figure 2.03: Full-step, bipolar drive Figure 2.04: Half-step, Uipolar drive Figure 3.01: Block diagram Figure 3.02: LDR sensor Figure 3.03: LDR setup Figure 3.04: Stepper-Motor Figure 3.05: Motor with circuitry Figure 3.06: Stepper motor with limit switch Figure 3.07: PIC16F84A Figure 3.08: PIC16F84A external-component Figure 3.09: LM7805 voltage regulator Figure 3.10: LM317T Figure 3.11: Solar-batter-charger Figure 3.12: Diode Figure 3.13: LED Figure 3.14: Current-limited-solar-batter-charger Figure 3.15: Programming Figure 3.16: PIC-basic-Pro Figure 3.17: Vdd/Vss Figure 3.18: Vpp/MCLR Figure 3.19: Clock/data Figure 3.20: Clock/data Figure 3.21: ICSP Figure 3.22:JDM2-components Figure 3.23: RS232 Figure 3.24: Complete-JDM2 Figure 3.25: JDM2-schematic Figure 3.26: Transistor-pin-configuration Figure 3.27: WinPic800 Figure 3.28: Real-time-programming Figure 3.29: Flow-chart Figure 3.30: LCD showing LDR reading Figure 3.31: NOT-gate Figure 3.32: AND-gate Figure 3.33: Manual drive sequence Figure 3.34: Pull-up-resistor Figure 3.35: 3PDT-toggle-switch Figure 3.36: 3PDT-connections Figure 3.37: Toggle switch and Push button Figure 4.01: Modular sections of system Figure 4.02: Different-points-on-solar-panel Figure 4.03: Chart-of-voltages-on-different-points-on-solar-panel V 07 08 12 12 15 16 16 17 18 18 18 19 19 21 21 22 22 22 23 24 25 26 27 27 28 29 29 30 30 31 31 32 33 34 35 35 36 36 36 37 37 38 39 39 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 LIST OF TABLES Table 1.1: Gantt-chart Table 2.1: Silicon-solar-cell Table 2.2: Voltage-received-at-various-angles-of-incident Table 3.1: Current-Vs-Resistance Table 3.1: DB-9 Pin-table Table 4.1: Voltages-received-at-various-positions-on-panel VI 03 09 14 21 30 40 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 ABSTRACT To develop and design of a Microcontroller Unit (MCU) based solar tracker system with a single-axis of freedom. Solar tracker system is a hybrid of hardware and software prototype that automatically provides best alignment of solar panel with the sun so as to get optimum output. A single-axis automatic controlled solar tracker to follow the position of the sun is designed and developed. According to the direction of beam propagation of sun’s radiation the solar tracker is able to track solar Photovoltaic (PV) panels. This complete tracking system will consists of sensors, motor with control circuitry, MCU with control software and PV panel mounted on chassis. This tracker can only rotate the panels from East to West axis and vice versa. This tracker system is operated automatically through a software programmed single chip MCU. These components that are used in the system are easily available, which are inexpensive and its simple design with its optimum solar output collecting capability makes it even more beneficial. Therefore we can conclude that, the solar tracking system is a flexible system which is inexpensive but high in efficiency for trapping the sun’s incident energy. VII Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 1. Introduction 1.1 PROJECT OBJECTIVE Since the position of the sun changes both with seasons and the time of day, therefore a solar tracker is needed so that it will detects the position where sunlight is strongest. Solar powered equipment works best when pointed at or near the sun, meaning that we can increase the effectiveness of a solar system by ensuring that the sun ray will always fall perpendicular to the solar panel at any fixed position. The objective of the project aims to design an economic software based single-axis solar tracking system using both software and electromechanical mechanism that is software controlled. 1.2 OVERALL OBJECTIVE Due to the depletion of fossil fuel and environmental protection issues, PV technology is rapidly expanding as it offers safe and clean energy sources. Solar panel is the fundamental energy conversion component of PV systems. Since the geographic location of Singapore is near to the Equator, there is an abundance of solar energy throughout the year. Furthermore solar energy is inexhaustible, free and non-polluting which justifies why it is the most ideal source for generating electricity. Literature review suggested that solar panels could achieve maximum illumination and energy concentration if the panels are at all times perpendicular to the sun position. However, the direction of the sunlight changes throughout the day from East to West, direction also changes frequently with varying weather and seasons. Conventionally, solar panels are fixed in a position to utilize the sun’s incident energy, unable to rotate to follow the sun, hence limiting their area of exposure to the sun. Therefore the solar energy collected by the convention solar panel is most of the time not maximized. Understand that generating electricity by convention solar panel is inefficient, so our overall project objective focuses on how to increase its efficiency. To maximize the amount of sunlight falling on solar panels, we are going to design a solar tracker system. Objective of this project is to design and develop software based solar tracker with a single degree of freedom, achieved by using light sensor tracking method and mechanical control system. This system is able to achieve the optimum energy concentration and illumination and thus reduces the number of solar panels required. Therefore, it has great significance for research and development. 1 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 1.3 APPROACHES AND METHODS EMPLOYED 1.3.1 PROJECT REQUIREMENT Basically, the sun tracker that will be built has to be of moderate size and most importantly it has to be relatively cheap. Firstly, the prototype requires solar cells panel for the collection of solar energy. The prototype will also need 2 light sensors which will be mounted on plastic or metal sheet about 2” apart with vertical 4” opaque barrier between them. When the sun beam is directly perpendicular to both sensors, they will produce the same resistance. However, once the sun moves from East to West during the day, the vertical barrier will form a shadow that will fall on one of the light sensors. In this case we are using Light Dependant Resistor (LDR) as the light sensor, this imbalance will cause a difference in resistance which will be detected by a software base MCU and in turns driving a motor to turn either clockwise or counter clockwise to reposition the solar cells panel, so to ensure the solar panel is always perpendicular to the sun. 2 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 1.3.2 PROJECT PLANNING Gantt chart Table1.1: Gantt-chart 3 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 The above Gantt chart was created to establish my project plan and also assist me in monitoring my project progress. Due to time constraint, the schedule of this project plan has to be followed closely for the project to progress smoothly throughout the year. In the planning phase, it permits me to consider how long I need to focus between individual tasks. It can be seen from the Gantt chart that individual tasks to be carried out are arrange in order. In the monitoring phase, the Gantt chart permits me to perceive what task should have been completed against the planed time. This will certainly help me in managing the progress of my project such as purchasing parts, programming of software, testing of hardware/software parts till the completion of the final year report and project submission. Since the nature of the project is dynamic therefore the schedule project plan must not be a rigid one. Should there be any unexpected problems; the schedule will be amended in order to bring the project back on track. The 3 areas which are very essential in the development of the project are research & analysis, design & development and evaluation. All of these were carefully planned in the Gantt chart. The research information that I gather includes online web resources, reference book from National libraries and journals. Since this is not a funded project, all expenses including the hardware components and software kit will be solely borne by me. Therefore budget is another issue that I need to take into consideration. As for the prototype requirements, I need to study and understand more from the actual product perspectives. This can be done easier if hardware & software parts are broken down into modular sections. Hardware parts that are match with the technical specs and meet the cost budget will be considered. Selection of suitable software is also essential, it must be compatible with the hardware and simple to configure. 1.3.3 PROJECT CONCLUSION After much research and review the draft of the final project has come to an end. Low cost, design simplicity and material readily available in market will make the project easier with constraint time. However this is totally based on analysis and research, hard work such as planning, trouble shooting and testing is needed in order for the end product to work. 4 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 1.4 Skills Review 1.4.1 Project targets and Criteria Below points denote the criteria that I have chosen to evaluate and follow closely throughout the whole project: 1) 2) 3) 4) 5) 6) To understand the fundamental principles of photovoltaic To understand the performance and structures of different types of stepper motors To understand the operational principle of light sensors To understand the structure and operation of voltage regulator Collect data and analyze on the programme to be used Compare different type of MCU and select the best choice 1.4.2 Skills identifications Skills needed in this project are basically survey and analysis, hardware and circuit design, programming, testing and trouble-shooting. During the intensive research done on this project, I had acquired substantial knowledge regarding this field. As for the hardware part, skills are needed in term of putting different modules of electromechanical mechanism to work together. The skills of writing software to control the whole system is also very critical, it enables the simplicity of the design. Troubleshooting and analytical skills are also critical in both hardware and software. 5 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 2 Investigation of Project Background 2.1 Motivation for the Research Solar energy has been used for the past few decades until now and surely in the future especially with the depletion of the natural resources. However before it can be used as the world’s alternative source of energy, we have to increase the efficiency of the solar cells. There are quite a number of ways to increase the efficiency; one way is to increase the size of the array but this is not very feasible due to their large size and weight. Other way is to increase the performance of the cell itself either by increasing the efficiency of the cell or by increasing the amount of the sun illumination falling on solar cell. However for the past few decades the improvement in the efficiency of the cell has not progressed substantially, therefore it is more beneficial and feasible to increase the amount of the sun illumination falling on solar cell. Below are the few methods that can be applied to increase the amount of solar energy collect by a solar cell. By choosing a fixed angle panel that can gives the best energy for the day By rotating the panel at a predetermined period distributed over the day By a dynamic panel tracking the sun’s location using a sensory tracking system Fix position method This is the least efficient method among the three, as it does not take the rotation of the sun into consideration. Since the sun keeps changing its position throughout the day therefore sun power collect on the panel cannot be maximize. Predetermined control method This second method typically rotates the panels towards the sun throughout the day. This can be done by using a programmed timer, rotating the panel at a predetermined time distributed over the day. Although this method has improved the efficiency, there are still some drawbacks as it does not take into consideration whereby the sun is block by the cloud. 6 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 Dynamic method The last method which is the dynamic method is apparently the best. It is a tracking system that actually tracks the strongest position of the sun based on some sensory input. Meaning that output of the light sensors actually gives a signal to the system, either turning clockwise or counter clockwise depends on the location of the sun. Generally, the dynamic method can be further classified into a few different kinds. The two most common ones are the single-axis and double-axis solar tracking system. Single-axis tracker is a single motor system that sets in one axis and tracks the daily movement of the sun in the other axis. Normally, the single-axis tracker only tracks the path of the sun from East to West and also reverse direction. Figure2.01: Single-axis-solar-tracker (http://www.solar-tracking.com) Advantages of single-axis: More stable system Simpler mechanical system Rotation angle can be easily adjusted Energy needed for the mechanical movements is lesser More economical due to lesser materials Disadvantages of single-axis: Cannot rotate to all directions Receives slightly less energy than maximum[7] 7 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 The main difference between single and double-axis tracker is that the latter can tracks the sun with varying weather and changing altitude. Usually this tracking system uses two motors to keep the sun perpendicular to the centre of the four light detecting sensors. The first motor is used to control the tilt of the panel, while the other motor controls the rotation of the panel. Double-axis tracker tracks the sun both North to South and East to West for additional sun energy. Figure2.02: Double-axis-solar-tracker (http://www.solar-tracking.com) Advantages of double axis: More robust system Receives maximum daytime energy. Can rotate to all directions Disadvantages of double axis: Complex system requiring rotation to be more complicated The adjustment of the panel involves complex mathematical algorithm Higher material cost Higher maintenance requirement Life span of the system is reduced due to complex mechanical movements Extra material is needed [7] 8 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 2.2 Project Background 2.2.1 Properties of solar cell Currently, Photovoltaic (PV) cell is the most efficient method of converting solar energy into usable resources which is the electricity. The term PV literally means light-voltage, which is to produce electricity when exposed to light. Basically solar cell can be made-up from a variety of semiconductor materials. Currently the most commonly used semiconductor material is silicon. Single p-n junction silicon cell is the most popular cell in mass manufactured with efficiency up to about 16.8% [1]. Basically the cell consists of a thin heavily n-doped top layer and a fairly p-doped base substrate. A plain metal layer on the back and thin metal contacts on the surface connect the photovoltaic element to the load. Then the cells will be wired either in parallel or in series to get electrical currents and voltages. PV effect is a process whereby light energy is converted into electrical energy by solar cell. The process start when light is fallen on the 2-layered semiconductor material and creates a voltage (Potential Difference) between them. Once sunlight is illuminated on the p-n junction silicon cell, electron-hole pairs with energy greater than the semiconductor band-gap energy will be created by the photons. The electric field will then pushes the holes to one side and the electrons to another, thus moving the charge carriers. The electrons can flow from the n-layer via the circuit and then back to the player if an external circuit is been attached. The charged carriers would simply collect at the ends of the cell if there is no external circuit. [6]. Electrons will flow from the external circuit to the rear contact of the solar cell and then back to the electric filed. 2.2.2 Different types of silicon solar cell Generally there are a number of different types of solar cell available, the most common types are Polycrystalline, Monocrystalline and Thin film. Comparisons of 3 different types of silicon solar cell efficiencies are shown below. More solar cells are needed for the same electricity output if its efficiency is lower. Efficiency here means output electrical energy of the solar cell over the input of the light energy into the cell. Table2.1: Silicon-soar-cell 9 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 2.3 Motors review Introduction All solar tracking systems need motor to control the position of the panel and a motor control circuit to direct it. Below sections will discuss about various types of motors that can be used for this kind of function. DC motors 3 commonly used DC motors are the series motor, shunt motor, and the compound motor. DC voltage is directly applied to the motor field winding and brushes. The field and the armature of the motors are both shown as a coil of wire. A field resistor will be placed in series with the field to control the speed of the motor. When DC voltage is applied, current will flows through the field coil from the negative terminal to the positive terminal. Finally, the current will return to the DC power source. The polarity of the armature switch will then meets with the location of the armature's magnetic field. In order for the armature to not lock up magnetically with the field, the switching action is timed. The magnetic fields will then build on each other and provide extra torque to maintain the motor shaft rotating. When the motor’s voltage is de-energized, the magnetic fields in the armature and the field winding will diminish and the armature shaft's speed will eventually reduce to zero. When voltage is applied to the motor once more, this will strengthen the magnetic fields and the armature will start to rotate again. Servo motors A servomotor is an assembly of a DC motor, a position-sensing device normally a potentiometer, a gear reduction unit, and a control circuit. Its shaft can be positioned to certain angular positions once it receives a coded signal. The servo will maintain the angular position of the shaft so long as the coded signal exists at the input signal. The angular position of the shaft changes once the coded signal changes. A servo has built in control circuitry and a potentiometer which is very important. The distance which a servo needs to travel is equivalent to the amount of power applied. Hence if the shaft requires turning at a larger distance, the motor will run at optimum speed. However, if it requires turning at a smaller amount, the motor will run at a slower speed. The main disadvantage of servo motors is that it requires to be modified for continuous rotation and also shaft encoders are needed. 10 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 Stepper motors In order for the stepper motors to move in steps, pulse trains of varying polarity must first be sent to its multiple windings. The direction of the motor is determined by the phasing between the pulses being applied to the multiple windings while the speed of the motor is determined by the frequency of the pulses. Therefore it is more precise control than DC motors but requires more complex circuitry. Permanent magnet stepper motors There are a number of stepper motors available and the most common type is the Permanent-Magnet stepper. It has a permanent magnet in the form of a rotor magnetized in alternate polarity "stripes" parallel to the rotor shaft. The step size of a given motor is entirely a function of the angular "width" of these magnetized stripes, ranging from 7.5 to 30 degrees. The Permanent-Magnet stepper will then run into two different wiring configurations, Unipolar and Bipolar. Unipolar drive supplies a ‘+ ‘positive and’ –‘negative alternating magnetic flux to the windings developed from a pair of ‘+’ square waves applied to opposite ends of centre-tapped windings. Bipolar drive is square waves alternating between ‘+’ and ‘-‘polarities. [3] [4] Unipolar stepper motors They are straightforward to control, able to generate stepping sequence just by using a simple counter circuit. They normally have 6 leads, in 2 triplets, every triplet powering up1 winding with a centre tap. However there are some with only 5 leads where the 2 "common" leads (centre taps) are connected internally. Normally Unipolar motors are controlled by using its centre taps as a common point, to reverse coil polarity simply by switching its drive voltage from one end of the winding to the other. Bipolar stepper motors They are constructed with exactly the same mechanism as used on the Unipolar. They normally have 4 leads in 2 pairs, every pair powering up 1 winding. To rotate the motor, we need to provide the 2 windings with a phase shifted pulse trains. They are simpler than the Unipolar but their drive circuitry needed to reverse the polarity of each pair of motor poles is more complicated. [5] 11 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 Full step drive It provides more torque since both coils are energized concurrently. In the process the rotor poles are attracted between the midway of the two field poles. Figure below shows a full step bipolar drive. Figure2.03: Full-step, bipolar drive On the other hand, Unipolar drive will need a pair of Unipolar waveforms for each of the above bipolar waveforms supply to the ends of a centre tapped winding. Unipolar drive uses a less complicated and cheaper driver circuit. [4] Half step drive Step angle of the stepper motor geometry is reduced to a half step drive. Meaning there will be twice as much of step pulses per revolution. Literally, half stepping offers better degree in positioning of the motor shaft. Figure below shows a Unipolar waveforms for half step drive. [4] Figure2.04: Half-step, Uipolar drive 12 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 2.4 Sensors review Another key module in this project is the light sensor, therefore a suitable and effective sensor must be chosen. Light sensors are passive devices that convert light energy into an electrical signal output. A few common types are Light Dependant Resistor (LDR), the Phototransistor and Solar Cell. The Light Dependant Resistor The LDR is a resistive light sensor that varies its electrical resistance from few thousand Ohms in the dark to only a several hundred Ohms when light falls on it. This means that an increase in illumination causes a decrease in resistance. The most commonly use materials for LDR is Cadmium Sulphide (Cds), since its spectral response curve very much matches our eyes and can be controlled easily by light source from a torch. Photo-junction Devices Photo-junction Devices are PN-Junction light sensors made from silicon semiconductors that can detect both visible light and infrared light. Examples of Photo-junction Devices light sensors are Photodiode and the Phototransistor. Photodiode The outer casing of the Photodiode is transparent so that light can fall on the junction. When light fall on the junction more electron pairs are formed thus causing the leakage current to increase. Light intensity is directly proportional to Photodiode’s current Phototransistor Phototransistor is basically a photodiode with amplification and operates by exposing its base region to the light source. Operations of Phototransistors are similar to Photodiodes except that they are more sensitive and can provide current gain. Photovoltaic Cells Solar Cell is the most common type of photovoltaic light sensor that converts light energy directly into electrical energy into current or voltage form. Single solar cell can be tied together in parallel to increase its current or in series to form solar panels that increases its output voltage. [1] 13 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 2.5 Position of Solar Panel versus Power By theory the maximum value of the voltage obtained from the solar panel is when the panel is perpendicular to the sun incident ray. To prove this theory experimentally, a static high power 1W LED light source is used to shine light onto a 15V solar panel. The experiment was tested out in a dark room so that no other light source would affect the results. The solar panel is positioned in a way that the angle of incidence of the light was between 0 to 90 degrees. Below table shows the data collected for this test. By looking at the data, it is proven that maximum voltage is obtained when the angle of incidence is at 0 degree. Table2.2: Voltage-received-at-various-angles-of-incident 14 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 3 METHODOLOGIES AND DESIGN 3.1 Introduction This proposed sun tracking system will mainly consists of two parts: Electromechanical mechanism Software Since the aim of the project is to be cost-effective, the best solution is to use complete software control system. By using a software control system no auxiliary translator circuit external to the MCU is needed, hence reducing number of components used, results in lower costs, power saving and simplicity. The complete system can be shown in the block diagram below. Key components of the control circuit are LDR, Stepper Motor with Driver circuits, software base MCU, Solar Panel, and of course the Power supply. The following sections will deal with the hardware and software design elements. Figure3.01: Block-diagram 15 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 3.2 Hardware selection 3.2.1 Choice of sensors Since this project is based on a low cost simple sun tracking system, it seems appropriate that the sensors be LDR. Even though other light sensors would have been effective, comparatively LDR are cheaper, more reliable, easier to use and not so sensitive towards voltage spikes. Below are some added advantages of the LDR: LDR internal impedance decreases when the ambient light brightens. LDR have a photo-variable resistor that changes its impedance when the intensity of light energy varies. LDR are easier to use since they have no polarity. Figure3.02: LDR-sensor The sensors are fixed on the solar panel to keep the panel perpendicular to the sun at all times. The prototype will require 2 LDR which will be mounted on plastic or metal sheet about 2” apart with vertical 4” opaque barrier between them. The LDR that is used has approximately 100K resistance in complete darkness and a 500-ohms resistance when totally saturated with light.[6] The LDR will show a resistance proportional to position of the sun as resistance will increase when illumination is lesser. The 2 LDR sensors show same resistance when they are both in perpendicular to the sun. If any unbalance in resistance occurred due to changing position of sun, a signal will be send to the software that triggers the MCU to reposition the solar panel. The figure below showing one of the LDR been partially blocked when the sun rotates. Figure3.03: LDR-setup sunenergyworld.blogspot.com/2006/04/knowing-sun-tracker.html 16 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 3.2.2 Choice of Motor and Circuitry As mention in section 1.3, a suitable motor is needed, therefore feasibility and the degree of difficulty in implementation is taken into consideration. Several kinds of motors are readily available in the market such as DC motors, Servo motors, Stepper motors and etc. The main difference between DC motors and stepper motors is that the latter cannot run freely by themselves. After much consideration of the above motors Unipolar stepper motor was chosen because they are straightforward to control, able to generate stepping sequence just by using a simple counter circuit. Stepper motors were chosen instead of DC motors because they are better in situations where precise controlled movement is needed. Furthermore, they also have a holding torque that produces the highest torque at low speeds whereby servomotors do not have. It enables a stepper motor to secure its position firmly while not moving. This is beneficial to my design prototype as it is able to hold the solar panel in a firm position without the use of any extra brake when it is not moving. Figure3.04: Stepper-Motor For the motor with circuitry, which is shown below, consists of a 12V Unipolar stepper motor with driver (UCN5804B) that are used to turn the solar panel in steps from East to West axis throughout the day. The software compares output differences of the LDR with the reference value for perpendicular position with sun illumination and sends a signal to motor driver to rotate the stepper motor. 4 external series diodes 1N4003 are used to prevent substrate current from being sourced through the outputs. 17 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 Figure3.05: Motor-with-circuitry http://www.avwd49.dsl.pipex.com/focusser.htm 3.2.3 Choice of Microcontroller Chip Choosing of a suitable controller chip is the next decision to be made follow by selecting a software control system. The chief purpose which is required of the controller chip includes converting the analogue resistance of the 2 LDR sensors into digital values that can display on the LCD and be compared. The controller chip not only handles inputs from the sensors, but also outputs to the stepper motors and inputs from the limit switches. The stepper motor requires four data channels from the chip to control its rotation and speed. The 2 limit switches require two data channels to control the position of the solar panel when in night mode and when it reaches its position limit. After taking consideration of all the necessary design specifications, MCU PIC16F84A from Microchip technologies was chosen as the controller chip for this project. PIC16F84A was a reasonable choice for this project as this microcontroller contains: i. Pot function ii. EEPROM is 64 bytes iii. 13 I/O pins 18 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 iv. RAM contains 68 bytes v. Reasonable price vi. 10,000 erase/write cycles The first four factors above had already covered the main functionality of this project. The Pot function that is needed for converting the sensor readings from analogue to digital, 13 I/O pins are required to handle the LCD, sensor, signals to motor and inputs from the limit switches, further more the chip has program space sufficient for the code files. In fact there are still quite a number of other factors that makes PIC16F84A the most suitable choice for this project; however, the above 6 were the deciding factors. External components In order to get the PIC MCUs start running, some external components of appropriate value are connected to the MCU. Fist, the MCLR pin that is connected to a 5V supply needs a 4.7K resistor because if unconnected the MCU will float around. Having the appropriate value capacitors and a good crystal connected to the MCU is essential. The oscillator will not start and run properly if the capacitor values are out by too much. For PIC16F84A, a 4MHz crystal and two 22pf (Pico farad) ceramic disk capacitors is good enough. Beside shows how a PIC16F84A is connected to its external components. 3.2.4 Voltage Regulation From the block diagram, the power supply provides power to the MCU, sensors and the motor circuitry. A Voltage regulator LM7805 is intended to be used in this circuit because the MCU and sensors need a constant flow of 5V supply. LM7805 is a common solid state device that steps down DC voltage from 8V-40V down to 5V. The circuit beside shows an unregulated supply to the input with connected ground and a regulated 5V made available at the output which is used for powering up the MCU. Power filter capacitors are connected to its Vcc source to reduce voltage fluctuation and elimination of noise. Since the stepper motor 19 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 requires a 12V supply for its operation, therefore this value can be used as the input voltage to the regulator circuit. This in turns helps to maintain the number of power rails to 2 in the design circuit. The stepper motor is robust enough running off with an unregulated 12V supply. 3.2.5 Choice of Axis After careful study and research, a single-axis tracking system is preferred instead of double-axis. From a global analysis of the operational costs and potential operational problems of each system’s configuration, we were led to conclude that a single EastWest axis tracking system presents the best overall compromise between the initial and operating costs. [2] 3.2.6 Solar Battery Charger To make this project more worthwhile an additional DIY solar battery charger was built using a small 13V 100ma Photovoltaic (PV) solar panel, 10x 2000ma AA NiMH rechargeable batteries, a voltage regulator and a zener diode. The objective is to have a renewable power source input to the tracker circuitry, so that the tracker can traps the maximum energy and again uses its own energy powering up the whole system. Selecting a suitable Solar Panel is very crucial, as a rule of thumb the solar panel should not have a current more than 10% of the charging batteries. For example, to charge a 2000ma battery, the solar panel should have a current of 200ma or lower. The next stage is how to put all the components together to build the solar battery charger. Firstly, the 13V solar panel which is made up of 2 smaller panels, a 5V and 7V 100ma solar panel were used. In order to produce a perfect 13V, the panels need to be connected in series. But if the panels are connected in parallel, the current will increase instead of the voltage. The batteries will be charged as long as the voltage of the solar panel is greater than the total voltage of the batteries when fully charged. Overcharged might happen if charged too fast, causing the batteries lifetime being reduced. In order not to damage the batteries even after they are fully charged, the charging current need to be low. To get a right balance of charging speed, a current of around 10% of battery capacity should be used. 20 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 Limiting Current with an LM317T LM317T is a voltage regulator chip that is used to regulate current with a suitable resistor. RESISTOR INPUT LM317T OUTPUT ADJ Figure3.10: LM317T LM317T can handle current up to 1.5A and usually do not have any problem with small solar panels. By Ohm's Law, the value of the resistor needed is given as 1.25V (LM317T’s ADJ regulated output) divided by the output current required. Since output current of the LM317T is fixed, higher input current and voltage will cause the LM317T to generate more heat. Table3.1: current-Vs-resistance The above table shows the resistor values available and the current required in an LM317T current limiting circuit (I = current, R = resistance). From the table it can be seen that to charge a 2000mah battery with a current of 200ma (10%), either a 6.8 or 5.6 Ohm resistor will be more appropriate. Using a 6.8 Ohm resistor will speed up charging and increase current while using a 5.6 Ohm resistor will slow down charging and reduce the current. From the right connection, a current limited solar battery charger that will send a fixed amount of current to the batteries was built and overcharging is no longer an issue. To make it more ideal a final enhancement will be to incorporate a battery status monitor using a zener diode to turn on an LED when the desired voltage level of the battery is reached. [9] Every zener diode has a specified zener voltage, an ideal way for determining whether voltage is flowing or not is by its reverse setting. No current will flow when the voltage in the circuit is less than the zener voltage but if the 21 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 voltage in the circuit is greater than the zener voltage, then the voltage drop across the diode is equal to the zener voltage. For example, in a circuit when a reverse zener diode is connected in series with an LED, the LED will only turn on if the circuit voltage is more than voltage drop across the LED plus the voltage of the zener diode. [10] In this project, 12.6V is used to indicate batteries under charge. To show that the batteries are being charged by the renewable energy setup, an LED will turn on once the voltage of the 12V batteries reaches 12.6V or higher. An 8.2V zener diode and an LED with a voltage drop of 2.5V was used, therefore the total voltage drop across the LED and the zener diode will be 10.7V. In order to prolong the life of the LED, a resistor is used to prevent too much current getting to it. Since the voltage difference between 12.6V and 10.7V is = 1.9V, the 1.9V must be dropped across a suitable resistor with a current lesser than 15mA. Using Ohm's Law, the resistance can be found by V/I = 1.9V / 0.015 Amps = 127 Ohms. Cathode (Negative) Anode (Positive) Figure3.12: Diode Figure3.13: LED The figures below show the final stage of putting all the components together. Finally, the LED of the complete battery status monitor will turn on once the charged batteries voltage reaches 12.6V. [10] Figure3.14: current-limited-solar-batter-charger 22 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 3.3 Software selection Figure3.15: Programming Programming a MCU needs only 3 simple process steps. They are writing the code, compiling the code and finally uploading the code into the MCU. For compiling the code, first a compiler is needed. PICBasic pro compiler from Micro Engineering Labs is used in this project. In addition to a compiler, a programmer kit and software are needed. Uploading the machine code into the MCU is the job of the programmer and software. These will be discussed in greater detail in the next few sections. 3.3.1 Choice of Programming Language and Compiler An important issue that has to be addressed in this section is how the project will be programmed. Using assembly or C languages are an adequate way of programming this project but it was by no means the most efficient or easiest. In this project the system code was developed using the Basic language. The main purpose for using Basic language rather than assembly or C is because it has wider applicability and is more flexible. BASIC is designed as an easy to use language, its English-like language is much easier to write and read than the assembly language. Another attractive feature of the Basic is that its code size much smaller than the assembler. In other words, Basic has reduced in debugging time, improved efficiency and thus faster development time. Last but not least, Basic is easier to modify and understand, that is a continuing benefit in this project for the past few months. Below are some advantages and features of Basic language: i. Quicker and easier than C or assembler ii. Provides faster program execution and longer programs than BASIC interpreters iii. More user variables iv. Peek instruction to access any PIC MCU register from BASIC v. Serial speeds to 9600 baud 23 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 vi. In-line assembler vii. Can be used in DOS or Windows The PICBasic Pro Compiler (PBPC) compiles the program source code that is saved as text file to an equivalent machine code instruction listing that is in standard 8-bit Hex file. The list of hexadecimal numbers that represents the Basic program is called the machine code. The Hex file can then be programmed directly into the MCU. Once the MCU started, its CPU will run through the programmed list of hexadecimal numbers. The operation of the PBPC is as follows: First, the program source code was created using word processor or text editor. Then choose the PIC MCU model that was used, next, open the BASIC source code that was created for the program. The name of the source code normally ends with .BAS extension. The BASIC source code must then be open into the same location where the PBP.EXE file is. After all that have been done, the PBPC can start to compile and process the file. If everything went smoothly, the assembler will complete its task by creating an assembler source and the final code file. However, when there is any error in the program, the compiler will issue a string of errors that requires correction in the BASIC source file before another compile. PBPC is a DOS command line compiler; however it can also be used in windows with CodeDesigner. CodeDesigner is a robust visual Integrated Development Environment (IDE) with In Circuit Debugging (ICD) capability designed specifically for PBPC. It provides writing of code in a friendlier environment, where launching and compiling of program can be done from the toolbar. Below figure shows the CodeDesigner converting the Basic programme to Hex format. Figure3.16: PIC-basic-Pro 24 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 3.3.2 PIC Programmer Since this is a software base MCU project it will be totally useless for a MCU without a programmer to burn in firmware. A programmer is the key to getting firmware into a MCU. Such device can physically connect the MCU to a PC. Programming happens when copying of firmware from a PC into the flash memory of a MCU. As this is a budget project, a DIY PIC programmer was built instead of buying one which is far beyond budget costing about USD150. After spending some time on research one suitable project was found online which is quite simple, straight forward and contains schematic diagram. (http://www.diylife.com/2008/02/15/program-a-pic-microcontroller/). A mere $8 SD investment had actually got this awesome programmer started. All the parts are easily available at Sim Lim square. Each component cost less than $2; the greatest expense was the 22uF/16 v Tantalum capacitor which cost $1.50 per piece. Programmer connections Prior to delving into the details of the programmer, let’s take a look at the 5 pin connections (Vdd/Vss/Vpp/Clk/Data) which are essential for a PIC to wakeup running. Vdd/Vss Vss and Vdd are use by Microchip to dedicate the ground ‘-’ and positive supply ‘+’. Vss is the ground that is always 0V while Vdd is basically a 5V positive supply (Vcc). From the figure below C1 (0.1uf capacitor) is placed in the Vdd/Vss pins. In practice, it is preferred to put a capacitor on every Vdd pin. C1 is called a decoupling capacitor as it isolates the chip from any noise in the supply power. If left unchecked the noise might create wild oscillation in the circuit. Figure3.17: Vdd/Vss 25 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 VPP/MCLR Erratic behaviour or hanging of PIC might happen if there are spikes in the supply power. To prevent this PIC has an MCLR/Master Clear and Reset function that will reset itself if such event happens. In order for this function to work, a 10K resistor (R1) is placed between the MCLR pin and the Vcc. Another important function of the MCLR pin is to put the PIC into programming mode. When Vpp is supplied from the programmer to the MCLR, the PIC opens itself for firmware to be copied and it is not necessary to erase the PIC before programming it. Different PIC models uses different Vpp, in this project the PIC16F84A uses a 13V Vpp. There will be a great risk of ruining every component on the circuit board by the 13V once the Vpp go through R1 and enter the circuit. To prevent this, a diode D1 (1n4148) is placed between Vcc and R1, this 1-way valve is to maintain the high Vpp where it should belongs. Figure3.18: Vpp/MCLR Clock and Data Clock and data pins on the PIC are for the code to flows into. They are normally located at pins 6 and 7 on PORTB of the PIC microcontrollers. PIC code files are normally in .Hex extension that is represented by 1s or 0s on a disk. From the figure below, in order to represent these bits, data is switched between ground0 and supply-1. The waveform of the clock toggles high and low again while proper values are on the data pin. The values on the data pin (1 or 0) will be copied into the PIC memory every time the clock pulse triggers it. 26 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 Figure3.19: Clock/Data To see how the PIC is programmed with Vpp, firstly the Vpp is raised to 13V in order to put the PIC into programming mode. The data line is then changed to reflect the value of 1 or 0. Next, the clock pulse is supplied so that the PIC can copy the values of the data pin. The Vpp will be removed once all the data has been transferred. Figure3.20: Clock/Data This programmer kit can connect a 5 pin connection from it to the circuit board and allows programming of a PIC in circuit. This will eventually saves lots of time removing chip from its sockets and also prevents subsequent bending of pins. This kind of programming is called In-Circuit-Serial-Programming (ICSP). ICSP allows direct download of code from a host PC to the target PIC. 27 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 Figure3.21: ICSP Building the JDM2 The programmer kit that was built was based on the JDM2 design. JDM2 programmer is powered by the PC serial port (RS-232) itself and its circuit will then generate a 13V programming voltage (Vpp), therefore no external power supply is needed. Below are the lists of the components needed for the JDM2. Resistors 10K ohm resistor 1/4 watt 1.5K ohm resistor 1/4 watt Capacitors 100uf/25v electrolytic 22uF/16 v Tantalum (Tantalum is used because it requires high speed) Diodes 8.2 volt zener diode ≥ 0.5 watt 5.1 volt zener diode ≥ 0.5 watt 4 x 1n4148 diode Transistors 2 x BC547B 28 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 Figure3.22: JDM2-components The JDM2 is a great programmer but there are a few limitations in the design. 1. In order to get a full positive 13V between Vpp and ground, it needs to use a negative ground voltage. Any power source for the circuit need to be removed before programming the JDM2. ( In actual practice, PIC is able to be programme 2. 3. Not able to work well with Laptops due to their low serial port voltage. Not able to work with a USB to serial converter due to similar reason. with just 12.7V) Serial port cable (DB9) The figures below shows a DIY DB9 cable that cost only about SGD4. The pins that are used by this connector are pin 3, 4, 5, 7 and 8. DB9 is used to supply power from PC serial port to the JDM2. TxD and RxD are the data transmission lines while RTS, CTS, DTR and DSR are the control lines. Voltage on the control line will be between 3 to 15V when either one of the control signals is active. Figure3.23: DIY-RS232 29 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 Table3.2: DB-9 Pin-table This picture shows the final product of the programmer kit. Figure3.24: Complete-JDM2 The picture below shows the schematic diagram of the programmer kit. Figure3.25: JDM2-schematic 30 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 The pin configuration for the transistors is shown below. Figure3.26: Transistor-pin-configuration 3.3.3 Programmer software In order for the programmer to burn firmware to the chip we need a software programmer. One of which that can be found online is the WinPic800. It is a PIC microcontroller programming application for Windows that uses serial port to program the PIC. WinPIC800 is chosen because it is free, stable, versatile and has latest updates for the PIC chips. Below shows WinPic800 opening up the code files with .Hex extension and burns it to the PIC. Figure3.27: WinPic800 31 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 Below are the steps on how to burn firmware to PIC using WinPic800 i. ii. iii. iv. v. vi. First connect programmer to the PIC. Next, connect the serial port of the PC to the programmer. Then launch the Winpic800. Next, go to Navigate Device to check device. Winpic800 will automatically detect the target PIC. Next, go to Navigate File to open the Code file for the PIC that is a .hex file. Finally, go to Device and select Program All to start copying to the PIC and contents will be verified after finished copying. The picture below shows the programmer interfacing with the PIC chip. Figure3.28: Real-time-programming 32 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 3.3.4 Outline of the System Enabling the prototype to either run in manual or automatic mode is one of the thesis objectives. The manual mode depends on the user input interface controlling the motor, while the automatic mode depends on sensory input from the LDR to the MCU to track the light. Combining these 2 modes into a single system enabled the system to run freely in its automatic mode and also manual alignment override if any malfunction happens with the software, sensors or MCU. The flowchart below outlines the steps that the program will follow during operation. Refer to Appendix D for the source code. Figure3.29: Flow-chart 33 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 3.3.5 Automatic Alignment The main objective of this thesis is to design an automatic solar tracker system. To accomplish this, analogue sensors resistance need to be read into the input of the MCU. Programmed MCU PIC16F84A from Microchip is designed to determine the optimum position of the panel during the day .The evaluated values taken from the LDR are a function of resistance which is converted to digital form by the MCU to control the position of the panel. The LDR used will have approximately 100K resistance in complete darkness and a 500ohms resistance when totally saturated with light.[6] The LDR will show a resistance proportional to position of the sun as resistance will increase when illumination is lesser. The 2 LDR sensors show same resistance when they are both in perpendicular to the sun. The program was written in such a way that if any unbalance in resistance for 10 units or more, a signal will be sends to the MCU to reposition the solar panel. An example of this will be that if LDR1 (Figure3.29) has a lower resistance reading than LDR2, the motor will be required to rotate clockwise until both LDRs having the same value. Figure3.30: LCD showing LDR reading For the motor with circuitry block, it consists of a Unipolar stepper motor with driver (UCN5804B) that are used to turn the solar panel in steps from East to West axis throughout the day. Half-step pattern was chosen to provide more accurate positioning but at the expense of increasing position timing. An extra feature of the system is that if both of the LDR reads more than 255 the system will return to the initial position and enters into night mode. Night mode indicates that there is no more sun light to be captured and therefore not necessary to track it. The initial position is to ensure that whenever the sun rises, the system will always be able to track it. 34 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 3.3.6 Manual Alignment This prototype also incorporates a manual alignment feature that can be activated by a 9-pin 3PDT toggle switch. This manual interface that is connected to the MCU and motor driver consists of a Manual/Auto toggle switch to switch between manual and auto mode, a 555 timer to produce a constant pulse, and 2 push buttons (P1/P2) input signals to 2 logic gates IC (Integrate Circuit), AND (74LS08) and NOT (74LS04) gate controlling the directions of the motor. An example of this will be that when either one of the push button is pressed the motor driver will receive a high or low signal and subsequently rotate the motor clockwise or counter-clockwise. Figure3.31: NOT-gate Figure3.32: AND-gate 35 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 Figure3.33: Manual-drive-sequence A pair of pull-up resistor is used, so the 2 input pin is almost 5V when both push-buttons (P1/P2) are open, however when either of the push-button is closed, voltage drop across the resistor will be 5V and the input pin will see a voltage that is almost 0V. The input pin signal is then fed into the AND and OR gate shown above. Figure3.34: Pull-up-resistor (http://www.madsciencenotebook.com/node/4) Figure3.35: 3PDT-toggle-switch 36 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 Below shows the pin configuration for the 3PDT, the left column is connected to the manual interface, the right column is connected to the MCU while the centre is connected to the motor driver circuitry. Schematic diagram of the circuitry was drawn using Protel in Appendix C. Figure3.36: 3PDT-connections Manual / Auto Toggle switch Push-Button P1/P2 Figure3.37: Toggle-switch-and-Push-button 37 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 4. DESIGN ANALYSIS 4.1 INTRODUCTION During the design of the prototype, it is made as simple as possible so that development and testing of prototype will be easier. It can be seen from the Gantt chart section 1.3.2 that a great amount of time was allocated for the troubleshooting of hardware/software issues. The main reason for this planning is because development and testing of hardware/software will not always goes on smoothly as planned. Another ingenious way that was mention previously is to develop modular sections first, so that problems can be located and fixed more easily. It is understandable that software control is the best method for controlling such prototype. Figure4.01: Modular-sections-of-system 4.2 UNEXPECTED PROBLEMS WITH THE DESIGN The initial testing of the prototype went fairly well, however a few issues occur that need to be addressed. The first problem faced was during the building of the JDM2 hardware part. At that point of time to produce the 13V for the MCLR was to no avail. After much research from the internet, it was finally found that TD powers C2 to be 13V trough the base collector diode of Q1. The voltage across C2 is limited by the zener D6 to be about 5.1V+8.2V = 13.3V and hence the problem was solved. 38 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 The next problem that needs to be addressed was during programming of the MCU. During the programming of the MCU, the programmer keeps prompting “unable to detect device”. It was impossible to initialise the programming without detecting the device. Much time was spent troubleshooting for wrong connection and faulty components. The root cause was finally found while measuring of the supply line that there was a glitch occurring during the initialising of the programmer. The MCU itself does not consume much of power; it was the MCU controlling devices that pull most of the current from the power line. The main culprit was then found to be the blinking display LED that puts enough glitch on the supply line causing the MCU momentarily to stop function properly. After removing of the LED, the power of the supply line was once again fairly distributed. 4.3 RESULTS OF COMPLETED DESIGN An experiment was tested out using a portable LED light source setup at various positions above the solar panel so that data of different voltages could be collected. The data for both the tracking and the static panel were then record down. The purpose of this experiment was to simulate the sun at different positions and compared the outcome between the 2 systems. The LED light source was set up 10cm above the panel at 9 different positions (A-I). The table and graph below shows the results of the experiment. Figure4.02: Different-points-on-solar-panel 39 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 Table4.1: Voltages-received-at-various-positions-on-panel Figure4.03: Chart-of-voltages-on-different-points-on-solar-panel It can be clearly seen from the above data that the sun-tracking system is more efficient in receiving energy. Whereas the static system is only able to receive greatest amount of energy when the light source is directly above (A-position), the data collected from positions (F-I) are quite low. These sets of positions (F-I) correspond to the position of the sun during rising and setting, so it is obvious that the static system will be less efficient during these periods of time. 40 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 5. CONCLUSION 5.1 INTRODUCTION Prior to the commencement of this project a few important system specifications were established and if adhered to, would definitely improve the overall system performance. Below were the specifications that the system had adhered to: I. Track the locate of the sun via sensor input II. Positioning of solar panel using motor and circuitry so that ray of light would always fell perpendicular to the panel’s surface III. System controlled by software program so to reduce the amount of hardware and power used by the system. Background investigation had been conducted on various sensors, motors and positioning of solar panel so that a basic concept of the prototype could be theorised. From then the system was developed and expanded part by part into a complete working prototype. Upon devised, the prototype was tested alongside with a static system to compare the amount of power received by each system. Figure5.01: Complete-solar-tracker 5.2 CONCLUSIONS REGARDING THE SYSTEM After comparing the results obtained from both the system, it was obvious that the system with tracking method is more effective. The tracker system had already met all of the required goals that had been set out. Although this prototype is not the best solar tracker system that can be built, it is however the most efficient given the budget and time constraints, within the context of undergraduate thesis. 41 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 5.3 APPLICATIONS FOR THE SYSTEM This prototype can be implemented into any application that collects energy from the sun using stationary solar panels. Currently more and more people living in remote areas of the world use solar energy for most of their daily requirements. To meet their needs large solar panels are often required. Hence, using a sun-tracker will be highly beneficial in such places, because panel size will be decreased while increasing energy received. In household applications it will be beneficial in larger appliances such as refrigeration, air-con and water heater system. A battery charger and a converter inside household are required to convert power from DC to AC for appliances backup power usage. In recent years solar water pump has gained popularity, tracking system offers better benefits and gains which can greatly reduce system cost. Convention solar pumps experience a disproportionate drop in performance during late afternoon and early morning, and the centrifugal pump will not produce sufficient centrifugal force to achieve the required lift. However by implementing the solar-tracker, daily yield can be doubled as the pump able to run at full speed throughout a whole sunny day. [11] 5.4 AREAS OF FURTHER RESEARCH The most practical further research in this field would be to design a more accurate and efficient system, a new way for positioning the solar panel had to be designed. The new design will utilise 2 motors, one is used to control tilt of the panel, while the other motor controls the rotation of the panel. This design will allow greater freedom of movement and accuracy compared to the current one. END OF THESIS (Total number of words excluding Appendices and Page I-VI= 9210 words) 42 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 BIBLIOGRAPHY http://www.electronics-tutorials.ws/io/io_4.html [1] http://www.di.ubi.pt/~palmeida/Artigos/ICIIEM2005%20.pdf [2] http://www.solarbotics.net/library/pieces/parts_mech_steppers.html [3] http://electojects.com/motors/stepper-motors-2.htm [4] Johnson, J., “Working with Stepper Motors”, 1998. [5] John Iovine, “PIC Microcontroller Project Book”, 2004. [6] http://bmf.hu/conferences/sisy2006/15_Elmer.pdf [7] http://www.diylife.com/2008/02/15/program-a-pic-microcontroller [8] http://www.reuk.co.uk/Solar-Battery-Charging.htm [9] http://www.reuk.co.uk/Make-a-Simple-Battery-Status-Monitor.htm [10] http://www.affordable-solar.com/solar.trackers.htm [11] 43 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 APPENDICES APPENDIX A: PIC16F84A PINOUT DESCRIPTION 44 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 APPENDIX B: UCN5804B DATASHEET 45 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 APPENDIX C: SCHEMATIC DIAGRAM 46 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 APPENDIX D: SOURCE CODE ‘ ‘ ' ' ' ' ' ' ' ' ' ' ' ' Solar tracker system LCD should be connected as follows: LCD PIC DB4 PortA.0 DB5 PortA.1 DB6 PortA.2 DB7 PortA.3 RS PortA.4 (add 4.7K pullup resistor to 5 volts) E PortB.3 RW Ground Vdd 5 volts Vss Ground Vo 20K potentiometer (or ground) DB0-3 No connect output portb.0 output portb.4 output portb.5 input portb.6 input portb.7 LDR1 var byte LDR2 var byte DIFF var byte Pause 500 ' Wait 500ms for LCD to startup loop: low 4 Pot 1,245,LDR1 Pot 2,245,LDR2 ' Read resistance from PortB Pin 1 ' Read resistance from PortB Pin 2 Lcdout 254, 1 Lcdout "LDR1: ",#LDR1 ' Clear LCD screen ' Display resistance from PortB Pin 1 Lcdout 254, 192 Lcdout "LDR2: ",#LDR2 Pause 500 ' Display resistance from PortB Pin 2 ' Wait 500ms if LDR1 < LDR2 then lesser if LDR1 > LDR2 then greater if LDR1 and LDR2 > 255 then night ' If both sensor dark go to night mode lesser: DIFF = LDR2 - LDR1 if DIFF > 10 then L1 Goto loop ' If resistance difference 10 or more then rotate motor ' Do it forever 47 Author: Foo Sey Yau Course: ENG499 PI no: Q0300044 greater: DIFF = LDR1 - LDR2 if DIFF > 10 then L2 Goto loop ' If resistance difference 10 or more then rotate motor ' Do it forever L1: low 0 high portb.5 pulsout 4, 5000 if portb.6 = 0 then opposite Goto loop ' Enable stepper motor ' Rotates clockwise ' Step input to stepper motor ' If reached right limit switch go to opposite ' Do it forever L2: low 0 low portb.5 pulsout 4, 5000 Goto loop ' Enable stepper motor ' Rotates counter-clockwise ' Step input to stepper motor ' Do it forever opposite: Lcdout 254, 1 Lcdout "Limit Reached" pause 100 low 0 low portb.5 pulsout 4, 5000 if portb.7 = 0 then loop Goto opposite night: Lcdout 254, 1 Lcdout "Enter Night Mode" pause 100 Pot 1,245,LDR1 Pot 2,245,LDR2 if LDR1 and LDR2 < 200 then loop if portb.7 = 0 then freeze low 0 low portb.5 pulsout 4, 500 Goto night freeze: high portb.0 Goto night ' Clear LCD screen ' Enable stepper motor ' Rotates counter-clockwise ' Step input to stepper motor ' Continue to loop when left limit switch reached ' Clear LCD screen ' Read resistance from PortB Pin 1 ' Read resistance from PortB Pin 2 ' Continue to rotate until left limit switch reached ' Enable stepper motor ' Rotates counter-clockwise ' Step input to stepper motor ' Disable stepper motor 48