Professional Documents
Culture Documents
INDEX
CONTENTS
1. Abbreviations 2. Figures locations 3. Introduction 4. Block Diagram 5. Block Diagram Description 6. Schematic 7. Schematic Description 8. Hardware Components
Micro Controller Power Supply LDR
11. KEIL procedure description 12.Conclusion (or) Synopsis 13. Future Aspects 14. Bibliography
ABBREVIATIONS
SYMBOL ACC B PSW SP DPTR DPL DPH P0 P1 P2 P3 IP IE TMOD TCON T2CON T2MOD TH0 TL0 TH1 TL1 TH2 TL2 SCON SBUF PCON NAME Accumulator B register Program status word Stack pointer Data pointer 2 bytes Low byte High byte Port0 Port1 Port2 Port3 Interrupt priority control Interrupt enable control Timer/counter mode control Timer/counter control Timer/counter 2 control Timer/counter mode2 control Timer/counter 0high byte Timer/counter 0 low byte Timer/counter 1 high byte Timer/counter 1 low byte Timer/counter 2 high byte Timer/counter 2 low byte Serial control Serial data buffer Power control
FIGURE LOCATIONS
S.No. 1 2 Figure Components of Typical Linear Power Supply An Electrical Transformer Page No.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
Bridge Rectifier Bridge Rectifier Positive Cycle Bridge Rectifier Negative Cycle Three terminal voltage Regulator Functional Diagram of Microcontroller Pin Diagram of Microcontroller Oscillator connections External clock drive connections A register B register RAM RAM Allocation Register Banks PSW DPTR SP PORT 0 TL0 and TH0 DB9 Connecting Microcontroller to PC
23
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
H-BRIDGE
DC MOTORS SOLAR PANEL LCD MC New Project Select Target device Select device for Target Copy 8051 startup code Source group 1 New file Opened new file File Save Add files to the source group Adding files to the source group Compilation After Compilation Build Selecting the Ports to be visualized Start Debugging
INTRODUCTION:
In present situation everyone is facing the problem with power cuts which is creating very much trouble to the people. So, to solve this problem we have a solution that is sun. Yes by using sun radiation we can get power i.e., the solar energy using which we generate the power. All we are know that there are so many renewable energy sources like solar, wind, geothermal etc. but solar energy system is very simple and easy to implement. But the main drawback of the solar system is it is very poor efficient system. By using this project we are going to improve the efficiency of solar system. Solar Panels are a form of active solar power, a term that describes how solar panels make use of the sun's energy: solar panels harvest sunlight and actively convert it
to electricity. Solar Cells, or photovoltaic cells, are arranged in a grid-like pattern on the surface of the solar panel. Solar panels are typically constructed with crystalline silicon, which is used in other industries (such as the microprocessor industry), and the more expensive gallium arsenide, which is produced exclusively for use in photovoltaic (solar) cells. Solar panels collect solar radiation from the sun and actively convert that energy to electricity. Solar panels are comprised of several individual solar cells. These solar cells function similarly to large semiconductors and utilize a large-area p-n junction diode. When the solar cells are exposed to sunlight, the p-n junction diodes convert the energy from sunlight into usable electrical energy. The energy generated from photons striking the surface of the solar panel allows electrons to be knocked out of their orbits and released, and electric fields in the solar cells pull these free electrons in a directional current, from which metal contacts in the solar cell can generate electricity. The more solar cells in a solar panel and the higher the quality of the solar cells, the more total electrical output the solar panel can produce. The conversion of sunlight to usable electrical energy has been dubbed the Photovoltaic Effect.
BLOCK DIAGRAM:
SO LA PA R NE L
BLOCK DIAGRAM EXPLANATION:The above block diagram gives an overview of the project in the pictorial form. With the help of the block diagram we will create pre model of the project and analyze the function of the project .The explanation of the project with block diagram over view is given as follows.
Micro controller:
In this project work the micro-controller plays a major role. Micro-controllers were originally used as components in complicated process-control systems. However, because of their small size and low price, Micro-controllers are now also being used in regulators for individual control loops. In several areas Micro-controllers are now outperforming their analog counterparts and are cheaper as well. According to the sensed signals all the Industrial parameters are getting controlled by the Microcontroller through mobile, and the status is displayed on the LCD by initializing the three control pins in LCD i.e., RS, R/W and EN pin.
Power supply:
In this system we are using both the supplies 12 volts and 5 volts. 5 volts is used for Microcontroller where as DC motor will be operated on 12 volts.
LCD:
This is the widely used output device to indicate the status. Here the current status of the project is clearly displayed on the LCD.
DC Motor:
Motor is an output device; its speed will be varied according to the speed set by the switches. The speed can be varied by varying the voltage given to the PWM converter (using keypad). The speed of DC motor is directly proportional to armature voltage and inversely proportional to flux. By maintaining the flux constant, the speed can be varied by varying the armature voltage.
SOLAR PANEL:
Here in this project solar panel is rotated by the DC motor according to the time. Whenever the radiation of the sun falls on the solar panel it grasps the radiation and stores.
Schematic:
LCD connections to Micro controller: Pins 1 2 3 4 5 6 7.14 Connections VSS (ground) VCC (+5V) 10k pot RS, this pin is connected to P2.7 of the micro controller R/w, this pin is connected to P2.6 of the micro controller EN, this pin is connected to P2.5 of the micro controller (D0-D7) these pins are connected to the port (P0) of the micro controller
Micro Controller connections: Pins 9TH 18th and 19th 20th 40th Connections RESET Crystal Oscillator circuit Ground VCC (+5V DC) supply
MC connection:
1st ,2nd CRYSTAL OSC(32.706MHZ) 3RD BATTERY 8TH - VCC 4TH GND 5TH P2.0 6TH P2.1 L293D connection: 2ND ,7TH ,10TH , 15TH P1.4 to P1.7 8TH VCC(12V) Motors connected to 3,6,11,14th pins of L293D(driver circuit).
10
HARDWARE COMPONENTS:
Micro Controller Power Supply Solar Panel L293D DC Motor MC keypad LCD
MICROCONTROLLER
INTRODUCTION:
A Micro controller consists of a powerful CPU tightly coupled with memory RAM, ROM or EPROM), various I/O features such as Serial ports, Parallel Ports, Timer/Counters, Interrupt Controller, Data Acquisition interfaces-Analog to Digital Converter (ADC), Digital to Analog Converter (DAC), everything integrated onto a single Silicon Chip. It does not mean that any micro controller should have all the above said features on chip, Depending on the need and area of application for which it is designed, The ONCHIP features present in it may or may not include all the individual section said above. Any microcomputer system requires memory to store a sequence of instructions making up a program, parallel port or serial port for communicating with an external system, timer / counter for control purposes like generating time delays, Baud rate for the serial port, apart from the controlling unit called the Central Processing Unit A Microcontroller has a CPU (a microprocessor) in addition to a fixed amount of RAM, ROM,I/OPORTS ,and a timer all on a single chip. In other words, the processor, RAM, ROM, I/OPORTS, and timer are all embedded together on one chip; therefore, the
11
designer cant add any external memory, I/O, or timer to it. The fixed amount of on-chip ROM, RAM, and number of I/O PORTS in microcontrollers makes them ideal for many applications in which cost and space are critical. In many applications, for example a TV remote control, there is no need for the computing power of a 486 or even an 8086 microprocessor. In many applications, the space it takes, the power it consumes, and the price per unit are much more critical considerations than the computing power. These applications most often require some I/O operation to read signal and turn on and off certain bits. For these reason some call these processors IBP (illy-bitty processors).
ROM
Microprocessors brought the concept of programmable devices and made many applications of intelligent equipment. Most applications, which do not need large amount of data and program memory is the microcontroller. Costly: The microprocessor system had to satisfy the data and program requirements so; sufficient RAM and ROM are used to satisfy most applications .The peripheral control equipment also had to be satisfied. Therefore, almost all-peripheral chips were used in the design. Because of these additional peripherals cost will be comparatively high. An example: 8085 chip needs: An Address latch for separating address from multiplexed address and data.32KB RAM and 32-KB ROM to be able to satisfy most applications. As also Timer /
12
Counter, Parallel programmable port, Serial port, and Interrupt controller are needed for its efficient applications. In comparison a typical Micro controller 8051 chip has all that the 8051 board has except a reduced memory as follows. 4K bytes of ROM as compared to 32-KB, 128 Bytes of RAM as compared to 32-KB. Bulky: On comparing a board full of chips (Microprocessors) with one chip with all components in it (Micro controller). Debugging: Lots of Microprocessor circuitry and program to debug. In Micro controller there is no Microprocessor circuitry to debug. Slower Development time: As we have observed Microprocessors need a lot of debugging at board level and at program level, where as, Micro controller do not have the excessive circuitry and the built-in peripheral chips are easier to program for operation. So peripheral devices like Timer/Counter, Parallel programmable port, Serial Communication Port, Interrupt controller and so on, which were most often used were integrated with the Microprocessor to present the Micro controller .RAM and ROM also were integrated in the same chip. The ROM size was anything from 256 bytes to 32Kb or more. RAM was optimized to minimum of 64 bytes to 256 bytes or more. Typical Micro controller have all the following features: 8/16/32 CPU Instruction set rich in I/O & bit operations. One or more I/O ports. One or more timer/counters. One or more interrupt inputs and an interrupt controller One or more serial communication ports. Analog to Digital /Digital to Analog converter One or more PWM output Network controlled interface
13
ADVANTAGES: If a system is developed with a microprocessor, the designer has to go for external memory such as RAM, ROM or EPROM and peripherals and hence the size of the PCB will be large enough to hold all the required peripherals. But, the micro controller has got all these peripheral facilities on a single chip so development of a similar system with a micro controller reduces PCB size and cost of the design. One of the major differences between a micro controller and a microprocessor is that a controller often deals with bits , not bytes as in the real world application, for example switch contacts can only be open or close, indicators should be lit or dark and motors can be either turned on or off and so forth.
INTRODUCTION TO 8051MICROCONTROLLER
In 1981,Intel corporation introduced an 8-bit microcontroller called the 8051.This microcontroller had 128 bytes of RAM,4K bytes of on-chip ROM, two timers, one serial port and 4 ports(each 8-bits wide)all on single chip. At that time it was also referred to as a system on a chip. The 8051 is an 8-bit processor, meaning that the CPU can work on only 8-bits of data at a time. Data larger than 8-bits has to be broken into 8-bit pieces to be processed by the CPU. The 8051 can have a maximum of 64K bytes of ROM, many manufacturers have put only 4Kbytes on chip. The major Features of 8-bit Micro controller ATMEL 89C51: 8 Bit CPU optimized for control applications Compatible with MCS-51 Products 4K Bytes of In-System Reprogrammable Flash Memory Endurance: 1000 Write/Erase Cycles. Fully Static Operation: 0Hz to 24MHz Three-level Program Memory Lock 128 x 8- bit Internal RAM 32 Programmable I/O Lines
14
Two 16-bit Timer/Counters Six Interrupt Sources Programmable Serial Channel Low-power Idle and Power-down Modes Extensive Boolean processing (Single - bit Logic) Capabilities. On - Chip Flash Program Memory On - Chip Data RAM Bi-directional and Individually Addressable I/O Lines Multiple 16-Bit Timer/Counters Full Duplex UART Multiple Source / Vector / Priority Interrupt Structure On - Chip Oscillator and Clock circuitry. On - Chip EEPROM SPI Serial Bus Interface
COUNTER INPUTS
INTERRUP T CONTROL
ON-CHIP FLASH
ON-CHIP RAM
CPU
OSC
BUS CONTROL
4 I/O PORTS
SERIL PORT
15
PO P2 P1 P3
TXD
RXD
For more information on the individual devices and features, refer to the Hardware Descriptions and Data Sheets of the specific device. Why AT 89C51? : The system requirements and control specifications clearly rule out the use of 16, 32 or 64 bit micro controllers or microprocessors. Systems using these may be earlier to implement due to large number of internal features. They are also faster and more reliable but, the above application is satisfactorily served by 8-bit micro controller. Using an inexpensive 8-bit Microcontroller will doom the 32-bit product failure in any competitive market place. Coming to the question of why to use AT89C51 of all the 8-bit Microcontroller available in the market the main answer would be because it has 4 Kb on chip flash memory which is just sufficient for our application. The on-chip Flash ROM allows the program memory to be reprogrammed in system or by conventional non-volatile memory Programmer. Moreover ATMEL is the leader in Flash technology in todays market place and hence using AT 89C51 is the optimal solution.
8051 micro controller architecture: The 8051 architecture consists of these specific features: Eight bit CPU with registers A (the accumulator) and B Sixteen-bit program counter (PC) and data pointer (DPTR) Eight- bit stack pointer (PSW) Eight-bit stack pointer (Sp)
16
Internal ROM or EPROM (8751) of 0(8031) to 4K (8051) Internal RAM of 128 bytes: 1. Four register banks, each containing eight registers 2. Sixteen bytes, which maybe addressed at the bit level 3. Eighty bytes of general- purpose data memory
Thirty two input/output pins arranged as four 8-bit ports:p0-p3 Two 16-bit timer/counters: T0 and T1 Full duplex serial data receiver/transmitter: SBUF Control registers: TCON, TMOD, SCON, PCON, IP, and IE Two external and three internal interrupts sources.
PIN DIAGRAM:
Oscillator and clock circuits Fig.1 Oscillator Connection. The P89C51 provides the following standard features: 4K bytes of Flash, 128 bytes of RAM, 32 I/O lines, two 16-bit timer/counters, five vector two-level interrupt architecture, a full duplex serial port, and on-chip oscillator and clock circuitry. In addition, the
18
P89C51 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port and interrupt system to continue functioning. The Power-down Mode saves the RAM contents but freezes the oscillator disabling all other chip functions until the next hardware reset.
NC
XTAL2
XTAL1
GND
Fig.2 External Clock Drive Configuration I/O ports: One major feature of a microcontroller is the versatility built into the input/output (I/O) circuits that connect the 8051 to the outside world. The main constraint that limits numerous functions is the number of pins available in the 8051 circuit. The DIP had 40 pins and the success of the design depends on the flexibility incorporated into use of these pins. For this reason, 24 of the pins may each used for one of the two entirely different functions which depend, first, on what is physically connected to it and, then, on what software programs are used to program the pins.
PORT 0 Port 0 pins may serve as inputs, outputs, or, when used together, as a bi directional low-order address and data bus for external memory. To configure a pin as input, 1 must be written into the corresponding port 0 latch by the program. When used for interfacing 19
with the external memory, the lower byte of address is first sent via PORT0, latched using Address latch enable (ALE) pulse and then the bus is turned around to become the data bus for external memory. PORT 1 Port 1 is exclusively used for input/output operations. PORT 1 pins have no dual function. When a pin is to be configured as input, 1 is to be written into the corresponding Port 1 latch. PORT 2 Port 2 maybe used as an input/output port. It may also be used to supply a high order address byte in conjunction with Port 0 low-order byte to address external memory. Port 2 pins are momentarily changed by the address control signals when supplying the high byte a 16-bit address. Port 2 latches remain stable when external memory is addressed, as they do not have to be turned around (set to 1) for data input as in the case for Port 0. PORT 3 Port 3 may be used to input /output port. The input and output functions can be programmed under the control of the P3 latches or under the control of various special function registers. Unlike Port 0 and Port 2, which can have external addressing functions and change all eight-port b se, each pin of port 3 maybe individually programmed to be used as I/O or as one of the alternate functions. The Port 3 alternate uses are:
SFR SBUF
20
P3.1 - TXD P3.2 - INTO 0 P3.3 - INTO 1 P3.4 - T0 P3.5 - T1 P3.6 - WR P3.7 - RD
Serial data output External interrupt 0 External interrupt 1 External Timer 0 input External timer 1 input External memory write pulse External memory read pulse
POWER SUPPLY
The power supplies are designed to convert high voltage AC mains electricity to a suitable low voltage supply for electronics circuits and other devices. A power supply can by broken down into a series of blocks, each of which performs a particular function. A d.c power supply which maintains the output voltage constant irrespective of a.c mains fluctuations or load variations is known as Regulated D.C Power Supply
21
Transformer:
A transformer is an electrical device which is used to convert electrical power from one electrical circuit to another without change in frequency. Transformers convert AC electricity from one voltage to another with little loss of power. Transformers work only with AC and this is one of the reasons why mains electricity is AC. Step-up transformers increase in output voltage, step-down transformers decrease in output voltage. Most power supplies use a step-down transformer to reduce the dangerously high mains voltage to a safer low voltage. The input coil is called the primary and the output coil is called the secondary. There is no electrical connection between the two coils; instead they are linked by an alternating magnetic field created in the soft-iron core of the transformer. The two lines in the middle of the circuit symbol represent the core. Transformers waste very little power so the power out is (almost) equal to the power in. Note that as voltage is stepped down current is stepped up. The ratio of the number of turns on each coil, called the turns ratio, determines the ratio of
22
the voltages. A step-down transformer has a large number of turns on its primary (input) coil which is connected to the high voltage mains supply, and a small number of turns on its secondary (output) coil to give a low output voltage.
An Electrical Transformer
RECTIFIER:
A circuit which is used to convert a.c to d.c is known as RECTIFIER. The process of conversion from a.c to d.c is called rectification TYPES OF RECTIFIERS: Half wave Rectifier Full wave rectifier -1. Centre tap full wave rectifier. -2. Bridge type full bridge rectifier.
23
Comparison of rectifier circuits: Type of Rectifier Parameter Number of diodes 1 PIV of diodes Vm D.C output voltage Vdc, at no-load Ripple factor Ripple frequency Rectification efficiency Transformer Utilization Factor(TUF) RMS voltage Vrms 1.21 f 0.406 0.287 Vm/2 0.482 2f 0.812 0.693 Vm/2 0.482 2f 0.812 0.812 Vm/2 Vm/ 0.318Vm 2Vm 2Vm/ 0.636Vm Vm 2Vm/ 0.636Vm 2 3 Half wave Full wave Bridge
Full-wave Rectifier:
From the above comparison we came to know that full wave bridge rectifier as more advantageous than the other two rectifiers. So, in our project we are using full wave bridge rectifier circuit.
24
Bridge Rectifier: A bridge rectifier makes use of four diodes in a bridge arrangement to achieve full-wave rectification. This is a widely used configuration, both with individual diodes wired as shown and with single component bridges where the diode bridge is wired internally. A bridge rectifier makes use of four diodes in a bridge arrangement as shown in fig(a) to achieve full-wave rectification. This is a widely used configuration, both with individual diodes wired as shown and with single component bridges where the diode bridge is wired internally.
Fig(A)
Operation:
During positive half cycle of secondary, the diodes D2 and D3 are in forward biased while D1 and D4 are in reverse biased as shown in the fig(b). The current flow direction is shown in the fig (b) with dotted arrows.
25
Fig(B) During negative half cycle of secondary voltage, the diodes D1 and D4 are in forward biased while D2 and D3 are in reverse biased as shown in the fig(c). The current flow direction is shown in the fig (c) with dotted arrows.
Fig(C) Filter:
A Filter is a device which removes the a.c component of rectifier output but allows the d.c component to reach the load.
Capacitor Filter:
We have seen that the ripple content in the rectified output of half wave rectifier is 121% or that of full-wave or bridge rectifier or bridge rectifier is 48% such high percentages of ripples is not acceptable for most of the applications. Ripples can be removed by one of the following methods of filtering: (a) A capacitor, in parallel to the load, provides an easier by pass for the ripples voltage though it due to low impedance. At ripple frequency and leave the d.c to appears the load. (b) An inductor, in series with the load, prevents the passage of the ripple current (due to high impedance at ripple frequency) while allowing the d.c (due to low resistance to d.c) (c) Various combinations of capacitor and inductor, such as L-section filter section
filter, multiple section filter etc. which make use of both the properties mentioned in (a)
26
and (b) above. Two cases of capacitor filter, one applied on half wave rectifier and another with full wave rectifier. Filtering is performed by a large value electrolytic capacitor connected across the DC supply to act as a reservoir, supplying current to the output when the varying DC voltage from the rectifier is falling. The capacitor charges quickly near the peak of the varying DC, and then discharges as it supplies current to the output. Filtering significantly increases the average DC voltage to almost the peak value (1.4 RMS value). To calculate the value of capacitor(C), C = *3*f*r*Rl Where, f = supply frequency, r = ripple factor, Rl = load resistance Note: In our circuit we are using 1000microfarads.
Regulator:
Voltage regulator ICs is available with fixed (typically 5, 12 and 15V) or variable output voltages. The maximum current they can pass also rates them. Negative voltage regulators are available, mainly for use in dual supplies. Most regulators include some automatic protection from excessive current ('overload protection') and overheating ('thermal protection'). Many of the fixed voltage regulator ICs has 3 leads and look like power transistors, such as the 7805 +5V 1A regulator shown on the right. The LM7805 is simple to use. You simply connect the positive lead of your unregulated DC power supply (anything from 9VDC to 24VDC) to the Input pin, connect the negative lead to the Common pin and then when you turn on the power, you get a 5 volt supply from the output pin.
27
Features:
Output Current of 1.5A Output Voltage Tolerance of 5% Internal thermal overload protection Internal Short-Circuit Limited No External Component Output Voltage 5.0V, 6V, 8V, 9V, 10V,12V, 15V, 18V, 24V Offer in plastic TO-252, TO-220 & TO-263 Direct Replacement for LM78
SOLAR PANEL:
Solar panels (arrays of photovoltaic cells) make use of renewable energy from the sun, and are a clean and environmentally sound means of collecting solar energy. Here at solar 28
panel information, we've amassed a wealth of information relating to solar panels and the field of photovoltaic technology.
29
Solar panel efficiency can be optimized by using dynamic mounts that follow the position of the sun in the sky and rotate the solar panel to get the maximum amount of direct exposure during the day as possible. For more information on solar panel efficiency through the use of mounts, see our section on solar panel mounts and accessories. Solar Panels are a form of active solar power, a term that describes how solar panels make use of the sun's energy: solar panels harvest sunlight and actively convert it to electricity. Solar Cells, or photovoltaic cells, are arranged in a grid-like pattern on the surface of the solar panel. These solar voltaic cells collect sunlight during the daylight hours and covert it into electricity.
30
infrared energy and light from the visible spectrum, the operational efficiency could increase up to thirty percent.
Stand-Alone Solar Panel Inverters Synchronous Solar Panel Inverters Multi-function Solar Panel Inverters
You can usually find the wattage rating on your home appliances by checking the power cable. The sum of these wattage ratings is what you need to determine the wattage you need from your solar panel stand-alone inverter.
32
Fossil Fuels
Fossil Fuels are the most widely-used means of generating electricity, and have been for some time. However, fossil fuels, as we have discovered, are a limited and nonrenewable resource. Estimates have determined that fossil fuel reserves may well run dry 33
by as early as 2050. Not only are fossil fuel reserves dwindling, but byproducts and emissions from burning fossil fuels are harmful to the environment, and have been associated with global warming theory.
DC MOTOR:
An electric motor is a machine which converts electrical energy into mechanical energy. DC motors are configured in many types and sizes, including brush less, servo, and gear motor types. A motor consists of a rotor and a permanent magnetic field stator. The magnetic field is maintained using either permanent magnets or electromagnetic windings. DC motors are most commonly used in variable speed and torque. Motion and controls cover a wide range of components that in some way are used to generate and/or control motion. Areas within this category include bearings and bushings, clutches and brakes, controls and drives, drive components, encoders and resolves, Integrated motion control, limit switches, linear actuators, linear and rotary motion components, linear position sensing, motors (both AC and DC motors), orientation position sensing, pneumatics and pneumatic components, positioning stages, slides and guides, power transmission (mechanical), seals, slip rings, solenoids, springs. Motors are the devices that provide the actual speed and torque in a drive system. This family includes AC motor types (single and multiphase motors, universal, servo motors, induction, synchronous, and gear motor) and DC motors (brush less, servo motor, and gear motor) as well as linear, stepper and air motors, and motor contactors and starters. In any electric motor, operation is based on simple electromagnetism. A currentcarrying conductor generates a magnetic field; when this is then placed in an external magnetic field, it will experience a force proportional to the current in the conductor, and to the strength of the external magnetic field. As you are well aware of from playing with magnets as a kid, opposite (North and South) polarities attract, while like polarities (North and North, South and South) repel. The internal configuration of a DC motor is designed to harness the magnetic interaction between a current-carrying conductor and an external magnetic field to generate rotational motion.
34
Let's start by looking at a simple 2-pole DC electric motor (here red represents a magnet or winding with a "North" polarization, while green represents a magnet or winding with a "South" polarization).
Every DC motor has six basic parts -- axle, rotor (a.k.a., armature), stator, commutator, field magnet(s), and brushes. In most common DC motors (and all that Beamers will see), the external magnetic field is produced by high-strength permanent magnets1. The stator is the stationary part of the motor -- this includes the motor casing, as well as two or more permanent magnet pole pieces. The rotor (together with the axle and attached commutator) rotates with respect to the stator. The rotor consists of windings (generally on a core), the windings being electrically connected to the commutator. The above diagram shows a common motor layout -- with the rotor inside the stator (field) magnets. The geometry of the brushes, commutator contacts, and rotor windings are such that when power is applied, the polarities of the energized winding and the stator magnet(s) are misaligned, and the rotor will rotate until it is almost aligned with the stator's field magnets. As the rotor reaches alignment, the brushes move to the next commutator contacts, and energize the next winding. Given our example two-pole motor, the rotation reverses the direction of current through the rotor winding, leading to a "flip" of the rotor's magnetic field, and driving it to continue rotating. Principle of operation: It is based on the principle that when a current-carrying conductor is placed in a magnetic field, it experiences a mechanical force whose direction is given by Fleming's Left-hand rule and whose magnitude is given by Force, F = B I l newton
35
Where B is the magnetic field in weber/m2. I is the current in amperes and l is the length of the coil in meter. The force, current and the magnetic field are all in different directions. If an Electric current flows through two copper wires that are between the poles of a magnet, an upward force will move one wire up and a downward force will move the other wire down.
The loop can be made to spin by fixing a half circle of copper which is known as commutator, to each end of the loop. Current is passed into and out of the loop by brushes that press onto the strips. The brushes do not go round so the wire does not get twisted. This arrangement also makes sure that the current always passes down on the
36
right and back on the left so that the rotation continues. This is how a simple Electric motor is made.
L293D Motor Driver IC: Since two motors are used to drive The back wheels of the robot independently, there is a need for Two H-bridges. Instead of implementing the above H-bridge controlCircuit twice, an alternative is to use an integrated circuit (IC), which Provides more than one H-bridges. One such IC is L293D, which has 2 H-Bridges in it. It can supply 600Ma continuous and 1.2A peak Currents. It is suitable for switching applications up to 5 kHz. These Features make it ideal for our application. Another option is to use IC L298, which can drive 2A continually and 3A peak currents. The Diagram of L293D is shown in Figure 2It can be observed from the figure that L293D has a similar configuration to the circuit in
Figure 1
37
Figure 1 3) Motor Driver Connections: The motor driver requires 2 control inputs for each motor. Since we drive 2 motors, we need 4 controls
Inputs from the microcontroller. Since it has many pins which can be configured as outputs, there are many options for implementation.For example, in our robot the last 4 bits of Port B (RB4, RB5, RB6,RB7 - Pins 37 to 40) are used to control the rotation direction of the motors . The enable pins of the motor driver are connected to the PWM outputs of the microcontroller (Pins 16and 17). This is because, as was mentioned above, by changing the width of the pulse (implying changing the enable time of the driver) one can change the speed of the motor. The truth table for motor driver is as shown in Table II, where H = high, L = low, and Z =high output impedance state. Since the motors are reverse aligned, in order to have the robot Move forward they must be configured such that one of them turns forward and the other one turns backward. In case of any requirement for the robot to move backward, it is sufficient to just reverse the
38
TABLE II THE TRUTH TABLE OF THE MOTOR DRIVER Input H L H L TABLE III DRIVER CONTROL INPUTS Direction Forward Backward Input 1 H L Input 2 L H Input 3 L H Input 4 H L enable H H L L output H L z z
Outputs of the control pins. For example, in our robot while moving forward, inputs of the motor driver have states shown in the first row Of Table III, whereas for backward movement, the states shown in the second row of Table III is applied.
MC:
39
40
41
42
43
44
45
46
LINEAR KEYPAD
This section basically consists of a Linear Keypad. Basically a Keypad can be classified into 2 categories. One is Linear Keypad and the other is Matrix keypad. 1. Matrix Keypad. 2. Linear Keypad. Matrix Keypad: This Keypad got keys arranged in the form of Rows and Columns. That is why the name Matrix Keypad. According to this keypad, In order to find the key being pressed the keypad need to be scanned by making rows as i/p and columns as output or vice versa. This Keypad is used in places where one needs to connect more no. of keys with less no. of data lines. Linear Keypad: This Keypad got n no. of keys connected to n data lines of microcontroller. This Keypad is used in places where one needs to connect less no. of keys. Generally, in Linear Keypads one end of the switch is connected to Microcontroller (Configured as i/p) and other end of the switch is connected to the common ground. So whenever a key of Linear Keypad is pressed the logic on the microcontroller pin will go LOW. Here in this project, a linear keypad is used with switches connected in a serial manner. Linear keypad is used in this project because it takes less no. of port pins. Linear Keypad with 4 Keys is shown below. The
1.
2.
47
LCD:
A liquid crystal display (LCD) is a thin, flat display device made up of any number of color or monochrome pixels arrayed in front of a light source or reflector. Each pixel consists of a column of liquid crystal molecules suspended between two transparent electrodes, and two polarizing filters, the axes of polarity of which are perpendicular to each other. Without the liquid crystals between them, light passing through one would be blocked by the other. The liquid crystal twists the polarization of light entering one filter to allow it to pass through the other. Many microcontroller devices use 'smart LCD' displays to output visual information. LCD displays designed around Hitachi's LCD HD44780
48
module, are inexpensive, easy to use, and it is even possible to produce a readout using the 8x80 pixels of the display. They have a standard ASCII set of characters and mathematical symbols. For an 8-bit data bus, the display requires a +5V supply plus 11 I/O lines. For a 4-bit data bus it only requires the supply lines plus seven extra lines. When the LCD display is not enabled, data lines are tri-state and they do not interfere with the operation of the microcontroller. Data can be placed at any location on the LCD. For 162 LCD, the address locations are:
Address locations for a 2x16 line LCD SIGNALS TO THE LCD The LCD also requires 3 control lines from the microcontroller: 1) Enable (E) This line allows access to the display through R/W and RS lines. When this line is low, the LCD is disabled and ignores signals from R/W and RS. When (E) line is high, the LCD checks the state of the two control lines and responds accordingly. 2) Read/Write (R/W) This line determines the direction of data between the LCD and microcontroller. When it is low, data is written to the LCD. When it is high, data is read from the LCD. 3) Register select (RS) With the help of this line, the LCD interprets the type of data on data lines. When it is low, an instruction is being written to the LCD. When it is high, a character is being written to the LCD. Logic status on control lines: E - 0 Access to LCD disabled
49
- 1 Access to LCD enabled R/W - 0 Writing data to LCD - 1 Reading data from LCD RS - 0 Instructions 1 Character
Writing and reading the data from the LCD: Writing data to the LCD is done in several steps: 1) Set R/W bit to low 2) Set RS bit to logic 0 or 1 (instruction or character) 3) Set data to data lines (if it is writing) 4) Set E line to high 5) Set E line to low Read data from data lines (if it is reading): 1) Set R/W bit to high 2) Set RS bit to logic 0 or 1 (instruction or character) 3) Set data to data lines (if it is writing) 4) Set E line to high 5) Set E line to low PIN DESCRIPTION Most LCDs with 1 controller has 14 Pins and LCDs with 2 controller has 16 Pins (Two pins are extra in both for back-light LED connections).
50
51
CIRCUIT DESCRIPTION:
The required operating voltage for Microcontroller 89C51 is 5V. Hence the 5V D.C. power supply is needed by the same. This regulated 5V is generated by stepping down the voltage from 230V to 18V and 12V in the both receiver and transmitter section now the step downed a.c voltage is being rectified by the Bridge Rectifier using 1N4007 diodes. The rectified a.c voltage is now filtered using a C filter. Now the rectified, filtered D.C. voltage is fed to the Voltage Regulator. This voltage regulator provides/allows us to have a Regulated constant Voltage which is of +5V. The rectified; filtered and regulated voltage is again filtered for ripples using an electrolytic capacitor 100F. Now the output from this section is fed to 40 th pin of 89c51 microcontroller to supply operating voltage. The microcontroller 89C51 with Pull up resistors at Port0 and crystal oscillator of 11.0592 MHz crystal in conjunction with couple of 30-33pf capacitors is placed at 18th & 19th pins of 89c51 to make it work (execute) properly. According to this project we are going to improve the efficiency of solar system. In which solar panel will turn according to the sun rotation with predefined angle. So by using DC motor we are going to turn the panel according to the time. As the time passes the panel rotates with the help of motor. Here MC (Real Time Clock) is used to give the exact time intervals to the controller. Whenever the radiation of the sun falls on the solar panel it grasps the radiation and stores in it and it will send the message to the controller about its power which is stored in it. Microcontroller will receive this information and display on LCD.
52
SOFTWARE:
ABOUT SOFTWARE
Softwares used are: *Keil software for C programming *Express PCB for lay out design *Express SCH for schematic design What's New in Vision3? Vision3 adds many new features to the Editor like Text Templates, Quick Function Navigation, and Syntax Coloring with brace high lighting Configuration Wizard for dialog based startup and debugger setup. Vision3 is fully compatible to Vision2 and can be used in parallel with Vision2. What is Vision3? Vision3 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 help you get started, several example programs (located in the \C51\Examples, \C251\Examples, \C166\Examples, and \ARM\...\Examples) are provided. HELLO is a simple program that prints the string "Hello World" using the Serial Interface. MEASURE is a data acquisition system for analog and digital systems. TRAFFIC is a traffic light controller with the RTX Tiny operating system. SIEVE is the SIEVE Benchmark. DHRY is the Dhrystone Benchmark.
53
Additional example programs not listed here are provided for each device architecture. Building an Application in Vision2 To build (compile, assemble, and link) an application in Vision2, you must: 1. Select Project -(forexample,166\EXAMPLES\HELLO\HELLO.UV2). 2. Select Project - Rebuild all target files or Build target. Vision2 compiles, assembles, and links the files in your project. Creating Your Own Application in Vision2 To create a new project in Vision2, you must: 1. Select Project - New Project. 2. Select a directory and enter the name of the project file. 3. Select Project - Select Device and select an 8051, 251, or C16x/ST10 device from the Device Database. 4. Create source files to add to the project. 5. Select Project - Targets, Groups, Files. Add/Files, select Source Group1, and add the source files to the project. 6. 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 typically only need to configure the memory map of your target hardware. Default memory model settings are optimal for most applications. 7. Select Project - Rebuild all target files or Build target. Debugging an Application in Vision2 To debug an application created using Vision2, you must: 1. Select Debug - Start/Stop Debug Session. 2. 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. 3. 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. Starting Vision2 and creating a Project
54
Vision2 is a standard Windows application and started by clicking on the program icon. To create a new project file select from the Vision2 menu Project New Project. This opens a standard Windows dialog that asks you for the new project file name. We suggest that you use a separate folder for each project. You can simply use the icon Create New Folder in this dialog to get a new empty folder. Then select this folder and enter the file name for the new project, i.e. Project1. Vision2 creates a new project file with the name PROJECT1.UV2 which contains a default target and file group name. You can see these names in the Project Window Files. Now use from the menu Project Select Device for Target and select a CPU for your project. The Select Device dialog box shows the Vision2 device database. Just select the microcontroller you use. We are using for our examples the Philips 80C51RD+ CPU. This selection sets necessary tool options for the 80C51RD+ device and simplifies in this way the tool Configuration Building Projects and Creating a HEX Files Typical, the tool settings under Options Target are all you need to start a new application. You may translate all source files and line the application with a click on the Build Target toolbar icon. When you build an application with syntax errors, Vision2 will display errors and warning messages in the Output Window Build page. A double click on a message line opens the source file on the correct location in a Vision2 editor window. Once you have successfully generated your application you can start debugging. After you have tested your application, it is required to create an Intel HEX file to download the software into an EPROM programmer or simulator. Vision2 creates HEX files with each build process when Create HEX files under Options for Target Output is enabled. You may start your PROM programming utility after the make process when you specify the program under the option Run User Program #1. CPU Simulation Vision2 simulates up to 16 Mbytes of memory from which areas can be mapped for read, write, or code execution access. The Vision2 simulator traps and reports illegal memory accesses.
55
In addition to memory mapping, the simulator also provides support for the integrated peripherals of the various 8051 derivatives. The on-chip peripherals of the CPU you have selected are configured from the Device Database selection You have made when you create your project target. Refer to page 58 for more Information about selecting a device. You may select and display the on-chip peripheral components using the Debug menu. You can also change the aspects of each peripheral using the controls in the dialog boxes. Start Debugging You start the debug mode of Vision2 with the Debug Start/Stop Debug Session command. Depending on the Options for Target Debug Configuration, Vision2 will load the application program and run the startup code Vision2 saves the editor screen layout and restores the screen layout of the last debug session. If the program execution stops, Vision2 opens an editor window with the source text or shows CPU instructions in the disassembly window. The next executable statement is marked with a yellow arrow. During debugging, most editor features are still available. For example, you can use the find command or correct program errors. Program source text of your application is shown in the same windows. The Vision2 debug mode differs from the edit mode in the following aspects: _ The Debug Menu and Debug Commands described on page 28 are Available. The additional debug windows are discussed in the following. _ The project structure or tool parameters cannot be modified. All build Commands are disabled. Disassembly Window The Disassembly window shows your target program as mixed source and assembly program or just assembly code. A trace history of previously executed instructions may be displayed with Debug View Trace Records. To enable the trace history, set Debug Enable/Disable Trace Recording.
56
If you select the Disassembly Window as the active window all program step commands work on CPU instruction level rather than program source lines. You can select a text line and set or modify code breakpoints using toolbar buttons or the context menu commands. You may use the dialog Debug Inline Assembly to modify the CPU instructions. That allows you to correct mistakes or to make temporary changes to the target program you are debugging.
SOURCE CODE
1. 2.
Click on the Keil uVision Icon on Desktop The following fig will appear
3. 4.
Click on the Project menu from the title bar Then Click on New Project
57
5.
Save the Project by typing suitable project name with no extension in u r own folder sited in either C:\ or D:\
6.
58
7. 8.
Select the component for u r project. I.e. Atmel Click on the + Symbol beside of Atmel
9.
59
10. 11.
12.
13. 14.
Now your project is ready to USE Now double click on the Target1, you would get another option Source group 1 as shown in next page.
60
15.
Click on the file option from menu bar and select new
61
16.
The next screen will be as shown in next page, and just maximize it by double clicking on its blue boarder.
17. 18.
Now start writing program in either in C or ASM For a program written in Assembly, then save it with extension . asm and for C based program save it with extension .C
62
19.
Now right click on Source group 1 and click on Add files to Group Source
20.
Now you will get another window, on which by default C files will appear.
63
Now select as per your file extension given while saving the file Click only one time on option ADD Now Press function key F7 to compile. Any error will appear if so happen.
24. 25.
If the file contains no error, then press Control+F5 simultaneously. The new window is as follows
64
26.
Then Click OK
27.
Now Click on the Peripherals from menu bar, and check your required port as shown in fig below
28.
65
29. 30.
Now keep Pressing function key F11 slowly and observe. You are running your program successfully
Embedded C:
What is an embedded system? An embedded system is an application that contains at least one programmable computer and which is used by individuals who are, in the main, unaware that the system is computer-based. Which programming language should you use?
66
Having decided to use an 8051 processor as the basis of your embedded system, the next key decision that needs to be made is the choice of programming language. In order to identify a suitable language for embedded systems, we might begin by making the following observations: Computers (such as microcontroller, microprocessor or DSP chips) only accept instructions in machine code (object codes). Machine code is, by definition, in the language of the computer, rather than that of the programmer. Interpretation of the code by the programmer is difficult and error prone. All software, whether in assembly, C, C++, Java or Ada must ultimately be translated into machine code in order to be executed by the computer. Embedded processors like the 8051 have limited processor power and very limited memory available: the language used must be efficient. The language chosen should be in common use.
Summary of C language Features: It is mid-level, with high-level features (such as support for functions and modules), and low-level features (such as good access to hardware via pointers). It is very efficient. It is popular and well understood. Even desktop developers who have used only Java or C++ can soon understand C syntax. Good, well-proven compilers are available for every embedded processor (8-bit to 32-bit or more). Basic C program structure: //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //Basic blank C program that does nothing // Includes
67
{
While (1);
{
Body of the loop // Infinite loop
} }
// match the braces
68
CONCLUSION
The project SOLAR TRACKING SYSTEM FOR OPTIMAL POWER GENERATION has been successfully designed and tested. Integrating features of all the hardware components used have developed it. Presence of every module has been reasoned out and placed carefully thus contributing to the best working of the unit. Secondly, using highly advanced ICs and with the help of growing technology the project has been successfully implemented.
Bibliography
The 8051 Micro controller and Embedded Systems -Muhammad Ali Mazidi Janice Gillispie Mazidi The 8051 Micro controller Architecture, Programming & Applications -Kenneth J.Ayala
69
Fundamentals Of Micro processors and Micro computers -B.Ram Micro processor Architecture, Programming & Applications -Ramesh S. Gaonkar Electronic Components -D.V. Prasad
WEB Resources:
www.atmel.com
www.8051projects.com
70