"Gantry Crane Using 8051 Microcontroller": Bachelor of Technology IN Electrical and Electronics Engineering
"Gantry Crane Using 8051 Microcontroller": Bachelor of Technology IN Electrical and Electronics Engineering
Major Project report submitted in partial fulfillment of the requirements For the award of the degree of
DEPART CERTIFICATE
NT OF
This is to certify that the major project report entitled GANTRY CRANE USING 8051 MICROCONTROLLER that is being submitted by Srinivas.K, Raju.E, Shivakumar.K, Rajashekhar.G.V in partial fulfillment for the award of the Degree of Bachelor of Technology in Electrical and Electronics Engineering to the Jawaharlal Nehru Technological University is a record of bonafide work carried out by them under my guidance and supervision. The results embodied in this project report have not been submitted to any other University or Institute for the award of any Graduation degree.
External Examiner
ii
ACKNOWLEDGEMENT
There are many people who have helped us directly or indirectly in the successful completion of our project. We would like to take this opportunity to thank one and all. First of all, we would like to express our deep sense of gratitude towards our project guide to V.V.S.Madhuri, Assistant Professor, Department of Electrical and Electronics Engineering, G.R.I.E.T for always being available whenever we required his guidance as well as for motivating us throughout the project work. We also express my sincere thanks to Mr.P.M.Sarma, Head of the Department, G.R.I.E.T and for extending their help. We are also grateful to to Mr. P. S. Raju, Director, G.R.I.E.T guidance in the successful completion of our project. for his valuable
We also thank for Dr. J. N. Murthy, (Principal, GRIET), providing useful infrastructure. We are also grateful to Dr. S. N. Saxena, (Professor (EEE) & Dean Placements) for his valuable guidance throughout the seminars in the college. We would like to thank all our friends for the help and constructive criticism during our project period. Finally, we are very much indebted to our parents for their moral support and encouragement to achieve higher goals. We have no words to express our gratitude and we are very thankful to our parents who have shown us this world and for every support they gave us.
RAJASHEKHAR.G.V (09245A0233)
iii
ABSTRACT
The use of gantry crane systems for transporting payload is very common in building constructions. However, moving the payload using the crane is not an easy task especially when strict specifications on the swing angle and on the transfer time need to be satisfied. Various attempts in controlling gantry cranes system based on open- loop and closed-loop control systems were proposed. However, most of the proposed controllers were designed based on the model and parameter of the crane system. In general, modeling and parameter identifications are troublesome and time consuming task. To overcome this problem, in this paper, a practical and intelligent control method for automatic gantry crane is introduced and evaluated experimentally. The results show that the proposed method is not only effective for controlling the crane but also robust to parameter variation. Our project is the design of a controller for the point-to-point motion of a gantry cranes system using a MICROCONTROLLER. The gantry crane has been modeled and a controller has been developed to meet several performance specifications. The designs were implemented in proteus for software implementation.
iv
Fig 1.1 Model Of Gantry Crane Fig 1.2 Schematic Of Laboratory Gantry Crane Fig2.1 Dc Motor Fig 2.2 Working Of Dc Motor Fig2.3 H-Bridge Topology Fig2.4 H-Bridge Topology - Forward Direction Fig2.5 H-Bridge Topology - Reverse Direction Fig3.1 Pin Diagram Of 8051 Fig4.1 Transformer Fig4.2 Full Wave Bridge Rectifier Fig4.3 The Positive Half-Cycle Of Fullwave Bridge Rectifier Fig4.4 The Negativehalf-Cycle Of Fullwave Bridge Rectifier Fig4.5 Resultant Output Waveform Of Bridge Rectifier Fig5.1 Pin Description Of Lcd Fig5.2 Disply Formar,Data Length Of Lcd Fig6.1 Kaypad Diagram Fig6.2 Switches In Keypad Fig8.1 Opening File Of Keil Fig8.2 New Uvision Project Of Keil Fig 8.3 Fig8.4 Fig8.5 Fig 8.6 Fig8.7 Fig8.8 Fig8.9 Fig 8.10 Fig 9.1 v
9 10 15 15 18 19 19 21 26 29 29 30 31 37 39 43 44 62 63 64 64 65 65 65 66 67 67 69
CONTENTS
TOPIC Chapter.1. INTRODUCTION 1.1 introduction about project 1.2 Introduction about gantry crane 1.2.1 Workstation Gantry Cranes 1.2.2 Rail Mounted or EOT Gantry Cranes 1.3 Characteristics of Gantry crane 1.3.1 Dynamics And Kinematics 1.3.2 Controls 1.3.3 Non-Minimum Phase Systems 1.3.4 Distributed Parameter Systems 1.3.5 Multi-Input-Multi-Output Systems (Mimo) 1.3.6 Robustness And Adaptive Control 1.3.7 Computer Interfacing Or Mechatronics Chapter.2. DC MOTOR AND H-BRIDGE 2.1 DC Motor 2.2 H-Bridge Principles 2.3 Operation 2.4 Direction Control - H-Bridge Topology PAGE NO
Chapter.3. MICROCONTROLLER 3.1 Introduction 3.2 Pin configuration of the AT89S52 3.3 Memory Organization 3.4 Interrupts Chapter.4. DETAILS OF THE COMPONENTS USED 4.1 Regulated power supply 4.2 Transformer 4.3 Rectifier 4.4 Bridge rectifier 4.5 Full Wave Bridge Rectifier: 4.6 Filters 4.7 Regulator 4.8 Applications of regulated power supply 4.9 1N4148 DIODE 4.9.1 Characteristics
4.9.2 VAROIUS APPLICATIONS
Chapter.5. LCD 5.1 Liquid Crystal Display 5.1.1 Pin Description 5.1.2 Commands And Instruction Set 5.2 Sending Commands To Lcd 5.3 Sending Data To Lcd
Chapter.6. KEYPAD
6.1Introduction
6.2 Constructing a Matrix Keypad 6.3Scanning a Matrix Keypad Chapter.7. SOFTWARE CODING
Chapter. 8. SOFTWARE TOOLS USED 8.1 KEIL -VISION 8.1.1 Steps For Creating And Debugging Files In Keil
Chapter.9. CIRCUIT SCHEMATIC 9.1 CIRCUIT OPERATION 9.2 Hardware circuit : Chapter.10. CONCLUSION Chapter.11. SCOPE Chapter.12.REFERENCES
CHAPTER 1
1.1 INTRODUCTION:
1.2
world.
Fig 1.1 model of a gantry crane Overhead crane and gantry crane are particularly suited to lifting very heavy objects and huge gantry cranes have been used for shipbuilding where the crane straddles the ship allowing massive objects like ships' engines to be lifted and moved over the ship. However; gantry cranes are also available running on rubber tyres so that tracks are not needed, and small gantry cranes can be used in workshops, for example for lifting automobile engines out of vehicles.
Workstation gantry cranes are used to lift and transport smaller items around a working area in a factory or machine shop. Some workstation gantry cranes are equipped with an enclosed track, while others use an I-beam, or other extruded shapes, for the running surface. Most workstation gantry cranes are intended to be stationary when loaded, and mobile when unloaded. Workstation Gantry Cranes can be outfitted with either a Wire Rope hoist as shown in the above hoist (device) picture or a lower capacity Chain Hoist.
Steam Crane using a line shaft for power produced by Stuckenholz AG, Wetter am der Ruhr, Germany. Design developed by Rudolf Bredt. Picture from ~1875. Electrical Overhead Travelling (EOT) cranes or Gantry Cranes are commonly found in factory applications such as steel yards, paper mills or locomotive repair shops. The EOT gantry crane functions similarly to an overhead bridge crane, but has rails installed on the ground and gantry-style legs to support the crane. Capacities range from 2 to 200 tons, and sometimes even greater capacities. Most are electrically powered and painted safety yellow. When bridge cranes and Gantry cranes became more popular in factories in the late 1800s a steam engine was sometimes used as a way to power these devices. The lifting and moving would be transferred from a fixed line shaft. the picture on the right shows an example of system powered by a line shaft and steam engine. The overhead crane is from 1875, and was one of the first systems to be powered in such a way.
1.3
1.3.2 CONTROLS:
The following issues can be explored in more advanced control courses,
either manually or automatically position the crane. Manual positioning was done using a hand-held potentiometer that adjusted the motor voltage supplied by the computer, while automatic control was done with simple position feedback from the crane. All data acquisition and control was handled by the program (through functions written by the students), and include dreading crane position measurements and manual voltage nputs, and writing motor control voltage to the power amplifiers. We were also required to graphically plot the crane's trajectory on the computer screen in real-time, and then compute a performance index to quantify which controller worked the best. Since this project was done in teams, it became somewhat of a competition to see which team created the best graphical interface, and also within teams, the program allowed them to see who could do the best manual control of the crane.
motors" although they have no external power supply to be synchronized with, as would be the case with normal AC synchronous motors.
WORKING
A DC motor works by converting electric power into mechanical work. This is accomplished by forcing current through a coil and producing a magnetic field that spins the motor. The simplest DC motor is a single coil apparatus, used here to discuss the DC motor theory. The process can be explained in further detail by observing the diagram below.
The voltage source forces voltage through the coil via sliding contacts or brushes that are connected to the DC source. These brushes are found on the end of the coil wires and make a temporary electrical connection with the voltage source. In this motor, the brushes will make a connection every 180 degrees and current will then flow through the coil wires. In the 0 degrees diagram, the brushes are in contact with the voltage source and current is flowing. The current that flows through wire segment C-D interacts with the magnetic field that is present and the result is an upward force on the segment. The current that flows through segment A-B has the same interaction, but the force is in the downward direction. Both forces are of equal magnitude, but in opposing directions since the direction of current flow in the segments is reversed with respect to the magnetic field. In the 180 degrees diagram, the same phenomenon occurs, but segment A-B is forced up and C-D is forced down. In the 90 and 270-degree diagrams, the brushes are not in contact with the voltage source and no force is produced. In these two positions, the rotational kinetic energy of the motor keeps it spinning until the brushes regain contact.
2.2
H-Bridge Principles
An H-Bridge is an electronic power circuit that allows motor speed and direction to be controlled. Often motors are controlled from some kind of brain or micro controller to accomplish a mechanical goal. The micro controller provides the instructions to the motors, but it cannot provide the power required to drive the motors. An H-bridge circuit inputs the micro controller instructions and amplifies them to drive a mechanical motor. This process is similar to how the human body generates mechanical movement; the brain can provide electrical impulses that are instructions, but it requires the muscles to perform mechanical force. The muscle represents both the H-bridge and the motor combined. The H-bridge takes in the small electrical signal and translates it into high power output for the mechanical motor. This document will cover the electronic
principles in creating the H-Bridge portion of the muscle. If the reader requires further information consult the references included at the end ofthe document.
2.3
Operation:
The H-bridge arrangement is generally used to reverse the polarity of the motor, but can also be used to 'brake' the motor, where the motor comes to a sudden stop, as the motor's terminals are shorted, or to let the motor 'free run' to a stop, as the motor is effectively disconnected from the circuit. The following table summarizes operation, with S1-S4 corresponding to the diagram above. S1 S2 S3 1 0 0 0 1 1 0 0 0 0 1 0 1 0 1 S4 1 0 0 1 0 Result Motor moves right Motor moves left Motor free runs Motor brakes Motor brakes
2.4
configuration, as shown in Figure 2.1. The switches are symbolic of the electronic Power MOSFETs which are used for switching.
Figure 2.3: H-Bridge Topology If it is desired to turn the motor on in the forward direction, switches 1 and 4 must be closed to power the motor. Figure 2.2 below is the H-Bridge driving the motor in the forward direction. If it is desired to turn the motor on in the reverse direction, switches 2 and 3 must be closed to power the motor. Figure 2.3 below is the H-Bridge driving the motor in the reverse direction.
3.2
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 high-impedance 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.
Fig 3.1 pin diagram of 8051 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.
Port 1 also receives the low-order address bytes during Flash programming and verification. P1.5 P1.6 P1.7 MOSI (used for In-System Programming) MISO (used for In-System Programming) SCK (used for In-System Programming)
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 (IIL) 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 use 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 use 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 (IIL) because of the pull-ups. Port 3 receives some control signals for Flash programming and verification. Port 3 also serves the functions of various special features of the AT89S51, as shown in the following table. Alternate functions of port 3, P3.0 P3.1 P3.2 RXD (serial input port) TXD (serial output port) INT0 (external interrupt 0)
INT1 (external interrupt 1) T0 (timer 0 external input) T1 (timer 1 external input) WR (external data memory write strobe) 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. This pin drives High for 98 oscillator periods after the Watchdog times out. The DIS-RTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled. ALE/PROG: Address Latch Enable (ALE) 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. Note, 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 (PSEN) is the read strobe to external program memory. When the AT89S51 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 program memory locations starting at 0000H up to FFFFH. Note, however, that 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 12-volt programming enable voltage (VPP) during Flash programming. XTAL1: Input to the inverting oscillator amplifier and input to the internal clock operating circuit. XTAL2: Output from the inverting oscillator amplifier.
3.3
Memory Organization:
Program Memory: If the EA pin is connected to GND, all program fetches are directed to external memory. On the AT89S51, if EA is connected to VCC, program fetches to addresses 0000H through FFFH are directed to internal memory and fetches to addresses 1000H through FFFFH are directed to external memory. Data Memory: The AT89S52 implements 128 bytes of on-chip RAM. The 128 bytes are accessible via direct and indirect addressing modes. Stack operations are examples of indirect addressing, so the 128 bytes of data RAM are available as stack space.
3.4
Interrupts:
Interrupts: The AT89S52 has a total of five interrupt vectors: two external interrupts (INT0 and INT1), two timer interrupts (Timers 0 and 1), and the serial port interrupt. Each of these interrupt sources can be individually enabled or disabled by setting or clearing a bit in Special Function Register IE. IE also contains a global disable bit, EA, which disables all interrupts at once. The Timer 0 and Timer 1 flags, TF0 and TF1, are set at S5P2 of the cycle in which the timers overflow. The values are then polled by the circuitry in the next cycle.
Electrical energy transmission systems. Common examples of this include power supplies that convert AC line voltage to DC voltage.
Energy storage devices such as batteries and fuel cells. Electromechanical systems such as generators and alternators. Solar power. A power supply may be implemented as a discrete, stand-alone device or as an integral device that is hardwired to its load. Examples of the latter case include the low voltage DC power supplies that are part of desktop computers and consumer electronics devices. Commonly specified power supply attributes include:
The amount of voltage and current it can supply to its load. How stable its output voltage or current is under varying line and load conditions.
How long it can supply energy without refueling or recharging (applies to power supplies that employ portable energy sources).
Regulated power supply mainly consist of : 1) Transformer 2) Bridge rectifier 3) Filter 4) Regulator
4.2
Transformer:
A transformer is a device that transfers electrical energy from one circuit to another through inductively coupled conductorsthe transformer's coils. A
varying current in the first or primary winding creates a varying magnetic flux in the transformer's core and thus a varying magnetic field through the secondary winding. This varying magnetic field induces a varying electromotive force (EMF), or "voltage", in the secondary winding. This effect is called inductive coupling.
Fig.4.1 Transformer
If a load is connected to the secondary, current will flow in the secondary winding, and electrical energy will be transferred from the primary circuit through the transformer to the load. In an ideal transformer, the induced voltage in the secondary winding (Vs) is in proportion to the primary voltage (Vp) and is given by the ratio of the number of turns in the secondary (Ns) to the number of turns in the primary (Np) as follows:
By appropriate selection of the ratio of turns, a transformer thus enables an alternating current (AC) voltage to be "stepped up" by making Ns greater than Np, or "stepped down" by making Ns less than Np. In the vast majority of transformers, the windings are coils wound around a ferromagnetic core, air-core transformers being a notable exception. Transformers range in size from a thumbnail-sized coupling transformer hidden inside a stage microphone to huge units weighing hundreds of tons used to interconnect portions of power grids. All operate on the same basic principles, although the range of designs is wide. While new technologies have eliminated the need for transformers in some electronic circuits, transformers are still found in nearly all electronic devices designed for household ("mains") voltage. Transformers are essential for high-voltage electric power transmission, which makes long-distance transmission economically practical.
4.3
Rectifier:
A rectifier is an electrical device that converts alternating current (AC), which periodically reverses direction, to direct current (DC), which flows in only one direction. The process is known as rectification. Physically, rectifiers take a number of forms, including vacuum tube diodes, mercury-arc valves, solid-state diodes, silicon-controlled rectifiers and other silicon-based semiconductor switches. Historically, even synchronous electromechanical switches and motors have been used. Early radio receivers,
called crystal radios, used a "cat's whisker" of fine wire pressing on a crystal of galena (lead sulfide) to serve as a point-contact rectifier or "crystal detector". Rectifiers have many uses, but are often found serving as components of DC power supplies and high-voltage direct current power transmission systems.
Rectification may serve in roles other than to generate direct current for use as a source of power. As noted, detectors of radio signals serve as rectifiers. In gas heating systems flame rectification is used to detect presence of flame. The simple process of rectification produces a type of DC characterized by pulsating voltages and currents (although still unidirectional). Depending upon the type of end-use, this type of DC current may then be further modified into the type of relatively constant voltage DC characteristically produced by such sources
as batteries and solar cells. A device which performs the opposite function (converting DC to AC) is known as an inverter.
4.4
Bridge rectifier:
A diode bridge is an arrangement of four (or more) diodes in a bridge circuit configuration that provides the same polarity of output for either polarity of input. When used in its most common application, for conversion of an alternating current (AC) input into direct current a (DC) output, it is known as a bridge rectifier. A bridge rectifier provides full-wave rectification from a two-wire AC input, resulting in lower cost and weight as compared to a rectifier with a 3-wire input from a transformer with a centertapped secondary winding.
4.5
Fig 4.2 Full Wave Bridge Rectifier The four diodes labelled D1 to D4 are arranged in "series pairs" with only two diodes conducting current during each half cycle. During the positive half cycle of the supply, diodes D1 and D2 conduct in series while diodes D3 and D4 are reverse biased and the current flows through the load as shown below. The Positive Half-cycle:
During the negative half cycle of the supply, diodes D3 and D4 conduct in series, but diodes D1 and D2switch "OFF" as they are now reverse biased. The current flowing through the load is the same direction as before. The Negative Half-cycle:
Fig 4.4 The Negative Half-cycle of fullwave bridge rectifier As the current flowing through the load is unidirectional, so the voltage developed across the load is also unidirectional the same as for the previous two diode full-wave rectifier, therefore the average DC voltage across the load is 0.637Vmax. However in reality, during each half cycle the current flows through two diodes instead of just one so the amplitude of the output voltage is two voltage drops ( 2 x 0.7 = 1.4V ) less than the input VMAX amplitude. The ripple frequency is now twice the supply frequency (e.g. 100Hz for a 50Hz supply) Although we can use four individual power diodes to make a full wave bridge rectifier, pre-made bridge rectifier components are available "off-the-shelf" in a range of different voltage and current sizes that can be soldered directly into a PCB circuit board or be connected by spade connectors. The image to the right shows a typical single phase bridge rectifier with one corner cut off. This cut-off corner indicates that the terminal nearest to the corner is the positive or +ve output terminal or lead with the opposite
(diagonal) lead being the negative or -ve output lead. The other two connecting leads are for the input alternating voltage from a transformer secondary winding.
4.6
Filters:
Electronic filters are electronic circuits which perform signalprocessing functions, specifically to remove unwanted frequency components from the signal, to enhance wanted ones, or both.
Fig 4.5
The smoothing capacitor converts the full-wave rippled output of the rectifier into a smooth DC output voltage. Generally for DC power supply circuits the smoothing capacitor is an Aluminium Electrolytic type that has a capacitance value of 100uF or more with repeated DC voltage pulses from the rectifier charging up the capacitor to peak voltage. However, their are two important parameters to consider when choosing a suitable smoothing capacitor and these are its Working Voltage, which must be higher than the no-load output value of the rectifier and its Capacitance Value, which determines the amount of ripple that will appear superimposed on top of the DC voltage. Too low a value and the capacitor has little effect but if the smoothing capacitor is large enough (parallel capacitors can be used) and the load current is not too large, the output voltage will be almost as smooth as pure DC. As a general rule of thumb, we are looking to have a ripple voltage of less than 100mV peak to peak. The maximum ripple voltage present for a Full Wave Rectifier circuit is not only determined by the value of the smoothing capacitor but by the frequency and load current, and is calculated as:
Where: I is the DC load current in amps, is the frequency of the ripple or twice the input frequency in Hertz, and C is the capacitance in Farads. The main advantages of a full-wave bridge rectifier is that it has a smaller AC ripple value for a given load and a smaller reservoir or smoothing capacitor than an equivalent half-wave rectifier. Therefore, the fundamental frequency of the ripple voltage is twice that of the AC supply frequency (100Hz) where for the half-wave rectifier it is exactly equal to the supply frequency (50Hz). The amount of ripple voltage that is superimposed on top of the DC supply voltage by the diodes can be virtually eliminated by adding a much improved -filter (pifilter) to the output terminals of the bridge rectifier. This type of low-pass filter consists of two smoothing capacitors, usually of the same value and a choke or inductance across them to introduce a high impedance path to the alternating ripple component. Another more practical and cheaper alternative is to use a 3-terminal voltage regulator IC, such as a LM78xx for a positive output voltage or the LM79xx for a negative output voltage which can reduce the ripple by more than 70dB (Datasheet) while delivering a constant output current of over 1 amp. In the next tutorial about diodes, we will look at the Zener Diode which takes advantage of its reverse breakdown voltage characteristic to produce a constant and fixed output voltage across itself.
4.7
Regulator:
A voltage regulator is an electrical regulator designed to automatically maintain a constant voltage level. A voltage regulator may be a simple "feed-forward" design or may include negative feedback control loops. It may use an electromechanical mechanism, or
electronic components. Depending on the design, it may be used to regulate one or more AC or DC voltages. Electronic voltage regulators are found in devices such as computer power supplies where they stabilize the DC voltages used by the processor and other elements. In automobile alternators and central power station generator plants, voltage regulators control the output of the plant. In an electric power distribution system, voltage regulators may be installed at a substation or along distribution lines so that all customers receive steady voltage independent of how much power is drawn from the line.
4.8
testing electronic circuits, possibly with continuous variation of the output voltage, or just some preset voltages; a laboratory (lab) power supply normally implies an accurate bench power supply, while a balanced or tracking power supply refers to twin supplies for use when a circuit requires both positive and negative supply rails). Mobile Phone power adaptors Regulated power supplies in appliances
4.9
1N4148 DIODE:
The 1N4148 is a standard silicon switching diode. Its name follows
the JEDEC nomenclature. The 1N4148 has a DO-35 glass package and is very useful at high frequencies with a reverse recovery time of no more than 4ns. The 1N4148 is a general-purpose signal diode having a maximum reverse voltage of 100 and forward current of 300 milliamps. The designation 1N4148 is an industrystandard part number from the Joint Electron Device Engineering Council, or JEDEC; numerous semiconductor manufacturers make the device with the same characteristics. The diode functions as a high-speed switch and signal detector in audio and radio applications.
4.9.1 Characteristics:
High switching speed: max. 4 ns Continuous reverse voltage: max. 75 V Repetitive peak reverse voltage: max. 100 V Repetitive peak forward current: max. 450 mA. Average Rectified Forward Current: 200mA DC Forward Current: 300mA Power Dissipation: 500 mW
2)
Forward Current:
A diode conducts current in the "forward" direction, blocking it in the "reverse"
direction. Its ability to conduct current is limited by its size and construction. A circuit that puts too much current through a diode will burn it up. The 1N4148 has a maximum continuous current of 200 milliamps and a pulsed maximum current of 450 milliamps.
3)
Voltage source:
The 1N4148 has a glass body with two leads for connecting it to circuits. This
format is handy for solder less breadboard, per board and printed circuit boards. Generally, this is a good diode for hobbyists and engineers looking to make small numbers of circuits. In 2011, mass-produced circuits use surface-mount components. They are physically smaller, lack leads and are optimized for machine handling.
4)
Switching Speed:
The 1N4148's high switching speed of 4 nanoseconds makes it useful for audio,
radio and some computer circuits. This is the time the diode takes to permit current flow after a signal changes its polarity from reverse to forward. A 4-nanosecond switching speed corresponds with a frequency of about 125 megahertz, but individual diodes may have much faster speeds. The 4-nanosecond figure is the maximum switching time, so some circumstances allow for higher speeds.
5)
AM Radio Detector:
In AM radio, an audio signal modulates the amplitude, or strength, of a high-
frequency carrier wave. A single-diode detector circuit, such as one using the 1N4148, recovers the audio from the carrier signal. A radio receiver has a tuner to select one carrier frequency from the AM band, and a diode detector and filter to remove the highfrequency signal, leaving the audio. The diodes switching action turns the carrier signals AC into DC. The amplitude of the DC is simply the audio in the broadcast.
6)
Rectifier:
All diodes function as rectifiers, converting alternating current, which reverses
direction, into direct current, which flows in one direction. DC power supplies typically use diodes with higher voltage- and current-handling capabilities than the 1N4148 as rectifiers. The 1N4001, for example, has a maximum current of one amp. For applications that do not exceed its 300-milliamp limit, the 1N4148 can act as a rectifier.
CHAPTER 5 LCD
5.1 LIQUID CRYSTAL DISPLAY
Liquid Crystal Display also called as LCD is very helpful in providing user interface as well as for debugging purpose. The most commonly used Character based LCDs are based on Hitachi's HD44780 controller or other which are compatible with HD44580. The most commonly used LCDs found in the market today are 1 Line, 2 Line or 4 Line LCDs which have only 1 controller and support at most of 80 characters, whereas LCDs supporting more than 80 characters make use of 2 HD44780 controllers.
Fig: 5.1 Pin description of LCD Pin No. 1 2 3 Name VSS VCC VEE Power supply (GND) Power supply (+5V) Contrast adjust 0 1 = Data input 0 = Write to LCD module = Instruction input Description
RS
R/W
1 = Read from LCD module Enable signal Data bus line 0 (LSB) Data bus line 1 Data bus line 2 Data bus line 3 Data bus line 4
6 7 8 9 10 11
EN D0 D1 D2 D3 D4
12 13 14 15 16
D5 D6 D7 LED+ LED-
Data bus line 5 Data bus line 6 Data bus line 7 (MSB) Back Light VCC Back Light GND
Display data RAM (DDRAM) stores display data represented in 8-bit character codes. Its extended capacity is 80 X 8 bits, or 80 characters. The area in display data RAM (DDRAM) that is not used for display can be used as general data RAM. So whatever you send on the DDRAM is actually displayed on the LCD. For LCDs like 1x16, only 16 characters are visible, so whatever you write after 16 chars is written in DDRAM but is not visible to the user. Now you might be thinking that when you send an ASCII value to DDRAM, how the character is displayed on LCD? So the answer is CGROM. The character generator ROM generates 5 x 8 dot or 5 x 10 dot character patterns from 8-bit character codes. It can generate 208 5 x 8 dot character patterns and 32 5 x 10 dot character patterns. As clear from the name, CGRAM area is used to create custom characters in LCD. In the character generator RAM, the user can rewrite character patterns by program. For 5 x 8 dots, eight character patterns can be written, and for 5 x 10 dots, four character patterns can be written. Busy Flag is a status indicator flag for LCD. When we send a command or data to the LCD for processing, this flag is set (i.e. BF =1) and as soon as the instruction is executed successfully this flag is cleared (BF = 0). This is helpful in producing and exact amount of delay for the LCD processing. To read Busy Flag, the condition RS = 0 and R/W = 1 must be met and The MSB of the LCD data bus (D7) act as busy flag. When BF
= 1 means LCD is busy and will not accept next command or data and BF = 0 means LCD is ready for the next command or data to process. There are two 8-bit registers in HD44780 controller Instruction and Data register. Instruction register corresponds to the register where you send commands to LCD e.g. LCD shift command, LCD clear, LCD address etc. and Data register is used for storing data which is to be displayed on LCD. When send the enable signal of the LCD is asserted, the data on the pins is latched in to the data register and data is then moved automatically to the DDRAM and hence is displayed on the LCD. Data Register is not only used for sending data to DDRAM but also for CGRAM, the address where you want to send the data, is decided by the instruction you send to LCD.
fig 5.2disply formar,data length of LCD Although looking at the table you can make your own commands and test them. Below is a brief list of useful commands which are used frequently while working on the LCD.
No. 1 2 3 4 5
Instruction Function Set: 8-bit, 1 Line, 5x7 Dots Function Set: 8-bit, 2 Line, 5x7 Dots Function Set: 4-bit, 1 Line, 5x7 Dots Function Set: 4-bit, 2 Line, 5x7 Dots Entry Mode Display off Cursor off
Decimal 48 56 32 40 6
7 8 9 10 12 13 14 15
Display on Cursor on Display on Cursor off Display on Cursor blinking Shift entire display left Shift entire display right Move cursor left by one character Move cursor right by one character Clear Display (also clear DDRAM content) Set DDRAM address or cursor position on display Set CGRAM address or set pointer to CGRAM location
14 12 15 24 30 16 20 1
16
0x80+add
128+add
17
0x40+add
64+add
5.2
5.3
CHAPTER 6
KEYPAD
6.1 Introduction
Keypads are a part of HMI or Human Machine Interface and play really important role in a small embedded system where human interaction or human input is needed. Martix keypads are well known for their simple architecture and ease of interfacing with any microcontroller. In this part of tutorial we will learn how to interface a 4x4 matrix keypad with AVR and 8051 microcontroller. Also we will see how to program then in Assembly and C.
6.2
Constuction of a keypad is really simple. As per the outline shown in the figure below we have four rows and four columns. In between each overlapping row and column line there is a key.
fig 6.1 keypad So keeping this outline we can constuct a keypad using simple SPST Switches as shown below:
Now our keypad is ready, all we have to do is connect the rows and columns to a port of microcontroller and program the controller to read the input.
6.3
There are many methods depending on how you connect your keypad with your controller, but the basic logic is same. We make the coloums as i/p and we drive the rows making them o/p, this whole procedure of reading the keyboard is called scanning.
In order to detect which key is pressed from the matrix, we make row lines low one by one and read the coloums. Lets say we first make Row1 low, then read the columns. If any of the key in row1 is pressed will make the corrosponding column as low i.e if second key is pressed in Row1, then column2 will give low. So we come to know that key 2 of Row1 is pressed. This is how scanning is done. So to scan the keypad completely, we need to make rows low one by one and read the columns. If any of the button is pressed in a row, it will take the corrosponding column to
a low state which tells us that a key is pressed in that row. If button 1 of a row is pressed then Column 1 will become low, if button 2 then column2 and so on.
void lcd1(item1); void keypad(); void main() { unsigned char r,s,t,c; unsigned char item,item1; h=0; sw1=0; sw2=0; sw3=0; sw4=0; main: lcdcmd(0x01); lcd1(item1); lcdcmd(0x06); keypad(); lcdcmd(0x01); lcd(item); lcdcmd(0xc0); keypad(); r=P1; if(r==0x2A)
{ goto main; } r=r-0x30; keypad(); s=P1; if(s==0x2A) { goto main; } s=s-0x30; keypad(); t=P1; if(t==0x2A) { goto main; } t=t-0x30; c=(r*100+s*10+t); if(h==1&&o==1) { sw1=0;
sw2=1; delay1(c); sw1=0; sw2=0; h--; o--; goto main; } if(h==2&&o==1){ sw1=1; sw2=0; delay1(c); sw1=0; sw2=0; h--; h--; o--; goto main; } if(h==1&&o==2) { sw3=1;
if(h==2&&o==2) { sw3=0; sw4=1; delay1(c); sw3=0; sw4=0; h--; h--; o--; o--; goto main;
P2=0x0F; y:var=1;P0=0x00; delay(20); if(P2==0x0F) goto y; delay(20); if(P2==0x0F) a=P2; P0=0x0e; if(P2!=0x0F) goto row1; P0=0x0d; if(P2!=0x0F)
goto row2; P0=0x0b; if(P2!=0x0F) goto row3; P0=0x07; if(P2!=0x0F) goto row4; else goto y;
} else if(P2==0x0B) { lcddata(keys[0][2]); g=keys[0][2]; return; } else if(P2==0x07) { lcddata(keys[0][3]); g=keys[0][3]; o++; h++; return; } goto y;
row2:if(P2==0x0E) { lcddata(keys[1][0]);
g=keys[1][0]; return; } else if(P2==0x0D) { lcddata(keys[1][1]); g=keys[1][1]; return; } else if(P2==0x0B) { lcddata(keys[1][2]); g=keys[1][2]; return; } else if(P2==0x07) { lcddata(keys[1][3]); g=keys[1][3];
row3:if(P2==0x0E) { lcddata(keys[2][0]); g=keys[2][0]; return; } else if(P2==0x0D) { lcddata(keys[2][1]); g=keys[2][1]; return; } else if(P2==0x0B)
{ lcddata(keys[2][2]); g=keys[2][2]; return; } else if(P2==0x07) { lcddata(keys[2][3]); g=keys[2][3]; o++; o++; h++; return; } goto y; row4:if(P2==0x0E) { lcddata(keys[3][0]); g=keys[3][0]; return; }
else if(P2==0x0D) { lcddata(keys[3][1]); g=keys[3][1]; return; } else if(P2==0x0B) { lcddata(keys[3][2]); g=keys[3][2]; return; } else if(P2==0x07) { lcddata(keys[3][3]); o++; o++; h++; h++;
return;} goto y; }
void lcdcmd(unsigned char value) { rs=0; rw=0; e=1; delay(10); P1=value; e=0; return; }
for(j=0;j<=1250;j++); } void delay1(char time) { char i; int j,m; for(i=0;i<=time;i++) for(m=0;m<=10;m++) for(j=0;j<=1275;j++); } void lcd(unsigned char item) { int f,n,p,q;
if(h==1&&o==1) { unsigned char shree[]={'M','A','I','N',' ','F','O','R','W','A','R','D'}; for(f=0;f<12;f++) lcddata(shree[f]); return; } if(h==2&&o==1) { unsigned char shree1[]={'M','A','I','N',' ','R','E','V','E','R','S','E'}; for(n=0;n<12;n++) lcddata(shree1[n]); return; } if(h==1&&o==2) { unsigned char shree2[]={'S','U','B',' ','F','O','R','W','A','R','D'}; for(p=0;p<11;p++) lcddata(shree2[p]); return; } if(h==2&&o==2)
{ unsigned char shree3[]={'S','U','B',' ','R','E','V','E','R','S','E'}; for(q=0;q<11;q++) lcddata(shree3[q]); return; } } void lcd1(unsigned char item1) { int f; unsigned char shree[]={'W','E','L','C','O','M','E',' ','G','R','I','E','T'}; lcdcmd(0x06); lcdcmd(0x0e); for(f=0;f<13;f++) lcddata(shree[f]); return; }
Fig 8.1 file opening of keil Step2: Select New uvision project.
Fig 8.2
Step 3: Select destination folder if already created or else create a separate folder for it.
Fig 8.4 creating a folder Step4: Select your micro controller from the given list of families.
Fig 8.5
Fig 8.6 Step6: Select LPC2148 from the list as we are using this controller.
Fig 8.7
Fig 8.8 Step 8: Write the code desired in to the file and save it as <filename>.c
Fig 8.9
Add the file to startup.s to debug it. Step 9: Click on debug or hit F7 key to build the program.
Fig 8.10
Fig 9.1
9.1
CIRCUIT OPERATION
The 230 V power supply from AC Mains is given to step down transformer. The step down transformer step downs the 230 V AC to 12 V AC. This 12 V AC is given to the bridge rectifier to convert AC signal into pulsating DC signal.This pulsated DC signal is converted to pure DC signal by a capacitor. The IC 7812 voltage regulator is used to convert signal to 12 V and it is given to the microcontroller. Now coming to the main circuit operation the LDR dectects day/night by the amount of light falling on it and sends the signal to the microcontroller port 0.0. The PIR sensor detects the motion of human intruder and sends the signal to the microcontroller port 0.1. When it is day and a human intruder motion is being detected then the microcontroller communicates with LCD and MOTOR. When it is night and a human intruder motion is being detected then the microcontroller communicates with LCD and GSM MODEM. The LCD data pins are connected to the microcontroller port 0.10, port 0.11, port 0.12, and port 0.13. The LCD displays DOOR OPEN during day time when a human intruder motion is detected, DOOR CLOSE when there is no motion of the human intruder. It displays THEFT DETECTED during night time when a human intruder motion is detected. The MOTOR is connected to the microcontroller port 0.4 and port 0.5 with the help of L293D driver.During day time when a human intruder motion is detected the motion runs in forward direction to open the door and after some delay the motor runs in opposite direction to close the door.
9.2
Hardware circuit :
1N4007
0
1N4007
0
micro control inputs
HI HI HI HI
2 7 10 15 5v
HI
3 6 11 14
1 9 8 16
mtr 2
5v
HI
Fig 9.3
CHAPTER 10 CONCLUSION
We are very pleased with the progress and changes that we made with the project. The new equipment and competition created an environment where we vigorously pursued learning and applying control systems knowledge. The gantry crane setup provided an excellent challenge to us while not being overbearingly difficult.
CHAPTER 11 SCOPE:
This chapter applies to the marking, construction, installation, inspection, testing,maintenance and operation of the following overhead and gantry cranes, including semi-gantry, cantilever gantry, wall cranes, bridge cranes, and others having the same fundamental characteristics. These cranes may be top-running, under-running, single- or double-girder.Hoist units and trolleys are most commonly electric powered, but can be air powered or hand-chain operated. These cranes may be cab operated, pulpit operated, floor operated, orremotely operated. Such cranes are grouped together because all have trolleys and similar travel characteristics. The proper and safe use of overhead and gantry cranes is governed by the American Society of Mechanical Engineers (ASME) standards and the Occupational Safety and HealthAdministration (OSHA) regulations. This section implements required criteria fromDOE/RL-92-36 Hanford Site Hoisting and Rigging Manual and the following standards: ASME B30.2-2005 Overhead and Gantry Cranes (Top Running Bridge, Single or Multiple Girder, Top Running Trolley Hoist) ASME B30.17-2006 Overhead and Gantry Cranes (Top Running Bridge, Single Girder, Underhung Hoist) OSHA 29 CFR 1910.179 - Overhead and Gantry Cranes OSHA 29 CFR 1926 Subpart CC Overhead and Gantry Cranes (only applies to temporarily installed cranes) The responsible engineer may invoke Rules for Construction of Overhead and Gantry Cranes (Top Running Bridge, Multiple Girder) ASME NOG-1-2004 for crane used at nuclear facilities. ASME NOG-1 applies to the design, manufacture, testing, inspection, shipment, storage, and erection of overhead and gantry cranes (Top Running Bridge, Multiple Girder). The responsible engineer may invoke Rules for Construction of Cranes, Monorails, and Hoists (with Bridge or Trolley or Hoist of the Under-hung Type) ASME NUM-1-2004 for cranes used at nuclear facilities. ASME NUM-1 applies to the design, manufacture, testing, inspection,
shipment, storage, and erection of monorails and hoists (with Bridge or Trolley or Hoist of the Under-hung Type). This section implements the following criteria and the applicable national standards and/or federal specifications that are mandatory requirements for each item. ASME B30.2-2005 Overhead and Gantry Cranes (Top Running Bridge, Single or Multiple Girder, Top Running Trolley Hoist), ASME B30.17-2006 Overhead and Gantry Cranes (Top Running Bridge, Single Girder, Underhung Hoist).
CHAPTER 12 REFERENCES
[1] Butler, H., Honderd, G. and Van Amerongen, J., ModelReference Adaptive Control of a Gantry Crane ScaleModel, IEEE Control Systems Magazine, 11, no.1, Jan.1991, pp.57-62. [2] Quanser Consulting. Wincon 3.1 Manual, 2000. [3] Quanser Consulting. Systems & Procedures, 2000 [4]. Durfee, W. K., Teaching Microprocessors toMechanical Engineers: Lessons from aProjectBased,Creative Design Course, Proceedings of the ASME WinterAnnual Meeting, ASME 93WA/DSC-8, 1993, pp. 1-3. [5]. Marttinen, A., "Pole-Placement Control of a PilotGantry," Proceedings of the American Control Conference,1989, pp. 2824-2826. [6]. Marttinen, A., J. Virkkunin, and R. T. Salminen,"Control Study with a Pilot Crane," IEEE Transactions onEducation, 1990, Vol. 33, No. 3, pp. 298-305.