You are on page 1of 60

SOLAR TRACKING SYSTEM

CHAPTER -1 INTRODUCTION
Solar tracking system is to utilize the maximum power from the sun. Now a day we are in heavy need to use the solar power as in the coming days everything we use might depend on this kind of systems.

1.1

INTRODUCTION Solar energy refers to the utilization of the radiant energy from the Sun. Solar power is

used interchangeably with solar energy, but refers more specifically to the conversion of sunlight into electricity by photovoltaic, concentrating solar thermal devices, or by an experimental technology such as a solar chimney or solar pond.Solar panels are Photovoltaic cells which gives voltage directly if you place them in sun light. Here if you change the position of panels the power output will vary. Means, direct sunrays on solar panel can give good output otherwise there might be decrease in the value of their outputs. So we have to track the path where the maximum power will attain. Solar panel devices are of two types that collect energy from the sun. One is solar photovoltaic modules which use solar cells to convert light from the sun into electricity and the other is solar thermal collector which converts the suns energy to heat water or another fluid such as oil or antifreeze. In this project we are using the photovoltaic type.The solar panel gives the voltage directly to the microcontroller through ADC. This solar panel should be fixed on the stepper motor shaft so that it can easily rotate 180 degrees. The microcontroller controls the stepper motor to rotate in desired direction. In order to attain maximum power output the microcontroller accesses the solar panel direction continuously, which is on the shaft of stepper motor. If maximum output attains it waits for the solar panel to acquire energy from the sun and gives the output voltage to the microcontroller. If the output of the solar panel is going to reduce, it again starts checking for the maximum output path. This is a cyclic process.

Page | 1 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

1.2. OBJECTIVE
The main aim of our project is to make the panel to rotate according to the sun direction from morning to evening automatically so that the panel grabs the solar energy to maximum extent possible throughout the day. This method of power generation is simple and is taken from natural resource. This need only maximum sunlight to generate power. This project helps for power generation by setting the equipment to get maximum sunlight automatically. This system is tracking for maximum intensity of light. When there is decrease in intensity of light, this system automatically changes its direction to get maximum intensity of light.

1.3. EXISTING MODEL


The existing technology of the solor tracking system is solar parllel plat system.In this system solar plat is constant and parllel to the sun risess due to this reason the solar pannel is get a maximum energy when sunlight is parllel to the pannel.So using this system we cannot utilize the maximum redundency energy of the sunlight and solar pannal in effective manner.

Page | 2 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

CHAPTER-2 PROPOSAL
2.1 BLOCK DIAGRAM

Fig. 2.1 Block diagram of solar tracking system.

Page | 3 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

2.2. ARCHITECTURE OF AT89S52

Fig.2.2 Architecture of 8052 microcontroller.

Page | 4 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

2.3 BLOCK DIAGRAM DISCRIPTION


2.3.1. POWER SUPPLY SECTION

Fig . 2.3 Power Supply Block Diagram

Page | 5 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

Unregulated DC power supply


Also be a block rectifier such as WO4 or even four individual diodes such as 1N4004 types. (See later rectifier ratings).The principal advantage of a bridge rectifier is you do not need A bridge rectifier D1 to D4 rectifies the ac from the transformer secondary, which may a centre tap on the secondary of the transformer. A further but significant advantage is that the ripple frequency at the output is twice the line frequency (i.e. 50 Hz or 60 Hz) and makes filtering somewhat easier. As a design example consider we wanted a small unregulated bench supply for our projects. Here we will go for a voltage of about 12 - 13V at a maximum output current (IL) of 500ma (0.5A). Maximum ripple will be 2.5% and load regulation is5%. Now the RMS secondary voltage (primary is whatever is consistent with your area) for our power transformer T1 must be our desired output Vo PLUS the voltage drops across D2 and D4 (2 * 0.7V) divided by 1.414.This means that V sec = [13V + 1.4V] / 1.414 which equals about 10.2V. Depending on the VA rating of your transformer, the secondary voltage will vary considerably in accordance with the applied load. The secondary voltage on a transformer advertised assay 20VA will be much greater if the secondary is only lightly loaded. If we accept the 2.5% ripple as adequate for our purposes then at 13V this becomes 13 * 0.025 = 0.325 V rms. The peak to peak value is 2.828 times this value. V rip= 0.325V X 2.828 = 0.92 V and this value is required to calculate the value of C1. Also required for this calculation is the time interval for charging pulses. If you are on a 60Hzsystem it 1/ (2 * 60) = 0.008333 which is 8.33 milliseconds. For a 50Hz system it is 0.01 sec or 10 milli seconds. Remember the tolerance of the type of capacitor used here is very loose. The important thing to be aware of is the voltage rating should be at least 13V X 1.414 or 18.33. Here you would use at least the standard 25V or higher (absolutely not 16V). With our rectifier diodes or bridge they should have a PIV rating of 2.828 times the V sec or at least 29V. Don't search for this rating because it doesn't exist. Use the next highest standard or even higher. The current rating should be at least twice the load current maximum i.e. 2 X 0.5A or 1A. A good type to use would be 1N4004, 1N4006 or 1N4008types.These are rated 1 Amp at 400PIV, 600PIV and 1000PIV respectively. Always be on the lookout for the higher voltage ones when they are on special.

Page | 6 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

TRANSFORMER RATING
In our example above we were taking 0.5A out of the V sec of 10V. The VA required is 10 X 0.5A = 5VA. This is a small PCB mount transformer available in Australia and probably elsewhere. This would be an absolute minimum and if you anticipated drawing the maximum current all the time then go to a higher VA rating. The two capacitors in the primary side are small value types and if you don't know precisely and I mean precisely what you are doing then OMIT them. Their loss won't cause you heartache or terrible problems.

THEY MUST BE HIGH VOLTAGE TYPES RATED FOR A.C USE


The fuse F1 must be able to carry the primary current but blow under excessive current; in this case we use the formula from the diagram. Here N = 240V /10V or perhaps 120V / 10V. The fuse calculates in the first instance to [2 X 0.5A] / [240/ 10] or .04A or 40 ma. In the second case 08A or 80 ma. The difficulty here is to find suitable fuses of that low a current and voltage rating. In practice you use the closest you can get (often 100 mass). Don't take that too literal and use 1A or 5A fuses.

CONSTRUCTION
The whole project MUST be enclosed in a suitable box. The main switch (preferably double pole) must be rated at 240V or 120V at the current rating. All exposed parts within the box MUST be fully insulated, preferably with heat shrink tubing. 4.1 RECTIFIERS In-order to work with any components basic requirement is power supply. In this section there is a requirement of two different voltage levels. Those are 1) 5V DC power supply. 2) 9V DC power supply. Now the aim is to design the power supply section which converts 230V AC in to 5V DC. Since 230V AC is too high to reduce it to directly 5V DC, therefore we need a Step-down transformer that reduces the line voltage to certain voltage that will help us to convert it in to a 5V DC. Considering the efficiency factor of the bridge rectifier, we came to a conclusion to choose a transformer, whose secondary voltage is 3 to 4 V higher than the required voltage i.e. 5V. For this application 0-9V transformers is used, since it is easily available in the market. Page | 7 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM The output of the transformer is 9V AC; it feed to rectifier that converts AC to pulsating DC. As we all know that there are 3 kind of rectifiers that is 1) half wave 2) Full wave and 3) Bridge rectifier Here we short listed to use Bridge rectifier, because half wave rectifier has we less in efficiency. Even though the efficiency of full wave and bridge rectifier are the same, since there is no requirement for any negative voltage for our application, we gone with bridge rectifier. Since the output voltage of the rectifier is pulsating DC, in order to convert it into pure DC we use a high value (1000UF/1500UF) of capacitor in parallel that acts as a filter. The most easy way to regulate this voltage is by using a 7805 voltage regulator, whose output voltage is constant 5V DC irrespective of any fluctuation in line Volts.

REGULATORS
Voltage regulator
A voltage regulator is a piece of equipment designed for the maintenance of a constant level of voltage. Several types of voltage regulators exist and each have their own advantages and disadvantages. Most voltage regulators work by using an internal fixed voltage as a reference to be compared to the voltage being put out.

Types of Voltage Regulators Series Pass Voltage Regulator


Series pass regulators are considered the least effective type of voltage regulator. Its power is continuously dissipated, thus making it more unreliable than other types Series pass voltage regulators are most effective when used in high voltage systems because their efficiency increases with high voltage. Series pass voltage regulators remain popular because they are the least expensive type.

Shunt Voltage Regulator


Shunt voltage regulators are more efficient than series pass types because their power is usually not dissipated until the battery approaches full capacity. Shunt regulators are popular because of regulator circuitry is fairly simple compared to other types of voltage regulators. This type is popular because it is inexpensive for use in systems using 1,000 watts of power or less. Page | 8 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

Step Down Series Switch Regulator


The step-down series switch regulator, like the series pass regulator, increases efficiency as the voltage output increases. The increased complexity of the circuitry, however, makes this type less reliable than either the series-pass or shunt types. That complexity of the circuitry also makes the step-down series more expensive than the other types.

Step-Up Shunt Switching Regulator


The step-up shunt switching regulator has the highest efficiency as a result of its complex circuitry. That complexity makes the cost of this type of regulator so high that it is impractical to use for certain purposes. It is also worth noting that the step-up shunt switching regulator must be used under stable conditions as it has tendency to oscillate when used at maximum power.

Cost
The costs of the different types of regulators are based on general usage. The actual cost of each type, but especially the first three types listed here, will vary depending upon the individual model as well as the quality of parts and workmanship. A higher quality series pass regulator, for example, might cost more than a lower quality step down series switch regulator.

7805 voltage regulator


7805 is a voltage regulator integrated circuit. It is a member of 78xx series of fixed linear voltage regulator ICs. The voltage source in a circuit may have fluctuations and would not give the fixed voltage output. The voltage regulator IC maintains the output voltage at a constant value. The xx in 78xx indicates the fixed output voltage it is designed to provide. 7805 provides +5V regulated power supply. Capacitors of suitable values can be connected at input and output pins depending upon the respective voltage levels.

Page | 9 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

Pin Diagram Pin description

Fig.2.4 Pin Diagram of Regulator Pin No 1 2 3 Function Input voltage (5V-18V) Ground (0V) Regulated output; 5V (4.8V-5.2V) Table 2.1 Pin Description Of Regulator Name Input Ground Output

FILTER Overview

Fig.2.5 Output of Filter As we have already seen, the rectifier circuitry takes the initial ac sine wave from the transformer or other source and converts it to pulsating dc. A full-wave rectifier will produce the waveform shown to the right, while a half-wave rectifier will pass only every other half-cycle to its output. This may be good enough for a basic battery charger, although some types of rechargeable batteries still won't like it. In any case, it is nowhere near good enough for most electronic circuitry. We need a way to smooth out the pulsations and provide a much "cleaner" dc power source for the load circuit.

Page | 10 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM To accomplish this, we need to use a circuit called a filter. In general terms, a filter is any circuit that will remove some parts of a signal or power source, while allowing other parts to continue on without significant hindrance. In a power supply, the filter must remove or drastically reduce the ac variations while still making the desired dc available to the load circuitry. Filter circuits aren't generally very complex, but there are several variations. Any given filter may involve capacitors, inductors, and/or resistors in some combination. Each such combination has both advantages and disadvantages, and its own range of practical application. We will examine a number of common filter circuits on this page. A Single Capacitor

Fig.2.6 Full wave Rectifier If we place a capacitor at the output of the full-wave rectifier as shown to the left, the capacitor will charge to the peak voltage each half-cycle, and then will discharge more slowly through the load while the rectified voltage drops back to zero before beginning the next half-cycle. Thus, the capacitor helps to fill in the gaps between the peaks, as shown in red in the first figure to the righ.Although we have used straight lines for simplicity, the decay is actually the normal exponential decay of any capacitor discharging through a load resistor. The extent to which the capacitor voltage drops depends on the capacitance of the capacitor and the amount of current drawn by the load; these two factors effectively form the RC time constant for voltage decay.

Fig.2.7 Output Of Full wave Rectifier Page | 11 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM As a result, the actual voltage output from this combination never drops to zero, but rather takes the shape shown in the second figure to the right. The blue portion of the waveform corresponds to the portion of the input cycle where the rectifier provides current to the load, while the red portion shows when the capacitor provides current to the load. As you can see, the output voltage, while not pure dc, has much less variation (or ripple, as it is called) than the unfiltered output of the rectifier. A half-wave rectifier with a capacitor filter will

only recharge the capacitor on every other peak shown here, so the capacitor will discharge considerably more between input pulses. Nevertheless, if the output voltage from the filter can be kept high enough at all times, the capacitor filter is sufficient for many kinds of loads, when followed by a suitable regulator circuit.

RC Filters:

Fig.2.8 RC Filter In order to reduce the ripple still more without losing too much of the dc output, we need to extend the filter circuit a bit. The circuit to the right shows one way to do this. This circuit does cause some dc loss in the resistor, but if the required load current is low, this is an acceptable loss. To see how this circuit reduces ripple voltage more than it reduces the dc output voltage, consider a load circuit that draws 10 mA at 20 volts dc. We'll use 100 f capacitors and a 100 resistor in the filter. For dc, the capacitors are effectively open circuits. Therefore any dc losses will be in that 100 resistor. For a load current of 10 mA (0.01 A), the resistor will drop

100 0.01 = 1 volt. Therefore, the dc output from the rectifier must be 21 volts, and the dc loss in the filter resistor amounts to 1/21, or about 4.76% of the rectifier output. This is generally quite acceptable. On the other hand, the ripple voltage (in the USA) exists mostly at a frequency of 120 Hz (there are higher-frequency components, but they will be attenuated even more than the 120 Hz component). At this frequency, each capacitor has a reactance of about 13.26 . Thus R and C2 Page | 12 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM form a voltage divider that reduces the ripple to about 13% of what came from the rectifier. Therefore, for a dc loss of less than 5%, we have attenuated the ripple by almost 87%. This is a substantial amount of ripple reduction, although it doesn't remove the ripple entirely. If the amount of ripple is still too much for the particular load circuit, additional filtering or a regulator circuit will be required.

LC Filters

Fig.2.9 LC Filter While the RC filter shown above helps to reduce the ripple voltage, it introduces excessive resistive losses when the load current is significant. To reduce the ripple even more without a lot of dc resistance, we can replace the resistor with an inductor as shown in the circuit diagram. In this circuit, the two capacitors store energy as before, and attempt to maintain a constant output voltage between input peaks from the rectifier. At the same time, the inductor stores energy in its magnetic field, and releases energy as needed in its attempt to maintain a constant current through itself. This provides yet another factor that attempts to smooth out the ripple voltage. In some cases, C1 is omitted from this

filter circuit. The result is a lower dc output voltage, but improved ripple removal. The choice is a trade-off, and must be made according to the specific requirements in each individual case. For dc, the inductance has only the resistance of the wire that comprises the coil, which amounts to a few ohms. Meanwhile, the capacitors still operate as open circuits at dc, so they do not reduce the dc output voltage. However, at the basic ripple frequency of 120 Hz, a 10 Henry inductance has a reactance of: XL = 2 fL = 7540 at the same time, a 100 f capacitor at the

same ripple frequency has a reactance of: XC = 1/2 fc = 13.26ohms. Thus, L and C2 form a voltage divider that drastically reduces the ripple component (to less than 0.2%) while leaving the desired dc output nearly alone. This configuration may provide sufficiently pure dc for some applications, without the need for any following regulator at all. The drawback of this approach is that a 10 Henry inductor is as large as some power transformers, with a heavy iron core. It takes up a lot of space and is relatively expensive. This is Page | 13 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM why the RC filter circuit may be preferred to the LC filter, provided the ripple reduction is sufficient and the power loss in the resistor is not excessive.

2.3.2 INTRODUCTION TO 8086 MICROCONTROLLER


Microcontrollers as the name suggests are small controllers. They are like single chip computers that are often embedded into other systems to function as processing/controlling unit. For example the remote control you are using probably has microcontrollers inside that do decoding and other controlling functions. They are also used in automobiles, washing machines, microwave ovens, toys ... etc, where automation is needed. Micro-controllers are useful to the extent that they communicate with other devices, such as sensors, motors, switches, keypads, displays, memory and even other micro-controllers. Many interface methods have been developed over the years to solve the complex problem of balancing circuit design criteria such as features, cost, size, weight, power consumption, reliability, availability, manufacturability. Many microcontroller designs typically mix multiple interfacing methods. In a very simplistic form, a micro-controller system can be viewed as a system that reads from (monitors) inputs, performs processing and write to (control) outputs. Embedded system means the processor is embedded into the required applications. An embedded product uses a microprocessor or microcontroller to do one task only. In an embedded system, there is only one application software that is typically burned into ROM. Example: printer, keyboard, video game player. Microprocessor - A single chip that contains the CPU or mo.st of the computer Microcontroller - A single chip used to control other devices Microcontroller differs from a microprocessor in many ways. First and the most important is its functionality. In order for a microprocessor to be used, other components such as memory, or components for receiving and sending data must be added to it. In short that means that microprocessor is the very heart of the computer. On the other hand, microcontroller is designed to be all of that in one. No other external components are needed for its application because all necessary peripherals are already built into it. Thus, we save the time and space needed to construct devices.

Page | 14 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

MICROPROCESSOR VS MICROCONTROLLER
Microprocessor
CPU is stand-alone, RAM, ROM, I/O, timer are separate Designer can decide on the amount of ROM, RAM and I/O ports. expensive versatility general-purpose

Microcontroller:
CPU, RAM, ROM, I/O and timer are all on a single chip fix amount of on-chip ROM, RAM, I/O ports for applications in which cost, power and space are critical single-purpose

SELECTION OF MICROCONTROLLER
As we know that there so many types of micro controller families that are available in the market. Those are 1) 8051 Family 2) AVR microcontroller Family 3) PIC microcontroller Family 4) ARM Family Basic 8051 family is enough for our application; hence we are not concentrating on higher end controller families. In order to fulfill our application basic that is AT89C51 controller is enough. But still we selected AT89S52 controller because of inbuilt ISP (in system programmer) option. There are minimum six requirements for proper operation of microcontroller. Those are: 1) power supply section 2) pull-ups for ports (it is must for PORT 0) 3) Reset circuit 4) Crystal circuit\

Page | 15 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM 5) ISP circuit (for program dumping) 6) EA/VPP pin is connected to Vcc. PORT0 is open collector thats why we are using pull-up resistor which makes PORT0 as an I/O port. Reset circuit is used to reset the microcontroller. Crystal circuit is used for the microcontroller for timing pluses. In this project we are not using external memory thats why EA/VPP pin in the microcontroller is connected to Vcc that indicates internal memory is used for this appli

MICROCONTROLLER 89S52
FEATURES
8K Bytes of In-System Reprogrammable Flash Memory Endurance: 1,000 Write/Erase Cycles Fully Static Operation: 0 Hz to 24 MHz 256 x 8-bit Internal RAM 32 Programmable I/O Lines Three 16-bit Timer/Counters Eight Interrupt Sources Programmable Serial Channel Low-power Idle and Power-down Modes

DESCRIPTION
The AT89C52 is a low-power, high-performance CMOS 8-bit microcomputer with 8Kbytes of Flash programmable and erasable read only memory (PEROM). The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89C52 is a powerful microcomputer, which provides a highly flexible and costeffective solution to many embedded control applications

Page | 16 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM PIN DIAGRAM - 8086

Fig.2.10 Pin Diagram of Micro controller 8086

PIN DESCRIPTION
VCC - Supply voltage. GND - Ground.

Port 0: Port 0 is an 8-bit open drain bi-directional I/O port. As an output port, each pin can
sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as highimpedance inputs. Port 0 can also be configured to be the multiplexed low-order address/data bus during accesses to external program and data memory. In this mode, P0 has internal pull-ups. Port 0 also receives the code bytes during Flash programming and outputs the code bytes during program verification. External pull-ups are required during program verification.

Port 1: Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 output
buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. In addition, P1.0 and P1.1 Page | 17 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM can be configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively.

PORT PIN ALTERNATE FUNCTIONS P1.0 T2 (external count input to Timer/Counter 2), clock-out P1.1 T2EX (Timer/Counter 2 capture/reload trigger and direction control Port 2:
Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 2 pins that are externally being pulled low will source current (I IL) because of the internal pull-ups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that uses 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to external data memory that uses 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification.

Port 3:
Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (I IL) because of the pull-ups. Port 3 also serves the functions of various special features of the AT89C51. Port 3 also receives some control signals for Flash programming and verification.

PORT PIN ALTERNATE FUNCTIONS


P3.0 RXD (serial input port) P3.1 TXD (serial output port) P3.2 INT0 (external interrupt 0) P3.3 INT1 (external interrupt 1) P3.4 T0 (timer 0 external input) P3.5 T1 (timer 1 external input) P3.6 WR (external data memory write strobe) Page | 18 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM P3.7 RD (external data memory read strobe).

RST:
Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device.

ALE/PROG:
Address Latch Enable is an output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during flash programming. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes. However, that one ALE pulse is skipped during each access to external data memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode.

PSEN:
Program Store Enable is the read strobe to external program memory. When the AT89C52 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory.

EA/VPP:
External Access Enable (EA) must be strapped to GND in order to enable the device to fetch code from external pro-gram memory locations starting at 0000H up to FFFFH. However, if lock bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program executions. This pin also receives the 12V programming enable voltage (VPP) during Flash programming when 12V programming is selected.

XTAL1:
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.

XTAL2:
It is an output from the inverting oscillator amplifier.

Page | 19 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

BLOCK DIAGRAM OF 8086

EXTERNAL INTERRUPTS INTERRUPT CONTROL ON-CHIP ROM FOR PROGRAM CODE ONCHIP RAM
TIMER/CO UNTER

TIMER 1 TIMER 0

COUNTER INPUTS

CPU

OSC

BUS CONTROL

4 I/O PORTS

SERIAL PORT

P0 P1 P2 P3

Tx

Rx

Fig.2.11 Block Diagram Of micro controller 8086

ARCHITECHTURE OF 8052 MICROCONTROLLER

Architecture of 89S52 OSCILLATOR CHARACTERISTICS


XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier, which can be configured for use as an on-chip oscillator. Either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven. There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications must be observed.

Page | 20 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

IDLE MODE
In idle mode, the CPU puts itself to sleep while all the on-chip peripherals remain active. The mode is invoked by software. The content of the on-chip RAM and all the special functions registers remain unchanged during this mode. The idle mode can be terminated by any enabled interrupt or by a hardware reset. It should be noted that when idle is terminated by a hardware reset, the device normally resumes program execution, from where it left off, up to two machine cycles before the internal reset algorithm takes control. On-chip hardware inhibits access to internal RAM in this event, but access to the port pins is not inhibited. To eliminate the possibility of an unexpected write to a port pin when Idle is terminated by reset, the instruction following the one that invokes Idle should not be one that writes to a port pin or to external memory.

OSCILLATOR CONNECTIONS Oscillator Connections

Fig.2.12 Oscillator

Note: C1, C2 = 30 pF 10 pF for Crystals = 40 pF 10 pF for Ceramic Resonators

Page | 21 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM Fig.2.13 External Clock drives Configuration.

2.3.3 SELECTION OF DRIVER


In electronics, a driver is an electrical circuit or other electronic component used to control another circuit or other component, such as a high-power transistor. The term is used, for example, for a specialized computer chip that controls the high-power transistors in DC-to-DC voltage converters. An amplifier can also be considered the driver for loudspeakers, or a constant voltage circuit that keeps an attached component operating within a broad range of input voltages. In this project we are using L293D IC to amplify the signals

CONNECTIONS OF DRIVER
In this application driver is used to increase the strength of signals .The 2nd and 7th pins of this IC are connected to the PORT1.0 and PORT1.1 of Microcontroller. The 10th and 15th pin of this IC are connected to the PORT1.2 and PORT1.3 of Microcontroller.

L293D
The Device is a monolithic integrated high voltage, high current four channel driver designed to accept standard DTL or TTL logic levels and drive inductive loads (such as relays solenoids, DC and stepping motors) and switching power transistors. To simplify use as two bridges each pair of channels is equipped with an enable input. A separate supply input is provided for the logic, allowing operation at a lower voltage and internal clamp diodes are included. This device is suitable for use in switching applications at frequencies up to 5 kHz.

FEATURES
Supply Voltage from 4.5 V to 3.5v Separate Input-Logic Supply Internal ESD Protection Thermal Shutdown High-Noise-Immunity Inputs

Page | 22 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM Functional Replacements for SGS L293 and SGS L293D Output Current 1 A per Channel (600 MA for L293D) Peak Output Current 2 A per Channel (1.2 A for L293D) Output Clamp Diodes for Inductive Transient Suppression (L293D)

PIN DIAGRAM

Fig.2.14 Pin Diagram Of Driver DESCRIPTION


The L293D is quadruple high-current half-H driver. It designed to provide bidirectional drive currents of up to 1 A at voltages from 4.5 V to 36 V and to drive inductive loads such as relays, solenoids, dc and bipolar stepping motors, as well as other high-current/high-voltage loads in positive-supply applications. All inputs are TTL compatible. Each output is a complete totem-pole drive circuit, with a Darlington transistor sink and a pseudo-Darlington source. Drivers are enabled in pairs, with drivers 1 and 2 enabled by 1,2EN and drivers 3 and 4 enabled by 3,4EN. When an enable input is high the associated drivers are enabled and their outputs are active in phase with their inputs. When the enable input is low, those drivers are disabled and their outputs are off and in the high-impedance state. With the proper data inputs, each pair of drivers forms a full-H (or bridge) reversible drive suitable for solenoid or motor applications. On the L293D, external high-speed output clamp diodes should be used for inductive transient suppression. A VCC1 terminal, separate from VCC2, is provided for the logic inputs to minimize device power dissipation. The L293D is characterized for operation from 0C to 70C.

Page | 23 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

Fig. 2.3 BLOCK DIAGRAM :

Fig.2.15 Block Diagram of Driver

Page | 24 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

Fig.2.2 Function Table Of Driver

Fig.2.16 Inputs & Outputs of Driver

Page | 25 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

Fig.2.17 Two-phase Motor Driver

2.3.4 INTRODUCTION TO DC MOTOR


A direct current (DC) motor is another widely used device that translate electrical Pulses into mechanical movement. In the DC motor we have only + and leads connecting them to a DC voltage source moves the motor in one direction .By reversing the polarity, the DC

motor will move in the opposite direction. One can easily experiment with DC motor. For example, small fans used in any mother boards to cool the CPU are run by DC motors. By connecting their leads to the + and voltage source, the DC motor moves .While a stepper motor moves in steps of 1 to 50degrees,the DC motor moves continuously. In a stepper motor, if we know the starting position we can easily count the number of steps the motor has moved and calculate the final position of the motor. This is not possible in a DC motor. The maximum speed of a DC motor is indicated in rpm and is given in the data sheet. The DC motor has two rpms: no load and loaded. The manufacturers data sheet gives the no -load rpm.the no-load rpm can be from a few thousand to tens of thousands. The rpm is reduced when moving a load and it decreases as the load is increased. For example, a drill turning a screw has a much lower rpm Page | 26 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM speed then when it is in the no-load situation.DC motors also have voltage and current ratings. The nominal voltage is the voltage for that motor under normal conditions, and can be from 1 to 150v, depending on the motor. As we increase the voltage, the rpm goes up. The current rating is the current consumption when the nominal voltage is applied with no load, and can be from 25mA to a few amps. As the load increases, the rpm is decreased, unless the current or voltage provided to the motor is increased, which in turn increases the torque. With a fixed voltage, as the load increases, the current (power) consumption of a DC motor is increased. If we overload the motor it will stall, and that can damage the motor due to the heat generated by high current consumption. INTRODUCTION TO MOTORS A motor is a machine which converts energy into rotating motion. The dictionary definition of motor is broader than that but when engineers and mechanics talk about motors they are almost always talking about rotating motion. There are different names for devices which convert energy into other types of motion. A DC motor is a motor that uses direct electrical current (DC) as the source of its energy. An AC motor is a motor that uses alternating electrical current (AC) as the source of its energy. AC current is the type of electricity provided by household wall outlets. DC current is the type of electricity provided by batteries. A gear motor is a motor with an attached set of gears driving a secondary drive shaft. Practical motor designs result in motors that spin too fast for most uses. As a result, almost all gear sets are used to "gear down" the motor. The geared down drive shaft spins slower than the direct motor drive shaft. The geared down drive shaft also spins "harder". Motor speed is generally measured in revolutions per minute (RPM). Rotating force is called torque and for hobby motors is generally measured in inch-ounces or centimeter-grams. For now, just remember that the higher the number the harder the motor turns. Gearing down a motor reduces its RPM (speed) but increases its torque. Gears are generally contained within a housing that protects the gears from interference and which provides a bearing surface for the various gear shafts and drive shafts. The term gear box generally refers to the entire system of gears, shafts, bearings and housing. When you apply energy to a motor it spins as fast and hard as its design allows for that energy level and output load. If you increase the energy supply it spins faster and harder. If Page | 27 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM you attach a load the motor will slow down. If you continue increasing the load it slows ever more until the motors capability to work is exceeded. When the extreme load causes the motor to stop it is said to be stalled. Reducing the load causes the motor spin faster. If you entirely remove the load the motor is said to be "free running" and operates at its maximum speed for that input energy level. Electric motors both ac and dc motors, come in many shapes and sizes. Some are standardized electric motors for general-purpose applications. Other electric motors are intended for specific tasks. In any case, electric motors should be selected to satisfy the dynamic requirements of the machines on which they are applied without exceeding rated electric motor temperature. Thus, the first and most important step in electric motor selection is determining load characteristics -- torque and speed versus time. Electric motor selection is also based on mission goals, power available, and cost. An electric motor uses electrical energy to produce mechanical energy. The reverse process for using mechanical energy to produce electrical energy is accomplished by a generator or dynamo. Electric motors are found in household appliances such as fans, refrigerators, washing machines, pool pumps, floor vacuums, and fan-forced ovens. They are also found in many other devices such as computer equipment, in its disk drives, printers, and fans; and in some sound and video playing and recording equipment as DVD/CD players and recorders, tape players and recorders, and record players. Electric motors are also found in several kinds of toys such as some kinds of vehicles and robotic toys. The classic division of electric motors has been that of direct current (DC) type vs. Alternating Current (AC) types. This is more a de facto convention, rather than a rigid distinction. For example, many classic DC motors run on AC power, these motors being referred to as universal motors.

COMPARISON OF MOTOR TYPES:


Type Advantages Disadvantages Typical Application Typical Drive

AC (Shaded Pole)

Induction

Least Long high power

expensive Rotation life frequency

slips

from Fans

Uni/Poly-phase AC

Low starting torque

Page | 28 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

AC

Induction High high starting torque

power Rotation frequency

slips

from

(split-phase capacitor)

Appliances

Uni/Poly-phase AC

AC Synchronous

Rotation in-sync with freq long-life (alternator)

Clocks More expensive Audio tape drives turntables

Uni/Poly-phase AC

Stepper DC

Precision

positioning Slow Requires a controller

speed Positioning in printers and floppy drives

High holding torque

Multiphase DC

Brushless motor

DC

electric

Long low High efficiency

lifespan maintenance

High

initial

cost

Hard CD/DVD electric vehicles

drives players Multiphase DC

Requires a controller

Brushed motor

DC

electric

Low Simple (Dynamo)

initial speed

cost High control (brushes) Low lifespan

maintenance

Treadmill automotive starters

exercisers

Direct (PWM)

(Fig) 2.3 Types of motors A DC motor is an electric motor that runs on direct current (DC) electricity. DC motors were used to run machinery, often eliminating the need for a local steam engine or internal combustion engine. DC motors can operate directly from rechargeable batteries, providing the motive power for the first electric vehicles. Today DC motors are still found in applications as small as toys and disk drives, or in large sizes to operate steel rolling mills and paper machines. Modern DC motors are nearly always operated in conjunction with power electronic devices. Two important performance parameters of DC motors are the motor constants, Kv and Km. Contents [hide] 1 Brush 2 Brushless 3 Uncommitted 4 Connection types 4.1 Series connection 4.2 Shunt connection Page | 29 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM 4.3 Compound connection 5 See also 6 External links 7 References

Brush Main article: Brushed DC electric motor


This is a brushed DC electric motor generating torque directly from DC power supplied to the motor by using internal commutation, stationary permanent magnets. Torque is produced by the principle of Lorentz force, which states that any current-carrying conductor placed within an external magnetic field experiences a force known as Lorentz force. The commentator consists of a split ring 80 degree shows the effects of having a split ring. The brushed DC electric motor generates torque directly from DC power supplied to the motor by using internal commutation, stationary magnets (permanent or electromagnets), and rotating electrical magnets. Like all electric motors or generators, torque is produced by the principle of Lorentz force, which states that any current-carrying conductor placed within an external magnetic field experiences a torque or force known as Lorentz force. Advantages of a brushed DC motor include low initial cost, high reliability, and simple control of motor speed. Disadvantages are high maintenance and low life-span for high intensity uses. Maintenance involves regularly replacing the brushes and springs which carry the electric current, as well as cleaning or replacing the commentator. These components are necessary for transferring electrical power from outside the motor to the spinning wire windings of the rotor inside the motor.[edit]Brushless Main articles: Brushless DC electric motor and Switched reluctance motor Brushless DC motors use a rotating permanent magnet or soft magnetic core in the rotor, and stationary electrical magnets on the motor housing. A motor controller converts DC to AC. This design is simpler than that of brushed motors because it eliminates the complication of transferring power from outside the motor to the spinning rotor. Advantages of brushless motors include long life span, little or no maintenance, and high efficiency. Disadvantages include high initial cost, and more complicated motor speed controllers. Some such brushless motors are sometimes referred to as "synchronous motors" although they have no external power supply to be synchronized with, as would be the case with normal AC synchronous motors. [Edit]Uncommitted Page | 30 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM Other types of DC motors require no commutation. Homopolar motor A homopolar motor has a magnetic field along the axis of rotation and an electric current that at some point is not parallel to the magnetic field. The name homopolar refers to the absence of polarity change. Homopolar motors necessarily have a single-turn coil, which limits them to very low voltages. This has restricted the practical application of this type of motor. Ball bearing motor A ball bearing motor is an unusual electric motor that consists of two ball bearing-type bearings, with the inner races mounted on a common conductive shaft, and the outer races connected to a high current, low voltage power supply. An alternative construction fits the outer races inside a metal tube, while the inner races are mounted on a shaft with a nonconductive section (e.g. two sleeves on an insulating rod). This method has the advantage that the tube will act as a flywheel. The direction of rotation is determined by the initial spin which is usually required to get it going. [Edit]Connection types See also: Excitation (magnetic) There are three types of connections used for DC electric motors: series, shunt and compound. These types of connections configure how the motor's field and armature windings are connected. The type of connection is significant because it determines the characteristics of the motor and is selected for speed/torque requirements of the load. [1] [Edit]Series connection A series DC motor connects the armature and field windings in series with a common D.C. power source. This motor has poor speed regulation since its speed varies approximately inversely to load. However, a series DC motor has very high starting torque and is commonly used for starting high inertia loads, such as trains, elevators or hoists.[2] With no mechanical load on the series motor, the current is low, the magnetic field produced by the field winding is weak, and so the armature must turn faster to produce sufficient counter-EMF to balance the supply voltage (and internal voltage drops). For some types of motor, the speed may be higher than can be safely sustained by the motor. In a no-load condition, the motor may increase its speed until the motor mechanically destroys itself. This is called a runaway condition. The speed/torque characteristic is also useful in applications such as dragline excavators, where the digging tool moves rapidly when unloaded but slowly when carrying a heavy load. Page | 31 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM Series motors called "universal motors" can be used on alternating current. Since the armature voltage and the field direction reverse at (substantially) the same time, torque continues to be produced in the same direction. Since the speed is not related to the line frequency, universal motors can develop higher-than-synchronous speeds, making them lighter than induction motors of the same rated mechanical output. This is a valuable characteristic for hand-held power tools. Universal motors for commercial power frequency are usually small, not more than about 1 kW output. However, much larger universal motors were used, fed by special low-frequency traction power networks to avoid problems with commutation under heavy and varying loads. [Edit]Shunt connection A shunt DC motor connects the armature and field windings in parallel or shunt with a common D.C. power source. This type of motor has good speed regulation even as the load varies, but does not have as high of starting torque as a series DC motor.[3] It is typically used for industrial, adjustable speed applications, such as machine tools, winding/unwinding machines and tensionless. [Edit]Compound connection A compound DC motor connects the armature and fields windings in a shunt and a series combination to give it characteristics of both a shunt and a series DC motor.[4] This motor is used when both a high starting torque and good speed regulation is needed. The motor can be connected in two arrangements: cumulatively or differentially. Cumulative compound motors connect the series field to aid the shunt field, which provides higher starting torque but less speed regulation. Differential compound DC motors have good speed regulation and are typically operated at constant speed. They are commonly used in elevators, air compressors, conveyors and punch presses.

Fig.2.18 dc motor

Page | 32 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

2.3.5 SOLAR PANEL


A solar panel is a device that collects and converts solar energy into electricity or heat. It transfers energy from the sun into electricity or heat which can be used by (for example) nearby buildings.

Fig.2.19 Solar panel

Solar (photovoltaic) panels convert energy in the form of light from the sun into electrical energy. Between 4 and 22 percent of the energy falling on a panel is actually converted to usable electrical energy. The rest is reflected or turned into heat. These panels should not be confused with those used for solar water heating, which simply use the sun's energy to heat water directly.

A solar cell or photovoltaic cell is a device that converts solar energy into electricity by the photovoltaic effect. Photovoltaic is the field of technology and research related to the application of solar cells as solar energy. Sometimes the term solar cell is reserved for devices intended specifically to capture energy from sunlight, while the term photovoltaic cell is used when the source is unspecified.

Page | 33 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

2.3.6 INTRODUCTION TO LIGHT EMITTING DIODE (LED)


A light-emitting diode (LED) is a semiconductor diode that emits incoherent narrow spectrum light when electrically biased in the forward direction of the pn-junction, as in the common LED circuit. This effect is a form of electroluminescence. While sending a message in the form of bits such as 1,the data is sent to the receiver side correspondingly the LED glows representing the data is being received simultaneously when we send 8 as a data the LED gets off .

As in the simple LED circuit, The effect is a form of electroluminescence where incoherent and narrow-spectrum light is emitted from the p-n junction. LEDs are widely used as indicator lights on electronic devices and increasingly in higher power applications such as flashlights and area lighting. An LED is usually a small area (less than 1 mm2) light source, often with optics added to the chip to shape its radiation pattern and assist in reflection. The color of the emitted light depends on the composition and condition of the semi conducting material used, and can be infrared, visible, or ultraviolet. Besides lighting, interesting applications include using UV-LEDs for sterilization of water and disinfection of devices, and as a grow light to enhance photosynthesis in plants.

Page | 34 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

COLOR CODING:

Color Infrared Red -

Potential Difference 1.6 V 1.8 V to 2.1 V 2.2 V 2.4 V 2.6 V 3.0 V to 3.5 V 3.0 V to 3.5 V 3.5V

Orange Yellow Green Blue

White Ultraviolet

Fig.2.4 color coding of led Page | 35 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM (Close-up of a typical LED in its case showing the internal structure)

ADVANTAGES LEDs have many advantages over other technologies like lasers. As compared to laser diodes or IR sources LEDs are conventional incandescent lamps. For one thing, they don't have a filament that will burn out, so they last much longer. Additionally, their small plastic bulb makes them a lot more durable. They also fit more easily into modern electronic circuits. The main advantage is efficiency. In conventional incandescent bulbs, the lightproduction process involves generating a lot of heat (the filament must be warmed). Unless you're using the lamp as a heater, because a huge portion of the available electricity isn't going toward producing visible light. LEDs generate very little heat. A much higher percentage of the electrical power is going directly for generating light, which cuts down the electricity demands considerably. LEDs offer advantages such as low cost and long service life. Moreover LEDs have very low power consumption and are easy to maintain.

DISADVANTAGES LEDs performance largely depends on the ambient temperature of the operating environment. LEDs must be supplied with the correct current. LEDs do not approximate a "point source" of light, so cannot be used in applications needing a highly collimated beam. But the disadvantages are quite negligible as the negative properties of LEDs do not apply and the advantages far exceed the limitations.

Page | 36 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

Miniature
These are mostly single-die LEDs used as indicators, and they come in various sizes from 2 mm to 8 mm, through-hole and surface mount packages. They usually do not use a separate heat sink.[83] Typical current ratings ranges from around 1 am to above 20 am. The small size sets a natural upper boundary on power consumption due to heat caused by the high current density and need for a heat sink. Common package shapes include round, with a domed or flat top, rectangular with a flat top (as used in bar-graph displays), and triangular or square with a flat top. The encapsulation may also be clear or tinted to improve contrast and viewing angle. There are three main categories of miniature single die LEDs: Low-current typically rated for 2 am at around 2 V (approximately 4 maw consumption). Standard 20 am LEDs at around 2 V (approximately 40 maw) for red, orange, yellow, and green, and 20 am at 45 V (approximately 100 maw) for blue, violet, and white. Ultra-high-output 20 am at approximately 2 V or 45 V, designed for viewing in direct sunlight. Five- and twelve-volt LEDs are ordinary miniature LEDs that incorporate a suitable series resistor for direct connection to a 5 V or 12 V supply.

Mid-range
Medium-power LEDs are often through-hole-mounted and used when an output of a few lumen is needed. They sometimes have the diode mounted to four leads (two cathode leads, two anode leads) for better heat conduction and carry an integrated lens. An example of this is the Super flux package, from Philips Luciles. These LEDs are most commonly used in light panels, emergency lighting, and automotive tail-lights. Due to the larger amount of metal in the LED, they are able to handle higher currents (around 100 m A). The higher current allows for the higher light output required for tail-lights and emergency lighting.

Page | 37 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

High-power
High-power LEDs (HPLED) can be driven at currents from hundreds of am to more than an ampere, compared with the tens of am for other LEDs. Some can emit over a thousand lumens.[84][85] Since overheating is destructive, the HPLEDs must be mounted on a heat sink to allow for heat dissipation. If the heat from a HPLED is not removed, the device will fail in seconds. One HPLED can often replace an incandescent bulb in a flashlight, or be set in an array to form a powerful LED lamp. Some well-known HPLEDs in this category are the Luciles Rebel Led, Orem Opt Semiconductors Golden Dragon, and Cree X-lamp. As of September 2009, some HPLEDs manufactured by Cree Inc. now exceed 105 lm/W [86] (e.g. the Lamp XP-G LED chip emitting Cool White light) and are being sold in lamps intended to replace incandescent, halogen, and even fluorescent lights, as LEDs grow more cost competitive. LEDs have been developed by Seoul Semiconductor that can operate on AC power without the need for a DC converter. For each half-cycle, part of the LED emits light and part is dark, and this is reversed during the next half-cycle. The efficacy of this type of HPLED is typically 40 lm/W.[87] A large number of LED elements in series may be able to operate directly from line voltage. In 2009, Seoul Semiconductor released a high DC voltage LED capable of being driven from AC power with a simple controlling circuit. The low-power dissipation of these LEDs affords them more flexibility than the original AC LED design.[88]

Page | 38 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

CHAPTER 3 CIRCUIT OPERATION

3.1 SCHEMATIC DIAGRAM

10K PULLUP

10K PULLUP

R8 R7 R6 R5 R4 R3 R2 R1 C

C R1 R2 R3 R4 R5 R6 R7 R8

VCC VCC GND 1 GND 2 VCC 3 VEE 4 RS 5 RW 6 EN 7 D0 8 D1 9 D2 10 D3 11 D4 12 D5 13 D6 14 D7 15 VCC 16 GND VCC

VCC VCC 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 (T2) P1.0 (T2 EX) P1.1 P1.2 P1.3 P1.4 (MOSI) P1.5 (MISO) P1.6 (SCK) P1.7 RST VCC P0.0/AD0 P0.1/AD1 P0.2/AD2 P0.3/AD3 P0.4/AD4 P0.5/AD5 P0.6/AD6 P0.7/AD7 EA/VPP 40 39 38 37 36 35 34 33 32 31 30

9 8 7 6 5 4 3 2 1

1 2 3 4 5 6 7 8 9

4.7K

CLK(MCP3201) DOUT(MCP3201) CS(MCP3201) FROM ISP FROM ISP FROM ISP RST

RS(LCD) EN(LCD) D4(LCD) D5(LCD) D6(LCD) D7(LCD)

5K TRIM POT P0.4 P0.5 P0.6 P0.7

XTAL2 XTAL1

(RXD) P3.0 (TXD) P3.1 ALE/PROG (INT0) P3.2 (INT1) P3.3 PSEN (T0) P3.4 P2.7/A15 (T1) P3.5 (WR) P3.6 P2.6/A14 P2.5/A13 (RD) P3.7 P2.4/A12 XTAL2 P2.3/A11 P2.2/A10 XTAL1 P2.1/A9 GND P2.0/A8

VCC 29 28 27 26 25 24 23 22 21 VCC 1B(ULN2003) 2B(ULN2003) 3B(ULN2003) 4B(ULN2003)

GND

GND

LCD

VCC 1 8 7 6 5 P1.0 P1.1 P1.2

GND

VREF IN+ INVSS

VCC CLK DOUT CS/SHDN

9 8 7 6 5 4 3 2 1

2 2 1 SOLARPANEL 3 4

AT89S52

10K PULLUP

GND

MCP3201

BRIDGE RECTIFIER 2 1 230V,A.C 2 + 4 1

LCD DISPLAY

P0.1 GND P0.3

7805 REG
VIN VOUT

C R1 R2 R3 R4 R5 R6 R7 R8
VCC = 5V 3 220 ohm 104pf LED

STEPPER MOTOR
P2.7 P2.6 P2.5 P2.4
1 2 3 4 5 6 7 8 1B 2B 3B 4B 5B 6B 7B GND 1C 2C 3C 4C 5C 6C 7C COM 16 15 14 13 12 11 10 9 1 2 3

TRANSFORMER

GND 2
33pf

(9V,1 AMP)

1000uf /35V

ULN2003 POWER SUPPLY(5V DC)


GND GND

VCC

VCC GND

SWITCH

33 pf C

10 uf/63V
RST R

1 3 5 7 9 VCC

I S P

2 4 6 8 10

P1.6 P1.7 RST P1.5

XTAL2 11.0592MHz 33 pf XTAL1 Title


M,AXIMUM POWER POINT TRACKING USING SOLAR POWERPANELS WITH HIGH EFICIENCY

8.2K

GND Size Document Number Wednesday , February 04, 2009 Sheet 1 of 1 Rev

GND

RESET

AT89S52 ISP

AT89S52 CRYSTAL
Date:

Page | 39 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

3.2 CIRCUIT DISCRIPTION

DESIGNING In order to fulfill this application there are few steps that has been performed i.e.

1) Designing the power supply for the entire circuitry. 2) Selection of microcontroller that suits our application. 3) Selection of ADC.

Complete studies of all the above points are useful to develop this project.

3.2.1 SELECTION OF MICROCONTROLLER

As we know that there so many types of micro controller families that are available in the market. Those are

1) 8051 Family 2) AVR microcontroller Family 3) PIC microcontroller Family 4) ARM Family

Basic 8051 family is enough for our application; hence we are not concentrating on higher end controller families.

In order to fulfill our application basic that is AT89C51 controller is enough. But still we selected AT89S52 controller because of inbuilt ISP (in system programmer) option.

There are minimum six requirements for proper operation of microcontroller. Those are: Page | 40 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM 3) power supply section 4) pull-ups for ports (it is must for PORT0) 5) Reset circuit 6) Crystal circuit 7) ISP circuit (for program dumping) 8) EA/VPP pin is connected to Vcc. PORT0 is open collector thats why we are using pull-up resistor which makes PORT0 as an I/O port. Reset circuit is used to reset the microcontroller. Crystal circuit is used for the microcontroller for timing pluses. In this project we are not using external memory thats why EA/VPP pin in the microcontroller is connected to Vcc that indicates internal memory is used for this application.

3.2.2 SELECTION OF DRIVER

Driver is used increase the strength of signal. In this application we are using stepper motor to rotate the solar panel .So to drive the stepper motor we have to increase the strength of signal. In the market so many ICs are available I selected ULN 2003 which is inbuilt 7 NPN transistors .And the working voltage of this IC is 5 volts which is same as microcontroller working voltage .And in my board I no need to design any other power supply section thats why I selected this IC in my project.

3.2.3 SELECTION OF ADC

Here in this project I selected SPI protocol based MCP3201 ADC. In this project ADC is used to convert analog voltage sent by the solar panel to digital voltage. We can use parallel ADC (ADC 0804) but we need more pins to interface that, so to reduce port pins we can use MCP3201, but to read the data from MCP3201 we can use SPI protocol.

Page | 41 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM CONNECTIONS TO MICROCONTROLLER

Microcontroller has 4 ports and every port has 8 pins We are connecting all external components to this ports only .LCD is connected to the PORT zero and ULN2003 is connected to PORT two and MCP 3201 which is acting as ADC is connected to the P1.0 and P1.1 and P1.2 .

CONNECTIONS OF ADC

In this application ADC is used to convert from analog voltage to digital voltage .The output of solar panel is connected to 2nd (input) pin of this IC .The output pins 7th, 6th, 5th are connected to P1.0, P1.1, and P1.2 of controller

CONNECTIONS OF DRIVER IC (ULN 2003) ULN 2003 has 16 pins in this 1st pin is connected to 2.7 pin and 2nd pin is connected to 2.6 and 3rd pin is connected to 2.5 and 4th pin is connected to 2.4 pin of the microcontroller. And 8th pin is connected to ground 9th to Vcc and 13th to 16th pins are connected to the stepper motor. And other pins are not connected.

CONNTCTOIONS TO THE STEPPER MOTOR

Stepper motor has 6 wires all this are connected to the ULN 2003 .In these two wires are connected to Vcc and other wires are connected to the 13th to 16th pin of the ULN 2003.

Page | 42 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM 3.3 CIRCUIT OPERATION

Whenever the power up we are written application program to rotate the solar panel till 360 degrees step by step to find maximum intensity .In this project we are using stepper motor to rotate the solar panel .In this application we are using 12 steps to rotate the solar panel 360 degrees .we can measure the intensity per each step in form of voltage levels .So we can measure 12 voltage levels for 12 steps .Solar panel gives the intensity in the form of voltage and this voltage gives to ADC, the ADC converts the analog voltage to digital voltage and this value is given to the controller. After measuring all voltage values then we can find maximum value it means there is maximum intensity .So we can place the solar panel where is the maximum intensity.

After a particular time again we can rotate the solar panel step by step till 360 degrees, then we can measure the voltage levels per each step and we can find the maximum intensity value in the form of voltage. According the voltage value we can place the solar panel at particular position. We can repeat this process.

Page | 43 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

CHAPTER 4 ADVANTAGES & DISADVANTAGES


4.1 ADVANTAGES 1.Solar tracking systems continually orient photovoltaic panels towards the sun and can help maximize your investment in your PV system. 2.One time investment, which provides higher efficiency & flexibility on dependency over other sources. 3.Tracking systems can help reducing emissions and can contribute against global warming. 4. Bulk implementations of tracking systems help reduced consumption of power by other sources. 5.It enhances the clean and emission free power production 4.2 Disadvantages 1. Initial investment is high on solar panels. 2. Its a bit of difficult for servicing, as the tracking systems are not quite popular regionally. 3. Moving parts and gears which will require regular maintenance. 4.May require repair or replacement of broken parts over a long run.

4.3 Applications
1. Can be used for small & medium scale power generations 2. For power generation at remote places where power lines are not accessible. 3 For domestic backup power systems.

Page | 44 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

CHAPTER 5
FUTURE SCOPE
Solar energy refers to the utilization of the radiant energy from the Sun. Solar power is used interchangeably with solar energy, but refers more specifically to the conversion of sunlight into electricity by photovoltaic, concentrating solar thermal devices, or by an experimental technology such as a solar chimney or solar pond.Solar panels are Photovoltaic cells which gives voltage directly if you place them in sun light. Here if you change the position of panels the power output will vary. Means, direct sunrays on solar panel can give good output otherwise there might be decrease in the value of their outputs. So we have to track the path where the maximum power will attain. Solar panel devices are of two types that collect energy from the sun. One is solar photovoltaic modules which use solar cells to convert light from the sun into electricity and the other is solar thermal collector which converts the suns energy to heat water or another fluid such as oil or antifreeze. In this project we are using the photovoltaic type.The solar panel gives the voltage directly to the microcontroller through ADC. This solar panel should be fixed on the stepper motor shaft so that it can easily rotate 180 degrees. The microcontroller controls the stepper motor to rotate in desired direction. In order to attain maximum power output the microcontroller accesses the solar panel direction continuously, which is on the shaft of stepper motor. By using real time clock we can adjust the panel directions according to the sun angle without using manpower

Page | 45 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

CHAPTER 6 Conclusion
A solar tracking system, comprising: a first set of solar heat gain transducers that produce respective first electrical output signals to drive a reversible first motor for changing a vertical angle of a solar collector; a second set of solar heat gain transducers that produce respective second electrical output signals to drive a reversible second motor for changing a horizontal angle of the solar collector; each of the transducers having a thermistor in thermal contact with a thermal mass, wherein the thermal mass comprises a mass of conducting material to elevate in temperature while illuminated by the sun, and wherein the thermistor senses the temperature of the thermal mass and produces a corresponding one of the electrical output signals proportional to the temperature; and each of the transducers having the thermistor and the thermal mass contained in a solar energy collecting and heat insulating enclosure that is solar energy transparent.

Page | 46 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

CHAPTER 7 REFERENCE
TEXT BOOKS REFERED
1. The 8051 Microcontroller and Embedded Systems by Muhammad Ali Mazidi and Janice Gillispie Mazidi, Pearson Education. 2. 8051 Microcontroller Architecture, programming and application by KENNETH JAYALA

3. ATMEL 89s52 Data sheets 4. Hand book for Digital ICs from Analogic Devices

WEBSITES VIEWED
www.atmel.com www.beyondlogic.org www.dallassemiconductors.com www.maxim-ic.com www.alldatasheets.com www.howstuffworks.com

Page | 47 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

APPENDIX A
A.1 INTRODUCTION TO EMBEDDED SYSTEMS
Embedded systems are electronic devices that incorporate microprocessors with in their implementations. The main purposes of the microprocessors are to simplify the system design and provide flexibility. Having a microprocessor in the device helps in removing the bugs, making modifications, or adding new features are only matter of rewriting the software that controls the device. Or in other words embedded computer systems are electronic systems that include a microcomputer to perform a specific dedicated application. The computer is hidden inside these products. Embedded systems are ubiquitous. Every week millions of tiny computer chips come pouring out of factories finding their way into our everyday products. Embedded systems are self-contained programs that are embedded within a piece of hardware. Whereas a regular computer has many different applications and software that can be applied to various tasks, embedded systems are usually set to a specific task that cannot be altered without physically manipulating the circuitry. Another way to think of an embedded system is as a computer system that is created with optimal efficiency, thereby allowing it to complete specific functions as quickly as possible. Embedded systems designers usually have a significant grasp of hardware technologies. They use specific programming languages and software to develop embedded systems and manipulate the equipment. When searching online, companies offer embedded systems development kits and other embedded systems tools for use by engineers and businesses. Embedded systems technologies are usually fairly expensive due to the necessary development time and built in efficiencies, but they are also highly valued in specific industries. Smaller businesses may wish to hire a consultant to determine what sort of embedded systems will add value to their organization. A.1.1 CHARACTERISTICS Two major areas of differences are cost and power consumption. Since many embedded systems are produced in tens of thousands to millions of units range, reducing cost is a major concern. Embedded systems often use a (relatively) slow processor and small memory size to minimize costs. The slowness is not just clock speed. The whole architecture of the computer is often intentionally simplified to lower costs. For example, embedded systems often use peripherals controlled by synchronous serial interfaces, which are ten to hundreds of times slower than comparable peripherals used in PCs. Programs on an embedded system often run with real-time constraints with limited hardware resources: often there is no disk drive, operating system, keyboard or screen. A flash drive may replace rotating media, and a small keypad and LCD screen may be used instead of a PC's keyboard and screen. Page | 48 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM Firmware is the name for software that is embedded in hardware devices, e.g. in one or more ROM/Flash memory IC chips. Embedded systems are routinely expected to maintain 100% reliability while running continuously for long periods, sometimes measured in years. Firmware is usually developed and tested too much harsher requirements than is general-purpose software, which can usually be easily restarted if a problem occurs. A.1.2 PLATFORM There are many different CPU architectures used in embedded designs. This in contrast to the desktop computer market which is limited to just a few competing architectures mainly the Intel/AMD x86 and the Apple/Motorola/IBM Power PCs which are used in the Apple Macintosh. One common configuration for embedded systems is the system on a chip, an application-specific integrated circuit, for which the CPU was purchased as intellectual property to add to the IC's design. A.1.3 TOOLS Like a typical computer programmer, embedded system designers use compilers, assemblers and debuggers to develop an embedded system. Those software tools can come from several sources: Software companies that specialize in the embedded market Ported from the GNU software development tools. Sometimes, development tools for a personal computer can be used if the embedded processor is a close relative to a common PC processor. Embedded system designers also use a few software tools rarely used by typical computer programmers. Some designers keep a utility program to turn data files into code, so that they can include any kind of data in a program. Most designers also have utility programs to add a checksum or CRC to a program, so it can check its program data before executing it. A.1.4 OPERATING SYSTEM

They often have no operating system, or a specialized embedded operating system (often a realtime operating system), or the programmer is assigned to port one of these to the new system. A.1.5 DEBUGGING

Debugging is usually performed with an in-circuit emulator, or some type of debugger that can interrupt the micro controllers internal microcode. The microcode interrupt lets the debugger operate in hardware in which only the CPU works. The CPU-based debugger can be used to test and debug the electronics of the computer from the viewpoint of the CPU. Developers should insist on debugging which shows the high-level language, with breakpoints and single stepping, because these features are widely available. Also, developers should write and use simple logging facilities to debug sequences of real-time events. PC or mainframe programmers first encountering this sort of programming often become confused about design priorities and acceptable methods. Mentoring, code-reviews and ego less programming are recommended. Page | 49 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

A.2 DESIGN OF EMBEDDED SYSTEMS:


The electronics usually uses either a microprocessor or a microcontroller. Some large or old systems use general-purpose mainframes computers or minicomputers. A.2.1 START-UP All embedded systems have start-up code. Usually it disables interrupts, sets up the electronics, tests the computer (RAM, CPU and software), and then starts the application code. Many embedded systems recover from short-term power failures by restarting (without recent selftests). Restart times under a tenth of a second are common. Many designers have found one of more hardware plus software-controlled LEDs useful to indicate errors during development (and in some instances, after product release, to produce troubleshooting diagnostics). A common scheme is to have the electronics turn off the LED(s) at reset, whereupon the software turns it on at the first opportunity, to prove that the hardware and start-up software have performed their job so far. After that, the software blinks the LED(s) or sets up light patterns during normal operation, to indicate program execution progress and/or errors. This serves to reassure most technicians/engineers and some users. A.2.2 THE CONTROL LOOP In this design, the software has a loop. The loop calls subroutines. Each subroutine manages a part of the hardware or software. Interrupts generally set flags, or update counters that are read by the rest of the software. A simple API disables and enables interrupts. Done right, it handles nested calls in nested subroutines, and restores the preceding interrupt state in the outermost enable. This is one of the simplest methods of creating an exocrine. Typically, there's some sort of subroutine in the loop to manage a list of software timers, using a periodic real time interrupt. When a timer expires, an associated subroutine is run, or flag is set. Any expected hardware event should be backed-up with a software timer. Hardware events fail about once in a trillion times. State machines may be implemented with a function-pointer per state-machine (in C++, C or assembly, anyway). A change of state stores a different function into the pointer. The function pointer is executed every time the loop runs. Many designers recommend reading each IO device once per loop, and storing the result so the logic acts on consistent values. Many designers prefer to design their state machines to check only one or two things per state. Usually this is a hardware event, and a software timer. Designers recommend that hierarchical state machines should run the lower-level state machines before the higher, so the higher run with accurate information. Complex functions like internal combustion controls are often handled with multidimensional tables. Instead of complex calculations, the code looks up the values. The software can interpolate between entries, to keep the tables small and cheap. Page | 50 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM One major disadvantage of this system is that it does not guarantee a time to respond to any particular hardware event. Careful coding can easily assure that nothing disables interrupts for long. Thus interrupt code can run at very precise timings. Another major weakness of this system is that it can become complex to add new features. Algorithms that take a long time to run must be carefully broken down so only a little piece gets done each time through the main loop. This system's strength is its simplicity, and on small pieces of software the loop is usually so fast that nobody cares that it is not predictable. Another advantage is that this system guarantees that the software will run. There is no mysterious operating system to blame for bad behavior.

A.3 USER INTERFACES


Interface designers at PARC, Apple Computer, Boeing and HP minimize the number of types of user actions. For example, use two buttons (the absolute minimum) to control a menu system (just to be clear, one button should be "next menu entry" the other button should be "select this menu entry"). A touch-screen or screen-edge buttons also minimize the types of user actions. Another basic trick is to minimize and simplify the type of output. Designs should consider using a status light for each interface plug, or failure condition, to tell what failed. A cheap variation is to have two light bars with a printed matrix of errors that they select- the user can glue on the labels for the language that she speaks. For example, Boeing's standard test interface is a button and some lights. When you press the button, all the lights turn on. When you release the button, the lights with failures stay on. The labels are in Basic English. Designers use colors. Red defines the users can get hurt- think of blood. Yellow defines something might be wrong. Green defines everything's OK. Another essential trick is to make any modes absolutely clear on the user's display. If an interface has modes, they must be reversible in an obvious way. Most designers prefer the display to respond to the user. The display should change immediately after a user action. If the machine is going to do anything, it should start within 7 seconds, or give progress reports. One of the most successful general-purpose screen-based interfaces is the two menu buttons and a line of text in the user's native language. It's used in pagers, medium-priced printers, network switches, and other medium-priced situations that require complex behavior from users. When there's text, there are languages. The default language should be the one most widely understood.

Page | 51 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

A.4 INTRODUCTION TO MICROCONTROLLER


Microcontrollers as the name suggests are small controllers. They are like single chip computers that are often embedded into other systems to function as processing/controlling unit. For example the remote control you are using probably has microcontrollers inside that do decoding and other controlling functions. They are also used in automobiles, washing machines, microwave ovens, toys ... etc, where automation is needed. Micro-controllers are useful to the extent that they communicate with other devices, such as sensors, motors, switches, keypads, displays, memory and even other micro-controllers. Many interface methods have been developed over the years to solve the complex problem of balancing circuit design criteria such as features, cost, size, weight, power consumption, reliability, availability, manufacturability. Many microcontroller designs typically mix multiple interfacing methods. In a very simplistic form, a micro-controller system can be viewed as a system that reads from (monitors) inputs, performs processing and writes to (controls) outputs. Embedded system means the processor is embedded into the required application. An embedded product uses a microprocessor or microcontroller to do one task only. In an embedded system, there is only one application software that is typically burned into ROM. Example: printer, keyboard, video game player Microprocessor - A single chip that contains the CPU or most of the computer Microcontroller - A single chip used to control other devices Microcontroller differs from a microprocessor in many ways. First and the most important is its functionality. In order for a microprocessor to be used, other components such as memory, or components for receiving and sending data must be added to it. In short that means that microprocessor is the very heart of the computer. On the other hand, microcontroller is designed to be all of that in one. No other external components are needed for its application because all necessary peripherals are already built into it. Thus, we save the time and space needed to construct devices. MICROPROCESSOR VS MICROCONTROLLER: Microprocessor CPU is stand-alone, RAM, ROM, I/O, timer are separate Designer can decide on the amount of ROM, RAM and I/O ports. expensive versatility general-purpose

Page | 52 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM Microcontroller

CPU, RAM, ROM, I/O and timer are all on a single chip fix amount of on-chip ROM, RAM, I/O ports for applications in which cost, power and space are critical

Page | 53 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

APPENDIX B
Many companies provide the 8051 assembler, some of them provide shareware version of their product on the Web, Kiel is one of them. We can download them from their Websites. However, the size of code for these shareware versions is limited and we have to consider which assembler is suitable for our application.

B.1 KIEL U VISION2 This is an IDE (Integrated Development Environment) that helps you write, compile, and debug embedded programs. It encapsulates the following components: . . . . . A project manager A make facility Tool configuration Editor A powerful debugger To get start here are some several example programs

B.2 BUILDING AN APPLICATION IN UVISION2

To build (compile, assemble, and link) an application in uVision2, you must:

Select ProjectOpen Project (For example, \C166\EXAMPLES\HELLO\HELLO.UV2)

Select Project - Rebuild all target files or Build target. UVision2 compiles, assembles,

and links the files in your project.

B.3 CREATING YOUR OWN APPLICATION IN UVISION2

To create a new project in uVision2, you must:

Select Project - New Project. Page | 54

Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM . . Select a directory and enter the name of the project file. Select Project - Select Device and select an 8051, 251, or C16x/ST10 device from the Device . . . Database Create source files to add to the project. Select Project - Targets, Groups, and Files. Add/Files, select Source Group1, and add the source files to the project. . Select Project - Options and set the tool options. Note when you select the target device from the Device Database all-special options are set automatically. You only need to configure the memory map of your target hardware. Default memory model settings are optimal for most.

B.4 DEBUGGING AN APPLICATION IN UVISION2

To debug an application created using uVision2, you must:

. .

Select Debug - Start/Stop Debug Session. Use the Step toolbar buttons to single-step through your program. You may enter G, main in the Output Window to execute to the main C function.

. .

Open the Serial Window using the Serial #1 button on the toolbar. Debug your program using standard options like Step, Go, Break, and so on.

B.5 LIMITATIONS OF EVALUATION SOFTWARE

The following limitations apply to the evaluation versions of the C51, C251, or C166 tool chains. C51 Evaluation Software Limitations:

The compiler, assembler, linker, and debugger are limited to 2 Kbytes of object code but source Code may be any size. Programs that generate more than 2 Kbytes of object code will not compile, assemble, or link the startup code generated includes LJMP's and Page | 55

Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM cannot be used in single-chip devices supporting Less than 2 Kbytes of program space like the Philips 750/751/752. . . . . The debugger supports files that are 2 Kbytes and smaller. Programs begin at offset 0x0800 and cannot be programmed into single-chip devices. No hardware support is available for multiple DPTR registers. No support is available for user libraries or floating-point arithmetic.

B.6 EVALUATION SOFTWARE

. . .

Code-Banking Linker/Locator Library Manager. RTX-51 Tiny Real-Time Operating System

B.7 PERIPHERAL SIMULATION

The u vision2 debugger provides complete simulation for the CPU and on chip peripherals of most embedded devices. To discover which peripherals of a device are supported, in u vision2. Select the Simulated Peripherals item from the Help menu. You may also use the web-based device database. We are constantly adding new devices and simulation support for on-chip peripherals so be sure to check Device Database often.

Page | 56 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM

APPENDIX C
C.1 CODE
#include <reg52.h> #include<lcd.h> #include<intrins.h> #define DELAY _nop_(); sbit sbit sbit sbit CLK = DOUT= DIN = CS = P2^5; P2^4; P2^3; P2^2;

sbit m1=P2^0; sbit m2=P2^1; sbit s1 = P2^6; sbit s2 = P2^7; sbit pin = P1^0; float adc_convert (void); void float_lcd(float f); unsigned char byte_write_read(unsigned char); void select_channel(void); float t; unsigned int i,j,range=0; unsigned char channel,A,C; void stop() { m1=m2=0; } void left() { m1=0; m2=1; } void right() { m1=1; m2=0; } void TEMP() { t=0; i=0; channel=i; t=t+adc_convert(); t=t*1; }

Page | 57 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM


void main (void) { m1=m2=0; s1=s2=1; pin=1; init_lcd(); display_lcd("Solar "); cmd_lcd(0x01); cmd_lcd(0x80); display_lcd("T:"); while(1) { m1=m2=0; s1=s2=1; pin=1; back: stop(); do { cmd_lcd(0x80); display_lcd("T:"); cmd_lcd(0x82); TEMP(); float_lcd(t); display_lcd(" V "); delay_ms(15); }while(pin==1); stop(); delay_ms(10); right(); do { cmd_lcd(0x80); display_lcd("T:"); cmd_lcd(0x82); TEMP(); float_lcd(t); display_lcd(" V "); delay_ms(15); }while(s2==1 && pin==0); if(s2==0) stop(); else goto back; delay_ms(10); left(); do { cmd_lcd(0x80); display_lcd("T:"); cmd_lcd(0x82); TEMP(); float_lcd(t);

Page | 58 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM


display_lcd(" V delay_ms(15); }while(s1==1 && pin==0); if(s1==0) stop(); else goto back; } } ");

float adc_convert (void) { // variables declaration unsigned char byte0,byte1,byte2; int i; float val; CLK=0; CS=1; CS=0; select_channel(); byte0=byte_write_read(A); byte1=byte_write_read(C); byte2=byte_write_read(0x00); CS=1; i=(byte1&0x0f); i=((i<<8)|byte2); val=(i*4.096)/4096; return val; } unsigned char byte_write_read (unsigned char a) { unsigned char c=0,mask=0x80; do { CLK=1; //delay_us(500); delay_ms(1); if(a&mask) DIN=1; else DIN=0; CLK=0; //delay_us(500); delay_ms(1); if(DOUT==1) c|=mask;

Page | 59 Gandhiji institute of science and technology

SOLAR TRACKING SYSTEM


mask>>=1; } while(mask>0); return c; } void select_channel (void) { unsigned char x; x=(channel*4)+0x60; A = x>>4; C = x<<4; }

Page | 60 Gandhiji institute of science and technology

You might also like