Beruflich Dokumente
Kultur Dokumente
CHAPTER-1 INTRODUCTION
1.1 EMBEDDED SYSTEMS:
Embedded systems are designed to do some specific task, rather than be a general-purpose computer for multiple tasks. Some also have real time performance constraints that must be met, for reason such as safety and usability; others may have low or no performance requirements, allowing the system hardware to be simplified to reduce costs. Wireless communication has become an important feature for commercial products and a popular research topic within the last ten years. There are now more mobile phone subscriptions than wired-line subscriptions. Lately, one area of commercial interest has been low-cost, low-power, and short-distance wireless communication used for personal wireless networks." Technology advancements are providing smaller and more cost effective devices for integrating computational processing, wireless communication, and a host of other functionalities. These embedded communications devices will be integrated into applications ranging from homeland security to industry automation and monitoring. They will also enable custom tailored engineering solutions, creating a revolutionary way of disseminating and processing information. With new technologies and devices come new business activities, and the need for employees in these technological areas. Engineers who have knowledge of embedded systems and wireless communications will be in high demand.
The ZIGBEE specification is a combination of Home RF Light and the 802.15.4 specification. The specification operates in the 2.4GHz (ISM) radio band - the same band as 802.11b standard, Bluetooth, microwaves and some other devices. It is capable of connecting 255 devices per network. The specification supports data transmission rates of up to 250 Kbps at a range of up to 30 meters. ZIGBEE's technology is slower than 802.11b (11 Mbps) and Bluetooth (1 Mbps) but it consumes significantly less power.
1.3 FEATURES:
Standards-based wireless technology Interoperability and worldwide usability Low data-rates Ultra low power consumption Very small protocol stack Support for small to excessively large networks Simple design Security Reliability
1.4 PARAMETERS:
Operating frequency Operating voltage Transmitted power Range Data rate Receiver sensitivity Frequency range : 2.4GHz : 3.3V : 1mw : 30m(urban area), 200m (LOS) : 250Kbps
SRTIST/ECE
Page 2
SRTIST/ECE
Page 3
POWER SUPPLY
MICRO CONTROLLER
LCD
KEYPAD
RTC
OPTO COUPLER
ENERGY METER
EEPROM
RELAY
ZIGBEE TRANSCEIVER
HOME APPLIANCES
BUZZER
SRTIST/ECE
Page 4
POWER SUPPLY
LCD
KEYPAD
MICRO CONTROLLER
ZIGBEE TRANSCEIVER
SRTIST/ECE
Page 5
SRTIST/ECE
Page 6
There are many types of power supplies. Most are designed to convert high voltage AC mains to a low voltage supply for electronic circuits and other devices. A power supply can be broken down into a series of blocks, each of which performs a particular function.
2.2 TRANSFORMERS:
Transformer is a device which can efficiently transform the electric energy. Major use of transformer is in power distribution. Which is used in electrical devices, control systems, communication system devices etc. Step-up transformers increase voltage, stepDown transformers reduce voltage. Most power supplies use a step-down transformer to Reduce the dangerously high mains voltage (230V) to a safer low voltage.
SRTIST/ECE
Page 7
The input coil is called the primary and the output coil is called the secondary. There is no electrical connection between the two coils, instead they are linked by an Alternating magnetic field created in the soft-iron core of the transformer. The two lines in the middle of the circuit symbol represent the core. A transformer that increases voltage from primary to secondary is called a step-up transformer. Conversely, a transformer designed to do just the opposite is called a stepdown transformer.
SRTIST/ECE
Page 8
A transformer designed to increase voltage from primary to secondary is called a step-up transformer. A transformer designed to reduce voltage from primary to secondary is called a step-down transformer.
2.3 RECTIFIER:
There are several ways of connecting diodes to make a rectifier to convert AC to DC. The bridge rectifier is the most important and it produces full-wave varying DC. A full-wave rectifier can also be made from just two diodes if a centre-tap transformer is used, but this method is rarely used now that diodes are cheaper. A single diode can be used as a rectifier but it only uses the positive (+) parts of the AC wave to produce halfwave varying DC. A circuit which is used to convert AC to DC is known as RECTIFIER. The process of conversion AC to DC is called rectification
SRTIST/ECE
Page 9
Number of Diodes
PIV of Diodes
Vm
2 Vm
Vm
Vm/
2Vm/
2Vm/
Vdc, at No-Load
0.318Vm
0.636Vm
0.636Vm
Ripple Factor
1.21
0.482
0.482
Ripple Frequency
2f
2f
0.406
0.812
0.812
0.287
0.693
0.812
Vm/2
Vm/2
Vm/2
SRTIST/ECE
Page 10
2.4 FILTER (Capacitor filter-smoothing): Smoothing is performed by a large value electrolytic capacitor connected across the DC supply to act as a reservoir, supplying current to the output when the varying DC voltage from the rectifier is falling. The diagram shows the unsmoothed varying DC
SRTIST/ECE
Page 11
(dotted line) and the smoothed DC (solid line). The capacitor charges quickly near the peak of the varying DC, and then discharges as it supplies current to the output.
The smoothing block smoothes the DC from varying greatly to a small ripple and the ripple voltage is defined as the deviation of the load voltage from its DC value. Smoothing is also named as filtering.
2.5 REGULATORS:
A voltage regulator is a circuit that supplies a constant voltage regardless of changes in load currents. Although voltage regulators can be designed using op-amps, it is quicker and easier to use IC voltage regulators. Line regulation is defined as the change in output voltage for a change in the input voltage and is usually expressed in milli volts or as a percentage of Vo. Ripple rejection is the measure of a regulators ability to reject ripple voltage. It is usually expressed in decibels. The smaller the values of line regulation, load regulation and temperature stability the better the regulation.
SRTIST/ECE
Page 12
PIN DESCRIPTION: Pin No 1 2 3 Function Input voltage (5V-18V) Ground (0V) Regulated output; 5V (4.8V-5.2V)
TABLE 2.2: PIN DESCRIPTION OF 7805
78XX:
The Bay Linear LM78XX is integrated linear positive regulator with three terminals. The LM78XX offer several fixed output voltages making them useful in wide range of applications. When used as a zener diode/resistor combination replacement, the LM78XX usually results in an effective output impedance improvement of two orders of magnitude, lower quiescent current. The LM78XX is available in the TO-252, TO-220 & TO-263packages.
Features:
Output Current of 1.5A. Output Voltage 5.0V, 6V, 8V, 9V, 10V, 12V, 15V, 18V, 24V.
SRTIST/ECE
Page 13
The essential portion of the Light Emitting Diode is the semiconductor chip. Semiconductors can be either intrinsic or extrinsic.
ADVANTAGES:
Low working voltages and currents Less power consumption Extremely long life
APPLICATIONS OF LEDs:
In 7-segment, 16-segment & dot matrix displays 1. In optical switching applications. 2. For Image sensing circuits in picture phones. 3. In burglar alarm systems
SRTIST/ECE
Page 14
CHAPTER-3 MICROCONTROLLER
The system requirements and control specifications clearly rule out the use of 16, 32 or 64 bit micro controllers or microprocessors. They are also faster and more reliable but, the above application is satisfactorily served by 8-bit micro controller.
SRTIST/ECE
Page 15
FEATURES: 8K Bytes of In-System Reprogrammable Flash Memory. Fully Static Operation: 0 Hz to 33 MHz 256 x 8-bit Internal RAM. 32 Programmable I/O Lines. Three 16-bit Timer/Counters. Eight Interrupt Sources. 4.0V to 5.5V Operating Range.
SRTIST/ECE
Page 16
Port 0:
Port 0 is an 8-bit open drain bidirectional 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 highimpedance inputs. Port 0 can also be configured to be the multiplexed low-order address/data bus during accesses to external program and data memory.
Port 1:
Port 1 is an 8-bit bidirectional 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.
Port 2:
Port 2 is an 8-bit bidirectional 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.
Port 3:
Port 3 is an 8-bit bidirectional 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.
SRTIST/ECE
Page 17
RST:
Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives High for 96 oscillator periods after the Watchdog times out.
PSEN:
Program Store Enable (PSEN) 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.
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.
XTAL1:
Input to the inverting oscillator amplifier and input to the internal clock operating circuit.
XTAL2:
It is output from the inverting oscillator amplifier.
SRTIST/ECE Page 18
Oscillator Characteristics:
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier which can be configured for use as an on-chip oscillator. Either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven as shown in Figure 6.2.4.There are no requirements on the duty cycle of the external clock signal, since the
SRTIST/ECE Page 19
input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications must be observed.
Code Memory:
Code memory is the memory that holds the actual 89S52 programs that is to be run. This memory is limited to 64K. Code memory may be found on-chip or off-chip. It is possible to have 4K of code memory on-chip and 60K off chip memory simultaneously. If only off-chip memory is available then there can be 64K of off chip ROM. This is controlled by pin provided as EA
a) Internal Ram:
The 89S52 have a bank of 128 of internal RAM. The internal RAM is found onchip. So it is the fastest Ram available. And also it is most flexible in terms of reading
SRTIST/ECE
Page 20
and writing. Internal Ram is volatile, so when 89S52 is reset, this memory is cleared. 128 bytes of internal memory are subdivided. The first 32 bytes are divided into 4 register banks. Each bank contains 8 registers. Internal RAM also contains 128 bits, which are addressed from 20h to 2Fh.
b) FLASH MEMORY:
Flash memory (sometimes called "flash RAM") is a type of constantly-powered non volatile that can be erased and reprogrammed in units of memory called blocks. It is a variation of electrically erasable programmable read-only memory (EEPROM) which, unlike flash memory, is erased and rewritten at the byte level, which is slower than flash memory updating. Flash memory is often used to hold control code such as the basic input/output system (BIOS) in a personal computer.
MEMORY TYPE
FEATURES
Mature, high-density, reliable, low cost; timeROM Read-Only Memory consuming mask required, suitable for high production with stable code
EPROM Electrically Programmable Read-Only Memory High-density memory; must be exposed to ultraviolet light for erasure
SRTIST/ECE
Page 21
EEPROMorE2PROM Electrically Erasable Programmable ReadOnly Memory Electrically byte-erasable; lower reliability, higher cost, lowest density
3.7 REGISTERS:
In the CPU, registers are used to store information temporarily. That information could be a byte of data to be processed, or an address pointing to the data to be fetched. The vast majority of 8052 registers are 8bit registers. In the 8052 there is only one data type: 8bits. The 8bits of a register are shown in the diagram from the MSB (most significant bit) D7 to the LSB (least significant bit) D0. With an 8-bit data type, any data larger than 8bits must be broken into 8-bit chunks before it is processed.
D7 D6 D5 D4 D3 D2 D1 D0
The most widely used registers of the 8051 are A (accumulator), B, R0, R1, R2, R3, R4, R5, R6, R7, DPTR (data pointer), and PC (program counter). All of the above registers are 8bits, except DPTR and the program counter. arithmetic and logic instructions. The accumulator, register A, is used for all
SRTIST/ECE
Page 22
(which is much easier) or by their addresses. For example, register A has address E0h, and register B has been ignited the address F0H, as shown in table. The following two points should noted about the SFR addresses. 1. The Special function registers have addresses between 80H and FFH. These addresses are above 80H, since the addresses 00 to 7FH are addresses of RAM memory inside the 8052. 2. Not all the address space of 80H to FFH is used by the SFR. The unused locations 80H to FFH are reserved and must not be used by the 8052 programmer. Regarding direct addressing mode, notice the following two points: (a) The address value is limited to one byte, 00-FFH, which means this addressing mode is limited to accessing RAM locations and registers located inside the 8052. (b) If you examine the 1st file for an assembly language program, you will see that the SFR registers names are replaced with their addresses as listed in table.
Symbol ACC B PSW SP DPTR DPL DPH P0 Name Accumulator B register Program status word Stack pointer Data pointer 2 bytes Low byte High byte Port0 82H 83H 80H Address 0E0H 0F0H 0D0H 81H
SRTIST/ECE
Page 23
P1 P2 P3 IP IE TMOD TCON T2CON T2MOD TH0 TL0 TH1 TL1 TH2 TL2 RCAP2H RCAP2L SCON SBUF PCON
Port1 Port2 Port3 Interrupt priority control Interrupt enable control Timer/counter mode control Timer/counter control Timer/counter 2 control Timer/counter mode2 control Timer/counter 0high byte Timer/counter 0 low byte Timer/counter 1 high byte Timer/counter 1 low byte Timer/counter 2 high byte Timer/counter 2 low byte T/C 2 capture register high byte T/C 2 capture register low byte Serial control Serial data buffer Power control
90H 0A0H 0B0H 0B8H 0A8H 89H 88H 0C8H 0C9H 8CH 8AH 8DH 8BH 0CDH 0CCH 0CBH 0CAH 98H 99H 87H
SRTIST/ECE
Page 24
A) Timer 0 Registers:
The 16-bit register of Timer 0 is accessed as low byte and high byte. The low byte register is called TL0 (Timer 0 low byte) and the high byte register is referred to as TH0 (Timer 0 high byte). These register can be accessed like any other register, such as A,B,R0,R1,R2,etc.
A) Timer 1 Registers:
These two SFRs, taken together, represent timer 1. Their exact behavior depends on how the timer is configured in the TMOD SFR.
B) Timer 2 Registers:
Control and status bits are contained in registers T2CON (shown in Table) and T2MOD (shown in Table) for Timer 2. The register pair (RCAP2H, RCAP2L) is the Capture/Reload registers for Timer 2 in 16-bit capture mode or 16-bit auto-reload mode.
SRTIST/ECE
Page 25
FIG: 4.1 LCD DISPLAY When sufficient voltage is applied to the electrodes, the liquid crystal molecules would be aligned in a specific direction. The light rays passing through the LCD would be rotated by the polarizers, which would result in activating / highlighting the desired characters. The LCDs are lightweight with only a few millimeters thickness. Since the LCDs consume less power, they are compatible with low power electronic circuits, and can be powered for long durations.
SRTIST/ECE
Page 26
4. Ease of programming for characters and graphics. 4.3 LCD PIN DESCRIPTION:
The LCD discussed in this section has 14 pins. The function of each pin is given in table.
Pin
1 2
symbol
Vss Vcc
I/O
---
Description
Ground +5V power supply Power supply to control
VEE
--
contrast
RS=0 to select command register. RS=1 to select data 4 RS I register R/W=0 for write 5 6 7 8 9 10 11 12 13 14 R/W E DB0 DB1 DB2 DB3 DB4 DB5 DB6 DB7 I I/O I/O I/O I/O I/O I/O I/O I/O I/O R/W=1 for read Enable The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus The 8-bit data bus
SRTIST/ECE
Page 28
The LCD can display a character successfully by placing the 1. Data in Data Register
2. Command in Command Register of LCD Data corresponds to the ASCII value of the character to be printed. This can be done by placing the ASCII value on the LCD Data lines and selecting the Data Register of the LCD by selecting the RS (Register Select) pin. Each and every display location is accessed and controlled by placing respective command on the data lines and selecting the Command Register of LCD by selecting the (Register Select) RS pin.
4.4 USES:
The LCDs used exclusively in watches, calculators and measuring instruments are the simple seven-segment displays, having a limited amount of numeric data. The recent advances in technology have resulted in better legibility, more information displaying capability and a wider temperature range. These have resulted in the LCDs being extensively used in telecommunications and entertainment electronics. So in this project, the LCD is used to display the instantaneous information. The information may be prompting or alerting or instructing the user.
SRTIST/ECE
Page 29
CHAPTER-5 RELAYS
5.1 DEFINITION:
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: 5.1 RELAY The coil of a relay passes a relatively large current, typically 30mA for a 12V relay, but it can be as much as 100mA for relays designed to operate from lower voltages. Most ICs (chips) cannot provide this current and a transistor is usually used to amplify the small IC current to the larger value required for the relay coil. Relays are usually
SRTIST/ECE Page 30
SPDT or DPDT but they can have many more sets of switch contacts, for example relays with 4 sets of changeover contacts are readily available. For further information about switch contacts and the terms used to describe them please see the page on switches.
FIG 5.2 WORKING OF 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.
SRTIST/ECE
Page 31
Advantages of Relays:
Relays can switch AC and DC, transistors can only switch DC. Relays can switch high voltages, transistors cannot. Relays are a better choice for switching large currents (> 5A). Relays can switch many contacts at once. In this project 4 relays are used to connect 4 loads of which 3 are Loads i.e.
normal and emergency loads whereas the other one is to switch the Energy Meter.
SRTIST/ECE
Page 32
CHAPTER-6 EEPROM
6.1 INTRODUCTION:
EEPROM is to store the no. of units consumed. This section acts as a backend database for the project. This section is realized using an EEPROM integrated circuit chip. The IS24C02 is a low cost 2,048-bit serial EEPROM. It is fabricated using ISSIs advanced CMOS EEPROM technology and operates from a single supply. The IS24C02 is internally organized as a 256 x 8 memory bank. The IS24C02 features a serial interface and software protocol allowing operation on a simple 2-wire bus.
SRTIST/ECE
Page 33
A0, A1, AND A2 - The address inputs are used to set the least significant three bits of
the slave address. These inputs may be tied HIGH or LOW, or they may be actively driven. These inputs allow up to eight IS24C02 devices to be connected together on the bus. When left floating, A0, A1 and A2 are pulled to ground. The default values are zeros.
SERIAL DATA (SDA) - The SDA pin is a bidirectional pin used to transfer data into
and out of the device. Data may change only when SCL is LOW. It is an open-drain output, and may be wired with any number of open-drain or open-collector outputs.
SERIAL CLOCK (SCL) - The SCL input is used to clock all data into and out of the
device. In the WRITE mode, data must remain stable when SCL is HIGH. In the READ mode, data is clocked out on the falling edge of SCL.
Write Control (WC) - The Write Control input is used to disable any attempt to write
to the memory. When HIGH, the memory is protected; when LOW, the write function is normal. The part can be read independent of the state of WC pin. When not connected, this pin will be pulled LOW.
6.4 FEATURES:
Low power CMOS
Active current less than 2 mA Standby current less than 8 mA Hardware writes protection Write control pin Internally organized as 256 x 8 Two-wire serial interface Bidirectional data transfer protocol
SRTIST/ECE
Page 34
8-Byte page-write mode Minimized total write time per byte Automatic word address incrementing Sequential register read Self-timed write cycle Maximum write cycle time is of 10 ms 400 KHz Compatibility Endurance: 1, 000,000 cycles per byte 8-pin PDIP, TSSOP, MSOP or SOIC packages Filtered inputs for noise suppression.
SRTIST/ECE
Page 35
The protocol defines any device that sends data onto the SDA bus as a transmitter, and the receiving device as a receiver. The device controlling the data transmission is named MASTER device, and the controlled device is named SLAVE device. In all cases, the IS24C02 will be a slave device, since it never initiates any data transfers. Up to eight IS24C02 can be connected to the bus. Device's physical address inputs A0-A2 must be connected to either VCC or GND. When left floating, A0, A1 and A2 are pulled to ground. The default values are zeros. Following a START condition, the MASTER (transmitter) device must initiate the Device Addressing Byte including device type identifier, device address, and a read or write operation to select a slave device (receiver) connected to the system bus. The receiver will then respond with an Acknowledge by pulling the SDA line LOW. The Acknowledge is used to indicate successful data transfers. The transmitting device will release the data bus (SDA goes HIGH) after transmitting eight bits (one data bit is transferred at the falling edge of each clock cycle).
6.6APPLICATIONS:
The IS24C02 is ideal for high volume applications requiring low power and low density storage. This device uses a low-cost, space-saving 8-pin plastic package. Candidate applications include robotics, alarm devices, electronic locks, meters and instrumentation.
SRTIST/ECE
Page 36
7.2 FEATURES:
Real-Time Clock (RTC) Counts Seconds, Minutes, Hours, Date of the Month, Month, Day of the week, and Year with Leap-Year Compensation Valid Up to 2100.
56-Byte, Battery-Backup, General-Purpose RAM with Unlimited Writes Automatic Power-Fail Detect and Switch Circuitry Consumes Less than 500nA in Battery-Backup Mode with Oscillator Running Optional Industrial Temperature Range: -40C to +85C Available in 8-Pin Plastic DIP or SO Underwriters Laboratories (UL) Recognized
SRTIST/ECE
Page 37
spec sheet can be used as RAM. Appears in the second DS1307 SOIC and DIP packages have 8 legs.
7.4 PIN DESCRIPTION: Pins 1, 2 X1, X2 Pin 3 VBAT Pin 4 - GND (Ground) Pin 5 - SDA Serial Data Input/output. Pin 6 - SCL Serial Clock Input. Pin 7 - SWQ/OUT Square Wave/Output Driver. Pin 8 - VCC (5 volts) 7.5OPERATION:
DS1307 operates slave device serial bus. Access obtained implementing START condition providing device identification code followed register address. Subsequent registers accessed sequentially until STOP condition executed. When falls below 1.25 VBAT devices terminates access progress resets device address counter. Inputs device
SRTIST/ECE Page 38
will recognized this time prevent erroneous data from being written device from tolerance system. When falls below VBAT device switches into low-current battery backup mode. Upon power-up, device switches from battery when greater than VBAT 0.2V recognizes inputs when greater than 1.25 VBAT.
SRTIST/ECE
Page 39
VBAT - Battery input for any standard 3 volt lithium cell or any other energy source. Battery voltage must be held between 2.0V to 3.5V for proper operation. The nominal write protect trip point voltage at which access to the RTC and user RAM is denied is set by the internal circuitry as 1.25 VBAT nominal. A lithium battery with 48mAhr or greater will back the DS1307 for more than 10 years in the absence of power at 25 degrees C. VCC, GND - DC power is provided to the devices on these pins. Vcc is the +5volt input. When 5 volts is applied within normal limits, the device is fully accessible and the data can be written and read. When a 3- volt battery is connected to the device below 1.25 VBAT, reads and writes are inhibited. However, the timekeeping function continues unaffected by the lower input voltage. SDA Serial Data Input/output - SDA is the data input/output for the I2C serial interface. The SDA pin is open drain and requires an external pull-up resistor. SCL Serial Clock Input - SCL is the clock input for the I2C interface and is used to synchronize data movement on the serial interface. SQW/OUT Square Wave/Output Driver - When enabled, the SQWE bit set to 1, the SQW/OUT pin outputs one of four square-wave frequencies (1Hz, 4 kHz, 8 kHz, and 32 kHz). SQW/OUT operates with either VCC or VBAT applied. An LED and 220 ohm resistor in series tied to VCC will produce a 1 HZ blink. This is a good way to tell if the clock chip is working.
values recorded in the register 7 are equivalent to the "install" boot time for the RTC. The read register values are read from 7 real-time chips created. For example, at launch, we recorded in the register "seconds" value 42, then the 12s we read this register, we obtain the value 54. For the first seven registers are most important in the operation of the DS1307. First observation held each bit of this register as shown in Figure
FIG 7.3 DS1307 ADDRESS MAP 7.8 CLOCK AND CALENDER: The time and calendar information is obtained by reading the appropriate register bytes. The clock and calendar is a full binary-coded decimal (BCD) clock/calendar format. The clock/calendar provides seconds, minutes, hours, day, date, month, and year information. Bit7 of register 0 is the clock halt (CH) bit. When this bit is set to a 1, the oscillator is disabled. When cleared to a 0, the oscillator is enabled. The clock operates in either the 24-hour or 12-hour format with AM/PM indicator. The DS1307 has a built-in power-sense circuit that detects power failures and
SRTIST/ECE
Page 41
automatically switches to the backup supply. Time keeping operation continues while the part operates from the backup supply.
7.8.2 CONTROL REGISTER: The DS1307 control register is used to control the operation of SQW/OUT pin. BIT7 OUT BIT6 X BIT5 X BIT4 SQWE BIT3 X BIT2 X BIT1 RS1 BIT0 RS0
SRTIST/ECE
Page 42
OUT (Output control): This BIT controls the output level of the SQW/OUT pin when the square wave output is disabled. If SQWE=0 the logic level on the SQW/OUT pin is 1 if OUT=1 and is0 if OUT=0. SQWE (Square Wave Enable): This bit, when set to logic 1 will enable the oscillator output. The frequency of the square wave output depends upon the value of the RS0 and RS1 bits. With square wave output 1Hz, clock registers update falling edge square wave. RS (Rate Select): These bits control the frequency of the square wave output when the square wave output has been enabled. The below table lists the square wave frequencies that can be selected with the RS bits. SQUAREWAVE OUTPUT FREQUENCY: SQW RS1 RS0 OUTPUT FREQUENCY 1 Hz 4.096kHz 8.192kHz 32.768kHz
0 0 1 1
0 1 0 1
SRTIST/ECE
Page 43
Optocoupler typically come in a small 6-pin or 8-pin IC package, but are essentially a combination of two distinct devices: an optical transmitter, typically a
SRTIST/ECE Page 44
gallium arsenide LED (light-emitting diode) and an optical receiver such as a phototransistor or light-triggered diac. The two are separated by a transparent barrier which blocks any electrical current flow between the two, but does allow the passage of light. Usually electrical connections to the LED section are brought out to the pins on one side of the package and those for the phototransistor or diac to the other side, to physically separate them as much as possible. This usually allows Optocoupler to withstand voltages of anywhere between 500V and 7500V between input and output.
SRTIST/ECE
Page 45
CHAPTER-9 KEYPAD
This section basically consists of a Linear Keypad. Basically a Keypad can be classified into 2 categories. One is Linear Keypad and the other is Matrix keypad. 1. Matrix Keypad. 2. Linear Keypad.
1. Matrix Keypad: This Keypad got keys arranged in the form of Rows and Columns. That is why the name Matrix Keypad. According to this keypad, In order to find the key being pressed the keypad need to be scanned by making rows as i/p and columns as output or vice versa. This Keypad is used in places where one needs to connect more no. of keys with less no. of data lines. 2. Linear Keypad: This Keypad got n no. of keys connected to n data lines of microcontroller. This Keypad is used in places where one needs to connect less no. of keys. Generally, in Linear Keypads one end of the switch is connected to Microcontroller (Configured as i/p) and other end of the switch is connected to the common ground. So whenever a key of Linear Keypad is pressed the logic on the microcontroller pin will go LOW.
SRTIST/ECE
Page 46
Here in this project, a linear keypad is used with switches connected in a serial manner. Linear keypad is used in this project because it takes less no. of port pins. The Linear Keypad with 4 Keys is shown below.
SRTIST/ECE
Page 47
SRTIST/ECE
Page 49
Name
Vcc DOUT DIN/CONFIG DO8 RESET PWM0/RSSI PWM1 [reserved] DDR/SLEEP_RQ/DI8 GND AD4/DIO4 CTS/DIO7 ON/SLEEP VREF
Direction
Output Input Output Input Output Output Input Either Either Output Input
Description
Power Supply UART Data Out UART Data In Digital Output 8 Module Reset PWM Output 0/RX Signal Strength Indicator PWM Output 1 Do not connect Pin Sleep Control Line or Digital Input 8 Ground Analog Input 4 or Digital I/O 4 Clear-to-Send Flow Control or Digital I/O 7 Module Status Indicator Voltage Reference for A/D Inputs Associated Indicator, Analog Input 5 or Digital
15
Associate/AD5/DIO5
Either
16 17 18 19 20
Digital I/O 6 Analog Input 3 or Digital I/O 3 Analog Input 2 or Digital I/O 2 Analog Input 1 or Digital I/O 1 Analog Input 0 or Digital I/O 0
SRTIST/ECE
Page 50
11.3 FEATURES:
a) Performance: Parameters Indoor/Urban Range Outdoor RF (LOS) Transmit Power Output RF Data Rate Serial Interface Data Rate Receiver Sensitivity Value 30m 100m 1mW (0dBm) 250,000bps 1200-115200bps -92dBm
b) POWER REQUIREMENTS:
Parameters
Supply Voltage Transmit Current Receive Current
Value
2.8 - 3.4V 45mA 50mA
SRTIST/ECE
Page 51
C) General: Parameters
Operating Frequency Dimensions Operating Temperature Antenna Options
Value
ISM 2.4GHz 2.468 x 2.761 -40o to 85o C Integrated Chip Antenna
SRTIST/ECE
Page 52
monitoring applications within the private home and industrial environment. The working model of the IEEE 802.15.4 and Zigbee is illustrated in Figure 6.9.
FIG: 11.2 ZIGBEE ARCHITECTURE . The software and hardware vendor will provide the software stack with appropriate tools to allow an OEM to create applications, which are added to the APL. The Physical (PHY) layer and Medium Access Control (MAC) layer are based on the IEEE802.15.4 PAN standard. This includes the actual radio hardware. Above the MAC and PHY are the Network (NWK) and application layers defined by Zigbee. The first two layers, the physical (PHY) and Medium Access Control (MAC) are defined in the IEEE standard. The other layers that build on the PHY and MAC layers are defined by the Zigbee alliance.
SRTIST/ECE Page 53
The PHY layer contains the RF transceiver and access to the other hardware and control mechanisms. The function of the PHY is to activate and deactivate the radio transceiver and other hardware specific services such as access to the channels. The MAC layer is as described by the name a controlling device for radio medium. It controls access to the physical radio channel and other services defined by the PHY service. The network (NWK) layer is responsible for the network controlling functions. It controls the mechanism for joining and leaving a network and for creating a network for those devices which have the capability to do so. The NWK layer applies also security to what is going to be data packets. The NWK layer is responsible for discovery and storing information about the neighbors in the network. The application layer (APL) consists of three different blocks which have different functionalities and responsibilities. The application support sub-layer (APS) is responsible for maintaining a table of devices that are connected to each other, a binding table. The APS layer provides an interface between the NWK layer and the APL with its set of services.
11.5MODES OF OPERATION:
The Transceiver operates in five modes .They are 1. Idle Mode 2. Receive mode 3. Transmit Mode 4. Sleep Mode 5. Command Mode
SRTIST/ECE
Page 54
FIG: 11.3 DIFFERENT MODES OF OPERATION The operation of Transceiver in each mode is explained below
1. Direct Transmission:
Once the End Device either transmits data to the Coordinator or polls the Coordinator for data, the Coordinator will use direct transmission for all subsequent data transmissions to that module address until ST time (or number of beacons) occurs with no
SRTIST/ECE
Page 55
activity (at which point it will revert to using indirect transmissions for that module address).
2. Indirect Transmission:
A packet is retained for a period of time and is only transmitted after the destination module (Source Address = Destination Address) requests the data. To configure Indirect Transmissions in a PAN (Personal Area Network), the SP (Cyclic Sleep Period) parameter value on the Coordinator must be set to match the longest sleep value of any End Device.
SRTIST/ECE
Page 56
SOURCE CODE
#include<reg52.h> #include<serial.h> #include<lcd216.h> sbit Mains = P2^2; sbit K_Inc = P3^7; sbit K_Dec = P3^6; sbit K_Ent = P3^5; bit v_msg,flag2,flag3,msgrx_flag=0; unsigned char idata str[6],v_id[6]; int count; void Display_Amt(unsigned int); unsigned char Pay_Bill(); bit ZigBee_Flag=0; unsigned char idata a[50],i=0,Meter_No[5]; void intr(void) interrupt 4 using 2 { if(RI==1) { RI=0; a[i]=SBUF; a[i]='\0'; i=0; i++; }
SRTIST/ECE Page 57
} void ex_int0(void) interrupt 0 { meter_flag=1; } void main() { int amount,amount_pre,ZigBee_Data,CU; unsigned char j=0; bit Demo_flag = 0,Demo_Mode_Flag = 0; Mains=0; LCD_Init(); LCD_Cmd(0x80); Disp_Str(" Wireless Power "); LCD_Cmd(0xC0); Disp_Str(" Meter Reading"); Delay(100); SConfig(); ES=0;Send("AT+DMODE");Send_Char(0X0D);Delay(10);ES=1; Delay(100); LCD_Cmd(0x80); Disp_Str(" ZigBee "); // converting
SRTIST/ECE
Page 58
{ if(strcmp(&a[0],"2222")==0) { LCD_Cmd(0x80); Disp_Str("Sending Last Mth"); LCD_Cmd(0xC0); Disp_Str("Bill to the HHD "); Delay (200); EEPROM_Read(0x04,4); ZigBee_Data = atoi(eeprom_data); LCD_Cmd(0xC0); Disp_Str(eeprom_data); Send (eeprom_data); Send_Char(0x0D); Delay (200); } if(strcmp(&a[0],"0000")==0) { LCD_Cmd(0x80); Disp_Str("Sending Last Mth"); LCD_Cmd(0xC0); Disp_Str("Bill paid "); Delay (200); EEPROM_Read (0x04,4); ZigBee_Data = atoi(eeprom_data); LCD_Cmd(0xC0); Disp_Str(eeprom_data); Send (eeprom_data); Send_Char(0x0D); Delay (200); } else {
SRTIST/ECE
Page 59
LCD_Cmd(0x80); Disp_Str(" Invalide msg "); LCD_Cmd(0xC0); Disp_Str(" Format Delay(200); } } } } void convert_disp_new(unsigned char mybyte) { unsigned char lsb,msb; msb = mybyte/10; lsb = mybyte%10; LCD_Data(msb+0x30); LCD_Data(lsb+0x30); } unsigned char convert_disp(unsigned char value) { unsigned char y,x,temp; x=value&0x0F; y=value&0xF0; y=y>>4; temp = (y*10) + x; x=x+0x30; y=y+0x30; LCD_Data(y); LCD_Data(x); return temp; } ");
SRTIST/ECE
Page 60
RESULT
CONSUMER SECTION:
SRTIST/ECE
Page 61
SUBSTATION SECTION:
SRTIST/ECE
Page 62
APPLICATIONS
This project improves customer services by reducing the maltreatment of data and replaces the difficulties like involvement of distance and accessibility of measurement points. With the system described, customer service is improved through remote and automated meter reading, more credible utility bills and efficient data management. Provides security Saves time Highly reliable The meter reading and management processes are free from human errors.
SRTIST/ECE
Page 63
FUTURE SCOPE
For paying electricity bills we have to go to e-seva, this is very time consuming process and in electrical department side there may be a chance of errors in noting the units and issue of monthly bills. This can be overcome in our project. A further improvement can be made by adding a prepaid system, so that the consumers dont need to go to e-seva to pay the bill. Here we use an access card to pay the bill. As there is a chance of malfunction, the consumer is identified by inserting a plastic access card with a magnetic stripe or a plastic smart card with a chip that contains a unique card number and some security information. Authentication is provided by the customer entering a pin number (code) to pay the bill. By scratching the card and entering the code, the consumer can pay the bill. New features such as multi-tariff billing, reactive energy management and power quality monitoring are also possible in this system to improve generation, distribution, customer service and billing. This will not only help the service providers of power to offload the manpower, the trouble to collect energy meter readings and organizing bill preparation, but also provide consumers an online tracking system to regulate the energy bill ultimately.
SRTIST/ECE
Page 64
CONCLUSION
The project Intelligent Online Measurement and Management of Energy Meter Data through Advanced Wireless Network has been successfully designed and tested. Integrating features of all the hardware components used have developed it. Presence of every module has been reasoned out and placed carefully thus contributing to the best working of the unit. Secondly, using highly advanced ICs and with the help of growing technology the project has been successfully implemented. The objective of developing a wireless energy meter-reading system is not only to have high accuracy over a wide current dynamic range, better reliability and robustness but also to face the weakening competence in meter reading in localities such as increasingly over crowded big cities, overpopulated rural, sub urban regions and remote or snowy districts. In order to accommodate the advanced requirements not available in electromechanical meters, manufacturers have begun adopting all-electronic solutions. With the system described, customer service is improved through remote and automated meter reading, more credible utility bills and efficient data management.
SRTIST/ECE
Page 65
BIBLIOGRAPHY
TEXT BOOKS:
The 8052 Micro controller and Embedded Systems by -Muhammad Ali Mazidi, Janice Gillispie Mazidi Electronic Components -D.V.Prasad Wireless Communications - Theodore S. Rappaport Power systems by C.L. Wadhwa Electrical Machines by J.B. Gupta
WEB REFERENCES:
www.citeseerx.ist.psu.edu/viewdoc/download . http://focus.ti.com/docs/prod.html . www.8052.com www.electronicstutorial.com www.electronicsforyou.com www.abcofelectronics.com
SRTIST/ECE
Page 66