Sunteți pe pagina 1din 58

CHAPTER ONE 1.0 1.

1 INTRODUCTION Background Electricity theft is not a new phenomenon but it is becoming important because of its impact on the cost of electricity to consumers and the utility companies alike. Unlike other forms of theft, electricity theft hardly carries strict penalties. Recently, however, there has been the development of more policies and stronger legislative power to deal with those who take part in the fraudulent extraction of electricity. There are four main ways that electricity can be accessed illegally. Electricity can be fraudulently accessed through illegal hookups, meter tampering or bypass, billing irregularities and unpaid bills. Illegal hookups occur when electrical wires are directly connected to the grid system from the individuals premises. High risks of electrocution and electrical fires are associated with this type of electricity theft. Technically, this type of theft is the least sophisticated and is usually practiced by poorer households. It is also very easy to detect. Meter related theft is hardly found among poor households because it is technically sophisticated and usually requires some electrical wiring knowledge. Meter tampering can be done by inserting a device into the meter resulting in an inaccurately lower reading on the meter. This tampering can be detected only by an audit on the premises or by discrepancies in the electricity bill. Meter bypass occurs when some of the wiring of the premises is engineered to not pass through the meter. Like meter tampering, this is also very difficult to detect. Billing irregularities is a manifestation of corruption in the utility company through bribes to utility officials. Usually, the meter reader is compensated for not reporting the accurate electricity usage of the property. This method again, is not a popular option with the poor. Refusal to pay electricity bills is a common practice by all socioeconomic groups. The utility company has the greatest control over this since they are able to disconnect customers for unpaid bills. Disconnections are usually a prelude to another form of electricity fraud. In spite of this knowledge, there still remains a vague understanding of how much theft is being stolen by different groups of the society.

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

Power theft is a serious problem and its among some of the challenges confronting most African countries specifically the south Sahara countries which Ghana is not exceptional. Power theft when not checked and prevented can derail the growth and progress of an economy. It can also leads to frequent power outages due to lack of funds by the Electricity company to import power equipments like transformer and others to augment the demands of electrical power to both domestic and industrial consumers. The source of this illegal connection of power supply is mainly due to lack of proper monitoring system Most cases of electricity theft occur when violators physically alter the internal mechanism of their electric meters, causing the electricity to bypass the meter and not be recorded. As a result, violators are not charged for the total number of kilowatt-hours actually used, causing lost revenue for the electricity providers. In addition, tampering with live electricity inside a meter is dangerous and could result in a fire, shock or even death to the perpetrator. Utility staff could also be injured when later repairing the meter. Below are some of the common methods of identifying electricity theft: Financial Rewards Utility companies encourage consumers to report electricity theft, sometimes offering big reward for information leading to conviction of anyone stealing electricity. Unfortunately, most cases are never identified in both domestic and industrial setup due to lack of timely information. Periodic Checks Electricity theft frequently takes place after service has been disconnected. Some utility companies periodically checks disconnected meters if customers has not contacted them to reconnect services. This labor- intensive, manual process has little chance of success given that the apartment averages 70% turnover of tenants annually. Meter Readers Utility meter readers typically suspect that electricity theft is taking place when they find a broken meter tag or other signs of tempering. But as more utility companies outsource the meter reading function to third parties, training meter readers to detect theft is becoming more difficult and less efficient. In addition third party meter readers do not read disconnected meters. Harrison Kwaku Korankye, BEng (Hons), Regent Ghana 2

It is as a result of the above shortcomings in finding the power theft perpetrators and bringing them to face justice that this noble project work is being undertaking to bring the violators to limelight and expose them of their shameful deeds. Theft of electricity is a social evil. No country is free from its attack. Millions of dollars worth electricity is being pilfered every year. These costs are routinely passed to honest consumers in the form of higher electricity charges. Most countries have treated it as a criminal offence also. But crooks always have one step ahead of any anti tampering system or vigilance system of a utility. They stay in this business purely through their flair to circumvent any obstruction that may come on their way. Now, remotely operated power theft, frequency tampering, tampering by harmonics waves etc is common. Indeed, energy theft is a huge and growing problem. That problem is even more aggravated by the fact that there is very few information about those losses. Attempting to steal electricity by tampering with a meter or equipment can get someone killed. It also creates a dangerous safety hazard for the public and Clay Electric employees. The theft of electricity also affects all of the coop's members. When someone steals electricity, they're really stealing from their neighbors and other co-op members. Power thieves can typically afford to pay their electric bills, they just want to see if they can get away with it. Most are caught, and some of these thieves are seriously injured or killed by electrical contact accidents. If you suspect someone is stealing electricity, please call your nearest Clay Electric district office and report this illegal activity. It's not necessary to identify yourself when making a report. 1.2 Problem Statement Following both the previous and current Ghana government administration to hook every single village in Ghana to the national electricity grid, power usage has been on a higher side for the past decade now. It is a known fact that every investment made by either individuals or government should yield a positive profit returns in order to continue with different projects in other sectors of the economy. But it has always been a difficult task for the government of the day and the Electricity Company of Ghana to achieve their aim Harrison Kwaku Korankye, BEng (Hons), Regent Ghana 3

due to power theft activities. A recent research conducted indicates that about 30-35 percent of the profit generated by the ECG goes waste due to power theft. Previous attempt by the ECG to hire manpower to monitor the activities has not yielded positive results due to the corrupt practices of some of these personnel. This project aims at eliminating all these difficulties by designing a simple device to sound an alarm whenever there is a power theft activity at a certain cluster of an area. 1.3 General Objective Power theft which is otherwise known as illegal connections is currently gaining grounds in Ghana and its seriously having a negative impact on our economy despite all effort by the Electricity Company of Ghana (ECG) to reverse the trend. Generally this project work is aiming at helping the power utility companies to arrest and prosecute people who are behind this crime. 1.4 Specific Objective of the Study The objectives of this project are: To propose a microcontroller base power theft device for a prompt identification of power theft activities. To minimize the rate of illegal tapping of power supply for both domestic and industrial usage. To maximize revenue generation by the power utility companies. To minimize the higher cost of hiring power taskforce to monitor the activities.

1.5

Scope of Study Before starting this project one should have a fair degree of skill in assembly and soldering. Knowing your resistor and capacitor codes, and components position on PCB boards is important because when working with a microchips such as microcontroller, it is important to observe all the principles behind in terms of soldering and with respect to temperature. This might change the characteristics of the circuit consequently results in

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

poor performance. The characteristics of the circuit consists of the microcontroller, the LCD and the power supply unit. 1.6 Significance of project To help add to the existing knowledge of similar design To help us to acquire more knowledge in the field of electricity utilization and the relationship of its customers It will provide literature for other students, researchers and other people who are interested in the field of engineering To add up to the existing knowledge in the field of engineering. To replace the traditional way of taskforce moving from house to house in monitoring an illegal connections. To maximize the profit margin of power utility company in order to provide an uninterrupted power supply. 1.7 Limitations The major component (AT89C51) microcontroller IC chip used in construction of power theft identification is expensive and very difficult to come by since few of them are in market. Simulation softwares like MAT LAB, Multisim, Lab view etc. dont have thi s type of IC in the Lab. Because of this simulation of the project was very difficult. 1.8 Organisation of Study The research work is organized as follows: Literature review is captured in chapter two. Chapter three focuses on the methodology of the work. System analysis, identification of system component various limitations, merit and demerit is captured in chapter four with Chapter five concentrating on the system design, development and implementation of the project work. Chapter five talks about the results and discussions as well as cost analysis involved of the project work. Chapter six concludes the work with summary, conclusion and recommendation of the work.

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

CHAPTER TWO 2.0 LITERATURE REVIEW

2.1

History of power theft Identification

The electrical power theft goes back more than two thousand years, to the time the Ancient Greeks discovered that rubbing fur on amber caused an attraction between the two. By the 17th century, many electricity-related discoveries had been made, such as the invention of an early electrostatic generator, the differentiation between positive and negative currents, and the classification of materials as conductors or insulators. In the year 1600, English physician William Gilbert conned the term electric, from the Greek elektron, to identify the force that certain substances exert when rubbed against each other. Just after this beautiful discovery, electricity was produced in large and commercial quantities with many similar discoveries that go with the use of electrical power which makes its used very attractive and convenient to many consumers. As people enjoys this essential commodity which basically does not come free because power utility companies surely have to accrue money from consumers to be able purchase power equipments to ensure uninterrupted power supply. Consumers trying as much as they could to outwit the utility companies device a means of scaling down the readings of meters. Electricity theft, an ongoing problem for all electricity providers, is punishable by jail time, a fine or both in the Ghana. Most cases of electricity theft occur when violators physically alter the internal mechanism of their electric meters, causing the electricity to bypass the meter and not be recorded. As a result, violators are not charged for the total number of kilowatt-hours actually used, causing lost revenue for the electricity providers. In addition, tampering with live electricity inside a meter is dangerous and could result in a fire, shock or even death to the perpetrator. Utility staff could also be injured when later repairing the meter. Several studies have been done to prevent this power theft, Authors in [4] extensively studied NTL detection of electricity theft and abnormalities for large power consumers In TNB Malaysia where they raised the issue of dishonesty of the Electricity consumer being a problem faced by all power utilities and tried toFind efficient measurements for detecting fraudulent electricity consumption has been an active research area in recent years. Nagi and the group presented an approach towards detection of Non-technical Losses (NTLs) of

Large Power Consumers (LPC) in Tenaga Nasional Berhad (TNB) Malaysia. The main Harrison Kwaku Korankye, BEng (Hons), Regent Ghana 6

motivation of the study is to assist Tenaga Nasional Berhad (TNB) Sdn. Bhd. in Malaysia to reduce its NTLs in the LPC distribution sector. Remote meters installed at premises of LPC customers transmit power consumption data including remote meter events wirelessly to TNB Metering Services Sdn. Bhd. The remote meter reading (RMR) consumption data for TNB LPC customers is recorded based on half-hourly intervals. The technique proposed in this paper correlates the half-hourly RMR consumption data with abnormal meter events. The correlated data provides information regarding consumption characteristics i.e. load profiles of LPC customers, which helps to expose abnormal consumption behavior that is known to be highly correlated with NTL activities and electricity theft. Pilot testing results obtained from TNB Distribution (TNBD) Sdn. Bhd. for onsite inspection of LPC customers in peninsular Malaysia indicate the proposed NTL detection technique is effective with a 55% detection hitrate. With the implementation of this intelligent system, NTL activities of LPC customers in TNB Malaysia will reduce significantly. 2.2 Hu Xiaoxi power theft detection method

A novel anti-theft and detection method of street lamp power cables was also studied by Hu Xiaoxi et al [5] where a novel anti-theft and detection method of street lamp power cables is presented in the paper. A tunable capacitor is parallel connection with the single-phase bus on the transformer' outlet side. The frequency which makes the input impedance's imaginary part zero can be found by injecting a variable Frequency Constant signal. The number of lamp which connect to the street lamp system can be calculated. Whether the cable is stolen or not can be judged, and the fault location can be calculated. The novel method is no necessary to add equipment to the end of street lamp power cables, and it's not influenced by power transformer types and the cable length. Simulation experimentations are carried out. Simulation results show that the method is simple and correct. Nagi and the group again [6] studied Nontechnical Loss Detection for Metered Customers in Power Utility Using Support Vector Machines where they presented a new approach towards nontechnical loss (NTL) detection in power utilities using an artificial intelligence based technique, support vector machine (SVM). The main motivation of this study is to assist Tenaga Nasional Berhad (TNB) Sdn. Bhd. in peninsular Malaysia to reduce its NTLs in the distribution sector due to abnormalities and fraud activities, i.e., electricity theft. Harrison Kwaku Korankye, BEng (Hons), Regent Ghana 7

The fraud detection model (FDM) developed in this research study preselects suspected customers to be inspected onsite fraud based on irregularities in consumption behavior. This approach provides a method of data mining, which involves feature extraction from historical customer consumption data. This SVM based approach uses customer load profile information and additional attributes to expose abnormal behavior that is known to be highly correlated with NTL activities. The result yields customer classes which are used to shortlist potential suspects for onsite inspection based on significant behavior that emerges due to fraud activities. Model testing is performed using historical kWh consumption data for three towns within peninsular Malaysia. Feedback from TNB Distribution (TNBD) Sdn. Bhd. for onsite inspection indicates that the proposed method is more effective compared to the current actions taken by them. With the implementation of this new fraud detection system

TNBD's detection hitrate will increase from 3% to 60%.Another study under Improving SVMBased Nontechnical Loss Detection in Power Utility Using the Fuzzy Inference System was undertake by Keem Siah and the group [7] where they modeling a nontechnical loss (NTL) framework for the detection of fraud and electricity theft in power distribution utilities. Previous work was carried out by using a support vector machine (SVM)-based NTL detection framework resulting in a detection hitrate of 60%. They presented the inclusion of human knowledge and expertise into the SVM-based fraud detection model (FDM) with the introduction of a fuzzy inference system (FIS), in the form of fuzzy IF-THEN rules. The FIS acts as a post processing scheme for short-listing customer suspects with higher probabilities of fraud activities. With the implementation of this improved SVM-FIS computational intelligence FDM, Tenaga Nasional Berhad Distribution's detection hitrate has increased from 60% to 72%, thus proving to be cost effective.

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

2.3 E-Metering solution for checking energy theft Also e-metering solution for checking energy thefts and streamlining revenue collection in India was studied by the Authors in [8] and proposed e-metering, a special class of distributed data network. The e-metering data possess unique characteristics and the network needs innovative technology to record, monitor and process the data. The data are processed to collect information of defaulting customers, power usage profile of an area and of a consumer, supply outage time and losses incurred in distribution system. This system is capable of measuring and estimating the quality of power supplied to the consumers. It consists of data acquisition, transmission and processing components among the energy meters, local area stations and base stations. The application of the e-metering system is extended to streamline power distribution with online monitoring of power quality, real time theft detection and automatic billing. The facility can be extended to connect water and gas meters to this system using the meter interface units (MIUs) to develop a remote unified billing system. Parra et al did comprehensive studies on the Use of the Shunts Detecting Equipment for the Identification of Illegal Power Outlets [9] finding a great incidence or electrical fraud by means of unauthorized connections to the energy main, hidden by means of perforations in sidewalks and walls. To locate these clandestine derivations techniques and strategies have been implemented to speed the search, however it has been necessary to implement specialized tools to make the task easier. The lines detector has been one of the most effective tools used in the identification of illegal connections, managing to reduce in more than 50 %, the time of detection and, in more than 80% the cost due to this concept.

Mohammed and others conducted a researched on Non-Technical Loss analysis for detection of electricity theft using support vector machines in [10] and proposed a model that preselects

suspected customers to be inspected onsite for fraud based on irregularities and abnormal consumption behavior. This approach provides a method of data mining and involves feature extraction from historical customer consumption data. The SVM based approach uses customer load profile information to expose abnormal behavior that is known to be highly correlated with NTL activities. The result yields classification classes that are used to shortlist potential fraud suspects for onsite inspection, based on significant behavior that emerges due to irregularities in Harrison Kwaku Korankye, BEng (Hons), Regent Ghana 9

consumption. Simulation results prove the proposed method is more effective compared to the current actions taken by TNB in order to reduce NTL activities. Detection and Identification of Abnormalities in Customer Consumptions in Power Distribution Systems was analyze by Authors in [11] and proposed a computational technique for the classification of electricity consumption profiles. The methodology is comprised of two steps. In the first one, a C-meansbased fuzzy clustering is performed in order to find consumers with similar consumption profiles. Afterwards, a fuzzy classification is performed using a fuzzy membership matrix and the Euclidean distance to the cluster centers. Then, the distance measures are normalized and ordered, yielding a unitary index score, where the potential fraudsters or users with irregular patterns of consumption have the highest scores. The approach was tested and validated on a real database, showing good performance in tasks of fraud and measurement defect detection.

2.4 Heewan Park power theft detection method Heewan Park et al analyze Detecting code theft via a static instruction trace birthmark for Java methods [12] where a software birthmark was an inherent program characteristic that can identify a program. They proposed a static instruction trace birthmark to detect code theft of Java methods. Because the static instruction traces can reflect the algorithmic structure of a program, our birthmark can be used to detect algorithm theft which existing static birthmarks cannot handle. Because the static instruction traces are extracted by static analyses, they can be applied to library programs which previous dynamic birthmarks could not and evaluate the proposed birthmark with respect to two criteria: credibility and resilience. Experimental result shows that our birthmark is more resilient than and at least as credible as the existing Java birthmarks. Similarly, Detection technology of phishing was studied by Huang et al. Phishing is a form of online identity theft. Phishers use social engineering to steal victims' personal identity data and financial account credentials. Social engineering schemes use spoofed e-mails to lure unsuspecting victims into counterfeit websites designed to trick recipients into divulging financial data such as credit card numbers, account usernames, passwords and social security numbers. They proposed a thorough overview of a phishing attack and detection techniques is presented. Firstly, technologies used by phishers and the definition, classification and future works of deceptive phishing attacks are discussed. Harrison Kwaku Korankye, BEng (Hons), Regent Ghana 10

Following with the existing detection techniques in literatures and research-stage technologies were shown, and a thorough analysis that shortcomings of countermeasures was given. The above analyses and importance notwithstanding, power theft detection needs further investigation especially in the context of its performance in coexistence with other systems. In this contextan energy conservation system which saves electricity from being theft due to lack of monitoring system. We are monitoring the line voltage of the system continuously using a power line monitoring system. In the event of power theft, the power line monitoring system will automatically sense the dip in voltage due to power theft and sends the information to the PC about the power theft. This system will automatically trip the main power line in the event of theft and save electricity.

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

11

CHAPTER THREE 3.0 METHODOLOGY 3.1.0 Introduction The approach to this project is divided into two parts: the hardware and the software. The hardware will cover component acquisition, testing and building the entire circuit whiles the software which will concentrate on performance analysis of the complete circuit diagram 3.1.1 Components The main components used in the construction of this project were acquired imported from Interlogicx Embedded Solutions, India: printed circuit board, interconnection wires, Infra-red sensors, photo transistors, L324 op-amp, A89C52 microcontroller chip, LCD display, 12MHz crystal clock. The others were purchase from the electronic shops locally. 3.1.2 Tools Tools used to build the circuit include the following: a working bench, a clean duster, a set of electrician screw drivers, a pair of pliers, cutters, scissors, files, hole punchers, sand paper, an electrical extension board, multimeter, soldering iron and led. 3.1.3 Testing. Each of the components was tested using a multimeter to know of their viability before putting each into the circuit. 3.1.4 Casing of the system A polished chip board, screws, glue and veneer were used to house enclose the system.

3.1.5 Circuit Design The circuit was design on a paper and was transformed in to software using Multisim software and paint. All external component including the resistor, capacitor, and the power circuit were design with Multisim. The AT89C51

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

12

microcontroller is also design using paint to finally complete the circuit design. The complete power circuit is simulated with Multisim to proved output of 9v Paint is used in the design because simulation software like Multisim, MAT LAB, Electronics work bench, Lab view doesnt have the IC AT89C51

3.1.6 PCB Preparation the circuit layout is design using PCB layout software with components dimensions. The layout is printed on a P and N paper. A 60mm x 130mm PCB is shined with a steel wool. Iron fill are clean with cotton. The Clean Surface is heated with an electric iron with a paper between the iron and the PCB. The Printed layout is placed on the hot surface and it heated again for 10min and finally it is cooled. The P and N paper is removed and the circuit layout is marked on the PCB. An Ammonia Sulfate solution is prepared and the PCB is placed inside for 15min to remove the unwanted lines. A 1mm hole is drilled on the PCB for component mounting. 3.1.7 Assembling All components were mounted at their positions and soldered Heat sink was used on AT89C51 during soldering to prevent damaging due to heat.

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

13

Mounted Antenna on Mica box by an aluminum bracket brackets fastened with 3mm x 4mm screws and nuts and soldered to circuit with a 1.5mm2 flexible cable. Three interlocking push button switched are mounted on enclosure and joined to circuit via a 1.5 mm2 flexible cable. The Prototype is enclosed with 20cm x 14cm x 10cm Mica glass
3.2 Hardware components

3.2.1 Resistors The indicated code value of the resister was red in the Schematic Diagram. Selected an Ohmscale way below the indicated value. A resister is good if its resistance is close to the indicated value. Tolerance should be considered with Ohmmeter reading. While no resistance reading at all on the Ohmmeter scale settings means that the resister is open. A zero resistance reading on all Ohmmeter scale settings means that the resistor is shorted. Example a 1K resistor was tested. It is represented with Brown, Block and Red Color were Brown is one ( 1), Block is zero (0) and Red is the multiplier of two (2) that is 10 2 with Gold tolerance of 5%. We will identify a resistor of 1K. Reading with FLUKE 117 Multi - meter An Ohmmeter range of 10K was selected on the multi meter The meter probes was placed at the two terminals of the resistor The reading of the resistor value is displayed on the screen

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

14

3.2.2 Light Emitting Diode (LED) Set the Multi-meter to x1. Connect the positive probe to cathode and the negative probe to anode. The good and working LED will then light up or glow. A busted one will not.

Figure3.1 Testing an LED Diode 3.2.3 Capacitors For an electrolytic capacitor (capacitor with polarity), short the terminals to discharge it prior to testing. Set the multimeter to Rx10 or Rx1K scale. Connect the tester negative probe to the capacitor positive terminal and the positive probe to the negative terminal. A good indicator shows the meter needle deflecting towards zero and moves back again to infinite resistance position. For other capacitors with capacitance of less than 1.0 Micro farad, the meter will not deflect at all. A defective indication shows that the meter pointer will rest on zero and remain stationery at a point which is an indication that the capacitor is shorted. In most cases, a capacitor fails due to the deterioration of the dielectric material between its plates. Defective capacitors can have an internal shorted terminals, excessive leakage or degradation of the capacitance meter. Reading with Capacitance Meter The range of the capacitance was selected on the meter The meter probes was placed at the two terminals of the Capacitor The reading of the Capacitor value is displayed on the screen

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

15

3.2.4 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. 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. The maximum output current for the popular 555 timer IC is 200mA so these devices can supply relay coils directly without amplification. The relay's switch connections are usually labelled 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.

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

16

3.2.5 Diodes Set the multimeter knob to any of the resistances (x1, x10, x1K, x10K Ohm). Connect the positive probe to the anode and the negative probe to the cathode. Then connect the negative probe to the anode and the positive probe to the cathode of the diode. A good indication in the first procedure will show the meter deflected very little or may not deflect at all. And in the second procedure, the meter will deflect towards zero. The actual resistance reading is the forward resistance of the diode. A defective indication shows that the meter will not deflect at all even when the probes are reversed. Or the meter deflects at the same time or almost the same resistance reading for both steps.

3.2.6 Transistors Bipolar transistors are usually checked out of a circuit by means of an ohmmeter. When the ohmmeter is desired to check for resistance across the transistor emitter and collector, NPN or PNP, ohmmeter probes may be connected either way. A good transistor will show above a reading above 1000 ohm. How to determine NPN or PNP transistor? To determine the correct terminal of the transistors, set the range selector to x1 or x10 ohm. Connect the positive probe to the emitter and the negative probe to the base of the transistor. Note that the readings interchange the connection of the probes to the leads of the transistor. The conclusion is based on the procedure below: POSITIVE PROBE TO: ---NEGATIVE PROBE TO:---RESISTANCE READING---

CONCLUSION: Emitter ------Base-----Less than 150 ohms -----Transistor is NPN Base ---------Emitter--------Infinity--------Transistor is NPN

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

17

POSITIVE

PROBE

TO:----NEGATIVE

PROBE

TO:---RESISTANCE

READING:---

CONCLUSION: Emitter-------Base-------Infinity-------Transistor is PNP Emitter------Base------Less than 150 ohms---Transistor is PNP Some defective indications of transistors: Resistance between any pairs of terminals less than 10 ohms means that the transistor is shorted. Resistance between base and emitter or base collector for the forward and reverse application of ohmmeter probes is infinity (meter needle do not deflect), means that the transistor is open. Transistor overheats (except power transistors) during normal operating condition means that the transistor is shorted.

3.2.7 Software Section In this section simulation software example MAT LAB and Multisim was used to test the performance parameters [16] of the receiver which include test on Sensitivity, Fidelity and Image frequency rejection.

3.2.8 Programming The programming language employed to run the microcontroller was C51 optimizing C cross compiler. The C programming language is a general-purpose programming language that provides code efficiency, elements of structured programming, and a rich set of operators. Its generality, combined with its absence of restrictions, make C a convenient and effective programming solution for a wide variety of software tasks. Many applications can be solved more easily and effectively with C than with other more specialized languages. The C51 compiler generates code for the 8051 microprocessor but is not a universal C compiler adapted for the 8051 target. The C51 compiler gives software developers the flexibility of programming in C while matching the code efficiency and speed of assembly language. Using a high-level language like C has many advantages over assembly language programming. For example:

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

18

Knowledge of the processor instruction set is not required. A rudimentary knowledge of the 8051s memory architecture is desirable but not necessary. Register allocation and addressing mode details are managed by the compiler. The ability to combine variable selection with specific operations improves program readability. Keywords and operational functions that more nearly resemble the human thought process can be used. Program development and debugging times are dramatically reduced when compared to assembly language programming. The library files that are supplied provide many standard routines (such as formatted output, data conversions, and floating-point arithmetic) that may be incorporated into our application.

Existing routine can be reused in new programs by utilizing modular programming techniques available with C. The C language is very portable and very popular. C compilers are available for almost all target systems. Existing software investments can be quickly and easily converted from or adapted to other processors or environments.

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

19

4.0 SYSTEM DESIGN, DEVELOPMENT AND IMPLEMENTATION

4.1 Block diagram of the proposed design

Figure 4.1

Block Diagram of the Proposed Design

4.2 Power Theft Detection Circuit The Power theft detection circuit consists of a relay driver, the relay itself and a tripper. With the help of the Microcontroller AT89C51, under normal circumstance when there is No power theft activity ,the line to neutral voltage display on the LCD is between 220Harrison Kwaku Korankye, BEng (Hons), Regent Ghana 20

240v.

But as soon as there is a power theft going on the voltage immediately reduces below 200v the detection circuit sense the sudden reduction of voltage the buzzer then sound an alarm to signify an ongoing power theft activity.

4.3 Microcontroller AT89C51 The AT89C52 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy a parallel address space to the Special Function Registers. That means the upper 128 bytes have the same addresses as the SFR space but are physically separate from SFR space. When an instruction accesses an internal location above address 7FH, the address mode used in the instruction specifies whether the CPU accesses the upper 128 bytes of RAM or the SFR space. Instructions that use direct addressing access SFR space. For example, the following direct addressing instruction accesses the SFR at location 0A0H (which is P2). Instructions that use indirect addressing access the upper 128 bytes of RAM. For example, the following indirect addressing instruction, where R0 contains 0A0H, accesses the data byte at address 0A0H, rather than P2 (whose address is 0A0H). MOV @R0, #data Note that stack operations are examples of indirect addressing, so the upper 128 bytes of data RAM are available as stack space.

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

21

4.4 CIRCUIT DIAGRAM FOR THE PROPOSED DESIGN

Figure 4.2 Circuit Diagram for the proposed Design

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

22

4.5

HARDWARE DESCRIPTION

The Intel 8051 microcontroller is one of the most popular general purpose microcontrollers in use today. The success of the Intel 8051 spawned a number of clones which are collectively referred to as the MCS-51 family of microcontrollers, which includes chips from vendors such as Atmel, Philips, Infineon, and Texas Instruments. 4.6 8051 Microcontroller

The Intel 8051 is an 8-bit microcontroller which means that most available operations are limited to 8 bits. There are 3 basic "sizes" of the 8051: Short, Standard, and Extended. The Short and Standard chips are often available in DIP form, but the Extended 8051 models often have a different form factor, and are not "drop-in compatable". All these things are called 8051 because they can all be programmed using 8051 assembly language, and they all share certain features (although the different models all have their own special features). Some of the features that have made the 8051 popular are:

8-bit data bus 16-bit address bus 32 general purpose registers each of 8 bits 16 bit timers (usually 2, but may have more, or less). 3 internal and 2 external interrupts. Bit as well as byte addressable RAM area of 16 bytes. Four 8-bit ports, (short models have two 8-bit ports). 16-bit program counter and data pointer

8051 models may also have a number of special, model-specific features, such as UARTs, ADC, OpAmps, etc...

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

23

4.7 Typical applications 8051 chips are used in a wide variety of control systems, telecom applications, robotics as well as in the automotive industry. By some estimations, 8051 family chips make up over 50% of the embedded chip market.

Figure 4.3 Pin diagram of the 8051 DIP 4.7.0 Basic Pins PIN 9: PIN 9 is the reset pin which is used to reset the microcontrollers internal registers and ports upon starting up. (Pin should be held high for 2 machine cycles.) PINS 18 & 19: The 8051 has a built-in oscillator amplifier hence we need to only connect a crystal at these pins to provide clock pulses to the circuit.PIN 40 and 20: Pins 40 and 20 are VCC and ground respectively. The 8051 chip needs +5V 500mA to function properly, although there are lower powered versions like the Atmel 2051 which is a scaled down version of the 8051 which runs on +3V.

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

24

PINS 29, 30 & 31: As described in the features of the 8051, this chip contains a built-in flash memory. In order to program this we need to supply a voltage of +12V at pin 31. If external memory is connected then PIN 31, also called EA/VPP, should be connected to ground to indicate the presence of external memory. PIN 30 is called ALE (address latch enable), which is used when multiple memory chips are connected to the controller and only one of them needs to be selected. We will deal with this in depth in the later chapters. PIN 29 is called PSEN. This is "program select enable". In order to use the external memory it is required to provide the low voltage (0) on both PSEN and EA pins. 4.7.1 Ports arrangements There are 4 8-bit ports: P0, P1, P2 and P3. PORT P1 (Pins 1 to 8): The port P1 is a general purpose input/output port which can be used for a variety of interfacing tasks. The other ports P0, P2 and P3 have dual roles or additional functions associated with them based upon the context of their usage. PORT P3 (Pins 10 to 17): PORT P3 acts as a normal IO port, but Port P3 has additional functions such as, serial transmit and receive pins, 2 external interrupt pins, 2 external counter inputs, read and write pins for memory access. PORT P2 (pins 21 to 28): PORT P2 can also be used as a general purpose 8 bit port when no external memory is present, but if external memory access is required then PORT P2 will act as an address bus in conjunction with PORT P0 to access external memory. PORT P2 acts as A8A15, as can be seen from fig 1.1PORT P0 (pins 32 to 39) PORT P0 can be used as a general purpose 8 bit port when no external memory is present, but if external memory access is required then PORT P0 acts as a multiplexed address and data bus that can be used to access external memory in conjunction with PORT P2. P0 acts as AD0-AD7, as can be seen from fig

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

25

4.7.2 Oscillator Circuits The 8051 requires the existence of an external oscillator circuit. The oscillator circuit usually runs around 12MHz, although the 8051depending on which specific

model) Figure 4.4 Microcontroller 8051 internal architecture

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

26

running at a maximum of 40MHz. Each machine cycle in the 8051 is 12 clock cycles, giving an effective cycle rate at 1MHz (for a 12MHz clock) to 3.33MHz (for the maximum 40MHz clock).

4.7.3 INTERNAL SCHEMATICS OF THE 8051 Data and Program Memory The 8051 Microprocessor can be programmed in PL/M, 8051 Assembly, C and a number of other high-level languages. Many compilers even have support for compiling C++ for an 8051. Program memory in the 8051 is read-only, while the data memory is considered to be read/write accessible. When stored on EEPROM or Flash, the program memory can be rewritten when the microcontroller is in the special programmer circuit. 4.7.4 Program Start Address The 8051 starts executing program instructions from address 0x00 in the program memory. 4.7.5 Direct Memory The 8051 has 256 bytes of internal addressable RAM, although only the first 128 bytes are available for general use by the programmer. The first 128 bytes of RAM (from 0x00 to 0x7F) are called the Direct Memory, and can be used to store data. 4.7.6 Special Function Register The Special Function Register (SFR) is the upper area of addressable memory, from address 0x80 to 0xFF. This area of memory cannot be used for data or program storage, but is instead a series of memory-mapped ports and registers. All port input and output can therefore be performed by memory mov operations on specified addresses in the SFR. Also, different status registers are mapped into the SFR, for use in checking the status of the 8051, and changing some operational parameters of the 8051.

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

27

4.7.7 General Purpose Registers The 8051 has 4 selectable banks of 8 addressable 8-bit registers, R0 to R7. This means that there are essentially 32 available general purpose registers, although only 8 (one bank) can be directly accessed at a time. To access the other banks, we need to change the current bank number in the flag status register. 4.7.8 A and B Registers The A register is located in the SFR memory location 0xE0. The A register works in a similar fashion to the AX register of x86 processors. The A register is called the accumulator, and by default it receives the result of all arithmetic operations. The B register is used in a similar manner, except that it can receive the extended answers from the multiply and divide operations. When not being used for multiplication and Division, the B register is available as an extra general-purpose register. 4.7.9 Data Memory The AT89C52 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy a parallel address space to the Special Function Registers. That means the upper 128 bytes have the same addresses as the SFR space but are physically separate from SFR space. When an instruction accesses an internal location above address 7FH, the address mode used in the instruction specifies whether the CPU accesses the upper 128 bytes of RAM or the SFR space. Instructions that use direct addressing access SFR space. For example, the following direct addressing instruction accesses the SFR at location 0A0H (which is P2). Instructions that use indirect addressing access the upper 128 bytes of RAM. For example, the following indirect addressing instruction, where R0 contains 0A0H, accesses the data byte at address 0A0H, rather than P2 (whose address is 0A0H). MOV @R0, #data

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

28

Note that stack operations are examples of indirect addressing, so the upper 128 bytes of data RAM are available as stack space. TIMER 0 AND 1 Timer 0 and timer 1 in the AT89C52 operate the same way as timer 0 and timer 1 in the AT89C51. 4.7.10 TIMER 2 Timer 2 is a 16-bit Timer/counter that can operate as either a timer or an event counter. The type of operation is selected by bit C/T2 in the SFR T2CON (shown in table 2). Timer 2 has three operating modes: capture, auto-reload (up or down counting), and baud rate generator. The modes are selected by bits in T2CON, as shown in Table 3. Timer 2 consists of two 8-bit registers, TH2 and TL2. In the Timer function, the Tl2 register is incremented every later periods, the count rate is 1/12 of the oscillator frequency. In the counter function, the register is incremented in response to a 1-to-0 transition at its corresponding external input pin, T2. In this function, the external input is sampled during S5P2 of every machine cycle. When the samples show a high in one cycle and a low in the next cycle, the count is incremented. The new count value appears in the register during S3P1 of the cycle following the one in which the transition was detected. Since two machine cycles (24 oscillator periods) are required to recognize a 1-to-0 transition, the maximum count rate is 1/24 of the oscillator frequency. To ensure that a given level should be held for at least one full machine cycle.

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

29

4.7.11 MICROCONTROLLER INTERFACING (ADC0804) In our daily life, anything we deal like sound, pressure, voltage or any measurable quantity, are usually in analog form so what if we want to interface any analog sensor with our digital controllers? There must be something that translates the analog inputs to digital output, and so analog to digital converters come to play. Usually we call them ADC (Analog to digital converter). To be able to implement analog to digital conversion using the ADC0804LCN 8-bit A/D converter. You will design a circuit and program the chip so that when an analog signal is given as input, the equivalent digital voltage is displayed on an LCD display. Thus, in effect, your circuit should function like a simple voltmeter 4.8.0 Description of analog digital converters The ADC0801, ADC0802, ADC0803, ADC0804 and ADC0805 are CMOS 8-bit successive approximation A/D converters that use a differential potentiometric ladder-similar to the 256R products. These converters are designed to allow operation with the NSC800 and INS8080A derivative control bus with TRI-STATE output latches directly driving the data bus. These A/Ds appear like memory locations or I/O ports to the microprocessor and no interfacing logic is needed. Differential analog voltage inputs allow increasing the common-mode rejection and offsetting the analog zero input voltage value. In addition, the voltage reference input can be adjusted to allow encoding any smaller analog voltage span to the full 8 bits of resolution. Key Specification

Resolution Total error

8 bits LSB, LSB and 1 LSB

Conversion time 100 s

Table 4.1 Key specification Harrison Kwaku Korankye, BEng (Hons), Regent Ghana 30

4.8.1 FEATURES ADCs Compatible with 8080 P derivatives-no interfacing logic needed - access time - 135 ns Easy interface to all microprocessors, or operates "stand alone" Differential analog voltage inputs Logic inputs and outputs meet both MOS and TTL voltage level specifications Works with 2.5V (LM336) voltage reference On-chip clock generator 0V to 5V analog input voltage range with single 5V supply No zero adjust required 0.3[Prime] standard width 20-pin DIP package 20-pin molded chip carrier or small outline package Operates ratio metrically or with 5 VDC, 2.5 VDC, or analog span adjusted voltage reference.

4.8.2 Liquid crystal display A liquid crystal display (LCD) is a thin, flat electronic visual display that uses the light modulating properties of liquid crystals (LCs). LCs does not emit light directly. They are used in a wide range of applications including: computer monitors, television, instrument panels, aircraft cockpit displays, signage, etc. They are common in consumer devices such as video players, gaming devices, clocks, watches, calculators, and telephones. LCDs have displaced cathode ray tube (CRT) displays in most applications. They are usually more compact, lightweight, portable, less expensive, more reliable, and easier on the eyes.[citation needed] They are available in a wider range of screen sizes than CRT and plasma displays, and since they do not use phosphors, they cannot suffer image burn-in. LCDs are more energy efficient and offer safer disposal than CRTs. Its low electrical power consumption enables it to be used in battery-powered electronic equipment. It is an electronically-modulated optical device made up of any number of pixels filled with liquid crystals and arrayed in front of a light source (backlight) or reflector to produce images in colour Harrison Kwaku Korankye, BEng (Hons), Regent Ghana 31

or monochrome. The earliest discovery leading to the development of LCD technology, the discovery of liquid crystals, dates from 1888.[1] By 2008, worldwide sales of televisions with LCD screens had surpassed the sale of CRT units. Passive-matrix and active-matrix addressed LCDs

Figure 4.5 Passive-matrix and active-addressed LCDs A general purpose alphanumeric LCD, with two lines of 16 characters. LCDs with a small number of segments, such as those used in digital watches and pocket calculators, have individual electrical contacts for each segment. An external dedicated circuit supplies an electric charge to control each segment. This display structure is unwieldy for more than a few display elements. Small monochrome displays such as those found in personal organizers, electronic weighing scales, older laptop screens, and the original Game boy have a passive-matrix structure employing super-twisted nematic (STN) or double-layer STN (DSTN) technologythe latter of which addresses a colour-shifting problem with the formerand colour-STN (CSTN)wherein colour is added by using an internal filter. Each row or column of the display has a single electrical circuit. The pixels are addressed one at a time by row and column addresses. This type of display is called passive-matrix addressed because the pixel must retain its state between refreshes without the benefit of a steady electrical charge. As the number of pixels (and, correspondingly, columns and rows) increases, this type of display becomes less feasible. Very slow response times and poor contrast are typical of passive-matrix addressed LCDs. Color passive-matrix displays exist, although they are limited to 16 colors.

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

32

Monochrome passive-matrix LCDs was standard in most early laptops (although a few used plasma displays). The commercially unsuccessful Macintosh Portable (released in 1989) was one of the first to use an active-matrix display (though still monochrome), but passive-matrix was the norm until the mid-1990s, when color active-matrix became standard on all laptops. High-resolution color displays such as modern LCD computer monitors and televisions use an active matrix structure. A matrix of thin-film transistors (TFTs) is added to the polarizing and color filters. Each pixel has its own dedicated transistor, allowing each column line to access one pixel. When a row line is activated, all of the column lines are connected to a row of pixels and the correct voltage is driven onto all of the column lines. The row line is then deactivated and the next row line is activated. All of the row lines are activated in sequence during a refresh operation. Active-matrix addressed displays look "brighter" and "sharper" than passive-matrix addressed displays of the same size, and generally have quicker response times, producing much better images.

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

33

4.9.0 DESCRIPTION OF DEVELOPMENT SYSTEM 4.9.1 CROSS COMPILERS First of all we begin this chapter by giving a brief introduction about cross compilers in embedded programming and their applications. We know that the execution of code in a microcontroller takes place as a hexadecimal code. So we can program any microcontroller using an assembly language. Also though the use of cross compilers we can program the microcontrollers in any language like C or C++.The cross compilers acts as a bridge between the programming software and microcontrollers. Suppose we are programming the microcontroller using C the code written in C language cannot be directly executed by microcontroller. So this code written in C is fed to a cross compiler which converts into hexadecimal code which is understood and executed by microcontroller. The advantages of using cross compilers is that in case of some applications programming the microcontroller using assembly language will become bulk and tedious. So when we use cross compilers we can program the microcontroller in any other language which is easy to program and debug also. The commonly used cross compilers are SDCC (Small devices C compiler), Keil etc. In this our project the use of Keil cross compiler is to program the microcontroller. In this chapter we discuss the introduction to programming in Keil features of Keil and finally advantages of using Keil when compared to other cross compilers. When we are writing program for any microcontroller using cross compiler we cannot directly write the converted code on to the microcontroller. This means we need to use a special technique to load the program into the microcontroller. One of the methods is to use a microcontroller with a flash memory. Flash memory is similar to erasable programmable read only memory. So once program is written and debugged using cross compiler, we need to flash the program on to the flash memory of the memory. Once program is flashed the microcontroller is loaded with the hex code and it will be ready for execution.

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

34

4.9.2

INTRODUCTION TO KEIL

Keil software provides the premier 8051 development tools to industry .The keil software comprises of different tool kits. A tool kit consist of several application program that we can use to create our 8051 application .When we use keil software for our project the development cycle is some what similar to a software development project .It consist of creating source file in C or assembly language compiling or assembling the source files debugging error in the source file, linking file from complier and assembler and finally building a project linking all the files and testing the linked application. 4.9.3 FUNCTIONING OF KEIL All the files are created through the micro vision integrated development environment are then passed to the C51 compiler or A51 assembler. The compiler and assembler process source files and create relocatable object files. Object files created by the compiler or assembler may be used by the library manager to create a library. A library is a specially formatted, ordered program collection of object modules that linker can process. When the linker processes a library, only the object modules in the library necessary for program creation are used. Object files created by the compiler and assembler and library files created by the library manager are processed by the linker to create an absolute object module. An absolute object file or module is an object file with no releasable code. All the code in an absolute object file resides at fixed locations. The absolute object file created by the linker may be used to program EPROM or other memory devices. The absolute object module may also be used with the dScope-51 debugger / simulator or with an in-circuit emulator. The dScope-51 source level debugger/simulator is ideally suited for fast, reliable high-level-language program debugging. The debugger contains a high-speed simulator and a target debugger that let you simulate an entire 8051 system including on-chip peripherals. By loading specific I/O drivers, we can simulate the attributes and peripherals of a variety of 8051 family. The RTX-51 real time operating system is a multitasking kernel for the 8051 family. The RTX-51 real time kernel simplifies the system design, programming, and debugging of complex applications where fast reaction to time critical events is essential. The kernel is fully integrated into the C51compiler and is easy to use. Task description tables and

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

35

operating system consistency are automatically controlled by the BL51 code banking linker/locater. 4.9.4 DEVELOPMENT TOOLS IN KEIL The Fig 4.1 shows the full extent of the Keil Software 8051 development tools. The tools listed in this diagram comprise the professional developers kit. In addition to the professional kit, Keil Software provides a number of other tool kits for the 8051 developer. The most capable kit is the professional developers kit is described as follows: The professional developers kit includes everything the professional 8051 developer needs to create sophisticated embedded applications. This tool kit includes the following components: C51 Optimizing C compiler, A51 Macro Assembler, BL51 Code Banking Linker/Locator, OC51 Banked Object file converter, OH51 Object-Hex converter, LIB51 Library Manager, dScope-1 Simulator/debugger, tScope-51 Target Debugger, Monitor-51 ROM Monitor and Terminal Program, Integrated Development Environment, RTX-51 Tiny Real-Time Operating System.

In addition, the professional developers kit includes the following tools for Windows users: dScope-51 Simulator/Debugger for windows, Micro Vision/51 Integrated Development Environment for windows.

The professional developers kit can be configured for all 8051 derivatives. The tools included in this kit can run any compatible computer.

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

36

4.9.5 C51 OPTIMIZING C CROSS COMPILER The C programming language is a general-purpose programming language that provides code efficiency, elements of structured programming, and a rich set of operators. Its generality, combined with its absence of restrictions, make C a convenient and effective programming solution for a wide variety of software tasks. Many applications can be solved more easily and effectively with C than with other more specialized languages. The Keil software C51 optimizing cross compiler for the MS-DOS operating system is a complete implementation of the ANSI (American National Standards Institute) standard for the C language. The C51 compiler generates code for the 8051 microprocessor but is not a universal C compiler adapted for the 8051 target. It is a ground-up implementation dedicated to generating extremely fast and compact code for the 8051 microprocessor. For most 8051 applications, the C51 compiler gives software developers the flexibility of programming in /c while matching the code efficiency and speed of assembly language. Using a high-level language like C has many advantages over assembly language programming. For example: Knowledge of the processor instruction set is not required. A rudimentary knowledge of the 8051s memory architecture is desirable but not necessary. Register allocation and addressing mode details are managed by the compiler. The ability to combine variable selection with specific operations improves program readability. Keywords and operational functions that more nearly resemble the human thought process can be used. Program development and debugging times are dramatically reduced when compared to assembly language programming. The library files that are supplied provide many standard routines (such as formatted output, data conversions, and floating-point arithmetic) that may be incorporated into our application. Existing routine can be reused in new programs by utilizing modular programming techniques available with C.

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

37

The C language is very portable and very popular. C compilers are available for almost all target systems. Existing software investments can be quickly and easily converted from or adapted to other processors or environments.

4.9.6 A51 MACRO ASSEMBLER The A51 assembler is a macro assembler for the 8051 microcontroller family. It translates symbolic assembly language mnemonics into relocatable object code where the utmost speed, small code size, and hardware control are critical. The macro facility speeds development and conserves maintenance time since common sequences need only be developed once. The A51 assembler supports symbolic access to all features of the 8051 architecture and is configurable for the numerous 8051 derivatives. The A51 assembler translates an assembler source file into a relocatable object module. If the DEBUG control is used, the object file contains full symbolic information for debugging with dScope or an in-circuit emulator. In addition to the object file, the A51 assembler generates a list file which may optionally include symbol table and cross reference information. The A51 assembler is fully compatible with Intel ASM-51 source modules. The A51 assembler supports all members of the 8051 family. The special function register (SFR) set of the 8051 is predefined. However, the NOMOD51 control lets you override these definitions with processor-specific include files. The A51 assembler is shipped with include files for the 8051, 8051fx, 8051GB, 8052, 80152, 80451, 80452, 80515, 80C517, 80C517A, 8x552, 8xC592, 8xCL782, 8xCL410 and 80C320 microcontrollers. You can easily create include files for other 8051 family members. 4.9.7 BL51 CODE BANKING LINKER/LOCATOR The 51 code banking linker/locator combines one or more object modules into a single executable 8051 program. The linker also resolves external and public references, and assigns absolute addresses to relocatable programs segments. The BL51 code banking linker/locator processes object modules created by the keil C51 compiler and A51 assembler and the Intel PL/M-51 compiler and ASM-51 assembler. The linker automatically selects the appropriate runtime library and links only the library modules that are required. Normally, you invoke the BL51 code banking linker/locator from the command line specifying the names of the object modules Harrison Kwaku Korankye, BEng (Hons), Regent Ghana 38

to combine. The default controls for the BL51 code banking linker/locator have been carefully chosen to accommodate most applications without the need to specify additional directives. However, it is easy for us to specify custom settings for your applications. 4.9.8 OC51 BANKED OBJECT FILE CONVERTER The OC51 banked object file converter creates absolute object modules for each code bank in a banked object module. Banked object modules are created by the BL51 code banking linker/locator when you create a bank switching application. Symbolic debugging information is copied to the absolute object files and can be used by dScope or an in-circuit emulator. We may use the OC51 banked object file converter to create absolute object modules for the command area and for each code bank in your banked object module. You may then generate Intel HEX files for each of the absolute object modules using the OH51 object-hex converter. 4.9.9 OH51 OBJECT-HEX CONVETER The OH51 object-hex converter creates Intel hex files from absolute object modules. Absolute object modules can be created by the BL51 code baking linker or by the OC51 banked object file converter. Intel hex files are ASCII files that contain a hexadecimal representation of your application. They can be easily loaded into a device programmer for writing on Erasable programmable read only memory. 4.9.10 LIB51 LIBRARY MANAGER The LIB51 library manager lets you create and maintain library files. A library file is a formatted collection of one or more object files. Library files provide a convenient method of combining and referencing a large number of object files. Libraries can be effectively used by the BL51 code banking linker/locator. The LIB51 library manager lets you create a library file, add object modules to a library file, remove object modules from may be controlled interactively or from the command line.

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

39

4.9.11 DSCOPE-51 FOR WINDOWS DScope-51 is a source level debugger and simulator for programs created with the keil C51 compiler and A51 assembler and the Intel PL/M-51 compiler and ASM-51 assembler. DScope51 is a software-only product that lets us simulate the features of an 8051 without actually having target hardware. We may have used Scope-51 to test and debug our embedded applications before actual 8051 hardware is ready. DScope-51 simulates a wide variety of 8051 peripherals including the internal serial port, external I/O, and timers. 4.9.12 VISION/51 FOR WINDOWS Microvision/51 is an integrated software development platform that includes a full function editor, project manager, make facility, and environment control for the keil 8051 tools. When we use Vision/51 speeds our embedded applications development by providing the following:
4.9.13 TARGET PROCESSOR

Standard Windows user interface, Dialog boxes for all environment and development tool settings, Multiple file editing capability, Full function editor with user-definable key sequences, Application manager for adding external programs into the pull-down menu, Project manager for creating and maintaining projects, Integrated make facility for building target programs from your projects, On-line help system.

In our project microcontroller AT89C52 (Target processor) is used to governs all the essential process which has to be executed during acquisition. Microcontroller, as the name suggests, are small controllers. These are like single chip computers that are often embedded into systems to function as processing /controllers unit. For example, the remote control you are using probably has microcontrollers inside that do decoding and other controlling functions. They are also used in automobiles, washing machines, microwave ovens, toysetc, where automation is needed. The key features of microcontrollers include: Harrison Kwaku Korankye, BEng (Hons), Regent Ghana 40

High integration of Functionality Microcontrollers sometimes are called single chip computers because they have on-chip memory and I/O circuitry and other circuitries that enable them to function as small standalone computers without other supporting circuitry. Field Programmability, Flexibility Microcontrollers often use EEPROM or EPROM as their storage device to allow field programmability so they are flexible to use. Once the program is tested to be correct then

large quantities of microcontrollers can be programmed to be used in embedded systems. Easy to Use Assembly language is often used in microcontroller and since they usually follow RISC architecture, the instruction set is small. The development package of microcontrollers often includes an assembler ,a simulator ,a programmer to burn the chip and a demonstration board .Some packages include a high level language compiler such as a C compiler and more sophisticated libraries.

ADC Algorithm for Power Theft Identification:

Figure 4.6 ADC Algorithm for power theft Identification Harrison Kwaku Korankye, BEng (Hons), Regent Ghana 41

CHAPTER FIVE 5.0 RESULT AND DISCUSSION In this project a proposed energy conservation system which saves electricity from being theft due to lack of monitoring system. We are monitoring the line voltage of the system continuously using a power line monitoring system. In the event of power theft, the power line monitoring system will automatically sense the dip in voltage due to power theft and sends the information to the PC about the power theft. This system will automatically trip the main power line in the event of theft and save electricity. In the design the microcontroller AT89C52 by converting the logical 12V to5V before it is transferred to the microcontroller and to the other parts of the circuit. The microcontroller in work has four ports through which it communicates with the logic control unit and the LCD. Two of these ports, serving communication and data are being used in this project. The system has clock circuit which provides clock pulse to the microcontroller. The reset switch initializes the microcontroller in order to restart the operation from the beginning. The system has a peripheral for a connection to a PC. This makes it possible to access information on all activities (interruptions at the gates) stored in the memory of the microcontroller for analysis.

Microcontroller was chosen other than a microprocessor because Microcontroller differs from a microprocessor in many ways. First and the most important is its functionality. In order for a microprocessor to be used, other components such as memory, or components for receiving and sending data must be added to it. In short microprocessor is the very heart of the computer. On the other hand, microcontroller is designed to be all of that in one. No other external components are needed for its application because all necessary peripherals are already built into it. Time and space needed to construct devices were saved. In this project microcontroller AT89C52 (Target processor) is used to governs all the essential process which has to be executed during operation. Microcontroller, as the name suggests, are small controllers. These are like single chip computers that are often embedded into systems to function as processing /controllers unit. Harrison Kwaku Korankye, BEng (Hons), Regent Ghana 42

For example, the remote control you are using probably has microcontrollers inside that do decoding and other controlling functions. They are also used in automobiles, washing machines, microwave ovens, toysetc, where automation is needed. The key features of microcontrollers include: High integration of Functionality Microcontrollers sometimes are called single chip computers because they have on-chip memory and I/O circuitry and other circuitries that enable them to function as small standalone computers without other supporting circuitry. Field Programmability, Flexibility Microcontrollers often use EEPROM or EPROM as their storage device to allow field programmability so they are flexible to use. Once the program is tested to be correct then large

quantities of microcontrollers can be programmed to be used in embedded systems. Easy to Use Assembly language is often used in microcontroller and since they usually follow RISC architecture, the instruction set is small. The development package of microcontrollers often includes an assembler, a simulator,a programmer to burn the chip and a demonstration board .Some packages include a high level language compiler such as a C compiler and more sophisticated libraries. On the successful implementation of the system, it was realized that, when no interruptions made on the IR beam which continuously falls on the phototransistor at the gate, the system remains in its stable power on state. As the IR beam becomes interrupted, the logic control unit is able to detect an entry or exit and sends a signal to the microcontroller to count. The microcontroller increments/decrements the count by one for every entry/exit into the building, respectively. The microcontroller commands the LCD to display the count. By this the number of persons present in the building at a time is known. The microcontroller also monitors the presents/absence of persons in the building.

It issues another command to close/open relays to operate circuits controlling appliances like air conditioner, fans, lights, etc., in the presents/absence of human beings in the building, respectively.

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

43

During the testing, it was noticed that the counter could do up 999 interrupts and there cannot be used at location that counts numbers more than this figure. Also, the unit can withstand temperature up to 700 C. As stated in the objectives, this project aims at eliminating some of the challenges associated with the existing systems of monitoring the human traffic at a location, and also to cut down electric energy wastage through the control of relays. The Microcontroller, AT86C52 controls the entire circuit i.e. AT89C52 is the heart and the backbone to the operation of the system. The IR sensors detect the entry/exit at the gate which communicates the information to the microcontroller to process through the logic control system. The processed information is relayed to the LCD to display the number of persons in a room. The AT86C52 monitors the entry/exit at the gates such that whenever a person enters, AT86C52 issues a command to the relay driver to close a relay in order to closea circuit that controls appliances like air conditioner, fans, lights, etc. which were put off to start working. On the other hand when everybody has exited the room, the LCD will read number of persons: 0. In this condition, the AT86C52 issues another command to the relay driver to open a relay in order to off a circuit to put off the gadgets. Hence, proper electricity usage as a result of reduced energy wastage would help cut down cost electricity bill payments. The AT89C52 recordsevery passage of date and time to provide facts and figures on the human traffic to a location for future analysis. This would help to eliminating or reduced some of the challenges associated with the existing manual ways of counting. The recorded datais vital information to assist mangers of organisations make more informed decisions on: facility management (proper usage of the floor area, chair, lights, fans, TV, etc.), knowing the numbers and the trend of flow of people to the location, strategic marketing and operations is highly possible. (When to do adverts and promotions).Staff optimization(when to employ or reduce staff numbers), for efficiency and effectiveness.

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

44

5.1 Cost analysis The costs of the major components are listed below

No.

Component

Quantity

Unit Price Gh

Total Amount Gh 73.00 12.00 75.50 6.00 48.00 8.00 15.50 6.00 5.50 7.50 5.00 1.50 3.00 5.00 14.00 60.00 45

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

MicrocontrollerAT89C51 Relay LCD Sensors Voltage Regulator Reset button Oscillator Diode (1n4001) 1000F Capacitor 0.1 F Capacitor RS232 cable 100 standard resistor 1k standard resistor 12 V Transformer LM324 Miscellaneous

1 4 1 4 2 1 1 4 1 5 1 1 1 1 2 4

73.00 3.50 65.00 1.50 20.00 8.00 10.50 1.50 5.50 1.50 5.00 1.50 3.00 5.00 7.00 45.00

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

NO.

Component

Quantity

Unit Price Gh

Total Amount Gh

17 18

Casing Circuit board

1 1

40.00 30.00

50.50 40.00 393.00

Table 5.1 Cost of components Cost of labour = Gh 100 Total Cost = GH 493.00

The total cost of this project is Gh493.00.This cost was arrived at due to the non availability of the major components (i.e. microcontroller, circuit board, LCD, etc.) on the local market and so had to be imported. This is a low cost one as compared to other systems on the market. That notwithstanding, as it is a useful information on the human flow to public buildings and the use of circuit to control electrical energy wastage, it is better to endure this cost in our quest to maximize efficiency and effectiveness in all areas in our organisations.

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

46

CHAPTER SIX
6.0 CONCLUSION AND RECOMMENDATION

6.1 CONCLUSION In this project work an energy conservation system which saves electricity from being theft due to lack of monitoring system is proposed. The line voltage of the system was continuously monitored using a power line monitoring system. In the event of power theft, the power line monitoring system will automatically sense the dip in voltage due to power theft and sends the information to the PC about the power theft. This system makes automatically trip the main power line in the event of theft and saves electricity. This project work when improved upon will go a very long way to help a developing country like Ghana to reduce the frequent fire outbreaks in both the public and domestic buildings. Most of these fire outbreaks are attributable to an illegal electrical connections and an inferior electrical cables according to the statistics from the Ghana fire Authority. Also with the emerging of Global system of mobile telecommunication networks (GSM) in Ghana, this project could be upgraded in such a way that a suspected cluster of an area could be mapped onto a GSM network visitor location register (VLR) and home location register (HLR) so that should an intruder who is not part of the cluster attempts to connect to the power network will be denied access or an sms text message would be sent to the authorities concern about the development.

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

47

6.2 Recommendation The ministry of energy, the electricity company of Ghana and all the stakeholders of electrical energy should embrace this project invest in it ,so as to reduce the rate at which people illegally tapped onto electrical supply lines. The Ghana National Fire Authority, the National Disaster Management Organisation (NADMO) and the Electricity Company of Ghana should team up to encourage the importation of power theft equipments to reduce the rate of fire outbreaks in recent times. Electricity Company of Ghana training school should research more into this particular project.

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

48

REFERENCES [1] Donald G, Wayne H.Beaty, Standard Handbook for Electrical Engineers 11th

Edition, McGraw Hill, 2003, New York [2] Croft, Terrell, Summers, Wilford I, American Electricians' Handbook 11th Edition, McGraw Hill,2008 New York [3] Hsieh J.-W, Tsai G.-R, and Lin M.-C, Using FPGA to implement a n-channel arbitrary wave form generator with various add-on functions, in Proceedings of 2nd IEEE International Conference on Field-Programmable Technology (FPT 03), pp. 296298, University of Tokyo, Tokyo, Japan, December 2003. [4] Tsai G.-R, Lin M.-Z, Tung W.-Z, Chuang K.-C, and S, Chan S.-Y, Wide-band and precisely measurement method of phase detector based on FPGA with embedded processor, in Proceedings of International Conference on Informatics, Cybernetics and Systems (ICICS 03), I-SHOU University, Kaohsiung, Taiwan, December 2003. [5] Xilinx, Data Generation and Configuration for Spartan Series FPGAs, XAPP126, 2003 [6] Watanabe T. and Yamauchi S, An all-digital PLL for frequency multiplication by 4 to 1022 with seven-cycle lock time, IEEE Journal of Solid-State Circuits, vol. 38, no. 2, pp. 198204, 2003. [7] Best R.E, Phase-Locked Loops, Design, Simulation, and Applications, 5th edition, McGraw-Hill, 2003, New York, USA,. [8] [9] Xilinx Incorporation, The programmable logic data book, 2002. Dyer S.A, Survey of Instrumentation and Measurement John Wiley & Sons, New York, NY, USA, 2001. [10] Cummings M and Haruyama S, FPGA in the software radio, IEEE Communications Magazine, vol. 37, no. 2, pp. 108112, 2003. USA

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

49

[11]

Dick C and Harris F.J, Configurable logic for digital communications: some signal processing perspectives, IEEE Communications Magazine, vol. 37, no. 8, pp. 107111, 2002. Canada

[12] [13]

Xilinx, Configuring Spartan-II FPGAs from Parallel EPROMs, XAPP178, 2003. Vankka J., Waltari M., Kosunen M., and Halonen K.A.I., A direct digital synthesizer with an on-chip D/A-converter, IEEE Journal of Solid-State Circuits, vol. 33, no. 2, pp. 218237, Dec 2002, Japan.

[14]

Xilinx, The Low-Cost, Efficient Serial Configuration of Spartan FPGAs, XAPP098, 2005.

[15]

Kularatna N., Modern Electronic Test and Measuring Instruments IEEE, London, UK, 2004.

[16] Lindsey W.C and Chie C.M., A survey of digital phase locked loops, Proceedings of the IEEE, vol. 69, no. 4, pp. 410 431, 2003. [17] Tierney J.,Rader C., and Gold B., A digital frequency synthesizer, IEEE Transactions on Audio and Electro acoustics, vol. 19, no. 1, pp. 4857, Mar. 2000. USA

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

50

GLOSSARY PCB LCD LED GSM VRL HLR NADMO ECG EEPROM EPROM ROM ADC Printed Circuit Board Liquid Crystal Display Light Emitted Diode Global System for Mobile Telecommunication Visitor Location Register Home Location Register National Disaster Management Organization Electricity Company of Ghana Electrical Erasable Programmable Read Only Memory Erasable Programmable Read Only Memory Read Only Memory Analog Digital Converter

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

51

LIST OF FIGURES 3.1 4.1 4.2 4.3 4.4 4.5 4.6 Testing an LED..15 Block diagram of the proposed design20 Circuit diagram of the proposed design22 Pin diagram of the 8051 DIP..24 Microcontroller 8051 internal architecture26 Passive-matrix and active-addressed LCDs..32 ADC Algorithm for power theft identification.41

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

52

LIST OF TABLES 4.1 5.1 Key Specification.30 Cost of Components..45-46

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

53

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

54

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

55

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

56

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

57

Harrison Kwaku Korankye, BEng (Hons), Regent Ghana

58

S-ar putea să vă placă și