Monday, 17 March 2014

Microcntroller based 3-Q changeover switch by S. Emmanuel E.




INTRODUCTION
The invention of electricity and its advancements in the field of electrical engineering has made electrical energy so vast in its applications. A modern house today, cannot be said to be one if it has no use for electricity .This is because most of the items required for making life fit and comfortable in a home functions with electricity. Electrical appliances like water heaters, radios, televisions, fans, and water pumps e.t.c all have absolute need for electricity. Unfortunately though the poor availability of public utility power in Nigeria has pushed her citizens to seek alternatives and in dependent means of electricity this has resulted in individuals buying wind turbines, solar panels, generating sets and so on. Unavoidably this requires careful selection of the one to be ON to their use – alternative power or public power utility. Sequel to this, phase absence is a very common and severe problem in any industry, home or office. Many times one or two phases may not be live in the three phase supply, because of this some electrical appliances will be ON in one room and OFF in another room. This project is designed to check the availability of any live phase, and the load will be connected to the live phase only. This feat is achieved with AT89C52 MCU [C. N. Gary, 2003.]. This controller continuously checks for live condition of all the phases connected to it, and the controller connects the load the load to the active phase using a relay. The relay is driven with a transistor. If two or three phases are live, the phase will be connected to the phase that is ON only and automatically transferred to the phase that is ON in the event of a main outage or from generator back to main when restored. An LCD is provided to display the status of the phase condition. [M. E. Rajash K. E. Malhorta, 1980] Contrast control preset is given for LCD contrast control. Furthermore the project uses a regulated 12V, 500mA power supply. Bridge type full-wave rectifier was used to rectify the a.c output of the secondary 230/12V step –down transformer [R. J. Maddock, D. M. Calcutta 1988]. In addition due to problems incurred over interrupted power supply, this led to the discovery of three-phase intelligent switching system which makes the selection process a lot stress free, efficient and cost effective. The three-phase intelligent switching system makes our network infrastructure smarter. Intelligent switching systems are in a giving phase in that companies are continually developing solutions that will make network systems smarter in the future [F. B. Fredrick, F.C. Robert, 1975]. The demand for sensitive systems which are able to monitor the violent and devastating effect of fire and vandals at homes, offices etc have increased. This led to the idea of an intelligent switching system which has the ability to monitor, control and switch between phases. It also provides the comfort of starting a standby generator when there is power failure from the mains (PHCN) without the aid of an operator. The switching between the mains and the generator occurs in micro seconds.
1.2        BACKGROUND OF THE STUDY
Electrical power is an indispensable form of energy. Residential, industrial and commercial setups all require continuous supply of electric power to undertake their day- to-day activities. After its generation, the electrical energy is transmitted and finally distributed to be used by various consumers. The power system is never foolproof as it is bedeviled with myriad of problems both natural and man –made. These problems usually lead to power outages. Power system failures or outages in general do not encourage development in the public and private sectors, residential, and commercial Institutions. In countries where these failures are frequent and often lead to prolong periods of outages, the power system can be said to be unreliable. In these countries where government are encouraging private sector participation in the development process, investors confidence is low and investors do not find it prudent to channel their resources into capital intensive ventures in such countries. These problems militate against the development of Industries in such countries.
To lessen the effect of outages, Institutions like Hospitals, banks, etc. that can not do with the absence of electric power have resorted to the use of generators with enough capacity to meet their energy requirements. In the event of power outages, the changeover from power supplied by public utility to a generator is usually performed manually. These practices often result in waste of critical time, machine damage due to incompetence of personnel leading to financial losses. There have being instances because of poorly designed changeover systems, voltages generated by the generators have being fed back into the utility grid system leading to severe shocks and injuries suffered by personnel working on distribution lines.[ J. E. Angello 1960]
The above mentioned problems have created the need for automating the control aspect of finding alternative sources of power to back up the utility supply. Power automation refers to the use of the control systems such as numerical controllers, programmable logic controllers, and other industrial control system to control industrial machinery and processes, reducing the need for human intervention. Specialized hardened computers, referred to as programmable logic controllers (PLC) are use to synchronize the flow of input from sensors and events with the flow of the output to actuators and events.
This leads to precisely controlled actions that permit a tight control of almost any individual process [E. I. Owen, 1996]
In industries, power automation is yet to catch up and thus many industries undertake manual changeover switching. There are some changeover switches available in Nigerian markets which incorporates little or no automation at all. These switches are able to switch between two sources of power supply and do so upon detection of a complete absence of power o one source. These changeovers use contactors, which create chattering noises at half voltages or low voltages. Again, there are time delays in the changeover processes (Hermant Joshi, 2008).
This project seeks to address the problems inherent in the manual changeover process. This present the design and construction of microcontroller based three phase changeover switch that would be to switch electrical power from the utility to the generator installed in the event of power outage or insufficient voltage automatically.
1.3        Motivations for embarking on the Project
From various surveys, it is generally noticed that industries are vulnerable to long and short interruption that are considered as ‘reliability issues’ in the power system analysis. And the use of manual changeover switch has become a major problem due to its greatest delays.
Thus, when the power supply is reconnected, someone has to put OFF the generator and then change the source line from generator to the public supply.
       1.4   Specific objectives of the project.
The objective of this project is to solve the shortfall associated with power supply changeovers available in the market. These shortfalls include:
a)      Changeover delays, chattering which cause can fire, inability to detect and change over at low voltage.
b)        Design and construct a changeover switch that can switch loads from the mains power supply (PHCN) to a back up power supply (GENERATOR SET, SOLAR) with simplicity.
c)        Introduce a circuitry that can sense and monitors phase failure in each of the three phase available in the supply unit and switch to the next source.
Design a three phase changeover switch which is Microcontroller based that can be used for domestic applications, Industries and commercial loads without interruption in production process.
d)       Design a microcontroller based changeover which is capable of switching 50 amperes per phase.
1.5        Significance of the project:
The purpose of this project is to design and construct a microcontroller based three phase changeover switch that can provide solution to the fluctuation of power supply problem we are facing in Nigeria today. The microcontroller  based changeover switch is a unique switching system that can be used to effect the change from one power  supply to another as well as ensuring consistency and reliability in the supply to a particular load or network. The envisaged another changeover switch is to interface between two different electrical power sources e.g., the mains supply and the generator, (Blalock Thomas, 2006).
      1.6        The scope of Project
The scope of this project work seeks to look at how changeover switching affects the users of electricity (consumers) and how to come out with a simple device to protect consumers from these effects. The design and construction of a three phase microcontroller based changeover switch would solve the problem of work force and the danger likely to be encountered by the changeover. The electronic control switch monitors the incoming public supply voltage and detects when the voltage drops below a level that an electrical or electronic gadgets can function depending on the utility services, Michael Valcarcel, (1988)
                    

                                         CHAPTER TWO
                                     LITERATURE REVIEW
According to Donald G. Fink and Wayne (1998), Emergency power systems were used as early as World War II on naval ships. In combat, a ship may lose the function of its steam engines, which powers the steam driven turbines for the generators. Early transfer switches relied on manual operation; two switches would be placed horizontally in line and the ‘ON’ position facing each other, a rod is placed in between. In order to operate the switch one source must be turned ‘OFF’, the rod moved to the other side and the other turned ‘ON’.
Switches allow switching from a primary source to a secondary or tertiary power source and are employed in some electrical power distribution system, (M.A. Mazidi and J.G Mazidi. 200). Power Instability in developing countries have necessitated the need for automation between public power supply and alternative generators to back up the utility power supply, and as the rate of power instability becomes predominately high, the need for automation also becomes high. And since the industrial and commercial processes require uninterrupted power supply, if the process of power supply changeover is manual, it will not only waste time by slowly the process, but could also cause device, process or product to damage. There could be an error during the manual changeover as a result of human factor, and in some cases, this can lead to massive loss of revenue. Therefore, the major aim of this project is to exploit the ubiquitous microcontroller facilities in bringing about automation of change over process. One of the most critical needs of an embedded system such as to decrease the power consumption and space,(http://www.journal.au.edu/eu techn/2006) and this is achieved in this work. It has caused companies to lose millions of dollar each time there is power failures and when power is restored. This can be clearly seen in companies like Telecommunication, Breweries, Cold-rooms, etc .This study is carried out to proffer solution to the shortcomings of the already existing manual changeover switch by has the ability to eliminate the stress of manual switching; monitors phase failures, line drops, and then switch over to the alternate source (generator).
2.1        Review of Existing work
To ensure the continuity of power supply, many commercial/industrial facilities depend on both utility service and on-site generation. And because of the growing complexity of electrical; systems it becomes imperative to give attention to power supply reliability and stability, [P. J. Hurst) 2001].  Over the years many approaches have been implored in configuring a change over system. Some of them are discussed below:
2.1.1     Manual changeover switches box
Manual changeover switch box separates the source between a generator and public supply-Jonathan Gana Kolo (2007). Whenever there is power failure, switching over to other source of supply is done manually by human intervention and the same happens when the public power is restored and this is usually accompanied with loud noise and electrical sparks.
2.1.2     Limitations of a Manual changeover switch
      Below are some of the limitations of manual changeover switches;
a) Time wastage whenever there is power failure
b) It is strengthous to operate
c) Its causes devices, process or product to damage
d) It makes a lot of noise
e) Maintenance is more frequent as the changeover action causes wear and tear.
2.1.2 Automatic changeover system with electromagnetic Relays (EMRs)
A relay is an electromagnetic device that is activated by varying its input in order to get a desired output. Relays are of two types, the normally closed and the normally open-Paul Horowitz and Winfreid (2008)
Recently electromagnetic relays (EMRs) have been used with other components to implement automatic changeover .Such component can be logic gates, transistors, opt-coupler, microcontroller, etc. Most of these components makes use of 5volts since they are transistor-transistor logic (TTL) based, [ B. M. Weedy 1972].  Such control system must be properly isolated from the relay as shown in the block diagram below:
  Isolator
Electronic control
     
  Mains
  Electromagnetic Relay
     
     
    Load
 



Figure 1: Block diagram for control system
This type of changeover is better than manual changeover type because it is automatic and faster, but has its limitations listed below:
1) Noise associated with switching relays,
2) Wear and tear,
3) Arcing which can cause fire outbreak,
4) High components count making the system more prone to failures.
      2.3.1     CHANGEOVER WITH AUTOMATIC TRANSFER SWITCH (ATS)
This type of changeover has an automatic transfer switch –Jerry C. Whitaker, IEE press, Page 1030-1031, which monitors the alternating current ac, voltage coming from the utility company line for power failure conditions upon detection of power failure for predetermined period of time, the standby generator is activated (started) after which the load is transferred from utility to the standby generator. Then, on return of the utility fed, the load is switched back after some time and the generator is stopped. The limitations of this approach are more or less than the same thing with automatic changeover system with electromagnetic relays.
       2.4    DEVELOPMENT THAT HAVE TAKEN PLACE UNDER THIS PROJECT
In view of the limitations of the above previous works, this project proposes and implements a changeover system that drastically reduced the shortcomings. The noise, arcing, wear and tear associated with EMRs are eliminated totally by the introduction of solid state relays. Digital components were also used to make the work more reliable unlike the previously existing ones that make use of circuit breakers. Also AT89C52 microcontroller was also incorporated to help improve the speed of automation. The system is controlled by a software program embedded in the microcontroller, J.Boyle, 2001.
This work is handy and portable compared to the bulky works done previously. It also has some important features like an alarm system for indicating generator failure units and line drops.
       2.5       MICROCONTROLLER
A microcontroller is a computing device capable of executing a program (i.e. a sequence of instructions) and is often referred to as the “brain” or “control center” in a robot or SMART system since it is usually responsible for all computations, decision making, and communications.
In order to interact with the outside world, a microcontroller possesses a series of pins (electrical signal connections) that can be turned HIGH (1/ON), or LOW (0/OFF) through programming instructions. These pins can also be used to read electrical signals (coming form sensors or other devices) and tell whether they are HIGH or LOW.
It is also a self-contained system with peripherals, memory and a processor that can be used as an embedded system. Most programmable microcontrollers that are used today are embedded in other consumer’s product or machinery including phones, peripherals, automobiles and household appliances for computer systems. Due to that, another name for a microcontroller is “Embedded controller”. Some embedded systems are more sophisticated, while others have minimal requirement for memory and programming length and a low software complexity.
Input and output devices include solenoids, LCD displays, relays, switches and sensors for data like humidity, temperature or light level, amongst others
2.5.1 Microprocessors versus Microcontrollers
The primary difference between a microprocessor and a microcontroller is that the microcontroller includes more supporting functions such as on-board memory and I/O than the microprocessor. 
Until recently, microcontroller units (MCU's) were considered less powerful than microprocessors, however, continued development has lead to MCU's that meet or exceed the throughput (number of equivalent instructions per second) of high-end microprocessors. 
2.5.2 Types of microcontrollers
There are several types of Microcontrollers are:
> 8051 Family e.g. AT89C52,AT89S52
> PIC Family, e.g. PIC16F84,
> AVR Family, e.g. ATmega8, ATmega32.
> Digital Signal Processors
Digital Signal Processors (DSP's) are types of microcontrollers that are more specialized for a particular application.  DSP represent around 20% of the total MCU market. DSP's are particularly well suited to real-time operations in which a data stream, video, audio, etc. is modified in someway as it is passed along to another device or component.  Most DSP's are based on the Harvard Architecture.  DSP's commonly include analog-to-digital (A/D) conversion for their inputs and digital-to-analog (D/A) conversion of their outputs.
                      
      Figure 2: Digital Signal Processors Architecture.
2.5.3   Purpose of microcontrollers in this project
a) The embedded controller (microcontroller), in this project will make it precise and accurate in operation
b) It measures load current-true RMS
c) Monitors over voltage and under voltage cut-off for EB and DG (optional)
d) Significant saving on wall space and wiring.
f) For tropicalized and rugged design.
2.5.4. Communication Protocols of Microcontrollers
The various types of Microcontroller communication Protocols are listed as shown   bellow.
a) The SPI  Communication Protocol
b) The chip-to-chip protocol
c) The Master slave protocol
a) I2C and CAN Bus communication Protocol
 b) Serial I/O Interface (UART)
c) 1-Wire® Communication
1. The Universal Asynchronous Receiver/Transmitter (UART) is a popular form of serial communication between digital devices. 
A number of bits are presented to the UART in parallel and are then serialized, transmitted to another UART where they are converted back into a binary vector. 
The UART specification does not include details of the communication details. 
In fact, there are several interface standards in common use (e.g. RS232, RS422 and RS485).  For embedded systems the RS232 standard is the most popular. 
 1. The Serial Peripheral Interface (SPI)
This is a communications protocol used on most MCU's as an inexpensive alternative to multiple pin parallel communications. SPI is used for many applications in MCU including memory data block transfers.  The SPI interface include a clock line, a data-in, a data-out and a chip enable line, named as, SCLK - serial clock  MISO - master input, slave output MOSI - master output, slave input CS - chip select (optional, usually inverted polarity)

Figure .3: The Serial Peripheral Interface (SPI)
3.  I2C Communications
The Inter-Integrated Circuit (I2C) computer bus is used to interface many different types of peripherals to MCU's or other embedded systems when a high data throughput is not required. 
The I2C uses bidirectional data and clock lines with open-collector logic. The standard data rate for the I2C is 100 kilobits/second. It also supports a low-speed 10 Kbits/s or lower. 
The I2C protocol is ideal for sending control signals to remote devices, collecting A/D signals from sensors and accessing slow-speed non-volatile RAM. 
One of the most valuable features is that peripherals can be connected and removed from the I2C bus while powered up.  This is possible because of the open-collector logic in which a bus line is either set to ground or no-connection.
In open-collector circuits, a logical high is achieved by placing pull-up resistor one each open-collector line.
     4   Controller Area Network (CAN) Bus
This is a multicast shared serial bus standard.  The CAN bus was designed to operate in high noise conditions, which makes it a preferred communications standard for applications involving electrical motors and internal combustion engines. 
The CAN protocol uses error-correcting codes to automatically detect and recover bit errors in data words.  The full data transfer rate of 1Mbit/s the total length of the CAN network is limited to less than 50 metres. 
Figure 4: Controller Area Network (CAN) Bus
5. 1-Wire Communication with PIC Microcontroller
This application note introduces the user to the 1-Wire communication protocol and describes how a 1-Wire device can be interfaced to the PIC microcontrollers. 1-Wire protocol is a registered trade mark of Maxim/ Dallas Semiconductor.
A software stack for the basic, standard speed, 1-Wire master communication is provided with this application note along with an example application
5(a)       OVERVIEW OF THE 1-Wire BUS
The PIC microcontrollers have multiple General Purpose Input/output (GPIO) pins, and can be easily configured to implement Maxim/Dallas Semiconductor’s 1-Wire protocol.
The 1-Wire protocol allows interaction with many Maxim/Dallas Semiconductor parts, including battery and thermal management devices, memory, Buttons®, etc.
1-Wire devices provide solutions for identification, memory, timekeeping, measurement and control.
1-Wire data interface is reduced to the absolute minimum (single data line with a ground reference). As most 1-Wire devices provide a relatively small amount of data, the typical data rate of 16 kbps is sufficient for the intended tasks. It is often convenient to use a GPIO pin of an 8-bit or 16-bit microcontroller in a “bit banging” manner to act as the bus master. 1-Wire devices communicate using a single data line and well-defined, time tested protocols.

5(b)       1-Wire Protocol
• The protocol is called 1-Wire because it uses 1 wire to transfer data. 1-Wire architecture uses a pull-up resistor to pull voltage off the data line at the master side.
• 1-Wire protocol uses CMOS/TTL logic and operates at a supply voltage ranging from 2.8V to 6V.
• Master and slave can be receivers and transmitters, but transfer only one direction at a time (half duplex). The master initiates and controls all 1-Wire operations.
• It is a bit-oriented operation with data read and write, Least Significant bit (LSB) first, and is transferred in time slots.
• The system clock is not required as each part is self-clocked and synchronized by the falling edge of the master.
5©        Prerequisites
The requirements of any 1-Wire bus are:
• The system must be capable of generating an accurate and repeatable 1μs delay for standard speed and 0.25μs delay for overdrive speed.
• The communication port must be bidirectional; its output must be open-drain and there should be a weak pull-up on the line.
• The communication operations should not be interrupted while being generated
5(d)       OPERATIONS OF THE 1-Wire BUS
The four basic operations of a 1-Wire bus are Reset, Write 0 bit, Write 1 bit and Read bit.
Using these bit operations, one has to derive a byte or a frame of bytes.
The bus master initiates and controls all of the 1-Wire communication. Figure 2 illustrates the 1-Wire communication timing diagram. It is similar to Pulse-Width Modulation (PWM) because, the data is transmitted by wide (logic ‘0’) and narrow (logic ‘1’) pulse widths during data bit time periods or time slots. The timing diagram also contains the recommended time values for robust communication across various line conditions.
Table 1 provides a list of operations with descriptions and also implementation steps; this is for standard speed.
A communication sequence starts when the bus master drives a defined length “Reset” pulse that synchronizes the entire bus. Every slave responds to the “Reset” pulse with a logic-low “Presence” pulse (http://www.maxim-ic.com/quick_view2.cfm/qv_pk/
3711/t/al) To write the data, the master first initiates a time slot by driving the 1-Wire line low, and then, either holds the line low (wide pulse) to transmit a logic ‘0’ or releases the line (short pulse) to allow the bus to return to the logic ‘1’ state. To read the data, the master again initiates a time slot by driving the line with a narrow low pulse. A slave can then either return a logic ‘0’ by turning on its open-drain output and holding the line low to extend the pulse, or return a logic ‘1’ by leaving its open-drain output off to allow the line to recover.( http://www.maxim-ic.com/)
• Most 1-Wire devices support two data rates: standard speed of about 15 kbps and   overdrive speed of about 111 kbps.
The protocol is self-clocking and tolerates long inter-bit delays, which ensures smooth operation in interrupted software environments. (http://www.maxim-ic.com/1-Wire)
appnotes.cfm?appnote_number=126)

5) The SPI protocol
The SPI protocol is a widely accepted and easily used serial transfer protocol. It is fast and efficient, allowing for simultaneous bi-directional data transfer. The protocol involves a master-slave configuration which includes a master device and one or more slave devices. However, the protocol does allow for multiple slave devices to simultaneously communicate with a single master device. This application note provides information on both the hardware and software aspects of a single master, multi-slave SPI setup under two operating conditions: (1) when both master and slave are operating from the same source voltage and (2) when master and slave are operating from different source voltages.
This application note shows the hardware and software for an SST89E/V516RDx microcontroller utilizing its 8-bit hardware SPI to communicate with several SST25VFxxx Serial Flash memory devices. The software routines, written in C, contain extensive comments to describe the function of each routine. Port 1 of the MCU is used to interface 25VFxxx devices, and Port 2 of the MCU can contain LEDs for debugging. Companion product data sheets for the SST89E/ V516RDx MCU and 25VFxxx Serial Flash should be reviewed in conjunction with this application note for a complete understanding of the hardware and software examples provided here.
(a)  Master-Slave Running from the Same Voltage Source
Figure 2-1 shows the hardware setup of master and slaves operating at a single supply voltage. P1.2 - P1.4 control the Chip-Enable inputs for the three 25 series memory chips. P1.5 - P1.7 provide the SI, SO, and SCK interfaces respectively to each chip. This means that all three memory chips are clocked off the same clock and communicate on the same serial bus. Also note that the SO outputs on the memory are in a Hi-Z state when CE is HIGH. For this reason, no buffers are required between the memory and the MCU. For the same reason, only one memory chip may be enabled at one time. Enabling more than 1 memory chip at one time risks data corruption and possible hardware damage. Although there are extra port pins available on the MCU to implement the HOLD and Write-Protect features, such implementation is up to customer preference and beyond the scope of this application note.

      Figure 5: Master-Slave Running from the Same Voltage Source
(b)  Master-Slave Running from Different Source Voltages
The schematic in Figure 2-2 shows how the same master-slave setup can be achieved when the master is running at a different voltage than the slaves. As you can see, the first modification is the addition of a voltage regulator. Any suitable voltage regulator will be adequate. The one used with the above system is a STMicroelectronics LF30CV. Next, the addition of the high-speed Texas Instruments SN74LVC4245A level shifters is necessary due to the voltage differences between the master and slave devices. P1.2 - P1.4 outputs are still used to control the Chip- Enables of the three memory chips. The only difference now is that they are routed through the level shifters first so that the proper voltage levels can be conveyed to the memory devices. Level shifters are also used between the MCU and the SI, SO and SCK signals of the serial flash. Even with the addition of the level shifters, there is no software driver change between the formal single voltage system and the latter dual voltage system. One possible design concern is making sure the maximum data transmission speed for the level shifters matches or (preferably) exceeds the maximum desired transmission speed of the SPI bus.
Since the TI level shifters shown above can transmit data much faster than the SPI protocol would allow, this is not an issue in our design. However, if your design uses different level shifters, make sure the new level shifters can keep up with the SPI bus speed being used.
      Figure 6: Master-Slave Running from Different Source Voltages
2.6        PROGRAMMING SOFTWARE
2.6.1 Driver Description
Custom code is required for proper communication between a single master and multi slave devices. The following code is written for this purpose. It is also highly modular so it can be flexible while efficient. The code can be used in its entirety or modified to suit different application needs. The code contained within this application note is designed as a driver set for communication between a single master device and multiple slave devices via the SPI bus as illustrated in the preceding hardware section. As such, the functions shown below are meant to be called from the customer’s main program. A sample MAIN program is provided to illustrate proper use of the driver functions. The sample MAIN will initialize all three memory chips and perform a chip erase to all three chips. Then it will write the byte values 0-19 to the first memory chip, 20-39 to the second chip, and 40-59 to the third chip. All chips are being written to starting at memory address 0000H.
Name                                          Function
HWSPI_Init                                 Initializes SPI.
SST_Master IO                           Handles byte transfer to and
From slave device.
CE_High                                      Sets Chip Enable of the serial flash high
CE_Low                                      Clears Chip Enable of the serial flash low
Read Status_                                Register Reads the status register of
The serial flash
EWSR                                         Enables the Write Status
                                                         Register
WRSR                                         Performs a write to the status
                                                         Register
WREN                                         Write enables the serial flash
WRDI                                          Write disables the serial
                                                         Flash
Read_ID                                      Reads the manufacturer ID and
                                                          device ID
                                                          Reads one byte from the serial
                                                          flash and returns byte
Read_Cont                                  Reads multiple bytes
Byte Program                               Program one byte to the serial
                                                         flash
Auto_Add_IncA                          Initial Auto Address Increment process
Auto_Add_IncB                          Successive Auto Address_                                                                               Increment process after AAI
Initiation
Chip_Erase                                  Erases entire serial flash
Sector_Erase                                Erases one sector (4 KB) of the
                                                         serial flash
Block_Erase                                 Erases one block (32 KB) of
                                                         the serial flash
Wait_Busy                                   Polls status register until busy
                                                         bit is low
2.10      Description of solid state Relays
With emergence of semiconductor technology, the productions of solid state relays were made possible which in many applications out perform their predecessors. A typical solid state relay consists of a light emitting diode (LED) optically coupled to a photovoltaic device such as a Field effect Transistor (FET)
Light from the Led creates s voltage across the photovoltaic array and activates the output FET. FET is the preferred switching element in a solid state relay because it is comparatively less electric resistant when it is in a conductive state than a Traic in the same state and therefore generates less heat. (Alexander C. King, 2003) As a result of this, FET requires smaller heat dissipating fins and can reduce the overall size of the solid state relay. The internal circuitry of a solid states relay is shown above.



Advantages of Solid state Relay over Electromagnetic Relay
Solid state relay has the following properties which give it an edge over the EMR:
1. It has no moving coil part,
2, It has long operating life.
3. It is bounce-free operation
4. It has immunity to electromagnetic interference
5. It has high switching speed
6. It can be controlled by a low signal of about 3volts
7. It has multifunction integration
8. High reliability
9. Resistance to shock and vibration
10. Wide input voltage range
11. No arcing or sparking
12. No acoustical noise
13. High input-output isolation (John Saltford, 2003).
Because of the low signal control feature, solid state relays can be driven directly by the microcontroller without the use of interface drivers. This can save space, time and money, reduce component count as well as improve product life, performance and reliability.
2.11.     Liquid Crystal Display
In the early 1970's, digital watches started showing up in the marketplace with a new and different type of display-the liquid crystal display or LCD. The LCD displays used in these early digital watches were very different from the LEDs they replaced. While even a tiny LED display consumes a few mill watts of power, the LCD consumes just microwatts of power. Hence, the
LCDs are over 1000 times more efficient at their job than the LEDs.
Since their commercialization in the '70s, LCDs are the most popular electronic display device, except one-the CRT. LCD flat full color panels are now challenging the CRT as displays for television and computers. There are also many hybrid systems that use LCD display technology, R. Perez, (1988).
2.12 Liquid crystals
There are 3 states of matter: solid, liquid, gas.
Solids states can be further categorized into: crystalline which has regular arrangement of molecules; and amorphous where there is no regular structure. It is well known that
Crystalline solids  heat → Isotropic liquid.
In 1888, an intermediate phase is discovered and is known as the crystalline liquid or liquid crystal. This phase is called the nematic phase. An example is 4-n-pentyl-4'-cyano-biphenyl (PCB). Since than, over 20,000 known compounds have been found to have the nematic phase, B. Bahadur, (1990).
The main interest in these types of compound is that the nematic phase compounds with rod-like molecules can be aligned by varying an external electric field.
Most of the liquid crystal displays (LCDs) produced today uses either the twisted nematic (TN) or super twisted nematic (STN) electro-optical effects.
2.11.1 Types of LCDs
There are many types of LCDs.
• Dynamic Scattering: Higher voltage, higher power, less legible, now obsolete.
LIQUID CRYSTAL DISPLAYS 2
• FLC (Ferroelectric Liquid Crystal) Bi-stable, faster switching times (~2MHz), can achieve good grayscale by rubbing process.
• TN: Twisted Nematic
• STN: Super-twisted Nematic
• TFT: Thin Film Transistor Active Matrix TN
We will only cover the last three types in our lectures.
2.11.2 Power Requirements
The LCDs have minimal power requirements. Currently manufactured LCDs consume between 1 and 300 microwatts per square centimeter. This is the lowest power consumption of any display type now available. This very low power consumption allows most LCD products to be battery operated.
2.11.3   Principle of Operation of LCD
The LCD uses a system of filters to display information that is similar to the operation of the polarizer. Ambient light enters the LCD display through the front polarizing filter. The coherent light then passes through the liquid crystal medium. This liquid crystal medium is a collection of specific organic molecules which rotate the light passing through them. They change the polarization of the coherent light passed to them.
This rotation of the light's polarization may be from just a few degrees to over 270 degrees, M. Slater, (1989).
In most liquid crystal compounds used in manufacturing LCDs, the amount of rotation of the light's polarization is 90 degrees.
                     Figure 9: Simple diagram for working Principle of LCD
                                        CHAPTER THREE
                                           DESIGN METHODOLOGY
3.1         MATERIALS
The materials to be used in the design of this project are highlighted as shown below:
> The microcontroller device ,AT89S52 and ATmeg8, Voice activator
> Step down transformer, 220V/12V or 12Volt Battery,
> Cables,
> Electronic Components which are : Diodes, Capacitor, varactor,  Resistors,
> Relays, e.g., solid state and Electromagnetic relays, Liquid Crystal Display (LCD) 20X8, Ammeter, Voltmeter, Transistors, Operational Amplifiers, IC regulator, etc 
> Casing, etc.
3.2. Method used in the design
The different modules of three-phase Microcontroller based switching system are presented here. These include:
3.3. POWER SUPPLY UNIT: This unit is designed to produce power of 12volts to the loads. The circuit takes in an alternating current power from the supply and step it down to 12volts ac and then convert it to a direct current. This is achieved using some electronic components such as, diodes, resistors such as choke resistors, capacitors such as mica capacitors, etc. Using the following materials above in the conversion of ac power into a dc power is a transformer-less power supply unit .The conversion of ac power into a dc power is known as “Rectification”. The figure below shows the circuit diagram of the power supply.
                   
          Figure 10: Power supply unit
3.4. Voltage Comparator unit: This is the decision making unit of the system. Sample voltages are compared based on the reference values set. The unit has variable resistor used as potential zener diodes for voltage references, operational amplifiers as voltage comparators and industrial relays for interfacing the D.C outputs with the A.C inputs, J.E Angello, (1960).
The voltage reference settings are Zener diode D13 = 3V, Zener diode D14 =4.7V, Zener diode D15= 10V, Potentiometer VR1 = 13V, and the D.C. output from each phase after filtration equals 18V.
Figure 11: Voltage comparative circuit.
In the design, as seen in fig 1 the reference voltage for the IC comparator is from VR1 potentiometer. Once the input source at pin 3 of the IC is greater, a high output is produced at its pin terminal 6 to energize relay RLA. The energized relay immediately closes on the phase one supply to the A.C load- Bulb.
But when phase two has higher voltage than phase one, the reference voltage at pin 2 of IC1 increases to make the operational amplifier go low, and de-energizes relay RLA. Phase one supply is then shifted to the comparator two i.e. IC2. The reference voltage for IC2 is from the output of IC1. As far as output voltage of IC1 is high, pin 2 terminal of the second comparator will remain greater than the input value at pin 3 of IC2. This will make it impossible for the second relay, RLB to be energized. But one, IC1 goes low, voltage at pin 2 of IC2 immediately gets to OV, comparator 2 is pushed to energize relay RLB. Phase two supply can only be connected to the load when the other two phases are out of supply. Then, the reference of 10V from the diode D15 will be at the terminal 3 of IC3. The positive difference resulting from the two inputs of the comparator puts relay RLC in active form, P.J. Hurst, 2001, thus, this units monitors the line or voltage drop in each phases.

3.5 The Charging Unit
This is like the normal power supply that converts high ac input to a low dc output. The unit transform the high ac input to a low one, rectifies it to produce a dc output. A relay is connected in parallel with the dc output to disconnect the battery from the inverter section while it is charging, F. B. Fredreck, (1975). The values of the components used for the power charging unit are previously calculated. The circuit is as shown in figure 3.3.
         
             Figure 12: Charging circuit


3.6 Phase / line drop detector circuit.
This module of the design monitors the phase or line drop from any of the supply phases. The circuit monitors the phases and sends a feed back to the microcontroller. The microcontroller then signals the relay and energizes it to trip, thereby switching over to next available source.
                Figure 13: Phase/line drop detector circuit
3.7 Phase failure detector
The Microcontroller monitors the mains supply through the phase failure unit and switches the appropriate phase to the load through the solid state relay arrangement.
In case of total power failure, the system sustained by the back up battery, switches on a three phase generator, whose output is also connected to the load through the solid state relay arrangement.
         
Figure 14: Phase failure detector
3.8 The display unit
In the early 1970's, digital watches started showing up in the marketplace with a new and different type of display-the liquid crystal display or LCD. The LCD displays used in these early digital watches were very different from the LEDs they replaced. While even a tiny LED display consumes a few milliwatts of power, the LCD consumes just microwatts of power. Hence, the LCDs are over 1000 times more efficient at their job than the LEDs.
Since their commercialization in the '70s, LCDs are the most popular electronic display device, except one-the CRT. LCD flat full color panels are now challenging the CRT as displays for television and computers. There are also many hybrid systems that use LCD display technology. LCD is used in this project is provided to display the status of the three phase condition. It also has some important features which makes the system user friendly, an alarm system for indicating generator failure, phase failure display of the three phases, over-voltage and under-voltage level monitoring. Contrast control preset is given for LCD contrast control.


                                       
                   Figure 15: Diagram of LCD
3.9        Block Diagram
The different modules of three-phase Microcontroller based switching system are presented in block diagram below in figure 7.
The Microcontroller used in this project design is from the Atmel family, such as AT89S52. The embedded controller has 40 pins and is able to communicate with the hardware using master slave communication protocol to communicate with the hardware part of the system (project) The Master slave communication protocol is explained in details in chapter two of this project write-up.
               
            Figure 16: Shows the block diagram of the system.

3.10. PRINCIPLE OF OPERATION
The implementation of this system was achieved by using the AT89S52 as the host controller. The microcontroller does the control through the software program embedded in it. The phase failure, over voltage and under voltage monitoring was achieved using the operational amplifier LM3914 interfaced to microcontroller. LM3914 is a single IC that has ten separate op-amps embedded in it, J.B. Calverthree, (2001).The host microcontroller was connected to the hardware through cable, and the master microcontroller communicates through cable to the slave, (the hardware).
Below is the summary of the operations of the entire system:
• The microcontroller monitors the mains supply through the phase failure detector, over/under voltage detector units, and switches the appropriate three phases to the load through the solid relay arrangement.
• In the case of total power failure, the system, sustained by back up battery or make use  of the generator battery switches on the three Phase generator, whose output is also connected to the load through the solid relay arrangement.
The switching of the three phase generator is controlled by the generator  control unit.
• In case of starting failure after three attempts, the system sounds an alarm through the voice activator and automatically goes to manual mode (where the user will have to start the generator manually after putting it in order).
• The system connects the load back to utility power and automatically turns off the generator as soon as utility power is restored.
• The liquid crystal display (LCD) displays all the activities of the system, making it user friendly, R. Perez, (1988).
3.11.        Switching Unit. This unit consists of the solid state relays. Each relay is capable of switching at least 80amperes per phase, and each relay handles a phase. The circuit diagram of the switching unit is shown below:
Solid state Relay
   
                   
      Figure 17: Solid State Relay arrangement
3.12. Voice Activator: This device will enable you to wirelessly control the switching of various devices in the room environment, merely using the spoken command. It is aimed at the handicapped user who cannot push buttons on a remote but also has universal appeal as an easy and comfortable way to switch devices, without interrupting the work at hand.
3.12.1   Mode of operation
There are two basic modes of operation of the system –
• Training
• Recognition
But the scope of this project is only limited to the recognition mode of operation and it is explained as below:




3.12.2   Recognition

This mode is valid only when system has been programmed fully. In this mode, the system continuously samples the incoming signal and detects the start of the word. This is indicated by blinking of state LED. On capturing the word, it extracts the parameters and compares them with the previously stored template.
On identifying the match, the word number flashed on the word LEDs and the transmission of corresponding device code begins. The word LEDs remain unchanged till the transmission continues. On detecting the mismatch, the red state LED is flashed.
The recognition mode continues till the system is forced into training mode using DIP switches.
The diagram is shown below:
                                              
          Figure 18: Circuit diagram of voice activation
3.13. Mains Detector Unit: This unit detects the availability of the mains supply coming from the PHCN and sends signal to the Microcontroller through the phase failure detector units. The diagram is shown below:
                            
Figure 19: Mains Detector Unit:
      3.14.     CALCULATION OF POWER FOR A THREE PHASE SYSTEM
If the change over is to be applied on a 220V/415V, 40KVA generator operating at 50Hz and a power factor of about 0.8.
To determine rating of relay to be used as well as cable size
Recall:
Apparent power = 40 x 1000 VA (40KVA)
Line voltage = VL = 415V
Phase voltage = VsP = 240V
Active power “P” = Apparent power x power factor
= 40 x 1000 x 0.8
= 32KW
Assuming a balanced three phase load is being used,
P = 3* Ip*Vp* cos á¶²
40000 = 3 x Ip x 240 x 0.8
Ip = 45000 = 69.4A
Ip 69.4A
The relay required will have a minimum current rating of 69.4A
For increased efficiency a tolerance of about +25% will be given
Thus relay rating will be
15% of 69.4A
= 0.15 x 69.4A
=10.41A
=69.4+10.41
= 79.81Amps or nearest allowable.
Ip = 69.4A deduced is current per phase. Thus any cable used should be capable of carrying about 1.5 times the current. The operating environment will also play a role.
:. Required cable should carry a current of at least
69.4 + (50% x 69.4)
= 18.3 + 34.7
= 104.1Ampere
However, if the operating environment is very hot, a larger cable size will be required.








CHAPTER FOUR
CONSTRUCTION ANDS DESIGN OF THE
MICROCONTROLLER BASED THREE PHASE CHANGEOVER SWITCH PANEL
The Panel was constructed and designed in such a way as to make it look robust and self explanatory. Starting with the casing, it was fabricated from a steel metal (22.0mm thick) and has a dimension of (450X350X170) mm. The Hanger from mounting on the wall was also constructed with key lock facility for safety purposes.
     
      Figure 20: Pictorial of internal arrangement of the panel showing the solid relay.

        
        Figure 21: Pictorial diagram of the outer look of the project.

 
       Figure: 22: Internal diagram of the project showing the Microcontroller.
The panel was designed to carry a total load of 80amperes and can work with approximately a 40KVA three phase generator (maximum). It can not be used for single phase generator. The design was according to the formula shown below:
Power = IV
Nominal voltage =240V
Nominal Current =80A
Nominal Power =240X80
=20KVA (approx.)
The size of the cable used for the power circuit was 16mm²
4.1.       Testing and performance Analysis: The following test was carried out after the construction of the project and the following results were observed
1. Activate the generator start key and off the utility power supply
2. The power supply still off and generator start key deactivated
3. The power supply still off and generator start key deactivated and generator disengaged.
4. The power supply still off and generator start key deactivated and generator engaged.
5. Switch on the utility power supply and activate the utility power start key.
6. Switch on the utility power supply and deactivate the utility power start key and reduce the mains to 170V using variable transformer
7. Switch on the utility power supply and deactivate the utility power override and return the mains to 220V using variable transformer.
The corresponding expected results during the test are stated as shown below.
1. The system should not attempt starting the generator despite the fact that there is no utility supply
2. The system should attempt starting the generator.
 3. The system should attempt starting the generator three times and then sounds an alarm and display fault on LCD.
4. The system should start the Generator
5. The system should not switch on any of the three phases available from the utility supply
 6. The system should not switch on any phase but puts on gen if generator is not on.
7. The system should switch on any of the phase and switch off the generator.
After the project has been tested, the result oriented obtained are also stated as follows;
1. The system did not attempt starting the generator
2. The system did attempt starting the generator
3. The system immediately did start the generator three times and alarm was sounded and the fault was displayed on LCD
4. The system actually started the generator immediately
5. The system did not switch on any of the available three phases available from the utility supply
6. The system did not switch on any of the available three phases from the utility supply, but switch on the generator immediately when it was not on previously
7. The system switched on one of the phase and puts off the generator almost immediately
4.2        Panel coupling
The Power supply unit is first coupled after tested and its works. The next module/unit is the phase failure unit. The circuit diagram below shows the order of arrangement of the project work.
 

     
     
     
4.3     Program Algorithm
          The algorithm of the program is shown as follows:
1                 Start
2                 Initialize the system
3                 Check the utility supply
4                 Is there utility supply?
5                 ‘IF’ YES,
6                 Reset utility control unit
7                 IF NO,
8                 GO TO 17
9                 Is utility Power ON?
8                 ‘IF’ NO,
10                GO TO 3
11                ‘IF’ YES
12                Check the three phase Voltage
13                Are the three phases OK?
14                ‘IF’ YES,
15               Switch ON the three phases and switch OFF Gen
16                ‘IF’ NO,
17                GO TO 4
18                Is Gen Ignition ON?
19                ‘IF’ NO,
20                GO TO 3
21                ‘IF’ YES,
 22               Is Gen control unit OK?
23                   ‘IF’ NO
24                GO TO 3
25                ‘IF’ YES,
26                Start the Gen
27                Is the Gen ON?
28                ‘IF’ YES,
29                GO TO 37
30                ‘IF’ NO,
31                Start count
32                Is count =3?
33                ‘IF’ NO,
34                GO TO 2
35                ‘IF’ YES
36                Activate alarm and display fault on LCD
37                Clear count
38                Activate switching action and connect the load unit.
       4.4. Program Flow chart: The Program Flow Chart is shown in the space above.
        
          4.5    BILL OF ENGINEERING MEASUREMENT AND EVALUATION (BEME)
        S/N    Description of materials   Qty    Rate (#)       AMOUNT (#)
          1         Molded case                  1        4000            4000
          2         Solid state relay              3        25000          75000
          3         Atmega8                        1        2500            2500
          4         Comparators (LM324)   12      200              2400
          5         Transistors (BC547)       10      100              1000
          6         Electromagnetic relay     1        300              300
          7         Capacitors: Electrolytic  10      25                250
                                       Mica            10      25                250
          8         Varactor (MOV)            1        200              200
          9         Resistors: Fixed valued  25      10                250
                      i). Choke resistor         12      350              4200
                     ii).  Variable resistor       10      70                700
          10       IC voltage regulator        10      150              1500
          11       AT89S52 (MuC)            1        2500            2500
          12       Vero board (small)         7        150              1050
          13       Soldering Lead (Roll)     1        2000            2000
          14       Connecting Leads /yard  10      30                300
          15       Power cable (per yard)   1        800              800
          16       Liquid Crystal Display    1        2500            2500
          17       Diodes (IN4007)            10      30                300
          18       Step-down transformer   6        500              3000
          19       Connectors                    20      150              3000
          20       Buzzer                           1        1000            1000
          21       Bolt and Nuts                 12      30                360
          22       Cable tie                        10      60                600
          23       Cable guard                   9        100              900
          24       Transportation               --       ---                9140
                             Total             =                         #120,000.00                                                                                






CHAPTER FIVE
SUMMARY, CONCLUSION AND RECOMMENDATION
5.1     SUMMARY
From the discussion so far it can be seen that the use of solid state relay in the implementation of microcontroller based automatic changeover has a number of advantages over the other devices used in changeover system implementation. It eliminates all the noise, arching, wear and tear associated with EMRs and manual changeover switch box. The microcontroller with its ability to execute millions of instruction within seconds has also helped to improve the speed of the automation besides miniaturizing the entire system.
     
5.2     CONCLUSION
Unfortunately though the poor availability of public utility power in the developing countries has pushed her citizens to seek alternatives and dependent means of electricity .This has resulted in individuals buying wind turbines, solar panels, generating sets and so on.  Unavoidably this requires careful selection of the one to be ON to their use – alternative power or public power utility.
      Sequel to this, phase absence is a very common and severe problem in any industry, home or office. Many times one or two phases may not be live in the three phase supply, because of this, some electrical appliances will be ON in one room and OFF in another room. This project is designed to check the availability of the three phases, and the load will be connected to the three phase that are available only. In addition, due to problems incurred over interrupted power supply, this led to the discovery of three-phase microcontroller based switching system which makes the changing over process a lot stress free, efficient and cost effective. The three-phase microcontroller switching system makes our network infrastructure smarter. Intelligent switching systems are in a giving three phases in that companies are continually developing solutions that will make network systems smarter in the future. The demand for sensitive systems which are able to monitor the violent and devastating effect of fire and vandals at homes, offices etc have increased. This led to the idea of an intelligent switching system which has the ability to monitor, detects, control and switch between the alternative sources of supply. It also provides the comfort of starting a stand by generator when there is power failure from the mains (PHCN) without the aid of an operator. The switching between the mains and the generator occurs in micro seconds.
5.3     RECOMMENDATION
This project is recommended in areas where continuous power supply is needed such as homes, banks, industries, hospitals and so on. It is also recommended to the student in Electrical and Electronic Engineering department of Rufus Giwa Polytechnic, Owo for a more study and research in Electronic and programming.












REFERENCES
Boylet Robert L, and Nashelsky Louic,(2006). Electronics Devices and
Circuit Theory, Seventh Edition, Prentice Hallo, New Jersey Company.
Blalock Thomas, March (2006). History on “A Novel but Short-lived Power
Distributed System” IEEE Power Engineering Society, Vol. iii, page 336-348.
B. M. Weedy (1972).Electric Power Systems 1st Edition, London, John
 Wiley and sons.
    C. N. Gary (2003). A Microcontroller Analysis, 5th Edition, London,
 E.F.M.Spon Ltd. 
C. I. Daykin (1987). Design and Construction of Instrument, 23rd Edition,
New Delhi, Johnes Delhi Ltd.
          David E. Johnson and John L.Hillburn, (1997). Basic Electronics Circuit
 Analysis, Fifth edition, New York, John Wiley and sons, inc.
 Deshpande M.V. (2001). ‘Electrical Power Systems’, Fourth Edition, Tata
  New Dheli, Mcgraw-HillInc.
          Donald G. Fink and wayne H. Beaty, ( 1998). Standard Handbook for the
          Electrical Engineers, Eleventh Edition, New York, McGraw-Hill.
F. I. Radha (2002), Building Automatic Phase Changer, 2nd Edition,
           India, Chemical Press.
    F. B. Fredrick, F.C. Robert (1975). Solid State Devices And Applications,
             4th edition, USA, McGraw Book Company.
Hughes, (2002).Electrical and Electronics Technology, Eighth Edition
Revised, India, Kataria and Sons Ltd.
J .B. Calvertthree (2001).Three Phase Intelligent change over switch, 6th
 Edition, New York, John Wiley and sons press.  
 J. E. Angello (1960). Electronics: FETS, BJTS and Micro-circuits, USA,
 McGraw Book Company.
 Jerry C. Whitaker (nd) 1990. Electronic Handbook. (Cyclic Redundancy
Checks, CRC Press/Institute of Electronics Engineering, IEEE Press) Vol. II, Page 1030 – 1031.
 Jonathan Gana Kolo (2007). Design and Construction of an Automatic
             Power Changeover Switch. AUJ. T.Vol. II, Page 113 – 118
           M. E. Rajash and K. E. Malhorta (1980). Electronic Projects For Computer                      business bureau, 4th edition, Delhi.S.K.Kataria and Sons.
P. J. Hurst (1996). Analysis And Design of Analogue Integrated Circuit
         Fourth Edition, New York, Chemical Press.
Paul Horowitz and Winfield Hill (2003).  The art of electronics, second
edition, Cambridge, Cambridge university press.
R. J. Maddock D (1988). Calcutt electronics- A Course For Engineers, 8th 
Edition, London Longman press.
R. Edwards (1987). Optimizing The Zilog Z8 Forth Microcontroller For
Rapid Prototyping, 3rd Edition, Taylor press USA.
           R. M. Norbert (1995). Electronic Circuits: Analysis, Simulation And Design  
                   Englewood cliffs, New Jersey.
Theraja B.L. and Theraja A.K. (2000). Electrical technology, 3rd   edition,
New Dehli, S. Chad and Company  Limited.
          www.software.expresspcb.download
 (http://www.maxim-ic.com/quick_view2.cfm/qv_pk/
(http://www.maxim-ic.com/quick_view2.cfm/qv_pk/
                3711/t/al)
               at001_-ene.pdf
 http://www.maxim-ic.com/)
 (http://www.maxim-ic.com/1-Wire)
appnotes.cfm?appnote_number=126)




    









    
.
.






No comments:

Post a Comment