- Published: October 22, 2022
- Updated: October 22, 2022
- University / College: University of Chicago
- Language: English
- Downloads: 50
INTRODUCTION 1. INTRODUCTION TO EASY RECHARGING SYSTEM FOR ENERGY METER: Power sector players have made many efforts and spent considerable money and resources in formulating strategies for improving collection efficiency, however these have seldom yielded encouraging results. Metering is one of the major technical issues impacting the collection efficiency of power companies. Currently, only a few percent of power meters installed in India are electronic & rest are electromechanical. Usually, the meter reading is taken once a month by the field executive of the distribution company.
The human errors involved in collection of bills & old electronic & electromechanical type of meters together have resulted in poor metering , efficiency, zero metering, faulty reading, bribing utilities executives to charge less units & tampering of the meter to clock them reverse. Over the last few years, prepaid energy meter has been proposed as an innovative solution aimed at facilitating affordability & reducing the cost of utilities. This mechanism, essentially, requires the users to pay for the electricity before its consumption.
In this way, consumers hold credit & then use the electricity until the credit is exhausted. If the available credit is exhausted then the supply of electricity is cut off by a relay. Those who support the diffusion of prepaid meters claims that they benefit both consumers and utilities because they help users to consume more efficiently & to improve the management of their budget , while allowing firm to reduce financial costs as well as the cost of operation. The main purpose of the project work is to design and develop a wireless Energy meter, which can be implemented in big industries and huge commercial complexes. . 2 BLOCK DIAGRAM: [pic] Fig No. 1. 2(a): Block Diagram of the Home Side Unit Fig No. 1. 2(b): Block Diagram of EB Office/Recharging Point Side Unit 1. 3 BLOCK DIAGRAM DESCRIPTION: The block diagram consists of the following blocks: ? Power Supply ? Microcontroller ? RF Transmitter ? RF Receiver ? LED ? Relay Unit ? LCD Display ? Encoder ? Decoder Power Supply: It is source voltage of this project. The power supply module output voltage is regulated 5v constant direct current when the domestic power will on. So here source voltage is connected to entire positive and negative lead of entire circuits.
It contains step down transformer, full wave rectifier along with filter capacitor, regulated chip and indicator circuit. Microcontroller: The microcontroller used is 8-bit AT89C52 microcontroller & it is the main heart of our project . The controller will fetch and latch the data from external circuit for each clock cycle while execution time. Here clock and reset module is connected to controller chip. LED: LED’S are special diodes that emit light when connected in a circuit. They are frequently used as “ pilot” lights in electronic appliances to indicate whether the circuit is closed or not.
LCD Display: We have used 16×2 charters LCD. The main purpose of using LCD is to display the instructions, results & contents of the microcontroller. Relay Unit: A relay is an electrically operated switch. Current flowing through the coil of the relay creates a magnetic field, which attracts a lever and changes the switch contacts. The coil current can be on or off so relays have two switch positions and they are double throw (changeover) switches. RF Transmitter: This module uses the technique of ON-OFF keyed (OOK’s) modulation.
Local oscillator is based on PLL (phase-locked loop). The module is high performance, simple to use and miniaturized. For this antenna should be placed at a length of 17. 2cms. The input to the transmitter is given through encoder which will send all the data serially to the transmitter. In transmitter, all the data will get modulated and it will transmit at a frequency of 434 MHz. Fig No 1. 3(a): Pin Diagram of RF Transmitter RF Receiver: This receiver antenna should be in the length of 17. 2 cms. It will give digital data output to the decoder.
This decoder will receive the data from RF receiver and it will latch the output. The micro controller will get this input and program in the memory of micro controller will decode the data and perform the actions. The maximum data rate handled by the receiver is 1-10k bps. The input voltage can be in the range of 3v ??? 12v. Fig No. 1. 3(b): Pin Diagram of RF Receiver 1 ??? Antenna5 ??? Positive 2 ??? Ground6 ??? Digital data output 3 ??? Ground7 ??? Digital data output 4 ??? Positive8 ??? Ground Encoder: They are capable of encoding information. Each address/data input can be set to one of the two logic states.
The programmed addresses/data are transmitted together with the header bits via an RF or an infrared transmission medium upon receipt of a trigger signal Decoder: The decoders receive serial addresses and data from a programmed 212 series of encoders that are transmitted by a carrier using an RF or an IR transmission medium. They compare the serial input data three times continuously with their local addresses. If no error or unmatched codes are found, the input data codes are decoded and then transferred to the output pins. 1. 4 CIRCUIT DIAGRAM: [pic] Fig No. 1. 4(a): Circuit Diagram of Home Side Unit [pic]
Fig No. 1. 4(b): Circuit Diagram of EB Office Unit 1. 5 CIRCUIT DIAGRAM DESCRIPTION: i. Home Side Unit: It consist of the following units: ? Microcontroller : AT89S52 ? Power Supply : +5v, 500Ma Regulated Power Supply ? LED ? LCD Display : 16X2 characters ? Crystal : 11. 0592 MHz ? RF Receiver ? Decoder : HT12D IC ? Relay Unit ? Optocoupler ? Energy meter To implement this application we have used AT89S52 microcontroller. It is a complete microcontroller.
It provides a significantly more powerful instruction set and a full serial port this microcontroller has four ports. They are: ? PORT 0(pins 32-39) ? PORT 1(pins 1-8) ? PORT 2(pins 21-28) ? PORT 3(pins 10-17) The pins 32-36(P. 0. 0-P. 0. 4) of port 0 are connected to five LED respectively for charging and unit indication. The pins 37-39(P. 0. 5-P. 0. 7) of port 0 are connected to LCD data control pins i. e. RS, RW, EN respectively. Pin 1(P. 1. 0) of port 1 is connected to relay unit. Pin 2(P. 1. 1) of port 1 is connected to data reading input. Pins 21-28(P. 2. 0-P. 0. 7) of port 2 is connected to LCD data input pins.
Pins14-17 (P3. 4-P. 3. 7) of port 3 are connected to recharging data input from the decoder. ? Power Supply: Here are using step ??? down transformer of center tap type. This circuit output Voltage is 5v constantly. 230V AC is converted to 9V AC using step-down transformer. Its output again is converted to 9V DC by keeping full wave rectifier along with filter capacitor. Capacitor C1 is used to avoid excess noise and ripples. It stores the voltage. Again 9V DC is converted to 5V constant DC using regulated IC. Regulated IC has 3 Pins , left is input pin , middle is ground pin and right is output pin.
Due to the surrounding temperature output voltage of regulator IC gets noise and heated up, so the capacitor C2 is to avoid extra noise and ripples. The LED will glow when the power is ON. The 3rd pin of regulated IC is the output voltage of this circuit diagram. ? Liquid crystal display (LCD): A liquid crystal display (commonly abbreviated LCD) is a thin, flat display device made up of any number of color or monochrome pixels arrayed in front of a light source or reflector. It is prized by engineers because it uses very small amounts of electric power, and is therefore suitable for use in battery-powered electronic device Fig No 1. (a): Pin positions of LCD Display. As shown in the above figure the pins 7 to 14 of LCD are data pins, which are connected to the port2, pin1 is connected to GND, pin2 is connected voltage Vcc, & by changing the voltage at the pin3 we can change the contrast of the display, but in our project it is connected to the GND, Pin 4,(RS), pin5(R/W), pin6(EN) are connected to P0. 5, P0. 6, P0. 7 of the microcontroller respectively. Pin15 is backlight LED pin which is used to glow the LCD. Pin16 is connected to GND. ? RF Receiver: This receiver antenna should be in the length of 17. 2 cms. It will give digital data output to the decoder.
This decoder will receive the data from RF receiver and it will latch the output. The micro-controller will get this input and program in the memory of micro controller will decode the data and perform the actions. The maximum data rate handled by the receiver is 1-10k bps. The input voltage can be in the range of 3v ??? 12v. ? Decoder: For proper operation, a pair of encoder/decoder with the same number of addresses and data format should be chosen. The decoders receive serial addresses and data from a programmed 212 series of encoders that are transmitted by a carrier using an RF or an IR transmission medium.
They compare the serial input data three times continuously with their local addresses. If no error or unmatched codes are found, the input data codes are decoded and then transferred to the output pins. The VT pin also goes high to indicate a valid transmission. The 212 series of decoders are capable of decoding informations that consist of N bits of address and 12-N bits of data. Of this series, the HT12D is arranged to provide 8 address bits and 4 data bits of address information [pic] Fig No 1. 5(b): Pin Diagram of Decoder ? Relay Unit:
When a coil of wire is wound on a non magnetic material such as plastic, paper etc. , it is called a air-core solenoid or simply a solenoid . if a soft iron core is inserted into the coil, it becomes an electromagnet. This electromagnet is the basic component for relay and many other electromechanical devices such as electric bell, circuit breaker etc,. Relay is an electronics switch. This is used to switch ON any device. In our project one of the applications is ON/OFF loads system. The input of the relay is connected toP. 1. 0 the micro controller and the output is connected to the energy meter. Optocoupler: In electronics, an opto-isolator (or optical isolator, optocoupler, photocoupler, or photoMOS) is a device that uses a short optical transmission path to transfer a signal between elements of a circuit, typically a transmitter and a receiver, while keeping them electrically isolated ??? since the signal goes from an electrical signal to an optical signal back to an electrical signal, electrical contact along the path is broken A common implementation involves a LED and a phototransistor, separated so that light may travel across a barrier but electrical current may not.
When an electrical signal is applied to the input of the opto-isolator, its LED lights, its light sensor then activates, and a corresponding electrical signal is generated at the output. Unlike a transformer, the opto-isolator allows for DC coupling and generally provides significant protection from serious overvoltage conditions in one circuit affecting the other. [pic] Fig No 1. 5(c): Circuit diagram of an Optocoupler ? Energy Meter: An electric meter or energy meter is a device that measures the amount of electrical energy supplied to or produced by a residence, business or machine. The most common type is a kilowatt hour meter.
When used in electricity retailing, the utilities record the values measured by these meters to generate an invoice for the electricity. They may also record other variables including the time when the electricity was used. The most common unit of measurement on the electricity meter is the kilowatt hour, which is equal to the amount of energy used by a load of one kilowatt over a period of one hour, or 3, 600, 000 joules. Some electricity companies use the SI mega joule instead. ii. Electricity Board/Recharging Side Unit: It consist of the following units: ? RF Transmitter ? Encoder: HT12E ? Recharging Switch Unit ? RF Transmitter:
For this antenna should be placed at a length of 17. 2cms. The input to the transmitter is given through encoder which will send all the data serially to the transmitter. In transmitter, all the data will get modulated and it will transmit at a frequency of 434 Mhz. ? Encoder: Fig No 1. 5(d): Pin Diagram of Encoder They are capable of encoding information which consists of 8 address bits and 4 data bits. Each address/data input can be set to one of the two logic states. The programmed addresses/data are transmitted together with the header bits via an RF or an infrared transmission medium upon receipt of a trigger signal.
The capability to select a TE trigger on the HT12E or a DATA trigger on the HT12A further enhances the application flexibility of the 212 series of encoders. ? Recharging Switch Unit: This switch is used for recharging units. It is a 8-pin switch. In this project the provision of recharging 10, 20 & 30 units through 1st , 2nd & 3rd pin of the switch respectively is available. 1. 6 WORKING PRINCIPLE: As we know we are using AT89S52 microcontroller here. This is the main heart of this project. It has four ports, they are: PORT 0(pins 32-39), PORT 1(pins 1-8), PORT 2(pins21-28), PORT 3(pins 10-17).
In the electricity board side, when the required unit(say 10 unit) is recharged by using the recharging switch , the 4-bit data enters into the 4 data pins of the encoder(Pins 10, 11, 12, 13). The encoder encodes the signal & converts it into IF(intermediate Frequency) signal. The output IF signal at pin 15 is given is input to the RF transmitter. In the transmitter the IF signal gets modulated & is converted to RF(radio frequency)signal, which is then transmitted through the transmitting antenna. In the home side, the receiving antenna receives the RF signal and pass it to the receiver .
In the receiver the RF signal is converted back to IF signal which becomes the input at pin 14 of the decoder. The decoder decodes the signal and the 4bit data output at pin 10, 11, 12, 13 of the decoder is given to pin P. 3. 4-P. 3. 7 of port 3 of the microcontroller. The microcontroller then displays the instruction “ RECHARGED 10 UNIT SUCCESSFULLY” on the LCD. Then a low signal at pin P. 1. 0 of port 1 is given as input to the relay driving circuit. This switches ON the relay & as a result the meter starts operating . When there is load on the meter it starts rotating and for two pulses one unit is reduced.
The meter reading to the microcontroller is given in the following way: AC pulses from the meter is given as input to the optocoupler IC(MCT2E) at pin 1, 2.. Pin 6, 5 of optocoupler is connected to switching transistor. Collector of transistor is connected to microcontroller at P. 1. 1 for getting the meter reading. When AC pulses comes for optocoupler , the optocoupler will positive trigger signal to the base of base of transistor , it is switched on and the microcontroller will get low logic. And at the same time the LED will glow.
In this way the units reduces and when it becomes zero, the relay is turned off and the supply of electricity is cut off. INTRODUCTION TO EMBEDDED SYSTEM 2. 1 WHAT IS A SYSTEM? ? A system is something that maintains its existence and functions as a whole through the interaction of its parts. E. g. Body, Mankind, Access Control, etc ? A system is a part of the world that a person or group of persons during some time interval and for some purpose choose to regard as a whole, consisting of interrelated components, each component characterized by properties that are selected as being relevant to the purpose. pic] Fig No. 2. 1: System Constituents 2. 2 EMBEDDED SYSTEM: We can define embedded system as “ a computing device, built into a device that is not a computer, and meant for doing specific computing tasks” ? An embedded system is a special-purpose computer system usually built into an Environment connected to systems through sensors, actuators and other I/O interfaces. ? Embedded system must meet timing & other constraints imposed on it by nvironment 2. 2. 1 Typical Embedded System: Technically, there are prevalent and common characteristics of embedded systems.
From a programmer’s perspective the following components are used: Central Processing Unit (CPU), Random Access Memory (RAM), Programmable Read Only Memory (PROM) or Erasable PROM (EPROM), and Input/Output (I/O) space. [pic] Fig No. 2. 2. 1: Typical Embedded System 2. 2. 2 Microprocessor: The CPU is a unit that centrally fetches and processes a set of general purpose instructions. The CPU instruction set includes instructions for data transfer operations, ALU operations, stack operations, I/P /P operations and program control sequencing and supervising operations.
Any CPU must process the following basic functionality units: ? A control unit to fetch and control the sequential processing of given commands or instruction and for communicating with the rest of the system. ? An ALU for the arithmetic and logic operations on the bytes or words. It may be capable of processing 8, 16, 32 or 64-bit words at an instant. ? A microprocessor is a single VLSI chip that has a chip and may also have some other units that are additionally present and that result in faster processing of instructions. [pic] Fig No. 2. 2. 2: Block Diagram of Microprocessor 2. . 3 Microcontroller: A microcontroller is a single chip VLSI unit (also called microcomputer) which though having limited computational capabilities, posses an enhanced I/P, O/P capabilities and a number of on-chip functional units micro-controllers are particularly suited for use in embedded systems for real time applications with on-chip program memory and devices. 2. 3 THE ESSENCE: An embedded system is a computing device, built into a device that is not a computer, and meant for doing specific computing tasks. Also hardware and software together constitutes embedded system.
It is a microcontroller-based, software driven, reliable, real-time control system, autonomous, or human or network interactive, operating on diverse physical variables and in diverse environments and sold into a competitive and cost conscious market. [pic] Fig No. 2. 3: essence of embedded system 2. 4 SOFTWARE DESIGN AND WORKING OF EMBEDDED SYSTEM: In the design of the software, it simply has a loop called control loop. The loop calls subroutines. Each subroutine manages a part of the hardware or software. Interrupts generally set flags, or update counters that are read by the rest of the software.
A simple API disables and enables interrupts. Done right, it handles nested calls in nested subroutines, and restores the preceding interrupt state in the outermost enable. This is one of the simplest methods of creating an exocrine. There is some sort of subroutine in the loop to manage a list of software timers, using a periodic real time interrupt. When a Timer expires, an associated subroutine is run, or flag is set. Any expected hardware event should be backed-up with a software timer. Hardware events fail about once in a trillion times.
State machines may be implemented with a function-pointer per state-machine (in C++, C or assembly, anyway). A change of state stores a different function into the pointer. The function pointer is executed every time the loop runs. Many designers read each IO device once per loop, and storing the result so the logic acts on consistent values. HARDWARE DESCRIPTION 3. 1 ATMEL MICROCONTROLLER (AT89S52): The AT89S52 microcontroller belonging to the ATMEL family. This microcontroller has features that seem to make it more accessible than any other single chip microcontroller with a reasonable price tag.
It is an 8 bit single chip microcontroller has got a powerful CPU optimized for control applications, 8KB memory address space of ROM, 256 bytes of RAM (read/write memory), for 8 bit bidirectional parallel ports one full duplex serial ports three 16 bit timers/counters and an extensive interrupt structure. 3. 1. 1 What is a Microcontroller? [pic] Fig No. 3. 1. 1: Block diagram of microcontroller Definition: A single chip that contains the processor (the CPU), non-volatile memory for the program (ROM or flash), volatile memory for input and output (RAM), a clock and an I/O control unit.
Also called a “ computer on a chip,” billions of microcontroller units (M C Us) are embedded each year in a myriad of products from toys to appliances to automobiles. For example, a single vehicle can use 70 or more microcontrollers. 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 time periods. 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. With limited computational capabilities, posses an enhanced I/P, O/P capabilities and a number of on-chip functional units micro-controllers are particularly suited for use in embedded systems for real time applications with on-chip program memory and devices. 3. 1. 2 Overview of 8- bit AT89S52 Microcontroller: [pic] Fig No. 3. 1. 2 (a): 8- bit AT89S52 Microcontroller
Microcontrollers these days are silent workers in many apparatus, ranging from the washing machine to the video recorder. Nearly all of these controllers are mask programmed and therefore are of very little use for applications that require the programs to be changed during the course of execution. Even if the programs could be altered, the information necessary to do so an instruction set, an assembler language and description for the basic hardware is either very difficult to obtain or are in adequate when it came to the issue of accessibility.
A marked exception to the above category is the ATMEL 89CS52 microcontroller belonging to the ATMEL family. This microcontroller has features that seem to make it more accessible than any other single chip microcontroller with a reasonable price tag. The AT89S52, an 8 bit single chip microcontroller has got a powerful CPU optimized for control applications, 8KB memory address space of ROM, 256 bytes of RAM (read/write memory), for 8 bit bidirectional parallel ports one full duplex serial ports three 16 bit timers/counters and an extensive interrupt structure.
The AT89S52 is a second generation 8-bit single chip microcontroller. The AT89S52 provides a significantly more powerful architecture, a more powerful instruction set and a full serial port. The AT89S52 is a complete microcontroller. We will start our discussion on the programming model by looking at the architectural block diagram. As we can see the external connections seems to be very simple. There are 31 pins needed by the four 8 bit bidirectional ports. Eight additional pins provide power, which allows us to connect a crystal clock and provide a few timing and control signals.
The architecture includes the ALU, the accumulator, the stack pointer, a block of registers and a general purpose register-the B register. All these devices are connected to the AT89S52 internal 8-bit data bus. Each I/O port is also connected to the 8 bit internal data bus through a series of registers. These registers hold data during I/O transfers and control the I/O ports. The architectural block diagram also shows the AT89S52 ROM and RAM. [pic] Fig No. 3. 1. 2 (b): AT89S52 Microcontroller Internal Block Diagram 3. 1. 3 Pin Diagram of AT89S52 Microcontroller: [pic] Fig No. 3. 1. : Pin Diagram of AT89S52 Microcontroller 3. 1. 4 Pin Description: | Number | Description | | 1-8 | P1. 0 ??? P1. 7 – Port 1 | | 9 | RST ??? Res Reset | | 10-17 | P3. 0 – P3. 7 – Port 3 | | 18 | XTAL2 ??? Crystal | | 19 | XTAL1 ??? Crystal | | 20 | GND ??? Ground | | 21-28 | P2. – P2. 7 – Port 2 | | 29 | PSEN – Program Store Enable | | 30 | ALE – Address Latch Enable | | 31 | EA – External Access Enable | | 32-39 | P0. 7 – P0. 1 – Port 0 | Table No. 3. 1. 4 (a): Pin Description of AT89C52 Pin Description: ? VCC: Pin 40 provides supply voltage to the chip. The voltage source is +5V. ? GND: Pin 20 is 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 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. ? 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 ? 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 uses 16-bit addresses (MOVX @ DPTR). In this application, it uses strong internal pull-ups when emitting 1s. During accesses to external data memory that uses 8-bit addresses (MOVX @ RI); Port 2 emits the contents of the P2 Special Function Register. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification. Port 3: Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. Port 3 also serves the functions of various special features of the AT89S52. Table No. 3. 1. 4(b): Special Features of AT89S52 [pic] ? Reset (RST): Pin 9 is the reset pin. It is an input and is active high.
Upon applying a high pulse to this pin, the microcontroller will reset and terminate all activities. A high on the spin for two-machine cycle, while the oscillator is running, reset the device. ? 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, however, that one ALE pulse is skipped during each access to external Data Memory.
If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode. ? PSEN: Program Store Enable is the read strobe to external program memory When the AT89S52 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, for parts that require 12-volt VPP. ? XTAL1: Input to the inverting oscillator amplifier and input to the Internal clock operating circuit. XTAL2: Output from the inverting oscillator amplifier. ? Addressing Modes OF AT89S51/52: The CPU can access data in various ways. The data could be in a register, or in memory, or be provided as an immediate value. These various ways of accessing data are called addressing modes. The AT89S52 provides a total of five distinct addressing modes. They are as follow: ??? Immediate ??? Direct ??? Indirect ??? Register ??? Register Specific ??? Indexed 3. 1. 5 Interfacing the Microprocessor / Controller: The module, interfaced to the system, can be treated as RAM input/output, expanded or parallel I/O.
Since there is no conventional chip select signal, developing a strobe signal for the enable signal (E) and applying appropriate signals to the register select (RS) and read/write (R/W) signals are important. The module is selected by gating a decoded module ??? address with the host ??? processor’s read/write strobe. The resultant signal, applied to the LCD enable (E) input, clocks in the data. The ‘ E’ signal must be a positive going digital strobe, which is active while data and control information are stable and true. The falling edge of the enable signal enables the data / instruction register of the controller.
All module timings are referenced to specific edges of the ‘ E’ signal. The ‘ E’ signal is applied only when a specific module transaction is desired. The read and write strobes of the host, which provides the ‘ E’ signals, should not be linked to the module’s R/W line. An address bit which sets up earlier in the host’s machine cycle can be used as R/W. When the host processor is so fast that the strobes are too narrow to serve as the ‘ E’ pulse. ? Prolong these pulses by using the hosts ‘ Ready’ input. ? Prolong the host by adding wait states. ? Decrease the Hosts Crystal frequency.
In spite of doing the above mentioned, if the problem continues, latch both the data and control information and then activate the ‘ E’ signal. When the controller is performing an internal operation he busy flag (BF) will set and will not accept any instruction. The user should check the busy flag or should provide a delay of approximately 2ms after each instruction. The module presents no difficulties while interfacing slower M P Us. The liquid crystal display module can be interfaced, either to 4-bit or 8-bit M P Us. For 4-bit data interface, the bus lines DB4 to DB7 are used for data transfer, while DB0 to DB3 lines are disabled.
The data transfer is complete when the 4-bit data has been transferred twice. The busy flag must be checked after the 4-bit data has been transferred twice. Two more 4-bit operations then transfer the busy flag and address counter data. For 8-bit data interface, all eight-bus lines (DB0 to DB7) are used. 6. Advantages of Microcontrollers: ? If a system is developed with a microprocessor, the designer has to go for external memory such as RAM, ROM or EPROM and peripherals and hence the size of the PCB will be large enough to hold all the required peripherals.
But the microcontroller has got all these peripheral facilities on a single chip so development of a similar system with a microcontroller reduces PCB size and cost of the design. ? One of the major difference between a microcontroller and a microprocessor is that a controller often deals with bits, not bytes as in the real world application, for example switch contacts can only be open or close, indicators should be lit or dark and motors can be either turned on or off and so forth. The Microcontroller has two 16 bit timers / counters built within it, which makes it more suitable to this application since we need to produces one accurate timer delays. It is even more advantageous that the timers also act as interrupt. 7. Features of 8-bit AT89S52 Microcontroller: ? Compatible with MCS-51TM products ? 8Kbytes of ln-system reprogrammable flash memory ? Endurance: 1, 000 write/erase cycle ? Fully static operation: 0Hz to 24Hz ? Three level program memory lock ? 256 X 8-bit internal RAM ? 32 programmable I/O lines ? Three 16-bit timer/counter ? Eight interrupt sources Programmable serial channel ? Four 8-bit ports namely, port0, port1, port2 ? Low power idle & power down modes 3. 2 POWER SUPPLY DESCRIPTION: In electronics generally we use D. C. power. In our micro-controller circuits we use 6volts power supply. Normally in domestic power we get 230volts A. C. Power. Using some circuits we convert this A. C. Power into required D. C. Power. [pic] Fig No. 3. 2 (a): Power Supply Circuit ? Steps involved in power supply circuits: ??? Step down transformer ??? Rectifier circuit ??? Filter circuit ??? Regulator circuit ??? Indicator circuit ? Step down transformer:
First step involved in the power supply circuit is to reduce the 230A. C. Power into 9v A. C. for this purpose we use 9-0-9 step down transformer. This transformer is called center tapped transformer. This transformer reduces the 230v A. C. into 9v A. C power. This transformer consists of two parts. ??? Primary ??? Secondary Primary: Primary is the input of the transformer. Primary consists of two wires. One is connected to phase and other is connected to neutral of the domestic AC Power. Secondary: Secondary is the output of the transformer. Secondary consists of three wires.
The middle wire is ground terminal and the other two wires are 9v A. C terminals. When the input is connected to the 230v A. C power, we get 9vA. C power as the output of the transformer. [pic] Fig No. 3. 2 (b): Symbol for the Transformer ? Rectifier circuit: The output for the step down circuit is 9v A. C power. For our micro-controller circuit we need 6v D. C power. So we introduce the rectifier circuit. The rectifier circuit is the only circuit used to convert the AC Power into DC Power. ? Filter Circuit: The output of the Full wave Rectifier contains both AC and DC components.
A majority of the application, which cannot tolerate a high value ripple, necessitates further processing of the rectifier output. The undesirable AC components i. e. the ripple, can be minimized using filters. The output of the rectifier is fed as input to the filter. The output of the filter is not a perfect DC, but it also contains small AC components. Some important filters are ??? Inductor Filter ??? Capacitor Filter ??? LC Filter ??? CLC Filter In our circuit we use the Capacitor Filter. ? Regulator circuit: This circuit is a small +5V power supply, which is useful when experimenting with digital electronic.
Small inexpensive wall transformer with variable output voltage are available from any electronics shop and supermarket. Those transformers are easily available, but usually their voltage regulation is very poor, which makes then not very usable for digital circuit experimenter unless a better regulation can be achieved in some way. This circuit can give +5V out put at about 150mA current, but it can be increased to 1Amp when good cooling is added to 7805regulator chip. The circuit has overload and terminal protection. If you need other voltage than +5V, you can modify the circuit by replacing the 7805 chip with another regulator 78?? hip family. The last numbers in the chip code tells the output voltage. Remember that the input voltage must be at least 3v greater than regulator output voltage to otherwise the regulator does not work well. ? Capacitors: A capacitor is a passive electronic component that stores energy in the form of an electrostatic field. In its simplest form, a capacitor consists of two conducting plates separated by an insulating material called the dielectric. Capacitance is directly proportional to the surface areas of the plates, and is inversely proportional to the plates’ separation.
We are using ceramic capacitor in our project. ? Resistors: Definition: “ Obstruction produced by an object in the path of current is known as resistance. It is a passive circuit element, which opposes the flow of current i. e. it consumes power”. The power consumed by the resistor is given by Power, P= I2 R. Where, I= current flowing through the resistor R. ? Types of resistances: ??? Fixed resistance ??? Variable resistance ??? Semi variable resistance Here we are using fixed resistor. ? Diode: A p n junction diode consists of a p n junction formed either in germanium or silicon crystal.
The diode has two terminals namely anode and cathode. the anode refers to p-type region and the cathode refers to the n-type region. The most important characteristic of a p n- junction is its ability to conduct current in one direction only. In other words it offers very high resistance in reverse direction. ? Transistor: A transistor basically consists of two p-n junctions connected back-to-back. A transistor is a semiconductor device that can either amplify an electrical signal or act as an electronic switch. Basically a transistor consists of a germanium or silicon crystal which contains three separate regions.
The three regions may consists of either two n-type regions separated by a p-type region or two p-type regions separated by an n-type region. The transistor is our most important example of an “ active” component, a device that can amplify, producing an output signal with more power in it than the input signal. The additional power comes from an external source of power (the power supply, to be exact). According to the type of (p-type ‘ or’ n-type) sandwich, the transistors are classified into two groups, namely: ??? n-p-n transistor ??? p-n-p transistor ? Three regions of the transistor are named as: Emitter (E) ??? Base (B) ??? Collector (C) Here we are using n-p-n (BC547) type & p-n-p (BC557)type transistors are used. Also here we use transistor as a switch. ? Transformer: A transformer is a static (stationary) a. c. machine, which transfers the electric power (energy) from one electric circuit to another electric circuit with same frequency at different voltages and currents. It works on mutual induction (electro-magnetic induction) principle. Here we are using step down transformer. A step down transformer is a transformer whose output voltage is less than input. 3. 3 RELAY:
A relay is an electrically operated switch. Current flowing through the coil of the relay creates a magnetic field, which attracts a lever and changes the switch contacts. The coil current can be on or off so relays have two switch positions and they are double throw (changeover) switches. Relays allow one circuit to switch a second circuit, which can be completely separate from the first. For example a low voltage battery circuit can use a relay to switch a 230V AC mains circuit. There is no electrical connection inside the relay between the two circuits; the link is magnetic and mechanical.
Fig No. 3. 3: Driving Circuit for Relay The relay’s switch connections are usually labeled COM, NC and NO: ? COM = Common, always connect to this; it is the moving part of the switch. ? NC = Normally Closed, COM is connected to this when the relay coil is off. ? NO = Normally Open, COM is connected to this when the relay coil is on. ? Connect to COM and NO if you want the switched circuit to be on when the relay coil is on. ? Connect to COM and NC if you want the switched circuit to be on when the relay coil is off. 3. 4 ENERGY METER:
An electric meter or energy meter is a device that measures the amount of electrical energy supplied to or produced by a residence, business or machine. The most common type is a kilowatt hour meter. When used in electricity retailing, the utilities record the values measured by these meters to generate an invoice for the electricity. They may also record other variables including the time when the electricity was used The most common unit of measurement on the electricity meter is the kilowatt hour, which is equal to the amount of energy used by a load of one kilowatt over a period of one hour, or 3, 600, 000 joules.
Some electricity companies use the SI mega joule instead. [pic] Fig No. 3. 4: A Three Phase Electromechanical Induction Meter Three-phase electromechanical induction meter, metering 100 A 230/400 V supply. Horizontal aluminium rotor disc is visible in centre of meter 3. 5 LIQUID CRYSTAL DISPLAY (LCD): In our project we use an intelligent LCD display of two lines, 16 character per line, that is interfaced to the microcontroller. LCD in this project is used to display the messages to the incoming or outgoing persons like welcome, exit, thank you or any other messages can be programmed to display.
Some of the features of 16X2 Character LCD is: ? 5X8 dots with cursor. ? Built-in controller (KS 0066 or equivalent). ? +5V power supply (Also available for +3V). ? 1/16 duty cycle. ? B/L to be driven by pin 1, pin 2 or pin 15, pin 16 or A. K (LED). ? N. V. optional for +3V power [pic] Fig No. 3. 5: Block Diagram of LCD Vcc and Vss are supply pins and VEE (Pin no. 3) is used for controlling LCD contrast. Pin No. 4 is RS pin for selecting the register, there are two very important registers are there in side the LCD. The RS pin is used for their selection as follows.
If RS = 0, the instruction command code register is selected, allowing the user to send a command such as clear display. If RS= 1, the data register is selected, allowing the user to send data to be displayed on the LCD. R/W is a read or write Pin, which allows the user to write information to the LCD or read information from it. R/W= 1 when reading, R/W= 0 when writing. The enable (E) pin is used by the LCD to latch information presented to its data pins . When data is supplied to data pins, a high ??? to-low pulse must be applied to this pin in order for the LCD to latch in the data present at the data pins.
This pulse must be a minimum of 450 ns wide. The 8-bit data pins, D0-D7, are used to send information to the LCD or read the contents of the LCD’S internal registers. To display letters and numbers, we must send ASCII (Antenna Standard Code for Information Inter Change, Pronounced “ ask ??? E”) codes for the letters A ??? Z, and numbers 0 – 9 to these pins while making RS= 1. SOFTWARE DESCRIPTION 4. 1 INTRODUCTION TO EMBEDDED ‘ C’: Ex: Hitec ??? c, Keil ??? c. HI-TECH Software makes industrial-strength software development tools and C compilers that help software developers write compact, efficient embedded processor code.
For over two decades HI-TECH Software has delivered the industry’s most reliable embedded software development tools and compilers for writing efficient and compact code to run on the most popular embedded processors. Used by tens of thousands of customers including General Motors, Whirlpool, Qualcomm, John Deere and many others, HI-TECH ‘ s reliable development tools and C compilers, combined with world-class support have helped serious embedded software programmers to create hundreds of breakthrough new solutions.
Whichever embedded processor family you are targeting with your software, whether it is the ARM, PICC or 8051 series, HI-TECH tools and C compilers can help you write better code and bring it to market faster. HI-TECH PICC is a high-performance C compiler for the Microchip PIC micro 10/12/14/16/17 series of micro controllers. HI-TECH PICC is an industrial-strength ANSI C compiler – not a subset implementation like some other PIC compilers. The PICC compiler implements full ISO/ANSI C, with the exception of recursion.
All data types are supported including 24 and 32-bit IEEE standard floating point. HI-TECH PICC makes full use of specific PIC features and using an intelligent optimizer, can generate high-quality code easily rivaling hand-written assembler. Automatic handling of page and bank selection frees the programmer from the trivial details of assembler code. 4. 2 EMBEDDED ‘ C’ COMPILER: ? ANSI C – full featured and portable ? Reliable – mature, field-proven technology ? Multiple C optimization levels, Mixed C and assembler programming ?
An optimizing assembler & a Comprehensive C library with all source code provided ? Full linker, with overlaying of local variables to minimize RAM usage ? Includes support for 24-bit and 32-bit IEEE floating point and 32-bit long data types ? Unlimited number of source files Listings showing generated assembler ? Compatible – integrates into the MPLAB IDE, MPLAB ICD and most 3rd-party development tools ? Runs on multiple platforms: Windows, Linux, UNIX, Mac OS X, Solaris 4. 3 EMDEDDED DEVELOPMENT ENVIRONMENT: PICC can be run entirely from the.
This environment allows you to manage all of your PIC projects. You can compile, assemble and link your embedded application with a single step. Optionally, the compiler may be run directly from the command line, allowing you to compile, assemble and link using one command. This enables the compiler to be integrated into third party development environments, such as Microchip’s MPLAB IDE. 4. 4 EMBEDDED SYSEM TOOLS: ? Assembler: An assembler is a computer program for translating assembly language ??? essentially, a mnemonic representation of machine language ??? into object code.
A cross assembler (see cross compiler) produces code for one type of processor, but runs on another. The computational step where an assembler is run is known as assembly time. Translating assembly instruction mnemonics into opcodes, assemblers provide the ability to use symbolic names for memory locations (saving tedious calculations and manually updating addresses when a program is slightly modified), and macro facilities for performing textual substitution ??? typically used to encode common short sequences of instructions to run inline instead of in a subroutine.
Assemblers are far simpler to write than compilers for high-level languages. ? Operating Systems: To run any software we need operating system. Embedded systems do not require a complete operating system, which may make the system bulky, but only the basic functionalities of the operating system in a real time environment ??? RTOS. Off-the-shelf operating systems for these systems began to appear in the late 1970’s, and today several dozen viable options are available. Embedded operating systems are available in variety of flavors: Windows NT, LINUX, Windows CE 3. , PalmOS, QNX, ROMDOS, JBED, RT kernel, Tiny BIOS, Turbo task, Nucleus plus/Tasking, Diamond, ThreadX (#[email protected]%) etc. Out of these , a few major players have emerged , such as Vxworks, PSOS, neculeus, windows CE, ThreadX and linux. ‘ Inferno’ and ‘ Chai’ are the two popular environments that are used to develop application stems. 4. 5 EMBEDDED SYSEM TYPES: Embedded systems are of two types. They are: ? High-end embedded system – Generally 32, 64 Bit Controllers used with OS. ? Lower end embedded systems – Generally 8, 16 Bit Controllers used with a minimal operating systems and hardware layout designed for the specific purpose. Classification: ??? Real Time Systems ??? Non Real Time Systems 4. 6 APPLICATION OF EMBEDDED SYSEM: Embedded computing systems are found everywhere, including in cellular telephones, pagers, VCRs, camcorders, thermostats, automated supermarket stockers, computerized inventory control devices, digital thermometers, telephone answering machines, printers etc. They are also found in various fields like handheld P D As, cameras, and microwave ovens. Cars are full of them, as are airplanes, satellites, and advanced military and medical equipments.
Embedded systems are finding their way into robotic toys and electronic pets, intelligent cars and remote controllable home appliances. All the major toy makers across the world have been coming out with advanced interactive toys that can become our friends for life. ‘ Furzy’ and ‘ AIBO’ are good examples at this kind. Furbish have a distinct life cycle just like human beings, starting from being a baby and growing to an adult one. In AIBO first two letters stands for Artificial Intelligence. Next two letters represents robot. The AIBO is robotic dog. Embedded systems in cars also nown as Telemetric Systems are used to provide navigational security communication & entertainment services using GPS, satellite. Home appliances are going the embedded way. LG electronics digital DIOS refrigerator can be used for surfing the net, checking e-mail, making video phone calls and watching TV. IBM is developing an air conditioner that we can control over the net. Embedded systems cover such a broad range of products that generalization is difficult. Here are some broad categories: ? Aerospace and defense electronics: fire control, radar, robotics/sensors, sonar. Automotive: Auto body electronics, auto power train, auto safety, car information systems. ? Broadcast & entertainment: Analog and digital sound products, cameras, DVDs, Set top boxes, virtual reality systems and graphic products. ? Consumer/internet appliances: Business handheld computers, business network computers/terminals, electronic books, internet smart handheld devices, PDA. ? Data communications: Analog modems, ATM switches, cable modems, XDSL modems, Ethernet switches, concentrators. ? Digital imaging: Copiers, digital still cameras, Fax machines, printers, scanners. Industrial measurement and control: Hydro electric utility research & management traffic management systems, train marine vessel management systems. ? Medical electronics: Diagnostic devices, real time medical imaging systems, surgical devices, Critical care systems. ? Server I/O: Embedded servers, enterprise PC servers, PCI LAN/NIC controllers, RAID devices, SCSI devices. ? Telecommunications: ATM communication products, base stations, networking switches, SONET/SDH cross connect, multiplexer. ? Mobile data infrastructures: Mobile data terminals, pagers, VSAT, Wireless LANs, Wireless phones. 4. ADVANTAGES AND DISADVANTAGES OF EMBEDDED SYSTEM: An embedded system is a special purpose computer system usually built into an environment connected to system through sensors, actuators and other I/O interfaces. Some of the advantages and disadvantages of embedded system is as follow: Advantages: ? The main advantage of this system is its simplicity. ? Small pieces of software the loop is usually so fast. ? The system guarantees that the software will run. ? There is no mysterious operating system to blame for bad behavior. ? Careful coding can easily assure that nothing disables interrupts for long.
Thus interrupt code can run at very precise timings. Disadvantages: ? One major weakness of this system is that it does not guarantee a time to respond to any particular hardware event. ? Another major weakness of this system is that it can become complex to add new features.. ? Algorithms that take a long time to run must be carefully broken down so only a little piece gets done each time through the main loop. PROJECT CODE #include sfr ldata = 0xA0; //P2 sbit rs= P0_5; sbit rw= P0_6; sbit en= P0_7; sbit DATA= P1_1; // void Delay(unsigned int x) { int i, j; for(i= 0; i