1 ABSTRACT In recent times, there has been a growing demand in our society on how life can be made much easier and pleasurable and at the same enhances time –saving. With the availability of wireless technology and internet functionalities, the idea of making significant changes from a remote location has now become one of the major devices that give such pleasure. In the global world today, where several complex systems and mechanisms need to be constantly and simultaneously monitored to ensure maximum efficiency, Control Systems have provided a solution that makes it possible. Therefore the main objective of this project is to design an automatic transfer switch with a wireless enabled control device. This automatic transfer switch is good but it can be improved to become more efficient and effective by the introduction of a wireless handheld device that can be used to both monitor and control the entire complex system without having to be resigned to a stationary position. It is designed to give input to the control centre’s system as well as receive output from it despite being far from the stationary appliance. It gives room for a remote control as well as freedom of mobility. Basically, one of the notable features of this device is that due to the nature of our schedule, we might be required to put on a particular gadget or equipment and move away to do some other things .When the required time to put the equipment off reaches, we can simply do that by using our wireless 2 device (mobile phone) to effect a change. In our design, this work employs a Nokia phone, DTMF decoder, Microcontroller and output relays as the key elements. When a call comes in from another phone no matter the location, after ringing, the code to perform a particular function is entered. The DTMF decoder checks the validity of the code sent to it and then sends a signal to the microcontroller to perform the prescribed function. The system ignores the code if it is not valid. 3 CHAPTER ONE INTRODUCTION Automatic Transfer Switches (ATS) are mainly applied or used in power transfer. ATS are critical components of any emergency or standby power system. They are reliable, rugged, versatile and compact assemblies for transferring essential loads and electrical distribution systems from one power source to another. They utilize simple electrical operators to provide high-speed, quick-break, quick-make preloaded transfers. The operators are connected to the switch mechanism through precision self-aligning, ball joints and heavy duty linkage rods which prevent misalignment. An automatic transfer switch is often installed where a backup generator is located so that the generator may provide temporary electrical power if the utility source fails. 1.1 OVERVIEW 4 Manufacturing industries as well as houses with home appliances (such as air condition, sound-systems, security camera etc) are both operated with numerous processes and procedures. There are several processes that must be carried out before the desired output product or service can be declared completed. With the ever increasing need for automation and ease, as well as the solutions proffered by current technological advancement, the complex and numerous transmissions of signals in any industry or home can now be automatically and quite easily transferred and controlled through an automated system. However to further extend the human capacity and capability to regulate transfer of signals between two switches from anywhere, a wireless device could be used to regulate (i.e. monitor and control) transmission even when the user can manually operate the switch. If for some reason he has to leave the control station, he could simply carry such a device with him and continue his job from wherever he is. The device would afford him the ability to observe and do everything he can observe and do from the control station. The design of such a device is the purpose of this work. 1.2 OBJECTIVE The main aim of this work is to design and implement an intelligent transfer 5 switch that acts automatically on its own. This work also clearly lay out the current available means of transmission regulations and its apparent limitations with respect to mobility and then proffer a solution to this limitation in the form of a wireless device that can be used to regulate the processes from anywhere, even within the area of installation (instead of just within the control station). This project work outlines the design of a device with such capability and explains its functionality. 1.3 SIGNIFICANCE OF WORK Although one could rightly say that the technology behind the transmission of signals between two sources has vastly advanced and developed over the last few decades, the addition of such a gadget to the host of technological developments in this area holds some promise to the control industry. Firstly, the flexibility which this device will offer the user (or equivalent personnel whose job is to observe and control the processes) affords him the time and space to do other things instead of changing the switch manually from the control station in case there is power failure. Also, for the benefit of the company or the employer/user such an employee/user can still be assigned other duties thereby increasing his/her productivity. Secondly, an industry/individual may have an already installed system for the transmission of signal and needs to upgrade to a better system which 6 incorporates a device of such capability. Although there currently exists systems which include such devices, a total overhaul of the system in order to upgrade to the new one would be too cost intensive. The device being designed would allow for easy installation to any pre-existing system thereby enabling the company/individual to save cost while increasing efficiency. 1.4 SCOPE OF WORK As earlier stated, all this project work will be focused on, is the design of the device discussed above. The construction and implementation of a device with such specifications and capability is clearly attainable using the basic integrated circuits for its design, especially seeing as its implementation requires integration into a system of industrial processes or home appliances to be monitored and controlled. Thus, the scope of this work is limited to the design specifications, procedures that can be used to construct and implement such a device. 1.5 REPORT ORGANIZATION This report is basically divided into five chapters. The first chapter which is the introduction to the work is written to give the reader an idea of what the work is all about. The second chapter is the literature review and aims to explain 7 in details all the technologies that form a background of this work. It answers the question, “What is it that this work aims to improve upon or add to?” Furthermore, a literary description of the existing technologies that are involved in the operations of this device are also outlined in this chapter. Chapter three and chapter four is where the methodology, design and implementation of the said device is described. Everything that the design of this device entails is made clear in these chapters. The fifth and last chapter of this work tends to draw the curtain with our recommendations, suggestions for further work and conclusion. It also entails the program that is used in controlling the microcontroller together with cost prices of all the integrated circuits that was used in assembling of the circuit. 8 CHAPTER TWO LITERATURE REVIEW 2.0 TRANSFER SWITCH A transfer switch is an electrical device that switches a load between two sources. Some transfer switches are manual, in that an operator effects the transfer by throwing a switch when they sense one of the sources has lost or gained power. The ones that are automatic are normally intelligent in the sense the operator does not have to effect any transfer by throwing the switch rather the switch senses when there is loss of power in one the two sources available and switches to the one that has power. 9 2.1 AUTOMATIC TRANSFER SWITCH An Automatic Transfer Switch (ATS) can be defined as an electrical switch that switches a load between two sources intelligently. Automatic Transfer Switches (ATS) are mainly applied or used in power transfer. ATS are critical components of any emergency or standby power system. They are reliable, rugged, versatile and compact assemblies for transferring essential loads and electrical distribution systems from one power source to another. They utilize simple electrical operators to provide high-speed, quick-break, quick-make preloaded transfers. The operators are connected to the switch mechanism through precision self-aligning, ball joints and heavy duty linkage rods which prevent misalignment. An automatic transfer switch is often installed where a backup generator is located so that the generator may provide temporary electrical power if the utility source fails. An automatic transfer switch continuously monitors utility power. When the utility power failures the transfer switch will signal the generator to start. Once the generator has reached operating speeds with correct frequency and voltage levels the transfer switch will disconnect the utility source and connect the generator. The design of the auto transfer switch contacts makes it impossible for both sources to be connected simultaneously. The building utilizes the generator power to keep critical circuits running like AC, sump pumps, 10 fire pumps, computer systems and other critical circuits. After the utility power is restored the automatic transfer switch returns the load to the grid. A generator cool down timer is then initiated. After the cool down period the generator automatically shuts down. The transfer switch goes back into monitory mode and stands ready for the next power outage. The automatic transfer switch also regularly runs test cycles to make sure your standby generator is ready when you need it. Fig2.1 Basic Diagram of an Automatic Transfer Switch 2.2 OPERATION OF AUTOMATIC TRANSFER SWITCH An automatic transfer switch is normally applied in the transferring of the load to 11 the backup generator, it may also be used in the starting of a backup generator, based on the voltage monitored on the primary supply. ATS isolates the backup generator from the electric utility when the generator is on and providing the temporary power. The control capability of a transfer switch in this case ought to be automatic, although we can combine both the manual and automatic. The switch transition mode of a transfer switch may be open transition or closed transition. A typical example of the working principle or an illustration of how an automatic transfer switch works can be seen in a home equipped with a backup generator and an ATS, when the electric utility outage occurs, the ATS will send signal to the backup generator to start. As soon as the generator receives the signal being sent by the ATS, the generator supplies the power needed, but before the backup generator supplies the required power, the ATS breaks the home’s connection to the electric utility and connects the generator to the home’ s main electrical panel. The generator supplies the required power to the home’s electric load, but is not connected to the electric utility lines, it is necessary to isolate the generator from the distribution system to protect the generator from overload in powering loads beyond the house and for safety, as utility workers expect the lines to be dead. When the utility power returns for a minimum time, the transfer switch will transfer the house back to the utility power and command 12 the generator to turn off. A transfer switch can be set up to provide power only to critical circuits or to the entire electrical panels. Some transfer switches are built for load shredding or prioritization of optional circuits, such as heating and cooling equipment. Complex emergency switchgear are normally employed in large backup generators to enhance soft loading, thereby allowing loads to be smoothly transferred from the utility to synchronized generators and back to the grid if power comes back. This is normally used in reducing peak load demand from a utility. 2.3 TYPES OF AUTOMATIC TRANSFER SWITCH (ATS) There are four principal types or configurations of Automatic Transfer Switches (ATS). Most manufacturers of commercially available ATS are virtually identical in their basic functions and operation, no matter which type or configurations is considered. The transfer switch can be set up to provide standby electrical power to feed only certain critical circuits or the entire switchgear panel. Some transfer switches can allow for load shedding or prioritization of optional circuits, such as heating or cooling equipment 2.3.1 Open Transition ATS The open transition transfer switch is also often called a “break before make” transfer switch. A break before make switch breaks contact with one source of 13 power before it makes contact with another with a momentary interruption (called Contact Transfer Time) of power. This prevents any possibility of back-feeding from the emergency source to the utility line which could damage utility equipment or hurt/kill any utility workers. During the split second of the power transfer process, the flow of electricity is interrupted. A good example of this would be a 3-position manual circuit breaker where the utility power is on one side and the generator on the other – with “off” in the middle. This requires the operator to switch through the full disconnect or “off” position before making the next connection. Most automatic transfer switches have a pair of electrically and mechanically interlocked contactors to simulate such practice. 2.3.2 Closed Transition Transfer Switch The closed transition transfer switch is also called a “make before break” transfer switch. In typical emergency systems, there is an inherent momentary interruption of power to the load when it is transferred from one source to another. In most cases this outage is inconsequential, particularly if less than 1/6 of a second. Some loads however, are affected by even the slightest loss of power. There are also operational conditions where is may be desirable to transfer loads with zero interruption of power when conditions permit. For such applications, closed transition transfer switches can be provided. When transferring loads in this manner – during a test or when re-transferring to 14 normal after the primary power has stabilized, the switch will operate in the make-before-break mode, providing both sources are acceptable and synchronized. Typical parameters determining synchronization could be: voltage difference less than 5%, frequency difference less than 0.2HZ, and relative phase angle between sources of 5 electrical degrees. As the maximum frequency difference is 0.2HZ, the engine will certainly be controlled by an isochronous governor. The closed transition or overlap time is generally required to be less than 100 milliseconds. If either source is not present or not acceptable, the switch must operate in a break-to-make mode to ensure no back-feeding occurs. This type of switch may also be referred to as a Static Transfer Switch, as opposed to an Automatic Switch. In this system, the generator runs in parallel with the utility power supply for a certain period of time. This enables the generator to take up the load while the power supply remains uninterrupted. 2.3.3 Soft Loading Transfer Switch This is a version of the Closed Transition Switch (CTS). The only difference is that the amount of load accepted by the generator is actively changed with this method, offering a more dynamic version of the CTS method of transfer of the electrical power source. 2.3.4 Bypass Isolation ATS This switch is designed for applications where maintenance, inspection and 15 testing must be performed while maintaining continuous power to the load without interruption. Typically, this is required in such cases as critical life support systems, and where electrically-powered essential services are needed e. g. air traffic control, telecommunications, etc. Normally it comprises of two transfer switches - bussed in parallel – one automatic with the other for manual operation, with two redundant paths from each source to the load. These are mechanically and electrically interlocked to prevent accidental closure of both sources. In isolation mode, the ATS is withdrawn from all power sources for inspection, testing and maintenance. The load is served by the bypass Manual Transfer Switch. 2.4 USES OF AUTOMATIC TRANSFER SWITCHES (ATS) Automatic transfer switches are mostly use to switch between: • One generator to another This has to do with systems that use multiple generators as the prime power 16 source. Fig.2.2.Automatic transfer switch using two generators as power source • Utility power to generator This has to do with facilities that have both utility and income power and uses generators as backup only. Fig.2.3. Automatic transfer switch using the power grid and a generator as power source • One utility power to another utility power This involves system operating utility feeds at both ends. 17 Fig2.4. Automatic transfer switch using two power grid as the power source 2.5 DESCRIPTION OF COMPONENTS USED 2.5.1 DIODES In electronics, a diode is a two-terminal electronic component with asymmetric conductance; it has low (ideally zero) resistance to current in one direction, and high (ideally infinite) resistance in the other. A semiconductor diode, the most common type today, is a crystalline piece of semiconductor material with a p–n junction connected to two electrical terminals.[5] A vacuum tube diode has two electrodes, a plate (anode) and a heated cathode. Semiconductor diodes were the first semiconductor electronic devices. This unidirectional behavior is called rectification, and is used to convert alternating current to direct current, including extraction of modulation from radio signals in radio receivers these diodes are forms of rectifiers. However, diodes can have more complicated behavior than this simple on–off action, due to their nonlinear current-voltage characteristics. Semiconductor diodes begin 18 conducting electricity only if a certain threshold voltage or cut-in voltage is present in the forward direction (a state in which the diode is said to be forward-biased). The voltage drop across a forward-biased diode varies only a little with the current, and is a function of temperature; this effect can be used as a temperature sensor or voltage reference. Fig.2.5 Showing the flow of current in a diode 2.5.2 USES OF DIODES What do we use diodes for? Protect circuits by limiting the voltage (clipping and clamping) turn AC into DC (voltage rectifier) voltage multipliers (e.g. double input voltage) non-linear mixing of two voltages (e.g. amplitude modulation). 2.6 RELAYS A relay is an electrically operated switch. Many relays use an electromagnet to mechanically operate a switch, but other operating principles are also used, 19 such as solid-state relays. Relays are used where it is necessary to control a circuit by a low-power signal (with complete electrical isolation between control and controlled circuits), or where several circuits must be controlled by one signal. The first relays were used in long distance telegraph circuits as amplifiers: they repeated the signal coming in from one circuit and re-transmitted it on another circuit. Relays were used extensively in telephone exchanges and early computers to perform logical operations. A type of relay that can handle the high power required to directly control an electric motor or other loads is called a contactor. Solid- state relays control power circuits with no moving parts, instead using a semiconductor device to perform switching. Relays with calibrated operating characteristics and sometimes multiple operating coils are used to protect electrical circuits from overload or faults; in modern electric power systems these functions are performed by digital instruments still called "protective relays". A simple electromagnetic relay consists of a coil of wire wrapped around a soft iron core, an iron yoke which provides a low reluctance path for magnetic flux, a movable iron armature, and one or more sets of contacts (there are two in the relay pictured). The armature is hinged to the yoke and mechanically linked to one or more sets of moving contacts. It is held in place by a spring so that when 20 the relay is de-energized there is an air gap in the magnetic circuit. In this condition, one of the two sets of contacts in the relay pictured is closed, and the other set is open. Other relays may have more or fewer set. 2.6.1 TYPES OF RELAYS 1. LATCHING RELAY Latching relays are also called impulse relays. They work in the bi-stable mode, and thus have two relaxing states. They are also called keep relays or stay relays because as soon as the current towards this relay is switched off, the relay continues the process that it was doing in the last state. This can be achieved only with a solenoid which is operating in a ratchet and cam mechanism. It can also be done by an over-centre spring mechanism or a permanent magnet mechanism in which, when the coil is kept in the relaxed point, the over-centre spring holds the armature and the contacts in the right spot. This can also be done with the help of a remnant core. In the ratchet and cam method, power consumption occurs only for a particular time. Hence it is more advantageous than the others. 2. REED RELAY These types of relays have been given more importance in the contacts. In order to protect them from atmospheric protection they are safely kept inside a vacuum or inert gas. Though these types of relays have a very low switching 21 current and voltage ratings, they are famous for their switching speeds. 3. POLARIZED RELAY This type of relay has been given more importance on its sensitivity. These relays have been used since the invention of telephones. They played very important roles in early telephone exchanges and also in detecting telegraphic distortion. The sensitivity of these relays are very easy to adjust as the armature of the relay is placed between the poles of a permanent magnet. 4. BUCHHOLZ RELAY This relay is actually used as a safety device. They are used for knowing the amount of gas present in large oil-filled transformers. They are designed in such a way that they produce a warning if it senses either the slow production of gas or fast production of gas in the transformer oil. 5. OVERLOAD PROTECTION RELAY As the name implies, these relays are used to prevent the electric motors from damage by over current and short circuits. For this the heating element is kept in series with the motor. Thus when over heat occurs the bi-metallic strip connected to the motor heats up and in turn releases a spring to operate the contacts of the relay. 22 6. MERCURY WETTED RELAY This relay is almost similar to the reed relay explained earlier. The only difference is that instead of inert gases, the contacts are wetted with mercury. This makes them more position sensitive and also expensive. They have to be vertically mounted for any operation. They have very low contact resistance and so can be used for timing applications. Due to these factors, this relay is not used frequently. 7. MACHINE TOOL RELAY This is one of the most famous industrial relay. They are mainly used for the controlling of all kinds of machines. They have a number of contacts with easily replaceable coils. This enables them to be easily converted from NO contact to NC contact. Many types of these relays can easily be setup in a control panel. Though they are very useful in industrial applications, the invention of PLC has made them farther away from industries. 8. CONTACTOR RELAY This is one of the most heavy load relay ever used. They are mainly used in switching electric motors. They have a wide range of current ratings from a few amps to hundreds. The contacts of these relays are usually made with alloys containing a small percentage of silver. This is done so as to avoid the hazardous effects of arcing. These type of relays are mainly categorized in the 23 rough use areas. So, they produce loud noises while operated and hence cannot be used in places where noise is a problem. 9. SOLID STATE RELAY SSR relays, as its name implies are designed with the help of solid state components. As they do not have any moving objects in their design they are known for their high reliability. 10. SOLID STATE CONTACTOR RELAY These relays combine both the features of solid state relays and contactor relays. As a result they have a number of advantages. They have a very good heat sink and can be designed for the correct on-off cycles. They are mainly controlled with the help of PLC, microprocessors or microcontrollers. 2.7 CAPACITORS A capacitor is a two-terminal, electrical component. Along with resistors and inductors, they are one of the most fundamental passive components we use. You would have to look very hard to find a circuit which didn’t have a capacitor in it. Capacitors are components that are used to store an electrical charge and are used in timer circuits. A capacitor may be used with a resistor to produce a timer. Sometimes capacitors are used to smooth a current in a circuit as they can prevent false triggering of other components such as relays. When power is 24 supplied to circuit that includes a capacitor - the capacitor charges up. When power is turned off the capacitor discharges its electrical charge slowly. There are two common ways to draw a capacitor in a schematic. They always have two terminals, which go on to connect to the rest of the circuit. The capacitors symbol consists of two parallel lines, which are either flat or curved; both lines should be parallel to each other, close, but not touching (this is actually representative of how the capacitor is made). Hard to describe, easier to just show: Fig 2.7 A schematic diagram showing the connection of a capacitor (1) and (2) are standard capacitor circuit symbols. (3) is an example of capacitors symbols in action in a voltage regulator circuit. The symbol with the curved line (#2 in the photo above) indicates that the capacitor is polarized, meaning it’s probably an electrolytic capacitor. The 25 capacitance of a capacitor – how many farads it has – depends on how it’s constructed. More capacitance requires a larger capacitor. Plates with more overlapping surface area provide more capacitance, while more distance between the plates means less capacitance. The material of the dielectric even has an effect on how many farads a cap has. The total capacitance of a capacitor can be calculated with the equation: Where ε is the dielectric’s relative permittivity (a constant value determined by the dielectric material), A is the amount of area the plates overlap each other, and d is the distance between the plates. 2.7.1 How a Capacitor Works Electric current is the flow of electric charge, which is what electrical components harness to light up, or spin, or do whatever they do. When current flows into a capacitor, the charges get “stuck” on the plates because they can’t get past the insulating dielectric. Electrons – negatively charged particles – are sucked into one of the plates, and it becomes overall negatively charged. The large mass of negative charges on one plate pushes away like charges on the other plate, making it positively charged. The positive and negative charges on 26 each of these plates attract each other, because that’s what opposite charges do. But, with the dielectric sitting between them, as much as they want to come together, the charges will forever be stuck on the plate (until they have somewhere else to go). The stationary charges on these plates create an electric field, which influence electric potential energy and voltage. When charges group together on a capacitor like this, the cap is storing electric energy just as a battery might store chemical energy. 2.7.2 Charging and Discharging of a Capacitor When positive and negative charges coalesce on the capacitor plates, the capacitor becomes charged. A capacitor can retain its electric field – hold its charge – because the positive and negative charges on each of the plates attract each other but never reach each other. At some point the capacitor plates will be so full of charges that they just can’t accept any more. There are enough negative charges on one plate that they can repel any others that try to join. This is where the capacitance (farads) of a capacitor comes into play, which tells you the maximum amount of charge the cap can store. 2.7.3 A Capacitor’s Capacitance 27 How many farads it has – tells you how much charge it can store. How much charge a capacitor is currently storing depends on the potential difference (voltage) between its plates. This relationship between charge, capacitance, and voltage can be modeled with this equation: Charge (Q) stored in a capacitor is the product of its capacitance (C) and the voltage (V) applied to it. The capacitance of a capacitor should always be a constant, known value. So we can adjust voltage to increase or decrease the cap’ s charge. More voltage means more charge, less voltage…less charge. That equation also gives us a good way to define the value of one farad. One farad (F) is the capacity to store one unit of energy (coulombs) per every one volt. 2.7.4 Types of Capacitors There are all sorts of capacitor types out there, each with certain features and drawbacks which make it better for some applications than others. 1. Ceramic Capacitors The most commonly used and produced capacitor out there is the ceramic capacitor. The name comes from the material from which their dielectric is made. Ceramic capacitors are usually both physically and capacitance-wise small. It’s hard to find a ceramic capacitor much larger than 10µF. A surface-mount ceramic cap is commonly found in a tiny 0402 (0.4mm x 0.2mm), 0603 (0.6mm x 28 0.3mm) or 0805 package. Through-hole ceramic caps usually look like small (commonly yellow or red) bulbs, with two protruding terminals. Two caps in a through-hole, radial package; a 22pF cap on the left, and a 0.1µF on the right. In the middle, a tiny 0.1µF 0603 surface-mount cap. Compared to the equally popular electrolytic caps, ceramics are a more near-ideal capacitor (much lower ESR and leakage currents), but their small capacitance can be limiting. They are usually the least expensive option too. These caps are well-suited for high-frequency coupling and decoupling applications. 2. Aluminum and Tantalum Electrolytic Electrolytes are great because they can pack a lot of capacitance into a relatively small volume. If you need a capacitor in the range of 1µF-1mF, you’re most likely to find it in an electrolytic form. They’re especially well suited to high-voltage applications because of their relatively high maximum voltage ratings. Aluminum electrolytic capacitors, the most popular of the electrolytic family, usually look like little tin cans, with both leads extending from the bottom. An assortment of through-hole and surface-mount electrolytic capacitors. Notice each has some method for marking the cathode (negative lead). 3. Super capacitors 29 If you’re looking for a capacitor made to store energy, look no further than super capacitors. These caps are uniquely designed to have very high capacitances, in the range of farads. A 1F (!) super capacitor. High capacitance, but only rated for 2.5V. Notice these are also polarized. While they can store a huge amount of charge, supercaps can’t deal with very high voltages. This 10F super capacitor is only rated for 2.5V max. Any more than that will destroy it. Super caps are commonly placed in series to achieve a higher voltage rating (while reducing total capacitance). The main application for super capacitors is in storing and releasing energy, like batteries, which are their main competition. While super capacitors can’t hold as much energy as an equally sized battery, they can release it much faster, and they usually have a much longer lifespan. 2.8 RESISTORS A resistor is a passive two-terminal electrical component that implements electrical resistance as a circuit element. Resistors act to reduce current flow, and, at the same time, act to lower voltage levels within circuits. In electronic circuits resistors are used to limit current flow, to adjust signal levels, bias active elements, terminate transmission lines among other uses. High-power resistors that can dissipate many watts of electrical power as heat may be used as part of motor controls, in power distribution systems, or as test loads for generators. 30 Resistors may have fixed resistances that only change a little with temperature, time or operating voltage. Variable resistors can be used to adjust circuit elements (such as a volume control or a lamp dimmer), or as sensing devices for heat, light, humidity, force, or chemical activity. Resistors are common elements of electrical networks and electronic circuits and are ubiquitous in electronic equipment. Practical resistors as discrete components can be composed of various compounds and forms. Resistors are also implemented within integrated circuits. The electrical function of a resistor is specified by its resistance: common commercial resistors are manufactured over a range of more than nine orders of magnitude. The nominal value of the resistance will fall within a manufacturing tolerance. 2.9 TRANSISTORS During the course of this project, transistor was used as switch between the microcontroller and some of the relays in the circuit diagram below: 31 Fig2.8: showing the switching of a relay with a transistor There are many different types of transistors and they each vary in their characteristics and each have their own advantages and disadvantages. Some types of transistors are used primarily for switching applications. Others can be used for both switching and amplification. Still other transistors are in a specialty group all of their own, such as phototransistors, which respond to the amount of light shining on it to produce current flow through it. 2.9.1Bipolar Junction Transistors Bipolar Junction Transistors are transistors which are made up of 3 regions, the base, the collector, and the emitter. Bipolar Junction transistors, unlike FET transistors, are current-controlled devices. A small current entering in the base region of the transistor causes a much larger current flow from the emitter to the 32 collector region. Bipolar junction transistors come in two main types, NPN and PNP. A NPN transistor is one in which the majority current carrier are electrons. Electron flowing from the emitter to the collector forms the base of the majority of current flow through the transistor. The other type of charge, holes, are a minority. PNP transistors are the opposite. Fig2.9: bipolar transistor electron flow when biased In PNP transistors, the majority current carrier are holes. Overall, bipolar 33 junction transistors are the only type of transistor which is turned on by current input (input into the base). This is because BJTs have the lowest input impedance of all transistors. The low impedance (or resistance) allows current to flow through the base of the transistor. Because of this low impedance also do BJTs have the highest amplification of all transistors. The downside of BJTs is because they have low input impedance, they can cause loading in a circuit. Fig2.10: PNP transistor 34 Fig2.11: NPN transistor Loading is when a device can draw significant current from a circuit, thus disturbing a circuit's power source. The other type is Field Effect Transistor which will not be discussed as it is not exactly relevant in the course of this project. 2.9.2: The transistor as a switch Because a transistor's collector current is proportionally limited by its base current, it can be used as a sort of current-controlled switch. A relatively small flow of electrons sent through the base of the transistor has the ability to exert control over a much larger flow of electrons through the collector. Suppose we had a lamp that we wanted to turn on and off with a switch. 35 Such a circuit would be extremely simple as in Figure below: Fig2.12 switch connection For the sake of illustration, let's insert a transistor in place of the switch to show how it can control the flow of electrons through the lamp. Remember that the controlled current through a transistor must go between collector and emitter. Since it is the current through the lamp that we want to control, we must position the collector and emitter of our transistor where the two contacts of the switch were. We must also make sure that the lamp's current will move against the direction of the emitter arrow symbol to ensure that the transistor's junction bias will be correct as in Figure below (b): 36 Fig2.13: transistor as a switch A PNP transistor could also have been chosen for the job. The choice between NPN and PNP is really arbitrary. All that matters is that the proper current directions are maintained for the sake of correct junction biasing (electron flow going against the transistor symbol's arrow). Going back to the NPN transistor in our example circuit, we are faced with the need to add something more so that we can have base current. Without a connection to the base wire of the transistor, base current will be zero, and the transistor cannot turn on, resulting in a lamp that is always off. Remember that for an NPN transistor, base current must consist of electrons flowing from emitter to base (against the emitter arrow symbol, just like the lamp current). If the switch is open as in Figure above (a), the base wire of the transistor will be left “floating” (not connected to anything) and there will be no current through it. In this state, the transistor is said to be cutoff. If the switch is closed as in Figure above (b), 37 electrons will be able to flow from the emitter through to the base of the transistor, through the switch, up to the left side of the lamp, back to the positive side of the battery. This base current will enable a much larger flow of electrons from the emitter through to the collector, thus lighting up the lamp. In this state of maximum circuit current, the transistor is said to be saturated. 2.9.3 Meter check of a transistor Bipolar transistors are constructed of a three-layer semiconductor “sandwich,” either PNP or NPN. As such, transistors register as two diodes connected back-to-back when tested with a millimeter’s “resistance” or “diode check” function as illustrated in Figure below. Fig2.14: Multi-meter 38 Here we are assuming the use of a multi-meter with only a single continuity range (resistance) function to check the PN junctions. Some multi-meters are equipped with two separate continuity check functions: resistance and “diode check,” each with its own purpose. If your meter has a designated “diode check” function, use that rather than the “resistance” range, and the meter will display the actual forward voltage of the PN junction and not just whether or not it conducts current. Fig2.15: Multi-meter Meter readings will be exactly opposite, of course, for an NPN transistor, with both PN junctions facing the other way. Low resistance readings with the red (+) lead on the base are the “opposite” condition for the NPN transistor. If a 39 multi-meter with a “diode check” function is used in this test, it will be found that the emitter-base junction possesses a slightly greater forward voltage drop than the collector-base junction. This forward voltage difference is due to the disparity in doping concentration between the emitter and collector regions of the transistor: the emitter is a much more heavily doped piece of semiconductor material than the collector, causing its junction with the base to produce a higher forward voltage drop. Knowing this, it becomes possible to determine which wire is which on an unmarked transistor. This is important because transistor packaging, unfortunately, is not standardized. All bipolar transistors have three wires, of course, but the positions of the three wires on the actual physical package are not arranged in any universal, standardized order. Suppose a technician finds a bipolar transistor and proceeds to measure continuity with a multi-meter set in the “diode check” mode. Measuring between pairs of wires and recording the values displayed by the meter, the technician obtains the data: 40 Fig2.16: unknown bipolar transistor Meter touching wire 1 (+) and 2 (-): “OL” Meter touching wire 1 (-) and 2 (+): “OL” Meter touching wire 1 (+) and 3 (-): 0.655 V Meter touching wire 1 (-) and 3 (+): “OL” Meter touching wire 2 (+) and 3 (-): 0.621 V Meter touching wire 2 (-) and 3 (+): “OL” The only combinations of test points giving conducting meter readings are wires 1 and 3 (red test lead on 1 and black test lead on 3), and wires 2 and 3 (red test lead on 2 and black test lead on 3). These two readings must indicate forward biasing of the emitter-to-base junction (0.655 volts) and the collector-to-base junction (0.621 volts). Now we look for the one wire common to 41 both sets of conductive readings. It must be the base connection of the transistor, because the base is the only layer of the three-layer device common to both sets of PN junctions (emitter-base and collector-base). In this example, that wire is number 3, being common to both the 1-3 and the 2-3 test point combinations. In both those sets of meter readings, the black (-) meter test lead was touching wire 3, which tells us that the base of this transistor is made of N-type semiconductor material (black = negative). Thus, the transistor is a PNP with base on wire 3, emitteron wire 1 and collector on wire 2 as described in Figure below: Fig2.17: known bipolar transistor Please note that the base wire in this example is not the middle lead of the transistor, as one might expect from the three-layer “sandwich” model of a bipolar transistor. This is quite often the case, and tends to confuse new 42 students of electronics. The only way to be sure which lead is which is by a meter check, or by referencing the manufacturer's “data sheet” documentation on that particular part number of transistor. Knowing that a bipolar transistor behaves as two back-to-back diodes when tested with a conductivity meter is helpful for identifying an unknown transistor purely by meter readings. It is also helpful for a quick functional check of the transistor. If the technician were to measure continuity in any more than two or any less than two of the six test lead combinations, he or she would immediately know that the transistor was defective (or else that it wasn't a bipolar transistor but rather something else -- a distinct possibility if no part numbers can be referenced for sure identification!) 2.10 CRYSTAL OSCILLATOR: A crystal oscillator is an electronic oscillator circuit that uses the mechanical resonance of a vibrating crystal of piezoelectric material to create an electrical signal with a very precise frequency.[1][2][3] This frequency is commonly used to keep track of time (as in quartz wristwatches), to provide a stable clock signal for digital integrated circuits, and to stabilize frequencies for radio transmitters and receivers. The most common type of piezoelectric resonator used is the quartz crystal, so oscillator circuits incorporating them became known as crystal oscillators,[1] but other piezoelectric materials including polycrystalline ceramics 43 are used in similar circuits. Quartz crystals are manufactured for frequencies from a few tens of kilohertz to hundreds of megahertz. More than two billion crystals are manufactured annually. Most are used for consumer devices such as wristwatches, clocks, radios, computers, and cell phones. Quartz crystals are also found inside test and measurement equipment, such as counters, signal generators, and oscilloscopes. A crystal is a solid in which the constituent atoms, molecules, or ions are packed in a regularly ordered, repeating pattern extending in all three spatial dimensions. Almost any object made of an elastic material could be used like a crystal, with appropriate transducers, since all objects have natural resonant frequencies of vibration. For example, steel is very elastic and has a high speed of sound. It was often used in mechanical filters before quartz. The resonant frequency depends on size, shape, elasticity, and the speed of sound in the material. High-frequency crystals are typically cut in the shape of a simple, rectangular plate. Low-frequency crystals, such as those used in digital watches, are typically cut in the shape of a tuning fork. For applications not needing very precise timing, a low-cost ceramic resonator is often used in place of a quartz crystal. A major reason for the wide use of crystal oscillators is their high Q factor. A typical Q value for a quartz oscillator ranges from 104 to 106, compared to perhaps 102 for an LC oscillator. The maximum Q for a high stability quartz 44 oscillator can be estimated as: Q = 1.6 × 107/f, where f is the resonance frequency in megahertz. One of the most important traits of quartz crystal oscillators is that they can exhibit very low phase noise. In many oscillators, any spectral energy at the resonant frequency will be amplified by the oscillator, resulting in a collection of tones at different phases. In a crystal oscillator, the crystal mostly vibrates in one axis, therefore only one phase is dominant. This property of low phase noise makes them particularly useful in telecommunications where stable signals are needed and in scientific equipment where very precise time references are needed. 2.11 THE MICROCONTROLLER: A Microcontroller is a computer on a chip, some school of thought called it a single chip computer, Micro suggest that the device is small, and controller tells you that the device is used to control objects, processes or events. A microcontroller can be considered a self-contained system with a processor, memory and peripherals and can be used as an embedded system. The majority of microcontrollers in use today are embedded in other machinery, such as automobiles, telephones, appliances, and peripherals for computer systems. While some embedded systems are very sophisticated, many have minimal 45 requirements for memory and program length, with no operating system, and low software complexity. Typical input and output devices include switches, relays, solenoids, LEDs, small or custom LCD displays, radio frequency devices, and sensors for data such as temperature, humidity, light level etc. Embedded systems usually have no keyboard, screen, disks, printers, or other recognizable I/O devices of a personal computer and may lack human interaction devices of any kind. Microcontrollers must provide real time (predictable, though not necessarily fast) response to events in the embedded system they are controlling. When certain events occur, an interrupt system can signal the processor to suspend processing the current instruction sequence and to begin an interrupt service routine (ISR, or "interrupt handler"). The ISR will perform any processing required based on the source of the interrupt, before returning to the original instruction sequence. Possible interrupt sources are device dependent, and often include events such as an internal timer overflow, completing an analog to digital conversion, a logic level change on an input such as from a button being pressed, and data received on a communication link. Where power consumption is important as in battery operated devices, interrupts may also wake a microcontroller from a low power sleep state where the processor is halted until required to do something by a peripheral event. The PIC architecture is characterized by its multiple attributes: 46 • Separate code and data spaces (Harvard architecture). • A small number of fixed length instructions • Most instructions are single cycle execution (2 clock cycles, or 4 clock cycles in 8-bit models), with one delay cycle on branches and skips • One accumulator (W0), the use of which (as source operand) is implied (i.e. is not encoded in the opcode) • All RAM locations function as registers as both source and/or destination of math and other functions. • A hardware stack for storing return addresses • A small amount of addressable data space (32, 128, or 256 bytes, depending on the family), extended through banking • Data space mapped CPU, port, and peripheral registers • ALU status flags are mapped into the data space • The program counter is also mapped into the data space and writable (this is used to implement indirect jumps). In this our design, the microcontroller 16F877A is used. The PIC16F877A CMOS FLASH-based 8-bit microcontroller is upward compatible with the PIC16C5x, PIC12Cxxx and PIC16C7x devices. It features 200 ns instruction execution, 256 bytes of EEPROM data memory, self programming, an ICD, 2 Comparators, 8 47 channels of 10-bit Analog-to-Digital (A/D) converter, 2 capture/compare/PWM functions, a synchronous serial port that can be configured as either 3-wire SPI or 2-wire I2C bus, a USART, and a Parallel Slave Port. Some of the features of the PIC 16F877A includes the following: 2.11.1 High-Performance RISC CPU • Lead-free; RoHS-compliant • Operating speed: 20 MHz, 200 ns instruction cycle • Operating voltage: 4.0-5.5V • Industrial temperature range (-40° to +85°C) • 15 Interrupt Sources • 35 single-word instructions • All single-cycle instructions except for program branches (two-cycle). 2.11.2 Special Microcontroller Features • Flash Memory: 14.3 Kbytes (8192 words) • Data SRAM: 368 bytes • Data EEPROM: 256 bytes • Self-reprogrammable under software control • In-Circuit Serial Programming via two pins (5V) 48 • Watchdog Timer with on-chip RC oscillator • Programmable code protection • Power-saving Sleep mode • Selectable oscillator options • In-Circuit Debug via two pins 2.11.3 Peripheral Features • 33 I/O pins; 5 I/O ports • Timer0: 8-bit timer/counter with 8-bit prescaler • Timer1: 16-bit timer/counter with prescaler . Can be incremented during Sleep via external crystal/clock • Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler • Two Capture, Compare, PWM modules • . 16-bit Capture input; max resolution 12.5 ns . 16-bit Compare; max resolution 200 ns . 10-bit PWM Synchronous Serial Port with two modes: . SPI Master 49 . I2C Master and Slave • USART/SCI with 9-bit address detection • Parallel Slave Port (PSP) . • 8 bits wide with external RD, WR and CS controls Brown-out detection circuitry for Brown-Out Reset. 2.11.4 Analog Features • 10-bit, 8-channel A/D Converter • Brown-Out Reset • Analog Comparator module 2 analog comparators . Programmable on-chip voltage reference module . Programmable input multiplexing from device inputs and internal VREF . Comparator outputs are externally accessible. 2.14 DTMF DECODER. Over the years, there has been the need to transfer dialing information through the telephone network. The first method invented which is the Dial pulse signaling was not only slow but also suffer severe distortion over long wire loops, 50 but require a PC-path through the communication channels. A signaling scheme was developed utilizing voice frequency tones and implanted as a very reliable alternative to pulse dialing. This scheme is known as a very reliable alternative to pulse dialing. This scheme is known as DTMF (Dual Tone Multi-Frequency),touch tone or simply tone dialing. As its acronym suggests, a valid DTMF signal is the sum of two tones, one from a low group(697-941MHz) and one from the high group(1209-1633MHz) with each group containing four individual tones. The tone frequencies were carefully chosen such that they are not harmonically related and that their inter-modulation products result in minimal signaling impairment. Fig 2.19 DTMF KEYPAD LAYOUT 2.14.1 DUAL TONES MULTI-FREQUENCY KEYPAD: The DTMF keypad is laid out in a 4×4 matrix in which each row represents a low 51 frequency and each column represents a high frequency. Pressing a single key sends a sinusoidal tone for each of the two frequencies. For example, the key 1 produces a superimposition of tones of 697 and 1209 hertz (Hz). Initial pushbutton designs employed levers, so that each button activated two contacts. The tones are decoded by the switching center to determine the keys pressed by the user. The DTMF coding scheme ensures that each signal contains one and only one component from each of the high and low groups. This significantly simplifies decoding because the composite DTMF sign may be handled individually. As a result DTMF coding has proven a flexible signaling scheme of excellent reliability, hence motivating innovative and competitive decoder design. Early DTMF decoders (receivers) utilized banks of band pass filters making them somewhat cumbersome and expensive to implement. This generally restricted their application to control offices (telephone exchanges).The first generation receiver typically used LC filters, active filler or phase locked loop techniques to receive and decode DTMF tones. Initial functions were commonly, phone number decoders and toll call restrictors. A DTMF receiver is also frequently used as a building blocking in a tone to pulse converter which allows touch-tone dialing access to mechanical step-by-step and crossbar exchanges. DTMF keypad frequencies (with sound clips) 52 1209 H 1336 H 1477 H 1633 H z z z z 1 2 3 A 4 5 6 B 7 8 9 C * 0 # D 697 H z 770 H z 852 H z 941 H z Fig2.20 showing the frequency table of a DTMF keypad 2.14.2 WORKING PRINCIPLE OF MT8870 (DTMF DECODER) The MT8870 is a state of the art single chip DTMF. Receiver incorporating switched capacitor filter technology and an advanced digital counting algorithm for period of measurement. To aid design flexibility, the DTMF input signal is first buffered by an input OP-amp which allows adjustment of gain and choice of input configuration. The input stage is followed by low pass continuous RC active filter which perform an 53 anti-aliasing function. Dial tone 350Hz-440Hz is then rejected by a third order switched capacitor watch filter. The signal still in its composite form is then spilt into its individual high and low frequency components by two sixth order switched capacitor and pass filters. Each component tone is then smoothen by an output filter and square up by a hard limiting comparator. The two resulting rectangular waves are applied to digital circuitry when counting algorithm measures and averages their periods. An accurate reference clock is derived from an inexpensive external 3.58MHz color-burst crystal Upon recognition of a valid frequency from each tone group, the Early Steering(ESt) output is raised. The time required to detect the presence of two valid tones top is a function of the decodes algorithm, the tone frequency and the previous start of the decode logic. ESt indicates that the two tones of proper frequency have been detected and initiates an RC timing circuit. If both tones are present for the minimum guard time TGTP, which is determined by external RC network, the DTMF signal is decoded and the resulting data is cached in the output register. The delay steering (StD) is raised and indicates that new data is available. The time required to receive valid DTMF signal tREC, is equal to the sum of tDP and tGTP.. 2.15 TRANSFORMERS: 54 A transformer is an electrical device that transfers energy between two or more circuits through electromagnetic induction. A varying current in the transformer's primary winding creates a varying magnetic flux in the core and a varying magnetic field impinging on the secondary winding. This varying magnetic field at the secondary induces a varying electromotive force (emf) or voltage in the secondary winding. Making use of Faraday's Law in conjunction with high magnetic permeability core properties, transformers can thus be designed to efficiently change AC voltages from one voltage level to another within power networks. Transformers range in size from RF transformers less than a cubic centimeter in volume to units interconnecting the power grid weighing hundreds of tons. A wide range of transformer designs is encountered in electronic and electric power applications. Since the invention in 1885 of the first constant potential transformer, transformers have become essential for the AC transmission, distribution, and utilization of electrical energy.[3] Fig 2.21.A schematic diagram of a transformer Basic principles Ideal transformer connected with source V P on primary and load impedance ZL on secondary, where 0< ZL < ∞. 55 Fig.2.22. Ideal transformer and induction law[c] It is very common, for simplification or approximation purposes, to analyze the transformer as an ideal transformer model as represented in the two images. An ideal transformer is a theoretical, linear transformer that is lossless and perfectly coupled; that is, there are no energy losses and flux is completely confined within the magnetic core. Perfect coupling implies infinitely high core magnetic permeability and winding inductances and zero net magnetomotive force.[5][d] A varying current in the transformer's primary winding creates a varying magnetic flux in the core and a varying magnetic field impinging on the secondary winding. This varying magnetic field at the secondary induces a varying electromotive force (emf) or voltage in the secondary winding. The primary and secondary windings are wrapped around a core of infinitely high magnetic permeability[e] so that all of the magnetic flux passes through both the primary and secondary 56 windings. With voltage source connected to the primary winding and load impedance connected to the secondary winding, the transformer currents flow in the indicated directions. (See also Polarity.) According to Faraday's law of induction, since the same magnetic flux passes through both the primary and secondary windings in an ideal transformer,[7] a voltage is induced in each winding, according to eq. (1) in the secondary winding case, according to eq. (2) in the primary winding case.[8] The primary emf is sometimes termed counter emf.[9][10][f] This is in accordance with Lenz's law, which states that induction of emf always opposes development of any such change in magnetic field. The transformer winding voltage ratio is thus shown to be directly proportion to the winding turns ratio according to eq. (3).[11][12][g][h] According to the law of Conservation of Energy, any load impedance connected to the ideal transformer's secondary winding results in conservation of apparent, real and reactive. Real transformer equivalent circuit. Core loss and reactance is represented by the following shunt leg impedances of the model: Core or iron losses: RC Magnetizing reactance: XM.RC and XM are collectively termed the magnetizing branch of the model. Core losses are caused mostly by hysteresis and eddy current effects in the core and are proportional to the square of the core flux for 57 operation at a given frequency.[30] The finite permeability core requires a magnetizing current IM to maintain mutual flux in the core. Magnetizing current is in phase with the flux, the relationship between the two being non-linear due to saturation effects. However, all impedances of the equivalent circuit shown are by definition linear and such non-linearity effects are not typically reflected in transformer equivalent circuits.[30] With sinusoidal supply, core flux lags the induced emf by 90°. With open-circuited Secondary winding, magnetizing branch current I0 equals transformer no-load current.[29] Fig.2.23 showing the primary and secondary windings of a transformer All transformers have copper and core losses, and flux leakage. Copper loss is ohmic power lost in the primary and secondary windings of a transformer due to the ohmic resistance of the windings. Copper loss, in watts, may be found using the following equation 58 Copper Losses = Ip Rp + Is Rs Where, Ip is the primary current, Is is the secondary current, Rp is the primary resistance, and Rs is the secondary resistance. Core losses are caused by two factors: hysteresis and eddy current losses. Hysteresis loss is that energy lost by reversing the magnetic field in the core as the magnetizing AC rises and falls and reverses direction. Eddy current loss is a result of induced currents circulating in the iron core. It can be used by laminations. 2.15.1 Basic principles of a Transformer As mentioned earlier the transformer is a static device working on the principle of Faraday's law of induction. Faraday's law states that a voltage appears across the terminals of an electric coil when the flux linkages associated with the same changes. This emf is proportional to the rate of change of flux linkages. Putting mathematically, 59 Fig2.24: flux linkages of a coil Where, e is the induced emf in volt and is the flux linkages in Weber turn. Transformers are commonly used in applications which require the conversion of AC voltage from one voltage level to another. There are two broad categories of transformers: electronic transformers, which operate at very low power levels, and power transformers, which process thousands of watts of power. Electronic transformers are used in consumer electronic equipment like television sets, VCRs, CD players, personal computers, and many other devices, to reduce the level of voltage from 220V (available from the AC mains) to the desired level at which the device operates. Power transformers are used in power generation, transmission and distribution systems to raise or lower the level of voltage to the desired levels. The basic principle of operation of both types of transformers is 60 the same. CHAPTER THREE METHODOLOGY 61 3.1 SYSTEM SPECIFICATION The following are the system specifications for the design of this project: i. Two sources of power supply; the main supply which is power grid and the alternative supply which is generator. ii. Coding of a programmable micro controller. iii. An automatic switching system via relays. iv. Automatic start and stop system of the generator. v. A system designed based on the principle guiding Close Transition Transfer Switch (make before break). vi. An automatic power supply unit. vii. An automatic voltage sensing circuitry that senses insufficient power supply or power outage from the main supply to the load. viii. A wireless override system introduced into the system with the aid of a tone generator (mobile phone) and also a tone detector (DTMF). ix. The override operation has four (4) options which can be selected using your mobile phone: § Power grid Auto On § Power grid Auto Off 62 § Generator Auto On § Generator Auto Off x. Power grid Auto On and the Generator Auto On options, returns the system operation to ATS. xi. Power grid Auto Off option keeps the system power supply on the main supply. xii. Generator Auto Off option keeps the system power supply on the generator supply. 3.2 SYSTEM OVERVIEW/BLOCK DIAGRAM The system consists of different modules which include the DTMF transmitter, DTMF receiver, DTMF decoder, micro controller, LCD display, changeover actuator (via relays), generator start/stop actuator (via relays), voltage sensing circuitry. The different modules are interconnected as shown in figure 3.2 below: LCD DTMF Transmitter via GSM DTMF Receiver via GSM DTMF DECODE R VOLTAGE SENSING UNIT MICRO CONTROLLE R GENERATOR START/STOP ACTUATOR CHANGEOVER ACTUATOR LOAD 63 Figure 3.1 BLOCK DIAGRAM OF CIRCUIT DESIGN The block diagram can be grouped into two sections as below: 1. Remote Section 2. Local Control Section 1. Remote Section This section consists of a DTMF transmitter (user mobile), which is mainly a mobile telephone (GSM) with any of the network providers such as MTN, AIRTEL, ETISALAT, GLO etc. The transmitter sends a DTMF signal through the network to the receiver. This section serves as a remote for which the override options can be selected. 2. Local Control Section This section consists of a DTMF receiver (GSM phone) with any available network in the phone (we used MTN network in this case). This phone is packaged with a switching circuit which does the selection of a particular source of power. The phone must be in automatic answering mode since the devices are to be controlled automatically. This section has four main blocks, which include the DTMF receiver, DTMF decoder, LCD, and the microcontroller. 64 The functions of the different four blocks are treated individually as below: Ø DTMF Receiver This is a mobile phone that is capable of generating keypad tone and also able to be set on automatic answering mode. This phone operates using GSM technology and is interfaced with the DTMF decoder. It is embedded in the system and enables the user to communicate with the system. Ø DTMF Decoder The decoder is the MT8870D; it is a complete DTMF (Dual Tone Multi-Frequency) receiver integrating both the band split filter and digital decoder functions. The filter section uses switched capacitor techniques for high and low group filters; the decoder uses digital counting techniques to detect and decode all 16-bit DTMF tone pairs into a 4-bit code. The separation of the low-group and high-group tones is achieved by applying the DTMF signal to the inputs of sixth-order switched capacitor band pass filters, the bandwidths of which correspond to the low and high group frequencies. Following the filter section is a decoder employing digital counting techniques to determine the frequencies of the incoming tones and to verify that they correspond to the standard DTMF frequencies. 65 Ø LCD LCD (Liquid Crystal Display) screen is an electronic display module. The LCD used is a 16 x 2 LCD display and is very commonly used in various devices and circuits. A 16 x 2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5 x 7 pixel matrix. The LCD is interfaced to the microcontroller; it outputs information from the microcontroller. Ø Microcontroller (PIC16F877A) The PIC16F877A features 256 bytes of EEPROM data memory, self programming, an ICD, 2 comparators, 8 channels of 10-bit Analog-to-Digital (A/D) converter, 2 capture/compare/PWM functions, the synchronous serial port can be configured as either 3-wire Serial Peripheral Interface (SPI) or the 2-wire Inter-Integrated Circuit (I2C) bus and a Universal Asynchronous Receiver Transmitter (USART). All of these features make it ideal for advanced level applications as used in this project. The PIC is the main control unit of the system. It commands/instructs the system on its operation depending on the program written. The following are the functions of the microcontroller in this project: i. To constantly check the voltage from the mains. ii. To start and stop the generator. 66 iii. To check the operational mode of the generator; that is, either faulty or not. iv. To switch between the main supply (power grid), the auxiliary supply (generator), and the stand-by power source (12V dc rechargeable battery) to power the circuit. v. To transfer the load between the two sources of power; the power grid and the generator. vi. To implement the override operation being selected by the remote phone. vii. To automatically charge the receiver phone. 3.3 TYPES OF TRANSFER SWITCHES Two major types of transfer switches exist: 1. Manual transfer switch ( manual mode of operation) 2. Automatic transfer switch ( automatic mode of operation) 3.3.1 MANUAL TRANSFER SWITCH In this mode of operation when there is any mains failure i.e.: PHCN outage, there is need for a personnel to start the generator manually and wait till the generator attains a synchronous speed. Only after the generator attains that can the operator transfer the load to the generator. In the event that the mains supply is restored the operator has to transfer the load back to the mains supply and turn off the generator. This is done by the manually releasing the changeover breakers. To ensure safety of this operation, the two breakers of the transfer 67 switch must be interlocked. This involves quite a number of personnel as this operation is cumbersome. Restoration of power is usually a prolonged process which causes delay. The process may also result in heavy losses and damage could be done to sensitive loads during this manual process. The figure for this process is shown below: Figure 3.2 BLOCK DIAGRAM OF A MANUAL TRANSFER SWITCH The functions of the blocks are as follows: Ø Mains supply unit This unit is the part responsible for supply from PHCN. It handles AC signals for proper exchange to the load. It also provides the most required source and is frequently checked by the personnel involved to when it is available in other to transfer the load to it. It is majorly from AC mains from the PHCN. It is the most 68 frequent source of energy to the load. The load is connected through the manual contact unit that is operated through the push/pull switch unit. Ø Manual contactor unit Theoretically this is where the actual switch over occurs because the two signal from the two sources are interconnected here. At this region, cable from the two sources is interlinked together. It enables the actual changing over of the power. Ø Generator power supply unit This is the auxiliary part of the system. It is required when the power from the PHCN is not available. It is majorly needed due to non-constant supply of power from the PHCN. It is manually operated by a personnel involved. When the power started is transferred to the load by manually changing the push/pull switch that is connected to the load through the contact unit, it is helping the subsidiary system of the unit. Ø Manual push/pull switch This is the part of the system where the changeover is manually performed. But the common one nowadays is the pull switch type. In this region, when the power from the PHCN goes off, it is manually transferred to the generator. The transfer is possible due to the interconnection of the AC signal from the PHCN and AC signal from the contactor unit. The push/pull switch and contactor unit are properly connected to ensure their execution of the work allocated to them. 69 Ø Load This is the final consumer of all the work performed by the other systems. It provides visible response of the system to humans. 3.3.2 AUTOMATIC TRANSFER SWITCH In this mode of operation when there is any mains failure, there is an automatic switch of power source from the mains to an alternative source of power (in this case a generator). An advantage already picked is the fact that no personnel is needed to handle is transfer as it is automatic. Did I mention that the generator is also started automatically, yes it is. The generator is started automatically upon it sensing power from the mains supply and thereafter switches the load to the generator supply upon it attaining a synchronous speed. When power on the mains is restored, the switch again senses it and transfers the load back to the mains. Diagram for the process is shown below: 70 Figure 3.3 BLOCK DIAGRAM OF AUTOMATIC TRANSFER SWITCH The functions of the various units are as follows: Ø Power supply unit This bears the responsibility for supply from PHCN. It is the part that handles AC signals for proper exchange to the load. It is majorly from AC mains from the PHCN. In this automatic transfer switch system, the main supply unit is no longer monitored by a human being rather automatically monitored by sensing when it is available through the circuit provided in its design. It is automatically transferred to the load when sensed by the voltage sensing unit causing the transfer unit to cut off the supply from the generator. Through this, load receives 71 power from the main supply. Ø Voltage sensing unit In order to check the availability of supply from either source of the system, relay4 is inserted in series into the circuit immediately after the bridge rectifier and another relay3 immediately after relay4. They both make up the voltage sensing unit. During this sensing the public supply is available and the battery is fully charged. The following steps were involved in the sensing of the sources ∙ Relay4 normally open (OFF) simulates public supply availability. ∙ Relay4 normally closed (ON) simulates public supply outage and battery availability. ∙ Relay4 normally at public supply outage opened (OFF) simulates a bad battery or unavailability or faulty generator. ∙ Motor ON means the 12V motor rotates for about 4sec. ∙ Bulb ON means the 60W bulb lights Ø Logic control unit The control logic unit operation is based on sequential timing. The main component of the unit is a control oscillator. This device initiates the required switching in the circuit. Two terminals are used in the circuit for controlling two 72 latches. It is usually configured in the RC mode. Its pin 12 requires logic zero or ground for normal operation. Pin9, 10 and 1 are output 1, 2 and clock terminals, respectively. They are needed for the RC oscillator mode. The device works within 13-18 volts power failure and decide how the transfer should take place and then send appropriate signal to the switching section. Ø Switching transistor and relay unit A relay is an electromagnetic device that is used by varying the input in order to get a desired output. Relays are of two types, the normally closed and the normally open. The type used in this project is the normally open relay. It is a good and common practice to switch a relay with a transistor. The transistor is set in the common emitter configuration. This design of load transfer panel makes use of mainly relays. Its operation is based on the hierarchal rank of contactor relays. It consists of some relays which serves several purposes. Mains auxiliary relay - It is usually present in the generator circuit. When there is power outage in the mains supply, the contacts of the mains auxiliary relay which are in the generator circuit close thereby sending a signal to start the generator. Generator relays - After starting the generator automatically, the load is then 73 transferred to the generator via these relays. Generator auxiliary relay - It is the generator auxiliary relay that is responsible for ensuring that only a power source gets to the load at a point in time. When there is mains supply line to the load before the generator line is activated. Upon restoration of the mains power supply, the generator auxiliary again breaks the generator line before the load is transferred to the mains supply. This design is said t have the following advantages: ∙ It can switch alternating currents. ∙ It can switch high voltages. ∙ It is useful when high currents are to be used. ∙ It can switch many contacts at once. This quantity makes them flexible. It has the following drawbacks: 1. Poor sensing ability to fluctuations due to the fact that relays do not function optimally at low voltages. 2. Switching time in the event of mains power supply outage is slow because switching is done on the basis of energizing and de-energizing of the relay coils. 3. Relays generate a lot of heat during switching actions which could cause short circuits which are very hazardous. 4. Relays draw a lot of power from the supply thereby increasing the overall power consumed by the load. 74 In times like this, there is really no new invention rather what we have now are just improvements and innovations on fundamental principles of obtaining the desired results. Hence, the automatic transfer switch that is designed and constructed is an improvement on what others have done over the years. Ø Transfer unit The basic operation of the project is to switch ON auxiliary power supply (generator). This unit connects the power supply from the generator to the load after a predetermined time interval. This is intended to normalize the current from the generator. The unit is designed to automatically change power supply back to the main supply moments after the AC mains are restored and to switch OFF the generator. The unit removes the stress of manually switching ON the generator when power failure occurs. Ø Load This is the terminal that supplies the wiring of a building with electricity from either the normal AC mains power supply or auxiliary power supply from the generator is intended as back up to the normal AC mains power supply. A 60W light bulb is connected to the terminal as the load. 3.6 FLEXIBILITY The flexibility of the digital system made it easier and preferable to types of 75 system in carrying out most of the designs today. In this project work, most of the sensitive parts were constructed with either digital chips or other chips configured to function in the digital manner. 3.7 RELIABILITY Due to the flexible and simple nature of this design, the system realized is more reliable than the normal analog based design that lacks all sorts of digital logic. This is as a result of very few large scale integrated circuits employed in their implementation. Too many devices cause faults and make troubleshooting difficult. 76 CHAPTER FOUR DESIGN AND IMPLEMENTATION 4.1 SYSTEM DESIGN The project is designed for power supply applications. It involves automatic transfer switch between the main power supply and an auxiliary power supply, such as a generator, as well as a wireless override system. The project implements an automatic switching or starting of the power generator whenever the main power fails. The project also implements a wireless override system in order for an individual to be able to conveniently override the switching operation in the event of an every minute power failure which will cause the system to constantly start and stop the generator which may eventually destroy the coils of the generator or damage our load. The circuit of the project consists of a microcontroller unit, DTMF, and relay switches. The design of the project takes into consideration practical or real life situations, even though it is a prototype design. Irrespective of that fact, a lot of precautions were put in place to make its performance acceptable. The basic operation of the project is to switch ON an auxiliary power supply (like a generator) whenever power fails and safe guard our load in cases of momentary power failure. This operation connects the power supply from the 77 generator to the load after a predetermined time interval. This is intended to normalize the current from the generator. Switching is possible through the use of the relays. The system was designed to automatically transfer power supply back to the main supply moments after the A.C. mains are restored and to switch OFF the generator. The device removes the stress of manually switching ON the generator when power failure occurs. Whenever public power supply is OFF, the relay R1 goes to its normally closed position thereby turning ON the ignition circuit of the generator. This operation allows electric current to flow through the motor/starter of the generator. It is noted that one of the motors terminals is already connected to 12V+ terminals. The switching of the relay allows the other terminal to be grounded thereby completing the circuit of the electric motor. Meanwhile, the change in the logic state of this relay acts as an input to the microcontroller. The microcontroller then gives a few seconds delay and then turns ON transistor T1 which in turn turns ON relay R2 which will consequently make the generator starter circuit. Hence, the generator will come ON along side. Moreover, after a few seconds delay, the controller will activate transistor T2 which will turn ON relay R3 and output from the auxiliary source (generator) will be fed to the loads. However, when the mains supply is back, the relay R1 will go back to its initial 78 normally open position and both the starter and the ignition coil will be broken. Hence, the generator will automatically shut down. But where the mains supply is restored and the voltage sensing unit senses an insufficient voltage level, the microcontroller commands the relay R1 to stay on its normal closed position. The wireless override options are implemented in a case where power outage occurs at every single moment in time so we may want our source of power supply to remain on generator instead of switching at every second, or in a case where there is no generator available so we may want our source to remain on the power grid. The override options are password protected with each of the 4 options having a unique combination of keys. For example, for power grid auto ON (that is, for the system to continue its switching between the sources), the key combinations are *#1; for power grid auto OFF (that is, for the system to stay on the main power supply), the key combinations are *#2; for generator auto ON (that is, for the system to continue its switching between the sources), the key combinations are *#3; for generator auto OFF (that is, for the system to stay on the generator power supply), the key combinations are *#4. This project is divided into four main sections, they are: the power section, voltage sensing section, the switching section, and the wireless override section. Every of these sections operate dependently on each other for the project to work effectively and efficiently. 79 4.2 THE POWER SECTION DESIGN The power section consists of the regulated voltage from the mains and the battery of the generator and also a stand-by rechargeable battery embedded in the system to power it in the event of no power supply from both the mains and the auxiliary (generator). 4.2.1 Voltage Rectification and Regulation The power subsystem has a step down transformer that steps 220V to 12V ac. The required voltage levels for the system are 5V dc and 12V ac. Figure 4.1 Complete Power Supply Circuit Diagram . To obtain these voltage levels, the power supply was design as follows; it is divided into four modules, namely: a. Transformer b. Rectifier 80 c. Filter d. Regulator 4.3 THE VOLTAGE SENSING SECTION DESIGN This unit keeps constant check on the voltage level from the main supply to the load. Here, power outage as well as insufficient power supply from the mains is detected. The output of this unit is fed as an input to the microcontroller which then carries out a certain operation (s) depending on the program coded in the chip. The voltage sensing circuit is mainly made up of the step down transformer, bridge rectifier, capacitors, and resistors. 4.4 THE SWITCHING SECTION DESIGN The switching unit carries out the operation of switching the load between the sources of power. It consists of mainly the relays, and the transistors. 4.4.1 MICROCONTROLLER TO TRANSISTOR-RELAY-DEVICE INTERFACE In this section, four pins RC0 to RC3 of the microcontroller (PIC16F877A) were used as the output port. RC0 and RC1 are interfaced with the changeover 12volts relays while the pins RC2 and RC3 are interfaced with the generator auto start and stop mechanism. The output relay is energized when the NPN transistor 81 (BC547) is in its high state. The output relay will be activated and deactivated for every signal from the transistor, which is in turn operated for every bit signal from the microcontroller that is within the preset time period. When a high is sent through the microcontroller pins RC0 and RC1 to the base of the transistor, maximum circuit current flows through the device (it is biased). These biasing of the transistor causes the contact point of the relays (RL1 and RL2) to switch from either normally open to normally close or vice versa depending on the source being selected. 4.5 THE WIRELESS OVERRIDE SECTION DESIGN This section consists of the DTMF receiver phone, DTMF decoder, and the microcontroller and how they are interfaced with each other. 4.5.1 INTERFACING THE RECIEVER PHONE WITH DTMF DECODER (MT8870) 82 Fig 4.2 DTMF Decoder Circuit Here, a mobile phone is connected at the DTMF input via an ear piece jack. When a call is made to this phone, it automatically picks thereby creating the channel for wireless communication. The MT8870 circuit decodes the keypad pressed on the remote phone by generating a 4 bit binary digital output. This digital output is sent to the microcontroller. When a key is pressed on the matrix keypad, it generates a unique tone consisting of two audible tone frequencies. For example, if the key ‘*’ is being press on the phone, the tone heard actually consists of a 941Hz & 1209Hz sine signal. If the key ‘#’ is being pressed on the phone, the tone generated is a combination of the frequencies 941Hz & 1447Hz. Pressing key ‘1’ will generate the tone form by 697Hz & 1209Hz. 83 4.5.2 DTMF TO MICROCONTROLLER INTERFACE There are 33 I/O pins with individual direction control in the microcontroller. The program sets up the status of the pin. Four pins of the microcontroller (i.e. from RB0 to RB3) are set to be digital input from the DTMF decoder. Four of PORTB’s pins, RB3:RB0, have an interrupt on change feature. Only pins configured as inputs DTMF signal controlled override system can cause this interrupt to occur (i.e., any RB3:RB0 pin configured as an output is excluded from the interrupt on change comparison). For a change on the I/O pin to be recognized, the pulse width must be at least TCY (4/Fosc) wide. In our case DTMF decoder sets up a constant digital output until the new signal appears. The clock input (from OSC1) is internally divided by four to generate four non-overlapping quadrature clocks. In general the PIC16F8X can be operated in four different oscillator modes. We use XT mode (Crystal/Resonator). In this mode a crystal or ceramic resonator is connected to the OSC1/CLKIN and OSC2/CLKOUT pins to establish the oscillation 84 Fig.4.3 General Form of connection of oscillator Recommended capacitor selection for the oscillator is 15-33Pf for both C1 and C2 (but in this project, our C1=C2=22Pf) in the case of frequency 4MHz. Higher capacitance increases the stability of oscillator, but also increases the start up time. Rs may be required at our mode to avoid overdriving crystals with low drive level specification, but in our case we can use the oscillator without it. Pins RB4 – RB7 are grounded. MCLR is master clear (reset) input/programming voltage input. This pin is an active low reset to the device. MT8870 is a complete DTMF receiver with Low power consumption integrating both the band split filter and digital decoder functions. The band split filter section separates the high and low group tones. It is followed by the digital counting section, which verifies the frequency and duration of the received tones before passing the corresponding code to the output bus. There is a minimum component count achieved by on chip provision of a differential input amplifier, clock oscillator and latched three-state bus interface. OSC1 and OSC2 are 85 corresponding clock input and output. A 3.579545MHz crystal connected between pins OSC1 and OSC2 completes the internal oscillator circuit. Connecting TOE pin (Three State Data) to high logic level, it enables the outputs Q1-Q4 (the pin is pulled up internally). Q1–Q4 when enabled by TOE, provide the code corresponding to the last valid tone-pair received. StD pin presents logic high when a received tone-pair has been registered and the output latch updated; then it returns to low logic level. The output pins 11, 12, 13, and14 of the DTMF are connected to the input pins RB0, RB1, RB2, and RB3 respectively. Four LEDs are connected across the output pins of the DTMF with each on every pin. This LEDs function as bit indicators showing when either a high or low is being outputted through any of the pins. 4.6 SOFTWARE DESIGN Our software design and implementation concerns only the microcontroller section and its interface as shown in the above block diagram of figure 3.1. Here, our software development performs the following functions: Ø Decode incoming tone from the MT8870 The DTMF IC (MT8870) receives the DTMF multiple frequency signal from the dial of a key from the remote mobile phone, which it converts to the BCD code 86 that is outputted to the port B pins of the PIC16F877A. Pin 11 – 14 (Q1-Q4) of MT8870 is the three state data output of the DTMF that is enabled by the TOE (Three state Output Enable), an input pin of MT8870. When the TOE enables this Q1-Q4, it provides the code corresponding to the last valid tone pair received and this valid tone is what the PIC decodes at part two. The truth table of this BCD code corresponding to the valid tone-pair is shown in table 4.1 below. When TOE is logic low, the data outputs are high impedance. 87 Table 4.1 Functional Decode Table (L = logic low, H = logic high, Z = high impedance, X = don’t care). Pin RC7 of the PIC interfaces the microcontroller to the 16x2 LCD, which displays the power source mode selected or in use. 88 4.7 IMPLEMENTATION AND TESTING This was a crucial aspect of the system realization. Testing is a continuous process in a project design, in that at every stage, the different sections and parts needs to be tested to ensure that the system doesn’t develop technical faults in the later future. The integration testing (entire system test) was done at the end of the design to know the workability of the project design. This was first done on a breadboard following the theoretical achievement of the circuit on a workbench. The choice of the breadboard was for the following reasons: ∙ Easy removal of non-functioning (faulty) component. ∙ To enhance better planning and space management on the final (Vero) board. ∙ To enhance that the target has been achieved i.e. the whole system worked well. 4.7.1 TRANSMITTER MOBILE PHONE TO CONTROL SECTION MOBILE PHONE IMPLEMENTATION AND TESTING The implementation and testing here is not visible. The voice waveform coming from the transmitters or users mobile is digitally encoded before transmission. The system is based on TDMA (Time Division Multiple Access) hence the user mobile is given access to the radio channel for a limited period and transmits a burst of binary information through the GSM network. When proper interconnection is established between the two mobile phones through the GSM 89 network, then proper authentication is made by pressing the correct keypad combination on the user’s mobile to generate proper dual-multiple frequency for the DTMF IC to decode. We used Nokia 103 phone as our control section phone (i.e. receiver phone) because of the following reasons: ∙ Cheap cost of the phone. ∙ High reliability of Nokia phones. ∙ Availability of the phone in the market. ∙ Highly dependable mica and speaker port. ∙ Auto-answer mode options. 4.7.2 MAIN CIRCUITRY IMPLEMENTATION This is achieved by initially making the design on a breadboard before finally implementing it on the circuit board (Vero board). The only exception here is the microcontroller source code part that was tested on a simulator (proteus) to verify its correctness. Though before the design was implemented using breadboard and subsequently soldering it on the Vero board, the whole circuitry design was first designed on proteus lite software and simulated to vary its workability. The design was implemented on proteus including the microcontroller section and the mikroC source code was loaded on the PIC16F877A and was tested. Logic probes were used at the input of the PIC to 90 represent the BCD codes from the MT8770 DTMF decoder in the proteus lite implementation as shown in the figure 4.2 below. This helped us to test the output of the tone decoder and the microcontroller to ensure that the correct signals were produced from these components and also ensure that our source code helps us achieve our desired result. The components were carefully fixed in the breadboard in accordance with the circuit diagram and digital multi-meters were used to check for continuity and correct polarity of the components. 91 Figure 4.2 Proteus Simulation Diagram 4.8 SOLDERING Components had to be soldered since Vero board was used instead of a printed circuit board. Although, printed circuit board is more reliable and durable (thus most suitable for commercial purpose), the Vero board is chosen because it is cheaper and easier to use. To ensure good quality soldering, the following precautions were taken: 92 ∙ Before soldering, the board was thoroughly cleaned. ∙ A circuitry and contacts that were not to be soldered were covered with heat resistant materials. ∙ Proper care was taken while soldering to avoid damage to components and circuit board by using IC sockets and by not applying heat in a localized region. ∙ After cooling, soldered joints were cleaned and made to have smooth uniform shiny surface. In our soldering, we used digital meter to test for continuity after each component was soldered. Digital meter was used to check whether each component is giving the correct output before soldering it. 4.9 CASING CONSTRUCTION AND PACKAGING The casing was first designed with Autodesk design software called AUTO CAD. This design was then implemented with a cardboard sheet to actually visualize the dimension and shape of the casing. A wooden case was finally used to package the project work after considering various factors which can be categorized into two namely: 1. Physical Factors 2. Environmental Factors 93 4.9.1 PHYSICAL FACTORS The physical factors considered in choosing a wooden casing were: Ø Appearance: Our major aim is to arrive at a package that is beautiful and standard. A wood of high quality was used to ensure reliability. Ø Weight: Here, our consideration is a package or a casing that should be light to ensure portability. 4.9.2 ENVIRONMENTAL FACTORS The environmental factors that also influenced our packaging are: Ø Ambient temperature: We considered the fact that our project design is to be demonstrated in a high temperate area, Nsukka; therefore, the casing should withstand high temperatures. Sequel to this consideration the wooden case was covered with a black later material that could actually act as a heat sink. Ø Humidity: To ensure that the casing does not rust or is airtight and water tight, the package was sealed with a black leather material that will make the package rust resistant and watertight. 94 Ø Shock and Vibration: Due to the adverse effect of shock and vibration, which could affect the functionality of a component or the entire circuitry, the jointed areas of the casing were properly nailed together , damped and were not made of a conductor to prevent shock. Ø Pests and Insects: The casing was made such that it can be able to withstand the destructive tendencies of pests and insects. 4.10 SYSTEM RELIABILITY AND MAINTENANCE Due to the increasing complexity of modern engineering system, the concept of reliability has become a very important factor in the overall system design. Reliability is important because a designer can only justify the trust bestowed in him by the client when the designed system performs as expected over an interval without failure. Therefore, reliability can be defined as the probability of a system or component to function over a specified period under specified conditions without failure. Thus, this reliability can be viewed as a measure of successful performance of a system. Reliability, which is inherent characteristic of a system, similar to the system’s capacity or power rating, needs to be critically addressed at every stage of the product or system development 95 including design, manufacturing and testing. In the design phase, design method relating to the components, material, processes, tolerance and so on, are carefully selected. The objective at this stage are to ensure well established design procedure are applied, known materials and processes are used and the areas of uncertainty are highlighted for further actions. 96 CHAPTER 5 CONCLUSION AND RECOMMENDATIONS 5.1 CONCLUSION The design of this device, automatic transfer switch that has a wireless transmitter device highlights some important and interesting concepts. The first of these is a concept that is the basic definition of engineering the use of what is available to achieve what is needed. The technology that forms the background of this work (i.e. ICS) is a currently existing technology and yet in order to improve on it by introducing this new device, other pre-existing technologies are brought to work together to achieve a unified goal. Thus by using this intelligent switch we can automatically ensure that power is continuously supplied to a system. In some applications, automatic transfer switch may play a vital role. For example, consider a medical situation where a patient is placed under critical life support system and this system requires constant power supply, in the event of power outage, this automatic switching system is really a boon for them in that the alternative power source (generator) automatically takes up the load and power supply is uninterrupted. Finally, ATS proves to be a reliable system of power maintenance and also reduces stress of manpower changeover. As a way of concluding this work, it needs to be said that the idea of introducing this 97 device into the industry will greatly revolutionize the way industrial processes are regulated as well as bring a level of efficiency into this area that is heretofore unprecedented. 5.2 PROBLEMS ENCOUNTERED The major problem encountered was the issue of network failure, if the network is faulty the issue of communicating with the embedded phone becomes a problem. 5.3 RECOMMENDATIONS This control system is recommended for every home, offices, laboratories, hospitals and industries to aid those working or living in those places when it comes to ensuring constant power supply and also in monitoring and controlling some of the home appliances. Based on the foregoing it is recommended that the design and implementation presented in this project work be considered, expanded by anyone who would wish to make a tremendous impact on homes, industry as well as help any company with a pre-existing ICS technology increase efficiency without incurring the high costs required for a total overhaul of their current ICS technology. 98 5.4 LIST OF COMPONENTS AND THEIR COST S/No. Quantity Prices(=N=) 1. Micro Controller (PIC 16F877A) 1 900 2. Micro Controller socket 1 60 3. LCD screen; 16 x 2 1 1500 4. DTMF (MT8870DE) 1 500 5. DTMF socket 1 60 6. Relay; 30A 12V 5 750 7. NPN Transistor; BC547 3 60 8. Resistor; 10K 6 60 9. Zener Diode 6 60 10. Crystals; 4MHz 3 180 11. Resistor; 100K 4 40 12. Capacitor; 22pF 4 40 13. Resistor; 1K 8 80 14. LED; Red 6 60 15. Capacitor; 20pF 4 40 99 16. Capacitor; 0.1ųF 2 20 17. Transformer; 240V 500mA 2 x 24 2 480 18. Bridge Rectifier 2 240 19. Capacitor; 2200ųF 2 120 20. Capacitor; 220ųF 2 120 21. Voltage Regulator (7812) 2 100 22. Voltage Regulator (7805) 2 100 23. Line Vero board 2 200 3 yards 120 24. Jumper wire 25. Packaging 5000 26. Software 10000 27. Soldering lead 1 250 28. Phone ear piece 2 200 29. Renting of generator 1 3000 30. Nokia phone; 103 2 5000 Total = =N= 29,840 100 APPENDIX I: COMPLETE CIRCUIT DIAGRAM OF THE PROJECT 101 APPENDIX II: mikroC CODE FOR THE MICROCONTROLLER (PIC16F877A) 102 float AC_volt; char n=0,t=0,mode,l1,l2,INITIAL_STATE,REPEAT; int count=0; // LCD module connections sbit LCD_RS at RD4_bit; sbit LCD_EN at RD5_bit; sbit LCD_D4 at RD0_bit; sbit LCD_D5 at RD1_bit; sbit LCD_D6 at RD2_bit; sbit LCD_D7 at RD3_bit; sbit LCD_RS_Direction at TRISD4_bit; sbit LCD_EN_Direction at TRISD5_bit; sbit LCD_D4_Direction at TRISD0_bit; sbit LCD_D5_Direction at TRISD1_bit; sbit LCD_D6_Direction at TRISD2_bit; sbit LCD_D7_Direction at TRISD3_bit; // End LCD module connections void Lcd_update(){ if(l1==1 ){ lcd_out(1,1,"GENERATOR MODE "); lcd_out(2,1," "); 103 l2=0; } if(l2==2 ){ lcd_out(1,1,"POWER GRID MODE "); lcd_out(2,1," "); l1=0; } } void check_voltageLevel(){ AC_volt=adc_read(0); AC_volt=AC_volt*5000; AC_volt=AC_volt/1023; AC_volt= AC_volt*240; AC_volt= AC_volt/3000; if(AC_volt<=100){ RC0_BIT=1; delay_ms(800); RC1_BIT=1; l1=1;l2=0; //GENERATOR MODE Lcd_update(); //GENERATOR AUTO START TEST //REPEAT=0; 104 while(RC4_BIT==0 && REPEAT<6 ){ RC2_BIT=1; DELAY_MS(3000); RC2_BIT=0; DELAY_MS(1000); REPEAT++; } if(RC4_BIT==1){ REPEAT=0; } else{lcd_out(2,1,"GENERATOR FAULTY");} } else{ RC0_BIT=0; delay_ms(800); RC1_BIT=0; l2=2;l1=0; //POWER GRID MODE Lcd_update(); //TO OFF A GENERATOR while(RC4_BIT==1){ RC3_BIT=1; DELAY_MS(3000); 105 RC3_BIT=0; DELAY_MS(3000); } } } void mode_write(){ EEPROM_WRITE(0X10,mode); delay_ms(100); INITIAL_STATE=EEPROM_READ(0X10); delay_ms(20); } void interrupt(){ count++; if(count==36000){//for 40 MINUTE CHARGE STATE t=~t; if(t==0){ RC7_BIT=1; } else{ RC7_BIT=0; } count=0; 106 } T0IF_BIT=0; TMR0=0; } void main() { TRISB=0XFF; PORTB=0; TRISC=0X30; PORTC=0; ADCON1=0X09; ADC_Init(); delay_ms(500); PORTC=0; delay_ms(500); OPTION_REG=0X87; T0IE_BIT=1; GIE_BIT=1; INITIAL_STATE=EEPROM_READ(0X10); PORTC=0; Lcd_Init(); // Initialize LCD Lcd_Cmd(_LCD_CLEAR); Lcd_Cmd(_LCD_CURSOR_OFF); // Clear display // Cursor off 107 delay_ms(500); lcd_out(1,1,"AUTO SWITCH"); delay_ms(3000); REPEAT=0; do{ if(INITIAL_STATE==0x01){//power grid mode/auto off RC0_BIT=0; delay_ms(800); RC1_BIT=0; l2=2;l1=0; Lcd_update(); //TO OFF A GENERATOR while(RC4_BIT==1){ RC3_BIT=1; DELAY_MS(3000); RC3_BIT=0; DELAY_MS(3000); } } else if(INITIAL_STATE==0x02){//AUTO ON check_voltageLevel(); //off 108 } else if(INITIAL_STATE==0x03){ RC0_BIT=1; delay_ms(800); RC1_BIT=1; l1=1;l2=0;//GENERATOR MODE Lcd_update(); //TO START A GENERATOR //GENERATOR AUTO START TEST //REPEAT=0; while(RC4_BIT==0 && REPEAT<6 ){ RC2_BIT=1; DELAY_MS(3000); RC2_BIT=0; DELAY_MS(1000); REPEAT++; } if(RC4_BIT==1){ REPEAT=0; } else{lcd_out(2,1,"GENERATOR FAULTY"); } } 109 else if(INITIAL_STATE==0x04){ //AUTO ON check_voltageLevel(); //on } //KEYPRESSSCANNING SECTION if(PORTB==0X0B && n==0){ //* n=1; } if(PORTB==0X0C && n==1){//# n=2; } if(PORTB==0X01 && n==2){//1 n=0;mode=1; //NEPA AUTO ON mode_write(); } else if(PORTB==0X02 && n==2){//2 n=0;mode=2; //NEPA AUTO OFF mode_write(); } else if(PORTB==0X03 && n==2){//3 n=0;mode=3; //GEN AUTO ON mode_write(); } 110 else if(PORTB==0X04 && n==2){//4 n=0;mode=4; //GEN AUTO OFF mode_write(); } }while(1); }