Professional Documents
Culture Documents
Page |1
Chapter 1
INTRODUCTION
DEPARTMENT OF E.C.E
Page |2
1. INTRODUCTION
1.1 PROBLEM STATEMENT Indian power sector is facing serious problem of lean revenue collection as against energy supplied due to energy thefts and network losses. All the steps taken so far, regarding the improvement of the revenue collection did not yield satisfactory results. It is reported that the most faulty sub system is the metering and meter reading system.
The traditional billing systems are discrete, inaccurate, costly, slow, and lack flexibility as well as reliability. Therefore, several attempts were made to automate the billing systems. Even though accurate and fast readings are obtained, bill payment is still performed based on the old billing procedure. They require an individual/agent to physically come and take down the readings and report to house hold/office the amount one has to pay.
1.2 OBJECTIVE
To understand, analyse, design and develop an on line pre-paid energy meter which provides both the suppliers and the consumers with better services regarding meter billing and payment.
1.3 METHODOLOGY
This is a very good microcontroller based application. This unit will accept the number of units recharged by the concerned department person, counts the number of units consumed by the customer and as soon as the customer exceeds the recharged amount, it will disconnect the power supply to the customer until the next recharge.
Whenever the number of units in microcontroller becomes zero microcontroller sends a signal to Contact Maker /Breaker circuit which is nothing but the relay and this relay cuts off the power supply to the consumer until next recharge.
DEPARTMENT OF E.C.E
Page |3
DEPARTMENT OF E.C.E
Page |4
DEPARTMENT OF E.C.E
Page |5
Chapter 2
DEPARTMENT OF E.C.E
Page |6
The above shown is the block diagram of the prepaid energy meter. It uses AT89S52 microcontroller. Its the heart of the entire system. Initially electricity passes through power supply line to loads in household. There are few problems like revenue collection and huge manpower in present post-paid system. Our project gives an excellent answer for the current problem. In this system the customer buy recharge chards to recharge the system using the provision called card reader in the system. LCD is provides to display the meter readings to the customer. The current driver ULN2803IC is used to amplify the current from the microcontroller. ULN2803IC is used to run the peripherals like relays, printers, motors etc.
DEPARTMENT OF E.C.E
Page |7
A buzzer is used to intimate the user if the balance in the system is low. We can also use LED indications to indicate the balance in the users account. The buzzer by ringing indicates if the balance in the system is below 10%. The GREEN LED glows if the balance is upto 60%. The ORANGE led glows if the balance is between 61-85%. The RED LED is used to indicate last 10-15% balance.
Page |8
Page |9
DEPARTMENT OF E.C.E
P a g e | 10
Chapter 3
EMBEDDED SYSTEM
DEPARTMENT OF E.C.E
P a g e | 11
3. EMBEDDED SYSTEM
3.1 INTRODUCTION:
An Embedded System is a combination of computer hardware and software, and perhaps additional mechanical or other parts, designed to perform a specific function. A good example is the microwave oven. Almost every household has one, and tens of millions of them are used every day, but very few people realize that a processor and software are involved in the preparation of their lunch or dinner. This is in direct contrast to the personal computer in the family room. It too is comprised of computer hardware and software and mechanical components (disk drives, for example). However, a personal computer is not designed to perform a specific function rather; it is able to do many different things. Many people use the term general-purpose computer to make this distinction clear. As shipped, a general-purpose computer is a blank slate; the manufacturer does not know what the customer will do wish it. One customer may use it for a network file server another may use it exclusively for playing games, and a third may use it to write the next great American novel. Frequently, an embedded system is a component within some larger system. For example, modern cars and trucks contain many embedded systems. One embedded system controls the anti-lock brakes, other monitors and controls the vehicle's emissions, and a third displays information on the dashboard. In some cases, these embedded systems are connected by some sort of a communication network, but that is certainly not a requirement. At the possible risk of confusing you, it is important to point out that a generalpurpose computer is itself made up of numerous embedded systems. For example, my computer consists of a keyboard, mouse, video card, modem, hard drive. For example, the modem is designed to send and receive digital data over analog telephone line. That's it and all of the other devices can be summarized in a single sentence as well. If an embedded system is designed well, the existence of the processor and software could be completely unnoticed by the user of the device. Such is the case for a microwave oven, VCR, or alarm clock. In some cases, it would even be possible to build an equivalent device that does not contain the processor and software. This could be done by replacing the
DEPARTMENT OF E.C.E
P a g e | 12
combination with a custom integrated circuit that performs the same functions in hardware. However, a lot of flexibility is lost when a design is hard-cooled in this way. It is much easier, and cheaper, to change a few lines of software than to redesign a piece of custom hardware.
DEPARTMENT OF E.C.E
P a g e | 13
Embedded systems do a very specific task; they can't be programmed to do different things. Embedded systems have limited resources, particularly the memory. Generally, they do not have secondary storage device such as the CDROM or the floppy disk. Embedded systems have to work against some deadlines. A specific job has to complete with in the specific time. Embedded systems are constrained for power. As many embedded systems operate through a battery, the power consumption has to be very low. Embedded systems need to be highly reliable. Once in a while, pressing ALT+CRTL+DEL is ok in your desktops, but you can't afford to reset your embedded system. Some embedded systems have to operate in the extreme environmental conditions such as very high temperatures and humidity.
DEPARTMENT OF E.C.E
P a g e | 14
Chapter 4
MICROCONTROLLER
DEPARTMENT OF E.C.E
P a g e | 15
A microcontroller is an integrated chip that is often part of an embedded system. The microcontroller includes a CPU, ALU, PC, SP and registers, RAM, ROM, I/O ports and timers like a standard computer but they are designed to execute only a single specific task to control a single system. They are much smaller and simplified so that they can include all the functions required on a single chip. Like the microprocessor, a microcontroller is a general-purpose device, but one that is meant to read data, performs limited calculations on that data, and control its environment based on its calculations. Most microcontrollers will also combine other devices such as: A Timer module to allow the microcontroller to perform tasks for certain periods. time
DEPARTMENT OF E.C.E
P a g e | 16
A serial I/O port to allow data to flow between the microcontroller and other devices such as a PC or another microcontroller.
An ADC to allow the microcontroller to accept analogue input data for processing.
DEPARTMENT OF E.C.E
P a g e | 17
Among the MAJOR manufacturers are: AMD Atmel Cygnal Dallas Intel ISSI Matra OKI Enhanced 8051 parts (no longer producing 8051 parts) FLASH and semi-custom parts Fastest 8051 with Flash memory. 20MH internal clock. Fast variant. Also battery backed 8051 through 80C51GB / 80C51Sl. They invented the 8051 IS80C51/31 runs up to 40MHz 80C154, low voltage static variants 80C154, mask parts.
DEPARTMENT OF E.C.E
P a g e | 18
DEPARTMENT OF E.C.E
P a g e | 19
4.4 DISCRIPTION:
The AT89S8252 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of downloadable Flash programmable and erasable read-only memory and 2K bytes of EEPROM. The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 instruction set and pin out. The on-chip downloadable Flash allows the program memory to be reprogrammed through an SPI serial interface or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with downloadable Flash on a monolithic chip, the Atmel AT89S8252 is a powerful microcontroller, which provides a highly-flexible and costeffective solution to many embedded control applications. The AT89S8252 provides the following standard features: 8K bytes of downloadable Flash, 2K bytes of EEPROM, 256 bytes of RAM, 32 I/O lines, two data pointers, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S8252 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 external interrupt or hardware reset. The downloadable Flash can be changed a single byte at a time and is accessible through the SPI serial interface. Holding RESET active forces the SPI bus into a serial programming interface and allows the program memory to be written to or read from unless lock bits have been activated.
P a g e | 20
Three-level Program Memory Lock 256 x 8-bit Internal RAM 32 Programmable I/O Lines Three 16-bit Timer/Counters Nine Interrupt Sources SPI Serial Interface Programmable UART Serial Channel Interrupt Recovery from Power-down Dual Data Pointer Power-off Flag
DEPARTMENT OF E.C.E
P a g e | 21
DEPARTMENT OF E.C.E
P a g e | 22
As mentioned at the beginning of this chapter, the 8051 include a certain amount of on chip memory. On-chip memory is really one of two (SFR) memories. The layout of the 8051's internal memory is presented in the following memory map:
DEPARTMENT OF E.C.E
P a g e | 23
As is illustrated in this map, the 8051 has a bank of 128 bytes of Internal RAM. This Internal RAM is found on-chip on the 8051 so it is the fastest RAM available, and it is also the most flexible in terms of reading, writing, and modifying its contents. Internal RAM is volatile, so when the 8051 is reset this memory is cleared. The 128 bytes of internal RAM is subdivided as shown on the memory map. The first 8 bytes (00H 07H) are "register bank 0". By manipulating certain SFRs, a program may choose to use register banks 1, 2, or 3. These alternative register banks are located in internal RAM in addresses 08h through 1FH. Bit Memory also lives and is part of internal RAM. Keep in mind that bit memory actually resides in internal RAM, from addresses 20H through 2FH. The 80 bytes remaining of Internal RAM, from addresses 30h through 7Fh, may be used by user variables that need to be accessed frequently or at high-speed. This area is also utilized by the microcontroller as a storage area for the operating stack. This fact severely limits the 8051s stack since, as illustrated in the memory map, the area reserved for the stack is only 80 bytes--and usually it is less since these 80 bytes has to be shared between the stack and user variables.
DEPARTMENT OF E.C.E
P a g e | 24
registers are generally used to assist in manipulating values and moving data from one memory location to another.
DEPARTMENT OF E.C.E
P a g e | 25
DEPARTMENT OF E.C.E
P a g e | 26
the external interrupts are activated and also contain the external interrupt flags which are set when an external interrupt has occurred.
DEPARTMENT OF E.C.E
P a g e | 27
In most cases the program will wish to use one of the timers to establish the serial port's baud rate. In this case, it is necessary to configure timer1 by initializing TCON and TMOD.
P a g e | 28
only interrupt interrupts of lower priority. For example, if we configure the 8051 so that all interrupts are of low priority except the serial interrupt, the serial interrupt will always be able to interrupt the system, even if another interrupt is currently executing. However, if a serial interrupt is executing no other interrupt will be able to interrupt the serial interrupt routine since the serial interrupt routine has the highest priority.
P a g e | 29
DEPARTMENT OF E.C.E
P a g e | 30
4.10 UART:
One of the 8051s many powerful features is its integrated UART, otherwise known as serial port. An UART, universal asynchronous receiver /transmitter is responsible for performing the main task in serial communications with computers. The device changes incoming parallel information to serial data, which can be sent on a communication line. A second UART can be used to receive the information. The UART performs all the tasks, timing, parity checking, etc. Needed for the communication. The only extra devices attached are line driver chips capable of transforming the TTL level signals to line voltages and vice versa. The fact that the 8051 has an integrated serial port means that we may very easily read and write to the serial port we need to configure the serial ports operation mode and baud rate once configured all we have to do is to write to SFR to write a value to the serial port or the read same SFR to read a value from a serial port.
DEPARTMENT OF E.C.E
P a g e | 31
Table: 1
BIT
NAME
BIT ADDRESS
7 6 5
SERIAL PORT MODE BIT 0 SERIAL PORT MODE BIT 1 MULTIPROCESSOR COMMUNIATION ENABLE
4 3 2 1 0
REN B8 RB8 T1 R1
RECIVER ENABLE TRANSMIT BIT 8 RECEIVE BIT 8 TRANSMIT FLAG RECIVE FLAG
DEPARTMENT OF E.C.E
P a g e | 32
Table: 2
SM0 SM1
SERIAL MODE
0
EXPLIANATION
8BIT SHIFT REGISTER 8 BIT UART
BAUD RATE
OSCILATOR FREQUENCY BY 12 SET BY TIMER1 OSCILATOR FREQUENCY BY 32 SET BY TIMER1
8 BIT UART
8 BIT UART
The next bit is a SM2 is a flag for multiprocessor communication generally when a byte has been received the 8051 will set the RI flag this lets the program know that a byte has been received and that it needs to be processed. However if SM2 is set and a byte is received whose 9th bit is received the RI flag will never set. The next bit REN is receiver enable this bit is straight forward if we want to receive data via serial port set this bit. The last four bits are operational bits they are used when data is actually sent or received The Tb8 bit is used in modes 2 and 3. in modes 2 and 3 a total of 9 bits are transmitted first 8 are the data bits and the 9th bit is taken from Tb8 bit If Tb8 is set and the value is written to the serial port the data bits will be written to the serial line followed by a set 9th bit is if Tb8 is clear the 9th bit is clear. The Rb8 also operates in modes 2 and 3 and functions same way as Tb8 but on the reception side. TI means transmit interrupt. When a program writes a value to the serial port certain amount of time will pass before the individual bits of the byte are clocked out the serial port. When the TI bit is set, the program may assume that the serial port is free to send the next bit.
VIGNANS INSTITUTE OF INFORMATION AND TECHNOLOGY DEPARTMENT OF E.C.E
P a g e | 33
Finally the RI bit means receive interrupt. It functions are similar to that of a TI bit but it indicates the byte has been received.
8051 will begin transmitting the character via the serial port. Obviously transmission is not
VIGNANS INSTITUTE OF INFORMATION AND TECHNOLOGY DEPARTMENT OF E.C.E
P a g e | 34
instantaneous; it takes a measurable amount of time to transmit. And since the 8051 do not have a serial output buffer we need to be sure that a character is completely be transmitted before we try to transmit the next character. The 8051 lets us know when it is done transmitting a character by setting the TI bit in SCON. When this bit is set we know that the character has been transmitted and that we may send the next character, if any. Consider the following code segment: CLR TI; be sure the bit is initially clear MOV SBUF, #A; sends the letter A to the serial port JNB TI, $; pause until the TI bit is set These three instructions will successfully transmit the character and wait for the TI bit to be set before continuing. The last instruction says jump if the TI bit is not set to $-- $, in most assemblers meansthe same address of the current instruction. Thus the 8051 will pause on the JNB instruction until the TI bit is set by the 8051 upon successful transmission of the character.
DEPARTMENT OF E.C.E
P a g e | 35
Again, the 8051 sets the RI flag automatically when it receives the character via the serial port. So as long as the bit is not set the program repeats the JNB instruction continuously. Once the RI bit is set upon character reception the above condition automatically fails and program flow falls through to the MOV instruction, which reads the value.
4.11 INTERRUPTS:
As stated earlier, program flow is always sequential, being altered only by those instructions, which especially cause program flow to deviate in some way. However, interrupts give us a mechanism to "put on hold" the normal program flow, execute a subroutine, and then resume normal program flow as if we had never left it. The event may be one of the timers "overflowing," receiving a character via the serial port, transmitting a character via the serial port, or one of two "external events." The 8051 may be configured so that when any of these events occur the main program is temporarily suspended and control passed to a special section of code, which presumably would execute some function, related to the event that occurred. Once complete, control would be returned to the original
program. The main program never knows it was interrupted. The ability to interrupt normal program execution when certain events occur makes it much easier and much more efficient to handle certain conditions. If it were not for interrupts we would have to manually check in our main program whether the timers had overflow, whether we had received another character via the serial port, or if some external event had occurred. Besides making the main program complex and hard to read, such a situation would make our program inefficient since wed be burning precious "instruction cycles" checking for events that usually dont happen. The microcontroller itself will check for the condition automatically and when the condition is met will jump to a subroutine, execute the code, then returns. With interrupts, the 8051 will put the main program "on hold" and call our special routine to handle the reception of a character. Thus, we neither has to put a complex check in our main code nor we will lose characters.
DEPARTMENT OF E.C.E
P a g e | 36
Fig: 2.6 Pin diagram 4.12.1 VCC: Supply voltage. 4.12.2 GND: Ground. 4.12.3 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 may 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.
DEPARTMENT OF E.C.E
P a g e | 37
4.12.4 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. Port1 also receives the low-order address bytes during Flash programming and verification. 4.12.5 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. Port2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that uses 16-bit addresses. In this application, it uses strong internal pull-ups when emitting 1s. During accesses to external data memory that uses 8-bit addresses, 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. 4.12.6 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 also serves the functions of various special features of the AT89C51 as listed below: Port 3 also receives some control signals for Flash programming and verification. 4.12.7 RST: Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device.
DEPARTMENT OF E.C.E
P a g e | 38
4.12..8 Port Pin Alternate Functions: P3.0 P3.1 P3.2 P3.3 P3.4 P3.5 P3.6 P3.7 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)
Port 3 also receives some control signals for Flash programming and verification. 4.12.9 ALE/PROG: Address Latch Enable 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 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 ALEdisable bit has no effect if the microcontroller is in external execution mode. 4.12.11 PSEN: Program Store Enable is the read strobe to external program memory. When the AT89C51 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.
DEPARTMENT OF E.C.E
P a g e | 39
4.12.12 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, for parts that require12-volt VPP. 4.12.13 XTAL1: Input to the inverting oscillator amplifier and input to the internal clock operating circuit. 4.12.14 XTAL2: Output from the inverting oscillator amplifier.
DEPARTMENT OF E.C.E
P a g e | 40
Chapter 5
COMPONENTS
DEPARTMENT OF E.C.E
P a g e | 41
5. COMPONENTS
5.1 RESISTOR:
Resistors "Resist" the flow of electrical current. The higher the value of resistance (measured in ohms) the lower the current will be. Resistance is the property of a component which restricts the flow of electric current. Energy is used up as the voltage across the component drives the current through it and this energy appears as heat in the component.
Fig: 5-1
Resistor
DEPARTMENT OF E.C.E
P a g e | 42
5.2 CAPACITOR:
Capacitors store electric charge. They are used with resistors
in timing circuits because it takes time for a capacitor to fill with charge. They are used to smooth varying DC supplies by acting as a reservoir of charge. They are also used in filter circuits because capacitors easily pass AC (changing) signals but they block DC (constant) signals.
Fig: 5-3 Capacitor Symbol Electrolytic capacitors are polarized and they must be connected the correct way round, at least one of their leads will be marked + or -.
5.3 DIODES:
Diodes allow electricity to flow in only one direction. The arrow of the circuit symbol shows the direction in which the current can flow. Diodes are the electrical version of a valve and early diodes were actually called valves.
Circuit symbol:
Fig: 5-5 Diode Symbol Diodes must be connected the correct way round, the diagram may be labeled a or + for anode and k or - for cathode (yes, it really is k, not c, for cathode!). The cathode is marked by a line painted on the body. Diodes are labeled with their code in small print; you may need a magnifying glass to read this on small signal diodes.
DEPARTMENT OF E.C.E
P a g e | 43
Example:
5.4 BUZZER:
Fig: 5-7 Buzzer An electric coil is wound on a plastic bobbin, the latter having a central sleeve within which a magnetic core is sliceable positioned. One end of the sleeve is closed and projects beyond the coil. An inverted cup-shaped housing surrounds the coil and bobbin and has a central opening through which the closed end of the sleeve projects. The core projects into the closed end of the sleeve beyond the margin of the opening in the housing to augment the magnetic coupling between the housing and the core. The open end of the housing is attached to a support bracket of magnetic material, there being a spring between the bracket and bobbin normally urging the core toward the closed end of the sleeve.
DEPARTMENT OF E.C.E
P a g e | 44
Fig: 5.9 LED View They are manufactured in different shapes, colors and sizes. For their low price, low consumption and simple use, they have almost completely pushed aside other light sourcesbulbs at first place.
Fig: 5.10 Typical LEDS It is important to know that each diode will be immediately destroyed unless its current is limited. This means that a conductor must be connected in parallel to a diode. In
VIGNANS INSTITUTE OF INFORMATION AND TECHNOLOGY DEPARTMENT OF E.C.E
P a g e | 45
order to correctly determine value of this conductor, it is necessary to know diodes voltage drop in forward direction, which depends on what material a diode is made of and what colors it is. Values typical for the most frequently used diodes are shown in table below: As seen, there are three main types of LEDs. Standard ones get full brightness at current of 20mA. Low Current diodes get full brightness at ten times lower current while Super Bright diodes produce more intensive light than Standard ones. Since the 8051 microcontrollers can provide only low input current and since their pins are configured as outputs when voltage level on them is equal to 0, direct confectioning to LEDs is carried out as it is shown on figure (Low current LED, cathode is connected to output pin).
Fig: 5-11 Switch Typical actuators used for contact switches include spring loaded force cap actuators that reciprocate within a sleeve disposed within the canister. The actuator is typically coupled to the movement of the cap assembly, such that the actuator translates in a direction that is
DEPARTMENT OF E.C.E
P a g e | 46
parallel with the cap. A push button switch for a data input unit for a mobile communication device such as a cellular phone, a key board for a personal computer or the like is generally constructed by mounting a cover member directly on a circuit board. Printed circuit board (PCB) mounted pushbutton switches are an inexpensive means of providing an operator interface on industrial control products. In such push button switches, a substrate which includes a plurality of movable sections is formed of a rubber elastomeric. The key top is formed on a top surface thereof with a figure, a character or the like by printing, to thereby provide a cover member. Push button switches incorporating lighted displays have been used in a variety of applications. Such switches are typically comprised of a pushbutton, an opaque legend plate, and a back light to illuminate the legend plate.
5.7 Transistor:
Fig: 5-12 Different Transistors. A transistor is a semiconductor device used to amplify and switch electronic signals. It is made of a solid piece of semiconductor material, with at least three terminals for connection to an external circuit. A voltage or current applied to one pair of the transistor's terminals changes the current flowing through another pair of terminals. Because the controlled (output) power can be much more than the controlling (input) power, the transistor provides amplification of a signal. Some transistors are packaged individually but many more are found embedded in integrated circuits.
DEPARTMENT OF E.C.E
P a g e | 47
The transistor is the fundamental building block of modern electronic devices, and its presence is ubiquitous in modern electronic systems. Physicist Julius Edgar Lilienfeld filed the first patent for a transistor in Canada in 1925, describing a device similar to a Field Effect Transistor or "FET".[1] However, Lilienfeld did not publish any research articles about his devices,[citation needed] nor did his patent cite any examples of devices actually constructed. In 1934, German inventor Oskar Heil patented a similar device. . The transistor is the key active component in practically all modern electronics, and is considered by many to be one of the greatest inventions of the twentieth century.[8] Its importance in today's society rests on its ability to be mass produced using a highly automated process (semiconductor device fabrication) that achieves astonishingly low pertransistor costs. The transistor's low cost, flexibility, and reliability have made it a ubiquitous device. Transistorized mechatronic circuits have replaced electromechanical devices in controlling appliances and machinery. It is often easier and cheaper to use a standard microcontroller and write a computer program to carry out a control function than to design an equivalent mechanical control function.
5.7.1 USAGE:
The bipolar junction transistor, or BJT, was the most commonly used transistor in the 1960s and 70s. Even after MOSFETs became widely available, the BJT remained the transistor of choice for many analog circuits such as simple amplifiers because of their
VIGNANS INSTITUTE OF INFORMATION AND TECHNOLOGY DEPARTMENT OF E.C.E
P a g e | 48
greater linearity and ease of manufacture. Desirable properties of MOSFETs, such as their utility in low-power devices, usually in the CMOS configuration, allowed them to capture nearly all market share for digital circuits; more recently MOSFETs have captured most analog and power applications as well, including modern clocked analog circuits, voltage regulators, amplifiers, power transmitters, motor drivers, etc.
P a g e | 49
evolved.Modern transistor audio amplifiers of up to a few hundred watts are common and relatively inexpensive. The transistors used in this project are BC547. We use transistors as switching circuit to activate relays.
DEPARTMENT OF E.C.E
P a g e | 50
Chapter 6
DEPARTMENT OF E.C.E
P a g e | 51
commonly available energy source of 230V-50Hz and stepping down, rectifying, filtering
6.1 TRANSFORMER:
A bridge rectifier coupled with a step down transformer is used for our design. The voltage rating of transformer used is 0-12V and the current rating is 500mA. When AC voltage of 230V is applied across the primary winding an output AC voltage of 12V is obtained. One alteration of input causes the top of transformer to be positive and the bottom negative. The next alteration will temporarily cause the reverse.
6.2 RECTIFIER:
In the power supply unit, rectification is normally achieved using a solid-state diode. Diode has the property that will let the electron flow easily at one direction at proper biasing condition. Bridge rectifiers of 4 diodes are used to achieve full wave rectification. Two
DEPARTMENT OF E.C.E
P a g e | 52
diodes will conduct during the negative cycle and the other two will conduct during the positive half cycle.
6.4 REGULATORS:
The voltage regulators play an important role in any power supply unit. The primary purpose of a regulator is to aid the rectifier and filter circuit in providing a constant DC voltage to the device. Power supplies without regulators have an inherent problem of changing DC voltage values due to variations in the load or due to fluctuations in the AC line voltage. With a regulator connected to DC output, the voltage can be maintained within a close tolerant region of the desired output. IC 7805 and 7812 regulators are used in this project for providing a DC voltage of +5V and +12V respectively. 6.4.1 LM78XX General Description: The LM78XX series of three terminal regulators is available with several fixed output voltages making them useful in a wide range of applications. One of these is local on card regulation, eliminating the distribution problems associated with single point regulation etc. The voltages available, allow these regulators to be used in logic systems, instrumentation, HiFi, and other solid-state electronic equipment. Although designed primarily as fixed voltage regulators these devices can be used with external components to obtain adjustable voltages and currents. The LM78XX series is available in an aluminum TO-3 package that will allow over 1.0A load current if adequate heat sinking is provided. Current limiting is included to limit the peak output current to a safe value. Safe area protection for the output transistor is provided to limit internal power dissipation. If internal power dissipation becomes too high for the heat sinking provided, the thermal shutdown circuit prevents the IC from
overheating. Considerable effort was expanded to make the LM78XX series of regulators
VIGNANS INSTITUTE OF INFORMATION AND TECHNOLOGY DEPARTMENT OF E.C.E
P a g e | 53
easy to use and minimize the number of external components. It is not necessary to bypass the output, although this does improve transient response. Input bypassing is needed only if the regulator is located far from the filter capacitor of the power supply. For output voltage other than 5V, 12V and 15V the LM117 series provides an output voltage range from 1.2V to 57V. 6.4.2 FEATURES: Output current in excess of 1A. Internal thermal overload protection. No external components required. Output transistor safe area protection. Internal short circuit current limit Available in the aluminum TO-3 package
6.4.3 Types of ICs and their Voltage Range: Types of ICs Voltage Range
5V 12V 15V
DEPARTMENT OF E.C.E
P a g e | 54
DEPARTMENT OF E.C.E
P a g e | 55
Chapter 7
INTERFACING
DEPARTMENT OF E.C.E
P a g e | 56
7. INTERFACING
7.1 INTERFACING WITH 2x16 CHARACTER LCD
Fig: 7-1 16x2 LCD. LCDs are typically used for displaying outputs from a Micro controller or for debugging purposes LCDs come in varying sizes some of the typical ones are 16 X 1= one line 16 characters per line 16 X 2= Two lines 16 characters per line 20 X 4= Four lines 20 characters per line To display on LCD characters should be sent in ASCII format
DEPARTMENT OF E.C.E
P a g e | 57
6 7-14
EN D0-D7
7.1.3. R/W Pin: R/W =1 Read information from LCD R/W =0 Write information to LCD 7.1.4. EN Enable pin: It is used by LCD to latch information presented on data pins. When data/command is supplied to the LCD a HI to LO pulse must be applied to this pin in order for the LCD to latch the data/command present on the pins.
DEPARTMENT OF E.C.E
P a g e | 58
Code 01h 02h 06h 0Ch 0Fh C0h 38h Clear Display screen Return Home
Command
Increment Cursor after write Display on Cursor Off Display on Cursor blinking Force cursor to beginning of 2nd line 2 lines 5X7 font (initialization code)
c0h
c1h
c2h
c3h
c4h
c5h
c6h
c7h
c8h
c9h
cah
cbh
cch
cdh
Ceh
cfh
DEPARTMENT OF E.C.E
P a g e | 59
DEPARTMENT OF E.C.E
P a g e | 60
DEPARTMENT OF E.C.E
P a g e | 61
7.2.2 SPECIFICATIONS
RATING Output Voltage Input Voltage (Except ULN2801) Collector Current Continuous Base Current Continuous Operating Ambient Temperature Range Storage Temperature Range Junction Temperature
SYMBOL VO VI IC IB TA Tstg TJ
UNIT V V Ma mA C C C
DEPARTMENT OF E.C.E
P a g e | 62
DEPARTMENT OF E.C.E
P a g e | 63
DEPARTMENT OF E.C.E
P a g e | 64
In digital applications, it has been surpassed by the solid-state relay. These relays have no moving parts, so they can switch very quickly in response to a control signal. They are built from semiconductors, and they cannot handle the current that an electromagnetic relay could but their advantage is speed. High current solid-state relays often require heat sinks to drain excess heat. 7.3.3 Relay Construction: Relays are amazingly simple devices. There are four parts in every relay: Electromagnet Armature that can be attracted by the electromagnet Spring Switching contacts.
DEPARTMENT OF E.C.E
P a g e | 65
Fig: 7-6 Relay constructions 7.4.4 Relay Contact Information: Relay contacts on most of our kits and in the industrial world are labeled with NO (Normally Open), NC (Normally Closed), and CT (Common Terminal). A relay contact is a switch, nothing more, nothing less. It does not provide
power; it simply opens and closes an electrical circuit, just like the light switch on a wall. 7.4.4.1 Poles and Throws: Relays rarely have only one switch. This would be called as: Single Pole Single Throw (SPST) relay, and would operate similar to a light switch. It would make or break one electrical connection when turned on. Some other combinations for contacts are: Single Pole Double Throw (SPDT), Double Pole Single Throw (DPST), and Double Pole Double Throw (DPDT).
The number of poles indicates how many separate sets of contacts are present. The number of throws indicates whether the contact only makes a single connection in one state (on or off) or if both states have a connection.. It is very common to see a 24 Volt DC coil
DEPARTMENT OF E.C.E
P a g e | 66
switching 120 Volt AC contacts. This allows safe, low voltage control power to switch more dangerous, higher voltage power that does work. Single throw relays are only connected in one position. While relays are limited to being single throw or double throw (having only two states to choose from, on or off), they can have any arbitrary number of poles. When there are more than 2 poles, we switch from using the SPDT / DPDT format to #PDT, where # is the number of poles. 7.4.4.2 Magnetic Field: The solenoid, or coil, is the part of the relay that activates the switch. When the correct voltage is applied to the coil, it creates a magnetic field which moves the contacts, making or breaking connections. Relay coils come in a variety of voltages to suit a the varies control power standards used in different places: sometimes 5, 12, 24, or 48 Volts DC; sometimes 24, 120, or 240 Volts AC; and others are used as well. Relay coils are rated at those voltages, but it actually takes much less than their rated voltage to activate them. This is to desensitize them to voltage fluctuations in control power common in large factories (large motors starting up can cause voltage dips in other electrical systems connected to them) 7.4.5 Relay working: When a current flows through the coil, the resulting magnetic field attracts an armature that is mechanically linked to a moving contact. The movement either makes or breaks a connection with a fixed contact. When the current to the coil is switched off, the armature is returned by a force approximately half as strong as the magnetic force to its relaxed position. Usually this is a spring, but gravity is also used commonly in industrial motor starters. Most relays are manufactured to operate quickly. In a low voltage application, this is to reduce noise. In a high voltage or high current application, this is to reduce arcing. If the coil is energized with DC, a diode is frequently installed across the coil, to dissipate the energy from the collapsing magnetic field at deactivation, which would otherwise generate a spike of voltage and might cause damage to circuit components. If the coil is designed to be energized with AC, a small copper ring can be crimped to the end of the solenoid. This shading ring creates a small out-of-phase current, which increases the minimum pull on the armature during the AC cycle.
DEPARTMENT OF E.C.E
P a g e | 67
Fig:7-7 Relay operation 7.4.6 Choosing of relay: 1.Physical size and pin arrangement :
If you are choosing a relay for an existing PCB you will need to ensure that its dimensions and pin arrangement are suitable. You should find this information in the supplier's catalogue. 2.Coil voltage The relay's coil voltage rating and resistance must suit the circuit powering the relay coil. Many relays have a coil rated for a 12V supply but 5V and 24V relays are also readily available. Some relays operate perfectly well with a supply voltage which is a little lower than their rated value. 3.Coil resistance The circuit must be able to supply the current required by the relay coil. We can use Ohm's law to calculate the current: Ex:- A 12V supply relay with a coil resistance of 400 passes a current of 30mA.
This is OK for a 555 timer IC (maximum output current 200mA), but it is too much for most ICs and they will require a transistor to amplify the current. 4. Switch ratings (voltage and current)
The relay's switch contacts must be suitable for the circuit they are to control. You will need to check the voltage and current ratings. Note that the voltage rating is usually higher for AC, for example: "5A at 24V DC or 125V AC".
DEPARTMENT OF E.C.E
P a g e | 68
5. Switch
contact
Most relays are SPDT or DPDT which are often described as "single pole changeover" (SPCO) or "double pole changeover" (DPCO). 7.4.7 Advantages of relays: The complete electrical isolation improves safety by ensuring that high voltages and currents cannot appear where they should not be. Relays come in all shapes and sizes for different applications and they have various switch contact configurations. Double Pole Double Throw (DPDT) relays are common and even 4-pole types are available. You can therefore control several circuits with one relay or use one relay to control the direction of a motor. It is easy to tell when a relay is operating - you can hear a click as the relay switches on and off and you can sometimes see the contacts moving. 7.4.8. Disadvantages of Relays: Being mechanical though, relays do have some disadvantages over other methods of electrical isolation. Their parts can wear out as the switch contacts become dirty, high voltages and
currents cause sparks between the contacts. They cannot be switched on and off at high speeds because they have a slow response
and the switch contacts will rapidly wear out due to the sparking. Their coils need a fairly high current to energize, which means some micro-electronic
circuits can't drive them directly without additional circuitry. The back-emf created when the relay coil switches off can damage the components
that are driving the coil. To avoid this, a diode can be placed across the relay coil, as will be seen in any Electronics in Mecca no circuits that use relays with sensitive components.
DEPARTMENT OF E.C.E
P a g e | 69
7.4.9 Applications:
Fig: 7-8 A DPDT AC coil relay with ice cube packaging Relays are used: To control a high-voltage circuit with a low-voltage signal, as in some types of
solenoid of an automobile. To detect and isolate faults on transmission and distribution lines by opening and
closing circuit breakers (protection relays). To isolate the controlling circuit from the controlled circuit when the two are at
different potentials, for example when controlling a mains-powered device from a lowvoltage switch. The latter is often applied to control office lighting as the low voltage wires are easily installed in partitions, which may be often moved as needs change. They may also be controlled by room occupancy detectors in an effort to conserve energy. To perform logic functions. For example, the Boolean AND function is realized by
connecting NO relay contacts in series, the OR function by connecting NO contacts in parallel. The change-over or Form C contacts perform the XOR (exclusive or) function. Similar functions for NAND and NOR are accomplished using NC contacts. Due to the failure modes of a relay compared with a semiconductor, they are widely used in safety critical logic, such as the control panels of radioactive waste handling machinery.
DEPARTMENT OF E.C.E
P a g e | 70
closing a set of contacts. A very shorts (a fraction of a second) delay would use a copper disk between the armature and moving blade assembly. Current flowing in the disk maintains magnetic field for a short time, lengthening release time. For a slightly longer (up to a minute) delay, a dashpot is used. A dashpot is a piston filled with fluid that is allowed to escape slowly. The time period can be varied by increasing or decreasing the flow rate. For longer time periods, a mechanical clockwork timer is installed
DEPARTMENT OF E.C.E
P a g e | 71
Chapter 8
DEPARTMENT OF E.C.E
P a g e | 72
DEPARTMENT OF E.C.E
P a g e | 73
A Closer Look In 1800 the astronomer Sir William Herschel discovered infrared light while exploring the relationship between heat and light. Herschel used a prism to split a beam of sunlight into a spectrum and then placed a thermometer in each of the bands of light. When he placed the thermometer just outside the red band, where there was no visible colour, the temperature rose, as if light were shining on the thermometer. Further experiment showed that this invisible radiation behaved like visible light in many ways; for example, it could be reflected by a mirror. Infrared radiation is simply electromagnetic radiation with a lower frequency than visible light, having longer wavelengths of 0.7 micrometre to 1 millimetre. Ultraviolet radiation, like infrared radiation, lies just outside the visible part of the spectrum, but with higher frequencies; some animals, such as bees, are capable of seeing such radiation. Both infrared and ultraviolet radiations are often referred to as forms of light, though they cannot be seen by human beings. Heat energy is often transferred in the form of infrared radiation, which is given off from an object as a result of molecular collisions within it. Molecules typically have a characteristic infrared absorption spectrum, and infrared spectroscopy is a common technique for identifying the molecular structure of substances. Astronomers similarly analyse the infrared radiation emitted by celestial bodies to determine their temperature and composition.
DEPARTMENT OF E.C.E
P a g e | 74
Fig: 8-3 Graph of Wavelength. An infrared source can be described by the spectral distribution of power emitted by an ideal body (a blackbody curve). This distribution is characteristic of the temperature of the body. A real body is related to it by a radiation efficiency factor or emissivity which is the ratio at every wavelength of the emission of a real body to that of a blackbody under identical conditions. The illustration shows curves for these ideal blackbodies radiating at a number of different temperatures. The higher the temperature, the greater the total amount of radiation. See also Emissivity. 8.2.2 IR- SENSOR DISCRIPTION: In this project we are using infrared sensor. This sensor is used in card reader. The construction and working of card reader is explained later. The circuit and working of IRSENSOR is shown below.
8.2.3 Sensors:
The emitter and the receiver module of the IR Sensors can be placed on either side of the card reader to sense the smart card. When the entered card blocks the infrared beam, an input is given to the circuit board and the logic works accordingly.
P a g e | 75
Infra-red transmitter sensor gives the infra-red rays; this wavelength depends upon the input frequency of the sensor. If frequency is high, wavelength is high .IR receiver sensor resistance depends upon the receiving IR signal. If receiver receives signal from transmitter, the resistance of the resistor will be low .If receiver does not get signal from the transmitter, its resistance will be high .So we get some voltage drop across the receiver depending upon the resistance of the receiver. Comparator compares the signal given to the inverting and non-inverting terminal ,it will give output in terms of saturation level .If inverting terminal input is high comparator output will be at negative saturation(-12v).If non inverting terminal then input
comparator output saturation is positive(+12v). One input of comparator is from IR sensor and other input is reference signal. So we have to convert +12v to -12v pulse into TTL logic (0&5). The IR Sensors in our project can be better understood by the following analysis of the case studies: When no card cuts the sensors.
DEPARTMENT OF E.C.E
P a g e | 76
DEPARTMENT OF E.C.E
P a g e | 77
The reference signal which is one of the inputs fed to the comparator is always maintained low. This is done with the help of a variable resistance which is adjusted such that the resistance is negligible. The resistance is adjusted accordingly so that the voltage at the variable resistance is equal to the voltage at the IR receiver (Photo Diode) when it is in the reverse bias. Now when the card is not passing through the sensors, the signal from the IR receiver is high as light is falling on it. The other reference signal is low. These both are fed as the inputs to the comparator. The comparator gives output signal as low because both the signal are not equal. As one of the signals is high and the other is low the output will be low from the comparator.
DEPARTMENT OF E.C.E
P a g e | 78
DEPARTMENT OF E.C.E
P a g e | 79
Chapter 9
SOFTWARE
DEPARTMENT OF E.C.E
P a g e | 80
9. SOFTWARE:
9.1 What is software :
Anything that can be stored electrically is called as software or data. Software consists of instructions that we give to the computer.
DEPARTMENT OF E.C.E
P a g e | 81
In computing, an operating system (OS) is software (programs and data) that provides an interface between the hardware and other software. The OS is responsible for management and coordination of processes and allocation and sharing of hardware resources such as RAM and disk space, and acts as a host for computing applications running on the OS. An operating system may also provide orderly accesses to the hardware by competing software routines. This relieves the application programmers from having to manage these details. Operating systems offer a number of services to application programs. Applications access these services through application programming interfaces (APIs) or system calls. By invoking these interfaces, the application can request a service from the operating system, pass parameters, and receive the results of the operation. On large systems such as Unix-like systems, the user interface is always implemented as software that runs outside the operating system. In some other systems like Windows, the Window manager can be part of the operating system itself. While servers generally run Unix or some Unix-like operating system, embedded system markets are split amongst several operating systems. Although the Microsoft Windows line of operating systems has almost 90% of the client PC market. Example: Linux UNIX-SOLARIS Ms Dos, Ms Windows 95, Ms Windows NT Ms Windows XP Ms Windows 7.
DEPARTMENT OF E.C.E
P a g e | 82
A compiler is a computer program (or set of programs) that transforms source code written in a computer language (the source language) into another computer language (the target language, often having a binary form known as object code). The most common reason for wanting to transform source code is to create an executable program. The name "compiler" is primarily used for programs that translate source code from a high-level programming language to a lower level language (e.g., assembly language or machine code). A program that translates from a low level language to a higher level one is a de-compiler. A program that translates between high-level languages is usually called a language translator, source to source translator, or language converter. A language rewriter is usually a program that translates the form of expressions without a change of language. A compiler is likely to perform many or all of the following operations: lexical analysis, pre-processing, parsing, semantic analysis, code generation, and code optimization. Program faults caused by incorrect compiler behaviour can be very difficult to track down and work around and compiler implementors invest a lot of time ensuring the correctness of their software. The term compiler-compiler is sometimes used to refer to a parser generator, a tool often used to help create the lexer and parser.
DEPARTMENT OF E.C.E
P a g e | 83
The current version 1.3 supports many microcontrollers including: 8051, 80C51, 8052, AT89C2051, AT89C4051, AT89C51, AT89C51RC, AT89C52, AT89C55WD,AT89LV51, AT89LV52 AT89LV55, AT89S52, AT89LS51, AT89LS52, AT89S8253, AT89S2051, AT89S4051, T87C5101, T83C5101, T83C5102, TS80C32X2, TS80C52X2, AT80C58X2, TS87C52X2, AT87C54X2, AT80C32X2, AT87C58X2, AT80C52X2, TS80C54X2, AT87C52X2, TS80C58X2, AT80C54X2, TS87C54X2,
TS87C58X2, TS80C31X2, AT80C31X2, 8031, 8751, 8032, 8752, 80C31, 87C51, 80C52, 87C52, 80C32, 80C54, 87C54, 80C58, 87C58.
9.3.2 KEY FEAUTES: MCU simulator with many debugging features: register status, step by step, interrupt viewer, external memory viewer, code memory viewer, etc. Simulator for simple electronic peripherals: leds, displays, matrices, etc. Support for C language. Native macro-assembler. Support for ASEM-51. Advanced text editor with syntax highlighting and validation. Support for vim and nano embedded in the IDE. Simple hardware programmer for certain AT89Sxx MCUs. Scientific calculator: time delay calculation and code generation, base converter, etc. Hexadecimal editor.
In this software we wrote the code in assembly language. While saving it is saved with the file extinction .asm. After compiling the assembly language code 8051IDE generates 3 files.
P a g e | 84
Writing code should be burn to the microcontroller with the help of the burner. Usually pins 5,6,7,8 are used to burn the code to the microcontroller. The compiler converts the high level language code written by the user to the machine language code. The .hex file is burnt to the microcontroller with the help of the burner. REQUIREMENTS TO BURN: 1. COMPILER SOFTWARE. 2. MICROCONTROLLAR. 3. BURNER.
DEPARTMENT OF E.C.E
P a g e | 85
Chapter 10
ALGORITHM
DEPARTMENT OF E.C.E
P a g e | 86
10. ALGORITHM:
Step 1 : Start Step 2 : Insert the card. Step 3 : If the card is not valid go to step1. Otherwise go to step 4. Step 4 : Recharged successful. Step 5 : Power supply is on. Step 6 : The energy meter counts the consumed units. Step 7 : Compete total recharge consumption units with pre-stored value 5. If yes go to step 8. Else go to step 6. Step 8 : Buzzer rings. Step 9 : If the comparison equals to zero the go to step 10. Else go to step 8. Step 10: Power supply is switched off. Step 11: Go to step 1.
DEPARTMENT OF E.C.E
P a g e | 87
Chapter 11
FLOWCHART
DEPARTMENT OF E.C.E
P a g e | 88
DEPARTMENT OF E.C.E
P a g e | 89
Chapter 12
DEPARTMENT OF E.C.E
P a g e | 90
CARD_INFO EQU 30H RS RW EN PDATA BUZZER RELAY EQU P3.5 EQU P3.6 EQU P3.7 EQU P2 EQU P0.1 EQU P0.0
MAIN:
mov sp,#50h mov p1,#0ffh setb p3.0 SETB BUZZER CLR P0.0 CLR P0.2 mov p0,#00h MOV TMOD,#06H MOV TL0,#00H MOV TH0,#00H LCALL LCDINIT LCALL INSERT_CARD
AGAIN:
DEPARTMENT OF E.C.E
P a g e | 91
NEXT1:
NEXT2:
NEXT3:
NEXT4:
NEXT5:
FIFTY_RS_CARD: SETB RELAY lcall lcdinit LCALL DISP_RS_FIFTY lcall lcdinit LCALL UNITS_1 lcall lcdinit
VIGNANS INSTITUTE OF INFORMATION AND TECHNOLOGY DEPARTMENT OF E.C.E
P a g e | 92
LJMP COUNT1
HUND_RS_CARD: SETB RELAY lcall lcdinit LCALL DISP_RS_HUND lcall lcdinit LCALL UNITS_2 lcall lcdinit LJMP COUNT2 ONE_FIFTY_RS_CARD: SETB RELAY lcall lcdinit LCALL DISP_RS_ONE_FIFTY lcall lcdinit LCALL UNITS_3 lcall lcdinit LJMP COUNT3 TWO_HUND_RS_CARD: SETB RELAY lcall lcdinit LCALL DISP_RS_TWO_HUND lcall lcdinit LCALL UNITS_4 lcall lcdinit LJMP COUNT4 TWO_FIFTY_RS_CARD: SETB RELAY
VIGNANS INSTITUTE OF INFORMATION AND TECHNOLOGY DEPARTMENT OF E.C.E
P a g e | 93
lcall lcdinit LCALL DISP_RS_TWO_FIFTY lcall lcdinit LCALL UNITS_5 lcall lcdinit LJMP COUNT5
CJNE A,#40,CONT1 CLR BUZZER LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY SETB BUZZER UP1: MOV A,TL0 CJNE A,#50,UP1
VIGNANS INSTITUTE OF INFORMATION AND TECHNOLOGY DEPARTMENT OF E.C.E
P a g e | 94
CJNE A,#80,CONT2 CLR BUZZER LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY SETB BUZZER UP2: MOV A,TL0 CJNE A,#100,UP2 CLR RELAY LCALL LCDINIT LCALL UNITS_COMPT LJMP MAIN
COUNT3:
VIGNANS INSTITUTE OF INFORMATION AND TECHNOLOGY DEPARTMENT OF E.C.E
P a g e | 95
CJNE A,#130,CONT3 CLR BUZZER LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY SETB BUZZER UP3: MOV A,TL0 CJNE A,#150,UP3 CLR RELAY LCALL LCDINIT LCALL UNITS_COMPT LJMP MAIN
P a g e | 96
LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY SETB BUZZER UP4: MOV A,TL0 CJNE A,#200,UP4 CLR RELAY LCALL LCDINIT LCALL UNITS_COMPT LJMP MAIN
CJNE A,#245,CONT5 CLR BUZZER LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY LCALL DELAY
VIGNANS INSTITUTE OF INFORMATION AND TECHNOLOGY DEPARTMENT OF E.C.E
P a g e | 97
LCALL DELAY SETB BUZZER UP5: MOV A,TL0 CJNE A,#250,UP5 CLR RELAY LCALL LCDINIT LCALL UNITS_COMPT LJMP MAIN
INSERT_CARD: MOV R2,#16 MOV DPTR,#INST_CARD LOOP1:MOV A,#00H MOVC A,@A+DPTR LCALL WRTDAT INC DPTR DJNZ R2,LOOP1 RET
DISP_RS_FIFTY: MOV R2,#16 MOV DPTR,#FIFTY_CARD LOOP2: MOV A,#00H MOVC A,@A+DPTR LCALL WRTDAT INC DPTR DJNZ R2,LOOP2 RET
VIGNANS INSTITUTE OF INFORMATION AND TECHNOLOGY DEPARTMENT OF E.C.E
P a g e | 98
UNITS_1: MOV R2,#16 MOV DPTR,#FIFTY_UNITS LOOP3: MOV A,#00H MOVC A,@A+DPTR LCALL WRTDAT INC DPTR DJNZ R2,LOOP3 RET
DISP_RS_HUND: MOV R2,#16 MOV DPTR,#HUND_CARD LOOP4:MOV A,#00H MOVC A,@A+DPTR LCALL WRTDAT INC DPTR DJNZ R2,LOOP4 RET
UNITS_2: MOV R2,#16 MOV DPTR,#HUND_UNITS LOOP5: MOV A,#00H MOVC A,@A+DPTR
DEPARTMENT OF E.C.E
P a g e | 99
DISP_RS_ONE_FIFTY: MOV R2,#16 MOV DPTR,#ONE_FIFTY_CARD LOOP6: MOV A,#00H MOVC A,@A+DPTR LCALL WRTDAT INC DPTR DJNZ R2,LOOP6 RET
UNITS_3: MOV R2,#16 MOV DPTR,#ONE_FIFTY_UNITS LOOP7: MOV A,#00H MOVC A,@A+DPTR LCALL WRTDAT INC DPTR DJNZ R2,LOOP RET
DISP_RS_TWO_HUND:
VIGNANS INSTITUTE OF INFORMATION AND TECHNOLOGY DEPARTMENT OF E.C.E
P a g e | 100
MOV R2,#16 MOV DPTR,#TWO_HUND_CARD LOOP8: MOV A,#00H MOVC A,@A+DPTR LCALL WRTDAT INC DPTR DJNZ R2,LOOP8 RET
UNITS_4: MOV R2,#16 MOV DPTR,#TWO_HUND_UNITS LOOP9: MOV A,#00H MOVC A,@A+DPTR LCALL WRTDAT INC DPTR DJNZ R2,LOOP9 RET
DISP_RS_TWO_FIFTY: MOV R2,#16 MOV DPTR,#TWO_FIFTY_CARD LOOP10: MOV A,#00H MOVC A,@A+DPTR LCALL WRTDAT INC DPTR DJNZ R2,LOOP10
VIGNANS INSTITUTE OF INFORMATION AND TECHNOLOGY DEPARTMENT OF E.C.E
P a g e | 101
RET
UNITS_5: MOV R2,#16 MOV DPTR,#TWO_FIFTY_UNITS LOOP11: MOV A,#00H MOVC A,@A+DPTR LCALL WRTDAT INC DPTR DJNZ R2,LOOP11 RET
UNITS_COMPT: MOV R2,#15 MOV DPTR,#DATA LOOP15: MOV A,#00H MOVC A,@A+DPTR LCALL WRTDAT INC DPTR DJNZ R2,LOOP15 RET
P a g e | 102
LCDINIT:MOV A,#36H LCALL WRTCMD MOV A,#1AH LCALL WRTCMD MOV A,#0Eh LCALL WRTCMD MOV A,#0A6H LCALL WRTCMD RET
P a g e | 103
DELAY: NEXT:
MOV R6,#250 MOV R7,#200 AGAIN2: NOP NOP DJNZ R7,AGAIN2 DJNZ R6,NEXT RET
DB 'INSERT YOUR CARD' DB 'RS 50/- ACCESSED' DB 'RECHRGD 50 UNITS' DB 'RS 100/-ACCESSED' DB 'RCHRGD 100 UNITS'
HUND_UNITS:
ONE_FIFTY_CARD: DB 'RS 150/-ACCESSED' ONE_FIFTY_UNITS: DB 'RCHRGD 150 UNITS' TWO_HUND_CARD: DB 'RS 200/-ACCESSED' TWO_HUND_UNITS: DB 'RCHRGD 200 UNITS' TWO_FIFTY_CARD: TWO_FIFTY_UNITS: DB 'RS 250/-ACCESSED' DB 'RCHRGD 250 UNITS'
DEPARTMENT OF E.C.E
P a g e | 104
Chapter 13
13.1 ADVANTAGES:
VIGNANS INSTITUTE OF INFORMATION AND TECHNOLOGY DEPARTMENT OF E.C.E
P a g e | 105
1.2 DISADVANTAGES:
1. The main disadvantage of the system is, because of huge electronic hardware involved in the system, the overall system consumes more electric energy. Remedy: When the system is converted into engineering module, the bulky hardware can be converted into a smallintegrated chip. When the hardware is minimized naturally the system consumes less power. 2. Since it is a prototype module, because of huge hardware the system occupies more space. 3. The consumer or the electrical department has to spend more amounts for installing this kind of smart energy meters. Economically it is not advised.
DEPARTMENT OF E.C.E
P a g e | 106
Chapter 14
P a g e | 107
2. To save money by adjusting energy use in response to price signals. 3. To save money, the consumed energy corresponding price is displayed for the consumer benefits. 4. This project work has been taken up which serves the purpose of energy monitoring and controlling by implementing prepaid system. 5. It is hoped that this work helps the electrical engineers for better energy management and its utility in the distribution system for economic liability of the electrical companies.
2. With the help of this project work lot of Manpower can be reduced and power
pilferage can be controlled.
3. Server technology can be implemented to make the system completely wireless and automatic.
DEPARTMENT OF E.C.E
P a g e | 108
Chapter 15
REFERENCES
15. REFERENCES
1. http://www.8051projects.net/downloads134.html
VIGNANS INSTITUTE OF INFORMATION AND TECHNOLOGY DEPARTMENT OF E.C.E
P a g e | 109
http://indianengineer.wordpress.com/2008/09/21/prepaid-energy-meter-at89s52-8051microcontroller/
DEPARTMENT OF E.C.E
P a g e | 110
APPENDIX
DEPARTMENT OF E.C.E