Sites: | GlobalSpec Electronics | CR4 | Electronics360
Login | Register
The Engineer's Place for News and Discussion®


Join Date: Apr 2012
Posts: 1

Re: Stepper Motor Rotation Using Pic 16f877

04/05/2012 2:17 PM

Solar energy is rapidly advancing as an important means ofrenewable energy resource. More energy is produced by trackingthe solar panel to remain aligned to the sun at a right angle to therays of light. This paper describes in detail the design andconstruction of a prototype for solar tracking system with twodegrees of freedom, which detects the sunlight using photocells.The control circuit for the solar tracker is based on a PIC16F84Amicrocontroller (MCU). This is programmed to detect thesunlight through the photocells and then actuate the motor toposition the solar panel where it can receive maximum sunlight.Keyword: PIC MCU, tracking, photocell, frame, motion system1. IntroductionThese days electrical generation is typically provided by fossilfuels such as coal, natural gas, and oil and also as nuclear power[1, 19]. Some of today's most serious environmental problemscan be linked to world electricity production based primarily onthe use of non-renewable resources. Currently one third of theworld population do not have access to electricity and are notconnected to the national grid, one solution to this problem isrenewable energy in the form of photovoltaic (PV) systems.Despite high capital cost, PV systems are still a viable solutionfor rural areas [2]. Studies suggest that the rate at which fossilfuels are consumed today, there are high chances that they willdeplete by the end of this century. For a long time, it has beenthought that atomic energy would be a solution for the growingenergy problem, but in recent times solar energy has proved to bean efficient, more secure and safe way of providing energyConcepts related to the solar energy have constantly been underheavy research and development. The basic objective is tooptimize the energy produced from photovoltaic cells, by makingthe overall systems more efficient and cost effective. Most solarpanels are statically aligned; they have a fixed position at acertain angle towards the sky. Therefore, the time and intensityof direct sunlight falling upon the solar panel is greatly reduced,resulting in low power output from the photovoltaic (PV) cells.Solar tracking system is the solution to this issue as it plays amajor role in overall solar energy optimization.In order to ensure maximum power output from PV cells, thesunlight's angle of incidence needs to be constantlyperpendicular to the solar panel. This requires constant trackingof the sun's apparent daytime motion, and hence develops anautomated sun tracking system which carries the solar panel andpositions it in such a way that direct sunlight is always focusedon the PV cells [2].This paper is about moving a solar panel along with the directionof sunlight; it uses a gear motor to control the position of thesolar panel, which obtains its data from a PIC16F84Amicrocontroller. The objective is to design and implement anautomated, double-axis solar-tracking mechanism usingembedded system design in order to optimize the efficiency ofoverall solar energy output [3].Two light dependent resistors (LDR) is used for each degree offreedom. LDRs are basically photocells that are sensitive to light.Software will be developed which would allow the PIC to detectand obtain its data from the two LDRs and then compare theirresistance. The two LDRs will be positioned in such a way, sothat if one of the two comes under a shadow, the MCU willdetect the difference in resistance and thus actuate the motor tomove the solar panel at a position where the light upon bothLDRs is equal. Two separate but identical circuits will be utilizedfor both axes [3, 4, 20].2. Light Sensor TheoryA light sensor is the most common electronic component whichcan be easily found. The simplest optical sensor is a photoresistor or photocell which is a light sensitive resistor these aremade of two types, cadmium sulfide (CdS) and gallium arsenide(GaAs) [4],The sun tracker system designed here uses the cadmium sulfide(CdS) photocell for sensing the light. This photocell is a passivecomponent whose resistance is inversely proportional to theamount of light intensity directed towards it. It is connected inseries with capacitor. The photocell to be used for the tracker isbased on its dark resistance and light saturation resistance. Theterm light saturation means that further increasing the lightintensity to the CdS cells will not decrease its resistance anyfurther. [4, 5], Figure 1 shows the dimensions of the lightdependent resistor.Simplified Solar Tracking PrototypeCopyright @ 2010/gjto39Light intensity is measured in Lux, the illumination of sunlight isapproximately 30,000 lux, Figure 1 shows how a typical lightdependent resistor behaves in terms of its resistance with changesto light intensity.From the graph shown in figure 2 it can be clearly seen that theresistance of the LDR is inversely proportional to the lightintensity that as the light intensity increases the resistance of theLDR decreases [5].3, PIC16F84A Architecture DetailThere are three types of PIC16F84A packaging designs availablein the market: PDIP (18-Lead Plastic Dual In-line), SOIP (18-Lead Plastic Small Outline), and SSOP (20-Lead Plastic ShrinkSmall Outline). PDIP type packaging will be used for the solartracker embedded design. Figure 3 illustrates the PIC16F84APDIP [11] and shows the name and pin positions [7, 8, 12].Figure 1: Dimensions of LDRFigure 2: Light-resistance characteristicsThe PDIP has three key features that satisfy the objective. Theseare [17, 18]:• 8 bit multi-channel analog-to-digital converter• 13 input/output pins• 64 bytes of data EEPROM memoryThe internal hardware architecture of PIC16F84A is representedby the block diagram shown in figure 4.Figure 3: PIC16F84A Pin PositionsFigure 4: Block diagram of internal architecture of PIC16F84AAll the blocks of figure 4 are main bits of hardware and the linesthat connect them are called buses. These buses are basicallysmall parallel lines along which data can be passedsimultaneously from one hardware block to the other. Thenumber besides each bus indicates the number of lines presentwithin that bus, denoting the bits that can be sent along thesebuses,4. Motor DriverFigure 5 shows the H-bridge that is used to control the motor [14,15, 16].The PIC16F84A controls the H-bridge which consists of fourtransistors 2N2222, Four Diodes 1N4148 and two 10KΩresistors. Although any NPN transistor can be used, it wasdecided to use CS9103 NPN transistor for tracker circuit. Thiswas chosen because it is capable of handling high current asSimplified Solar Tracking PrototypeCopyright @ 2010/gjto40compared with 2N2222; the CS9013 can handle up to 500mA,which is sufficient enough to power up the motor. Figure 6shows the appearance of the transistor. On first trial run of the Hbridgeit was known that the speed of motor was not controlledand was moving very fast, to solve this problem a variableresistor bank was connected and a resistance of about 6 Ohm wasset. This enabled the motor to move slowly producing the sameamount of torque [6, 9, 10].Figure 5: H-bridge motor controlFigure 6 Transistor setThe 1N4148 diodes were chosen to be mounted on all fourtransistors because the PIC microcontroller is very sensitive toelectrical spikes (which may cause a reset or lockup); the diodesare connected across the collector-emitter junction of eachtransistor. Their function is to stop any electrical spikes causedby switching the motor's winding on and off.5. Voltage RegulationThe PIC16F84A needs a regulated supply D.C voltage of 5Volts, the 7805voltage Regulator is used to provide the voltagerequired by the microcontroller. The top view of the regulatoritself is shown in figure 7.Figure 7 Voltage regulatorThe circuit of figure 8 shows how to convert the unregulatedsupply of 12v to 5V, the capacitor of 0.1 microfarad is placedbetween the input and output to smoothen and maintain thevoltage.Figure 8- Voltage Regulator Circuit6. Construction of Printed circuit boardBefore the schematic diagram was plotted for the program aprototype was made onto a Vero board and tested, all errors wererectified before final sketch was made, and figure 9 shows adescription of prototypeFigure 9 Prototype componentsThe schematic diagram was plotted component by component ona program called Easy PC professional, which is used to makelayouts of any circuit. A new project was created and each of thecomponents were selected from its library and carefully placedonto the grid, each pad and hole were selected and addedaccording to the sizes of the various components used, thecomponents were connected and labeled carefully. Figure 10shows a detailed picture of the schematic when plotted on the

Register to Reply