Se ha denunciado esta presentación.
Utilizamos tu perfil de LinkedIn y tus datos de actividad para personalizar los anuncios y mostrarte publicidad más relevante. Puedes cambiar tus preferencias de publicidad en cualquier momento.

Thesis - Voice Control Home Automation

24.230 visualizaciones

Publicado el

Voice is used in this project for the controlling switches. Reason for choosing voice is because it is easily being reproduced by human. Besides that, usage of voice gives a control system that can be effective and convenient to be used. The application of this system involve modifying the switching system from the traditional way which is physical contact with the switch to a safer way where the usage of voice to replace all the physical contact. This project involve a simple switching system that used the transistor along with relay to do all the connecting of the power to the devices, a voice recognition system that consists of voice recognition chip AT89C51, and the AT89C51 microcontroller to build up the system. The ULN2003 serves as the ear that will listen and interpret the command by the given while the AT89C51 serve as the brain of the system that will coordinate the correct output with the input command given. This project able to recognition the command trained by the user and successfully to execute the correct output. This project is a small scale design which consists of 8 commands that will used to control three different switches. The command is able to individually switch on and switch off each of the switch. Besides that, the command also able to switch on all and off all the switch at the same time.

Publicado en: Tecnología
  • Inicia sesión para ver los comentarios

Thesis - Voice Control Home Automation

  2. 2. ABSTRACT Voice is used in this project for the controlling switches. Reason for choosing voice is because it is easily being reproduced by human. Besides that, usage of voice gives a control system that can be effective and convenient to be used. The application of this system involve modifying the switching system from the traditional way which is physical contact with the switch to a safer way where the usage of voice to replace all the physical contact. This project involve a simple switching system that used the transistor along with relay to do all the connecting of the power to the devices, a voice recognition system that consists of voice recognition chip AT89C51, and the AT89C51 microcontroller to build up the system. The ULN2003 serves as the ear that will listen and interpret the command by the given while the AT89C51 serve as the brain of the system that will coordinate the correct output with the input command given. This project able to recognition the command trained by the user and successfully to execute the correct output. This project is a small scale design which consists of 8 commands that will used to control three different switches. The command is able to individually switch on and switch off each of the switch. Besides that, the command also able to switch on all and off all the switch at the same time.
  3. 3. LIST OF ABBREVIATIONS LED - Light Emitting Diode LCD - Liquid Crystal Display PCB - Printed Circuit Board SRAM - Static Random Access Memory RAM - Random Access Memory ADC - Analog Digital Converter BCD - Binary Code to Decimal CMOS - Complementary metaloxidesemiconductor
  4. 4. CHAPTER 1 INTRODUCTION 1.1Background Home automated system is characterized by the ability of the system to perform tasks to initiate or control appliance or devices in home. Nowadays, the appliance that available in the market is getting increase as days passed. Thus, the controlling of such devices is getting more and more attention. From long time ago mostly the controlling is done manually such as walking to the switch and switching it on. But as time passed the arrival or remote control that give the user alternative way to control such appliance without the need for the user to walk to the appliance. From the above, there are some more advancement in the controlling method that been on research. The advancement mention is using of the voice to act as the controlling medium to initiate or to control the appliance. Taking example such as a security door is only can be activated with the voice of the authorized personal only if then the door will be unlocked. In this project, the voice is also used as the medium to perform the controlling of the electrical appliance in home. The same concept applies in this project compare to the security door where the different is the electrical appliance controlled. 1.2 Objective of Project The main objective of this project is to design a voice recognition home automation system. This project will enable the user to control the electrical appliance in home using their voice as the medium that will control the power system. This project also aim to allow not only the user that have train the system with their voice to control the system but it extend to the other user who also can use the system without do the training process again.
  5. 5. Besides that, this system provides user a better safety against any current leakage, because by using voice direct contact with the power source is reduced compare to the usage of conventional switch. 1.3 Scope of Project In order to achieve the objective of this project, there are several scope had been identified. The scope of this project includes the designing of a voice recognition circuit for the voice recognition purpose. Follow by the designing of the microcontroller board using AT89S52 as the hardware that control the whole project by serving as interface for the voice recognition board with the electrical appliance. Next, a C programming is to be design and coded to enable the microcontroller to be able to function properly as desired. 1.4 Outlined of Thesis This thesis consists of five chapters. In the first chapter, it discuss about the objective, scope of project and summary of the work. In second chapter, the discussion is more focused on the literature review. In third chapter, the discussion will be mainly on the methodology of the hardware and the software implementation in this project While for chapter four, the discussion is mainly on the theory and working description. Last but not least the chapter five, the result, conclusion of this project is discussed along with the future work 1.5 Summary of work This project is summarized to the flow chart below for all the necessary implementation and optimization of the project. Figure 1.1 shows the flow chart..
  6. 6. Figure 1.1: The Flow chart of the implementation of the project.
  7. 7. CHAPTER 2 LITERATURE REVIEW 2.1 Introduction This chapter included the background study regarding the voice recognition concept and several similar projects that applies the theory of voice and sound. It also discussed briefly about the AT89S52 microcontroller. 2.2 Voice Recognition concept This concept is more alike a comparison of between the source and the data stored in memory (the voice that stored during the training process). The way of this concept function is when a user speaks out some command, with then the voice is captured through microphone as the input devices. Once the voice is captured, the usage of a decoding system that will convert the analog (voice) to digital (binary signal). Later, the input voice is compared with the data stored in the memory early before the testing. The output of the comparison is the voice matched with any of the command trained and certain signal is produce as the input for the controlling system. 2.3 Past Project There are a few projects done locally by other student and researcher in Malaysia regarding on the voice related research. First of it will be the automated home lighting system, by a degree student of UTM. In this projects, the usage of clap(s) as the source of input or command to control the lighting system in home. This project offers the ability to control the lighting in term of the intensity or brightness with corresponding to the light intensity in a room due to environment. From this
  8. 8. project, it can be concluded that the usage of sound is proof to be a way of controlling the electrical appliance [1]. But the application will be limited to one electrical appliance. Follow by another research by a master student of UTM. While for this project the voice is apply as a way to control the wheel chair movement. In this project, a wheel chair is modified by equipping it with the motor system that will read the command given by the user to control it speed and movement direction [2]. This project is successful due to the usage of the HM2007 voice recognition chip. From this project, it can be concluded that the usage of the voice is capable to be one of the method to control electrical devices provided a suitable system is used. There are also some projects made by our seniors based on the controlling of electrical appliances with the help of PC interface and remote control . 2.4 Outcome of this project From all above of the discussion on the previous project that have been done by other student. In this project, the application of the concept and theory used in the above project is applied. Thus this lead to a project that have the capability to produce a system that have the application of voice as the controlling method for controlling the electrical appliance or devices in home. In this system, voice is used as the primary input to the system. This is because voice is available for each and every user by doing so the system offers a wide range of the controlling to the user. By using all the above way the system is able to function as it was designed for which is to enable the usage of the voice to control the electrical appliance and devices in home.
  9. 9. CHAPTER 3 METHODOLOGY 3.1 Introduction Home automation (also called domotics) is the residential extension of "building automation". It is automation of the home, housework or household activity. Home automation may include centralized control of lighting, HVAC (heating, ventilation and air conditioning), appliances, and other systems, to provide improved convenience, comfort, energy efficiency and security. Home automation for the elderly and disabled can provide increased quality of life for persons who might otherwise require caregivers or institutional care. A home automation system integrates electrical devices in a house with each other. The techniques employed in home automation include those in building automation as well as the control of domestic activities, such as home entertainment systems, houseplant and yard watering, pet feeding, changing the ambiance "scenes" for different events (such as dinners or parties), and the use of domestic robots. Devices may be connected through a computer network to allow control by a personal computer, and may allow remote access from the internet. Typically, a new home is outfitted for home automation during construction, due to the accessibility of the walls, outlets, and storage rooms, and the ability to make design changes specifically to accommodate certain technologies. Wireless systems are commonly installed when outfitting a pre-existing house, as they reduce wiring changes. These communicate through the existing power wiring, radio, or infrared signals with a central controller. Network sockets may be installed in every room like AC power receptacles. Although automated homes of the future have been staple exhibits for World's Fairs and popular backgrounds in science fiction, complexity, competition between vendors, multiple incompatible standard and the resulting expense have limited the penetration of home automation to homes of the wealthy or ambitious hobbyists. Possibly the first "home computer" was an experimental system in 1966
  10. 10. 3.1.1 History and early developments  Earliest home control systems were proposed by Hitachi & Matsushita in 1978.  First home automation blue prints and demonstrations held by Japanese Electrical Appliance manufacturers like Sanyo, Sony, Toshiba etc.  Honeywell’s first demonstration house started in 1978.  American X 10 system appeared in 1979.  Two rival programs CE Bus and Smart House started in the early 1980’s in the US.  GE reported their multimedia home bus signaling protocol Homenet in 1983.  Total Home system launched in 1992.  GIS, Home Automation Ltd. MK Electric took the initiative in Europe.
  11. 11. 3.1.2 General Working Fig 2 General Working of our project
  12. 12. 3.2 Hardware implementation In this section will discuss on the hardware used in the implementation of this system that include the AT89S52, ULN 2003, voltage regulator and the relay for interfaces. Fig. Circuit of our project
  13. 13. zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves 3.2.1 Microcontroller AT89S52 Features · Compatible with MCS®-51 Products · 8K Bytes of In-System Programmable (ISP) Flash Memory · Endurance: 10,000 Write/Erase Cycles · 4.0V to 5.5V Operating Range. · Fully Static Operation: 0 Hz to 33 MHz · Three-level Program Memory Lock. · 256 x 8-bit Internal RAM. · 32 Programmable I/O Lines. · Three 16-bit Timer/Counters. · Eight Interrupt Sources. · Full Duplex UART Serial Channel. · Low-power Idle and Power-down Modes. · Interrupt Recovery from Power-down Mode. · Watchdog Timer. · Dual Data Pointer. · Power-off Flag. · Fast Programming Time. · Flexible ISP Programming (Byte and Page Mode). · Green (Pb/Halide-free) Packaging Option.
  14. 14. Description The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel AT89S52 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications. The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S52 is designed with static logic for operation down to the RAM con-tents but freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset.
  15. 15. Pin Configurations 40-lead PDIP 44-lead PLCC
  16. 16. 44-leadTQFP BLOCK DIAGRAM
  17. 17. Pin Description
  18. 18. 1. VCC- Supply voltage. 2. 0.GND- Ground. 3. Port 0- Port 0 is an 8-bit open drain bidirectional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as high-impedance inputs. Port 0 can also be configured to be the multiplexed low-order address/data bus during accesses to external program and data memory. In this mode, P0 has internal pull-ups. Port 0 also receives the code bytes during Flash programming and outputs the code bytes during program verification. External pull-ups are required during program verification. 4. Port 1- Port 1 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins, they are pulled high by the inter-nal pull-ups and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown in the following table. Port 1 also receives the low-order address bytes during Flash programming and verification. 5. Port 2- Port 2 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port
  19. 19. 2 pins that are externally being pulled low will source current (IIL) because of the internal pull-ups. Port 2 emits the high-order address byte during fetches from external program memory and during accesses to external data memory that use 16-bit addresses (MOVX @ DPTR). In this application, Port 2 uses strong internal pull-ups when emitting 1s. During accesses to external data memory that use 8-bit addresses (MOVX @ RI), Port 2 emits the contents of the P2 Special Function Register. Port 2 also receives the high-order address bits and some control signals during Flash programming and verification. 6. Port 3- Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins, they are pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the pull-ups. Port 3 receives some control signals for Flash programming and verification. Port 3 also serves the functions of various special features of the AT89S52, as shown in the following table. 7. RST- Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives high for 98 oscillator periods after the Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to
  20. 20. disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled. 8. ALE/PROG - Address Latch Enable (ALE) is an output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operation, ALE is emitted at a constant rate of 1/6 the oscillator frequency and may be used for external timing or clocking purposes. Note, however, that one ALE pulse is skipped dur-ing each access to external data memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode. 9. PSEN- Program Store Enable (PSEN) is the read strobe to external program memory. When the AT89S52 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory. 10. EA/VPP- External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program executions. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming. 11. XTAL1- Input to the inverting oscillator amplifier and input to the internal clock operating circuit. 12. XTAL2 -Output from the inverting oscillator amplifier. . Special Function Registers
  21. 21. A map of the on-chip memory area called the Special Function Register (SFR). Note that not all of the addresses are occupied, and unoccupied addresses may not be implemented on the chip. Read accesses to these addresses will in general return random data, and write accesses will have an indeterminate effect. User software should not write 1s to these unlisted locations, since they may be used in future products to invoke new features. In that case, the reset or inactive values of the new bits will always be 0. Timer 2 Registers: Control and status bits are contained in registers T2CON and T2MOD for Timer 2. The register pair (RCAP2H, RCAP2L) are the Capture/Reload registers for Timer 2 in 16-bit capture mode or 16-bit auto-reload mode. Interrupt Registers: The individual interrupt enable bits are in the IE register. Two priorities can be set for each of the six interrupt sources in the IP register. Memory Organization MCS-51 devices have a separate address space for Program and Data Memory. Up to 64K bytes each of external Program and Data Memory can be addressed. Program Memory If the EA pin is connected to GND, all program fetches are directed to external memory. On the AT89S52, if EA is connected to VCC, program fetches to addresses 0000H through 1FFFH are directed to internal memory and fetches to addresses 2000H through FFFFH are to external memory. Data Memory The AT89S52 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy a parallel address space to the Special Function Registers. This means that the upper 128 bytes have the same addresses as the SFR space but are physically separate from SFR space. When an instruction accesses an internal location above address 7FH, the address mode used in the instruction specifies whether the CPU accesses the upper 128 bytes of RAM or the SFR space. Instructions which use direct addressing access the SFR space. For example, the following direct addressing instruction accesses the SFR at location 0A0H (which is P2).
  22. 22. MOV 0A0H, #data Instructions that use indirect addressing access the upper 128 bytes of RAM. For example, the following indirect addressing instruction, where R0 contains 0A0H, accesses the data byte at address 0A0H, rather than P2 (whose address is 0A0H). MOV @R0, #data Note that stack operations are examples of indirect addressing, so the upper 128 bytes of data RAM are available as stack space. 3.2.2 78-Series Voltage Regulator 3-Terminal 1A Positive Voltage Regulator Features • Output Current up to 1A • Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V • Thermal Overload Protection • Short Circuit Protection • Output Transistor Safe Operating Area Protection Description The KA78XX/KA78XXA series of three-terminal positive regulator are available in the TO- 220/D-PAK package and with several fixed output voltages, making them useful in a wide range of applications. Each type employs internal current limiting, thermal shut down and safe operating area protection, making it essentially indestructible. If adequate heat sinking is provided, they can deliver over 1A output current. Although designed primarily as fixed voltage regulators, these devices can be used with external components to obtain adjustable voltages and currents.
  23. 23. 3.2.2 IC – ULN 2003 DESCRIPTION The ULN2003 is high voltage, high current Darlington arrays each containing seven open collectors Darlington pairs with common emitters. Each channel rated at 500mA and can withstand peak currents of 600mA. Suppression diodes are included for inductive load driving and the inputs are pinned opposite the outputs to simplify board layout. PACKAGE 2003A is supplied in 16 pin plastic DIP packages with a copper lead frame to reduce thermal resistance. ULN2003A: 06 – 15V CMOS PMOS
  24. 24. APPLICATIONS These versatile devices are useful for driving a wide range of loads including solenoids, relays DC motors; LED displays filament lamps, thermal print heads and high power buffers.
  25. 25. SCHEMATIC DIAGRAM 3.2.3POWER SUPPLY In the power supply section we use one step down transformer to step down the voltage from 220 volt ac to 9 volt dc. Output of the transformer is further connected to the two diode circuit. Here two diode work as a full wave rectifier circuit. Output of the full wave rectifier is
  26. 26. now filtered by the capacitor. Capacitor converts the pulsating dc into smooth dc with the help of charging and discharging effect. Output of the capacitor is now regulated by the IC 7805 regulator. IC 7805 provides a 5 volt regulation to the circuit and provides a regulated 5 volt power supply. Output of the regulator is now again filter by the capacitor. In the output of the capacitor we use one resistor and one l.e.d in series to provide a visual indication to the circuit. 3.2.4 RECTIFIER DIODE Philips Semiconductors Product specification Rectifiers 1N4001G to 1N4007G FEATURES · Glass passivated · Maximum operating temperature · Low leakage current · Excellent stability
  27. 27. · Available in ammo-pack DESCRIPTION Rugged glass package, using a high temperature alloyed construction. This package is hermetically sealed and fatigue free as coefficients of expansion of all used parts are matched. Fig.1 Simplified outline (SOD57) and symbol.
  28. 28. 3.2.5 TRANSISTOR The name is transistor derived from ‘transfer resistors’ indicating a solid state Semiconductor device. In addition to conductor and insulators, there is a third class of material that exhibits proportion of both. Under some conditions, it acts as an insulator, and under other conditions it’s a conductor. This phenomenon is called Semi-conducting and allows a variable control over electron flow. So, the transistor is semi conductor device used in electronics for amplitude. Transistor has three terminals, one is the collector, one is the base and other is the emitter, (each lead must be connected in the circuit correctly and only then the transistor will function). Electrons are emitted via one terminal and collected on another terminal, while the third terminal acts as a control element. Each transistor has a number marked on its body. Every number has its own specifications. There are mainly two types of transistor (i) NPN & (ii) PNP NPN Transistors: When a positive voltage is applied to the base, the transistor begins to conduct by allowing current to flow through the collector to emitter circuit. The relatively small current flowing through the base circuit causes a much greater current to pass through the emitter / collector circuit. The phenomenon is called current gain and it is measure in beta. PNP Transistor: It also does exactly same thing as above except that it has a negative voltage on its collector and a positive voltage on its emitter.
  29. 29. Transistor is a combination of semi-conductor elements allowing a controlled current flow. Germanium and Silicon is the two semi-conductor elements used for making it. There are two types of transistors such as POINT CONTACT and JUNCTION TRANSISTORS. Point contact construction is defective so is now out of use. Junction triode transistors are in many respects analogous to triode electron tube. A junction transistor can function as an amplifier or oscillator as can a triode tube, but has the additional advantage of long life, small size, ruggedness and absence of cathode heating power. Junction transistors are of two types which can be obtained while manufacturing. The two types are: - 1) PNP TYPE: This is formed by joining a layer of P type of germanium to an N-P Junction. 1) NPN TYPE: P N P This is formed by joining a layer of N type germanium to a P-N Junction. N P N Both types are shown in figure, with their symbols for representation. The centre section is called the base, one of the outside sections-the emitter and the other outside section-the collector. The direction of the arrowhead gives the direction of the conventional current with the forward bias on the emitter. The conventional flow is opposite in direction to the electron flow. OPERATION OF PNP TRANSISTOR
  30. 30. A PNP transistor is made by sand witching two PN germanium or silicon diodes, placed back to back. The centre of N-type portion is extremely thin in comparison to P region. The P region of the left is connected to the positive terminal and N-region to the negative terminal i.e. PN is biased in the forward direction while P region of right is biased negatively i.e. in the reverse direction as shown in Fig. The P region in the forward biased circuit is called the emitter and P region on the right, biased negatively is called collector. The centre is called base. The majority carriers (holes) of P region (known as emitter) move to N region as they are repelled by the positive terminal of battery while the electrons of N region are attracted by the positive terminal. The holes overcome the barrier and cross the emitter junction into N region. As the width of base region is extremely thin, two to five percent of holes recombine with the free electrons of N-region which result in a small base current while the remaining holes (95% to 98%) reach the collector junction. The collector is biased negatively and the negative collector voltage aids in sweeping the hole into collector region. As the P region at the right is biased negatively, a very small current should flow but the following facts are observed:- 1) A substantial current flows through it when the emitter junction is biased in a forward direction. 2) The current flowing across the collector is slightly less than that of the emitter. 3) The collector current is a function of emitter current i.e. with the decrease or increase in the emitter current a corresponding change in the collector current is observed.
  31. 31. The facts can be explained as follows:- 1. As already discussed that 2 to 5% of the holes are lost in recombination with the electron n base region, which result in a small base current and hence the collector current is slightly less than the emitter current. 2. The collector current increases as the holes reaching the collector junction are attracted by negative potential applied to the collector. 3. When the emitter current increases, most holes are injected into the base region, which is attracted by the negative potential of the collector and hence results in increasing the collector current. In this way emitter is analogous to the control of plate current by small grid voltage in a vacuum triode. Hence we can say that when the emitter is forward biased and collector is negatively biased, a substantial current flows in both the circuits. Since a small emitter voltage of about 0.1 to 0.5 volts permits the flow of an appreciable emitter current the input power is very small. The collector voltage can be as high as 45 volts. 3.2.6 RESISTANCE Resistance is the opposition of a material to the current. It is measured in Ohms (W). All conductors represent a certain amount of resistance, since no conductor is 100% efficient. To control the electron flow (current) in a predictable manner, we use resistors. Electronic circuits use calibrated lumped resistance to control the flow of current. Broadly speaking, resistor can be divided into two groups viz. fixed & adjustable (variable) resistors. In fixed resistors, the value is fixed & cannot be varied. In variable resistors, the resistance value can be varied by an adjuster knob. It can be divided into (a) Carbon composition (b) Wire wound (c) Special type. The most common type of resistors used in our projects is carbon type. The resistance value is normally indicated by color bands. Each resistance has four colors, one of the band on either side will be gold or silver, this is called fourth band and indicates the tolerance, others three band will give the value of resistance (see table). For example if a resistor has the following marking on it say red, violet, gold. Comparing these colored rings with the color code, its value is 27000 ohms or 27 kilo ohms and its tolerance is ±5%.
  32. 32. Resistor comes in various sizes (Power rating). The bigger, the size, the more power rating of 1/4 watts. The four color rings on its body tells us the value of resistor value as given below. COLOURS CODE Black-----------------------------------------------------0 Brown----------------------------------------------------1 Red-------------------------------------------------------2 Orange---------------------------------------------------3 Yellow---------------------------------------------------4 Green-----------------------------------------------------5 Blue-------------------------------------------------------6 Violet-----------------------------------------------------7 Grey------------------------------------------------------8 White-----------------------------------------------------9 The first rings give the first digit. The second ring gives the second digit. The third ring indicates the number of zeroes to be placed after the digits. The fourth ring gives tolerance (gold ±5%, silver ± 10%, No color ± 20%).
  33. 33. In variable resistors, we have the dial type of resistance boxes. There is a knob with a metal pointer. This presses over brass pieces placed along a circle with some space b/w each of them. Resistance coils of different values are connected b/w the gaps. When the knob is rotated, the pointer also moves over the brass pieces. If a gap is skipped over, its resistance is included in the circuit. If two gaps are skipped over, the resistances of both together are included in the circuit and so on. A dial type of resistance box contains many dials depending upon the range, which it has to cover. If a resistance box has to read up to 10,000W, it will have three dials each having ten gaps i.e. ten resistance coils each of resistance 10W. The third dial will have ten resistances each of 100W. The dial type of resistance boxes is better because the contact resistance in this case is small & constant. 3.2.7 Capacitors It is an electronic component whose function is to accumulate charges and then release it. To understand the concept of capacitance, consider a pair of metal plates which all are placed near to each other without touching. If a battery is connected to these plates the positive pole to one and the negative pole to the other, electrons from the battery will be attracted from the plate connected to the positive terminal of the battery. If the battery is then disconnected, one plate will be left with an excess of electrons, the other with a shortage, and a potential or voltage difference will exists between them. These plates will be acting as capacitors. Capacitors are of two types:- (1) Fixed type like ceramic, polyester, electrolytic capacitors-these names refer to the material they are made of aluminum foil. (2) Variable type like gang condenser in radio or trimmer. In fixed type capacitors, it has two leads and its value is written over its body and variable type has three leads. Unit of measurement of a capacitor is farad denoted by the symbol F. It is a very big unit of
  34. 34. capacitance. Small unit capacitor are Pico-farad denoted by PF (1PF=1/1000, 000,000,000 f) Above all, in case of electrolytic capacitors, its two terminal are marked as (-) and (+) so check it while using capacitors in the circuit in right direction. Mistake can destroy the capacitor or entire circuit in operational. 3.2.8 DIODE The simplest semiconductor device is made up of a sandwich of P-type semiconducting material, with contacts provided to connect the p-and n-type layers to an external circuit. This is a junction Diode. If the positive terminal of the battery is connected to the p-type material (cathode) and the negative terminal to the N-type material (Anode), a large current will flow. This is called forward current or forward biased. If the connections are reversed, a very little current will flow. This is because under this condition, the p-type material will accept the electrons from the negative terminal of the battery and the N-type material will give up its free electrons to the battery, resulting in the state of electrical equilibrium since the N-type material has no more electrons. Thus there will be a small current to flow and the diode is called Reverse biased. Thus the Diode allows direct current to pass only in one direction while blocking it in the other direction. Power diodes are used in concerting AC into DC. In this, current will flow freely during the first half cycle (forward biased) and practically not at all during the other half cycle (reverse biased). This makes the diode an effective rectifier, which convert ac into
  35. 35. pulsating dc. Signal diodes are used in radio circuits for detection. Zener diodes are used in the circuit to control the voltage. Some common diodes are:- 1. ZENER DIODE:- A zener diode is specially designed junction diode, which can operate continuously without being damaged in the region of reverse break down voltage. One of the most important applications of zener diode is the design of constant voltage power supply. The zener diode is joined in reverse bias to d.c. through a resistance R of suitable value. 2. PHOTO DIODE:- A photo diode is a junction diode made from photo- sensitive semiconductor or material. In such a diode, there is a provision to allow the light of suitable frequency to fall on the p-n junction. It is reverse biased, but the voltage applied is less than the break down voltage. As the intensity of incident light is increased, current goes on increasing till it becomes maximum. The maximum current is called saturation current. 3. LIGHT EMITTING DIODE (LED):- When a junction diode is forward biased, energy is released at the junction diode is forward biased, energy is released at the junction due to recombination of electrons and holes. In case of silicon and germanium diodes, the energy released is in infrared region. In the junction
  36. 36. diode made of gallium arsenate or indium phosphide, the energy is released in visible region. Such a junction diode is called a light emitting diode or LED. 3.2.9 Relay In this project, the primary interface between the systems with the electrical appliance is the relay. The relay is actually a switch alike component just the different is the way of triggering is through the magnetic field that will change the contact and thus activating a switch. This model of relay is selected for a few reasons. First of it is the required triggering voltage which is 5 volts and this power sources is easy to be acquire by using a simple 7805 regulator IC Chip. Second is the contacts voltage that permitted by this model which is 240volts, and it fit just nice to the system as this system serves as the switching system that will replace a switch which traditionally used to connect the 240 volts power supply from 16 power supply. 3.2.10 LIGHT EMITTING DIODE Light emitting diode (LED) is basically a P-N junction semiconductor diode particularly designed to emit visible light. There are infrared emitting LEDs which emit invisible light. The LEDs are now available in many colors red, green and yellow. A normal LED emits at 2.4V and consumes MA of current. The LEDs are made in the form of flat tiny P-N junction enclosed in a semi-spherical dome made up of clear colored epoxy resin. The dome of a LED acts as a lens and diffuser of light. The diameter of the base is less than a quarter of an inch. The actual diameter varies somewhat with different makes. The common circuit symbols for the LED are shown in Fig. It is similar to the conventional rectifier diode symbol with two arrows pointing out. There are two leads- one for anode and the other for cathode.
  37. 37. LEDs often have leads of dissimilar length and the shorter one is the cathode. All manufacturers do not strictly adhere this to. Sometimes the cathode side has a flat base. If there is doubt, the polarity of the diode should be identified. A simple bench method is to use the ohmmeter incorporating 3-volt cells for ohmmeter function. When connected with the ohmmeter: one way there will be no deflection and when connected the other way round there will be a large deflection of a pointer. When this occurs the anode lead is connected to the negative of test lead and cathode to the positive test lead of the ohmmeter. If low range (Rxl) of the ohmmeter is used the LED would light up in most cases because the low range of ohmmeter can pass sufficient current to light up the LED. Another safe method is to connect the test circuit shown in Fig. 2. Use any two dry cells in series with a current limiting resistor of 68 to 100 ohms. The resistor limits the forward diode current of the LED under test to a safe value. When the LED under test is connected to the test terminals in any way: if it does not light up, reverse the test leads. The LED will now light up. The anode of the LED is that which is connected to the “A” terminal (positive pole of the battery). This method is safe, as reverse voltage can never exceed 3 volts in this test. 3.2.11 Transformers PRINCIPLE OF THE TRANSFORMER:- Two coils are wound over a Core such that they are magnetically coupled. The two coils are known as the primary and secondary windings. In a Transformer, an iron core is used. The coupling between the coils is source of making a path for the magnetic flux to link both the coils. A core as in fig.2 is used and the coils are wound on the limbs of the core. Because of high permeability of iron, the flux path for the flux is only in the iron and hence the flux links both windings. Hence there is very little ‘leakage flux’. This term leakage flux denotes the part of the flux, which does not link both
  38. 38. the coils, i.e., when coupling is not perfect. In the high frequency transformers, ferrite core is used. The transformers may be step-up, step-down, frequency matching, sound output, amplifier driver etc. The basic principles of all the transformers are same. Miniature Transformer Conventional power transformer 3.2.12 Fundamentals of RS232 Serial Communications Due to its relative simplicity and low hardware overhead (when compared to parallel interfacing), serial communications is used extensively within the electronics industry. Today, the most popular serial communications standard is certainly the EIA/TIA-232-E specification. This standard, which was developed by the Electronic Industry Association and the Telecommunications Industry Association (EIA/TIA), is more popularly called simply RS-232, where RS stands for "recommended standard." Although this RS prefix has been replaced in recent years with EIA/TIA to help identify the source of the standard, this paper uses the common RS232 notation. The official name of the EIA/TIA-232-E standard is "Interface Between Data Terminal
  39. 39. Equipment and Data Circuit-Termination Equipment Employing Serial Binary Data Interchange." Although the name may sound intimidating, the standard is simply concerned with serial data communication between a host system (Data Terminal Equipment, or DTE) and peripheral system. The EIA/TIA-232-E standard was introduced in 1962 and has since been updated four times to meet the evolving needs of serial communication applications. The letter "E" in the standard's name indicates that this is the fifth revision of the standard. Specifications RS-232 is a complete standard. This means that the standard sets out to ensure compatibility between the host and peripheral systems by specifying: 1. Common voltage and signal levels 2. Common pin-wiring configurations 3. A minimal amount of control information between the host and peripheral systems. Unlike many standards which simply specify the electrical characteristics of a given interface, RS-232 specifies electrical, functional, and mechanical characteristics to meet the above three criteria. Each of these aspects of the RS-232 standard is discussed below. Electrical Characteristics The electrical characteristics section of the RS-232 standard specifies voltage levels, rate of change for signal levels, and line impedance. As the original RS-232 standard was defined in 1962 and before the days of TTL logic, it is no surprise that the standard does not use 5V and ground logic levels. Instead, a high level for the driver output is defined as between +5V to +15V, and a low level for the driver output is defined as between -5V and -15V. The receiver logic levels were defined to provide a 2V noise margin. As such, a high level for the receiver is defined as between +3V to +15V, and a low level is between -3V to -15V. Figure 1 illustrates the logic levels defined by the RS-232 standard. It is necessary to note that, for RS-232 communication, a low level (-3V to -15V) is defined as a logic 1 and is historically referred to as "marking." Similarly, a high level (+3V to +15V) is defined as logic 0 and is
  40. 40. referred to as "spacing." Figure 1. RS-232 logic-level specifications. The RS-232 standard also limits the maximum slew rate at the driver output. This limitation was included to help reduce the likelihood of crosstalk between adjacent signals. The slower the rise and fall time, the less chance of crosstalk. With this in mind, the maximum slew rate allowed is 30V/ms. Additionally, standard defines a maximum data rate of 20kbps, again to reduce the chance of crosstalk. The impedance of the interface between the driver and receiver has also been defined. The load seen by the driver is specified at 3kΩ to 7kΩ. In the original RS-232 standard the cable length between the driver and receiver was specified to be 15 meters maximum. Revision "D" (EIA/TIA-232-D) changed this part of the standard. Instead of specifying the maximum length of cable, the standard specified a maximum capacitive load of 2500pF, clearly a more adequate specification. The maximum cable length is determined by the capacitance per unit length of the cable, which is provided in the cable specifications. Table 1 summarizes the electrical specifications in the current standard.
  41. 41. Table 1. RS-232 Specifications RS-232 Cabling Single-ended Number of Devices 1 transmit, 1 receive Communication Full duplex Mode Distance (max) 50 feet at 19.2kbps Data Rate (max) 1Mbps Signaling Unbalanced Mark (data 1) -5V (min) -15V (max) Space (data 0) 5V (min) 15V (max) Input Level (min) ±3V Output Current 500mA (Note that the driver ICs normally used in PCs are limited to 10mA) Impedance 5kΩ (Internal) Bus Architecture Point-to-Point Characteristics Because RS-232 is a complete standard, it includes more than just specifications on electrical characteristics. The standard also addresses the functional characteristics of the interface, #2 on our list above. This essentially means that RS-232 defines the function of the different signals used in the interface. These signals are divided into four different categories: common, data, control, and timing. See Table 2. The standard provides abundant control signals and supports a primary and secondary communications channel. Fortunately few applications, if any, require all these defined signals. For example, only eight signals are used for a typical modem. Examples of how the RS-232 standard is used in real-world applications are discussed later. The complete list of defined signals is included here as a reference. Reviewing the functionality of all these signals is, however, beyond the scope of this paper. Table 2. RS-232 Defined Signals
  42. 42. Circuit Mnemonic Circuit Name* Circuit Direction Circuit Type AB Signal Common — Common BA Transmitted Data (TD) To DCE Data BB Received Data (RD) From DCE CA CB CC CD CE CF CG CH CI CJ RL LL TM Request to Send (RTS) Clear to Send (CTS) DCE Ready (DSR) DTE Ready (DTR) Ring Indicator (RI) Received Line Signal Detector** (DCD) Signal Quality Detector Data Signal Rate Detector from DTE Data Signal Rate Detector from DCE Ready for Receiving Remote Loopback Local Loopback Test Mode To DCE From DCE From DCE To DCE From DCE From DCE From DCE To DCE From DCE To DCE To DCE To DCE From DCE Control DA ransmitter Signal Element Timing from DTE To DCE DB DD Transmitter Signal Element Timing from DCE Receiver Signal Element Timing from DCE From DCE From DCE Timing SBA SBB Secondary Transmitted Data Secondary Received Data To DCE From DCE Data SCA SCB SCF Secondary Request to Send Secondary Clear to Send Secondary Received Line Signal Detector To DCE From DCE From DCE Control *Signals with abbreviations in parentheses are the eight most commonly used signals. **This signal is more commonly referred to as Data Carrier Detect (DCD). Mechanical Interface Characteristics
  43. 43. The third area covered by RS-232 is the mechanical interface. Specifically, RS-232 specifies a 25-pin connector as the minimum connector size that can accommodate all the signals defined in the functional portion of the standard. The pin assignment for this connector is shown in Figure 2. The connector for DCE equipment is male for the connector housing and female for the connection pins. Likewise, the DTE connector is a female housing with male connection pins. Although RS-232 specifies a 25-position connector, this connector is often not used. Most applications do not require all the defined signals, so a 25-pin connector is larger than necessary. Consequently, other connector types are commonly used. Perhaps the most popular connector is the 9-position DB9S connector, also illustrated in Figure 2. This 9-position connector provides, for example, the means to transmit and receive the necessary signals for modem applications. This type pf application will be discussed in greater detail later. Figure 2. RS-232 connector pin assignments.
  44. 44. Evolution of RS-232 IC Design Regulated Charge Pumps The original MAX232 Driver/Receiver and its related parts simply doubled and inverted the input voltage to supply the RS-232 driver circuitry. This design enabled much more voltage than actually required; it wasted power. The EIA-232 levels are defined as ±5V into 5kΩ. With a new low-dropout output stage, Maxim introduced RS-232 transceivers with internal charge pumps that provided regulated ±5.5V outputs. This design allows the transmitter outputs to maintain RS- 232-compatible levels with a minimum amount of supply current. Low-Voltage Operation The reduced output voltages of the new regulated charge pumps and low-dropout transmitters allow use of reduced supply voltages. Most of Maxim's recent RS-232 transceivers operate with supply voltages down to +3.0V. Auto Shutdown In the never-ending battle to extend battery life, Maxim pioneered a technique called auto-shutdown. When the device is not detecting valid RS-232 activity, it enters a low-power shutdown mode. An RS-232-valid output indicates to the system processor whether an active RS- 232 port is connected at the other end of the cable. The MAX3212 goes one step further: it includes a transition-detect circuit whose latched output, applied as an interrupt, can awaken the system when a change of state occurs on any incoming line. Auto Shutdown Plus Building on the success of Auto Shutdown, devices with Maxim's Auto Shutdown Plus capability achieve a 1μA supply current. These devices automatically enter a low-power shutdown mode
  45. 45. either when the RS-232 cable is disconnected or the transmitters of the connected peripherals are inactive, or when the UART driving the transmitter inputs is inactive for more than 30 seconds. The devices turn on again when they sense a valid transition at any transmitter or receiver input. Auto Shutdown Plus saves power without changes to the existing BIOS or operating system. Mega Baud Moving beyond the EIA-232 specification is mega baud mode, which allows the driver slew rate to increase, thereby providing data rates up to 1Mbps. Mega Baud mode is useful for communication between high-speed peripherals such DSL or ISDN modems over short distances. High ESD Some ICs are designed to provide high ESD protection. These ICs specify and achieve ±15kV ESD protection using both the human body model and the IEC 801-2 air-gap discharge method. Maxim's high-ESD protection eliminates the need for costly external protection devices such as Transzorbs, while preventing expensive field failures. Capacitor Selection The charge pumps of Maxim RS-232 transceivers rely on capacitors to convert and store energy, so choosing these capacitors affects the circuit's overall performance. Although some data sheets indicate polarized capacitors in their typical application circuits, this information is shown only for a customer who wants to use polarized capacitors. In practice, ceramic capacitors work best for most Maxim RS-232 ICs. Choosing the ceramic capacitor is also important. Capacitor dielectric types of Z5U and Y5V are unacceptable because of their incredible voltage and temperature coefficients. Types X5R and X7R provide the necessary performance. Unused Inputs RS-232 receiver inputs contain an internal 5kΩ pull-down resistor. If this receiver input is unused, it can be left floating without causing any problems. The CMOS transmitter inputs are high-impedance and must be driven to valid logic levels for proper IC operation. If a transmitter
  46. 46. input is unused, connect it to VCC or GND. Layout Guidelines Maxim RS-232 ICs should be treated like DC-DC converters for layout purposes. The AC current flow must be analyzed for both the charge and discharge stages of the charge-pump cycle. To facilitate an easy and effective layout, Maxim conveniently places all the critical pins in close proximity to their external components. RS-232 Transceivers in Tiny Packages Low-power RS-232 transceivers are available in space-saving chip-scale (UCSP), TQFN, and TSSOP packages. The MAX3243E in a 32-pin (7mm x 7mm) thin QFN package saves 20% board space over TSSOP solutions. The MAX3222E, also available in a 20-pin (5mm x 5mm) TQFN, improves and thus saves board space by 40%. Other transceiver part families packaged in a TQFN, the MAX3222E and MAX3232E with two drivers and two receivers and the MAX3221E with a single driver and single receiver, feature Auto Shutdown capability to reduce the supply current to 1μA (See Table 3). These RS-232 transceivers are ideal for battery-powered equipment. The MAX3228E/MAX3229E family in a 30-bump (3mm x 2.5mm) UCSP package saves about 70% board space, making these ICs ideal for space-constrained applications such as notebook, cell phone, and handheld equipment. Low-power RS-232 transceivers in space-saving UCSP with a low 1μA shutdown supply current are ideal for ultra-low-power system applications. Table 3. RS232 Transceivers in Space-Saving Packages Part Package Shutdown Supply Current (μA) Data Rate (kbps) No. of Drivers/Receivers ESD Protection (±kV) MAX3221E 20-Pin TQFN 1 250 1/1 15 MAX3222E 16-Pin 1 250 2/2 15
  47. 47. TQFN MAX3223E 20-Pin TQFN 1 250 2/2 15 MAX3230E 20-Bump UCSP 1 250 2/2 15 MAX3231E 20-Bump UCSP 1 250 1/1 15 MAX3232E 16-Pin TQFN 1 250 2/2 15 MAX3237E 28-Pin SSOP 10nA 1Mbps 5/3 15 MAX3243E 32-Pin TQFN 1 250 3/5 15 MAX3246E 36-Bump UCSP 1 250 3/5 Practical RS-232 Implementation Most systems designed today do not operate using RS-232 voltage levels. Consequently, level conversion is necessary to implement RS-232 communication. Level conversion is performed by special RS-232 ICs with both line drivers that generate the voltage levels required by RS-232, and line receivers that can receive RS-232 voltage levels without being damaged. These line drivers and receivers typically invert the signal as well, since logic 1 is represented by a low voltage level for RS-232 communication, and logic 0 is represented by a high logic level. Figure 3 illustrates the function of an RS-232 line driver/receiver in a typical modem application. In this example, the signals necessary for serial communication are generated and received by the Universal Asynchronous Receiver/Transmitter (UART). The RS-232 line driver/receiver IC performs the level translation necessary between the CMOS/TTL and RS-232 interface.
  48. 48. Figure 3. Typical RS-232 modem application. The UART performs the "overhead" tasks necessary for asynchronous serial communication. Asynchronous communication usually requires, for example, that the host system initiate start and stop bits to indicate to the peripheral system when communication will start and stop. Parity bits are also often employed to ensure that the data sent has not been corrupted. The UART usually generates the start, stop, and parity bits when transmitting data, and can detect communication errors upon receiving data. The UART also functions as the intermediary between byte-wide (parallel) and bit-wide (serial) communication; it converts a byte of data into a serial bit stream for transmitting and converts a serial bit stream into a byte of data when receiving. Now that an elementary explanation of the TTL/CMOS to RS-232 interface has been provided, we can consider some real-world RS-232 applications. It has already been noted in the Functional Characteristics section above that RS-232 applications rarely follow the RS-232 standard precisely. The unnecessary RS-232 signals are usually omitted. Many applications, such as a
  49. 49. modem, require only nine signals (two data signals, six control signals, and ground). Other applications require only five signals (two for data, two for handshaking, and ground), while others require only data signals with no handshake control. We begin our investigation of real-world implementations by considering the typical modem application. RS-232 in Modem Applications Modem applications are one of the most popular uses for the RS-232 standard. Figure 4 illustrates a typical modem application. As can be seen in the diagram, the PC is the DTE and the modem is the DCE. Communication between each PC and its associated modem is accomplished using the RS-232 standard. Communication between the two modems is accomplished through telecommunication. It should be noted that, although a microcontroller is usually the DTE in RS- 232 applications, this is not mandated by a strict interpretation of the standard. Figure 4. Modem communication between two PCs. Although some designers choose to use a 25-pin connector for this application, it is not necessary
  50. 50. as there are only nine interface signals (including ground) between the DTE and DCE. With this in mind, many designers use 9- or 15-pin connectors. (Figure 2 above shows a 9-pin connector design.) The "basic nine" signals used in modem communication are illustrated in Figure 3 above; three RS-232 drivers and five receivers are necessary for the DTE. The functionality of these signals is described below. Note that for the following signal descriptions, ON refers to a high RS-232 voltage level (+5V to +15V), and OFF refers to a low RS-232 voltage level (-5V to -15V). Keep in mind that a high RS-232 voltage level actually represents a logic 0, and that a low RS-232 voltage level refers to a logic 1. Transmitted Data (TD): One of two separate data signals, this signal is generated by the DTE and received by the DCE. Received Data (RD): The second of two separate data signals, this signals is generated by the DCE and received by the DTE. Request to Send (RTS): When the host system (DTE) is ready to transmit data to the peripheral system (DCE), RTS is turned ON. In simplex and duplex systems, this condition maintains the DCE in receive mode. In half-duplex systems, this condition maintains the DCE in receive mode and disables transmit mode. The OFF condition maintains the DCE in transmit mode. After RTS is asserted, the DCE must assert CTS before communication can commence. Clear to Send (CTS): CTS is used along with RTS to provide handshaking between the DTE and the DCE. After the DCE sees an asserted RTS, it turns CTS ON when it is ready to begin communication. Data Set Ready (DSR): This signal is turned on by the DCE to indicate that it is connected to the telecommunications line.
  51. 51. Data Carrier Detect (DCD): This signal is turned ON when the DCE is receiving a signal from a remote DCE, which meets its suitable signal criteria. This signal remains ON as long as a suitable carrier signal can be detected. Data Terminal Ready (DTR): DTR indicates the readiness of the DTE. This signal is turned ON by the DTE when it is ready to transmit or receive data from the DCE. DTR must be ON before the DCE can assert DSR. Ring Indicator (RI): RI, when asserted, indicates that a ringing signal is being received on the communications channel. The signals described above form the basis for modem communication. Perhaps the best way to understand how these signals interact is to examine a step-by-step example of a modem interfacing with a PC. The following steps describe a transaction in which a remote modem calls a local modem. 1. The local Pc uses software to monitor the RI (Ring Indicate) signal. 2. When the remote modem wants to communicate with the local modem, it generates an RI signal. This signal is transferred by the local modem to the local PC. 3. The local PC responds to the RI signal by asserting the DTR (Data Terminal Ready) signal when it is ready to communicate. 4. After recognizing the asserted DTR signal, the modem responds by asserting DSR (Data Set Ready) after it is connected to the communications line. DSR indicates to the PC that the modem is ready to exchange further control signals with the DTE to commence communication. When DSR is asserted, the PC begins monitoring DCD for an indication that data is being sent over the communication line. 5. The modem asserts DCD (Data Carrier Detect) after it has received a carrier signal from the remote modem that meets the suitable signal criteria. 6. At this point data transfer can begin. If the local modem has full-duplex capability, the
  52. 52. CTS (Clear to Send) and RTS (Request to Send) signals are held in the asserted state. If the modem has only half-duplex capability, CTS and RTS provide the handshaking necessary for controlling the direction of the data flow. Data is transferred over the RD and TD signals. 7. When the transfer of data has been completed, the PC disables the DTR signal. The modem follows by inhibiting the DSR and DCD signals. At this point the PC and modem are in the original state described in step number 1. RS-232 in Minimal Handshake Applications Although the modem application discussed above is simplified from the RS-232 standard because of the number of signals needed, it is still more complex than many system requirements. For many applications, only two data lines and two handshake control lines are necessary to establish and control communication between a host system and a peripheral system. For e.g., an environmental control system may need to interface with a thermostat using a half-duplex communication scheme. At times the control systems read the temperature from the thermostat and at other times they load temperature trip points to the thermostat. In this type of simple application, only five signals could be needed (two for data, two for handshake control, and ground. Figure 5 illustrates a simple half-duplex communication interface. As can be seen, data is transferred over the TD (Transmit Data) and RD (Receive Data) pins, and the RTS (Ready to Send) and CTS (Clear to Send) pins provide handshake control. RTS is driven by the DTE to control the direction of data. When it is asserted, the DTE is placed in transmit mode. When RTS is inhibited, the DTE is placed in receive mode. CTS, which is generated by the DCE, controls the flow of data. When asserted, data can flow. However, when CTS is inhibited, the transfer of data is interrupted. The transmission of data is halted until CTS is reasserted.
  53. 53. Figure 5. Half-duplex communication scheme. RS-232 Application Limitations In the more than four decades since the RS-232 standard was introduced, the electronics industry has changed immensely. There are, therefore, some limitations in the RS-232 standard. One limitation—the fact that over twenty signals have been defined by the standard—has already been addressed. Designers simply do not use all the signals or the 25-pin connector. Other limitations in the standard are not necessarily as easy to correct. Generation of RS-232 Voltage Levels As explained in the Electrical Characteristics section, RS-232 does not use the conventional 0 and 5V levels implemented in TTL and CMOS designs. Drivers have to supply +5V to +15V for logic 0 and -5V to -15V for logic 1. This means that extra power supplies are needed to drive the RS-232 voltage levels. Typically, a +12V and a -12V power supply are used to drive the RS-232 outputs. This is a great inconvenience for systems that have no other requirements for these power supplies. With this in mind, RS-232 products manufactured by Dallas Semiconductor have on-chip charge-pump circuits that generate the necessary voltage levels for RS-232 communication. The first charge pump essentially doubles the standard +5V power supply to provide the voltage level necessary for driving logic 0. A second charge pump inverts this voltage and provides the voltage level necessary for driving logic 1. These two charge pumps allow the
  54. 54. RS-232 interface products to operate from a single +5V supply. Maximum Data Rate Another limitation in the RS-232 standard is the maximum data rate. The standard defines a maximum data rate of 20kbps, which is unnecessarily slow for many of today's applications. RS- 232 products manufactured by Dallas Semiconductor guarantee up to 250kbps and typically can communicate up to 350kbps. While providing a communication rate at this frequency, the devices still maintain a maximum 30V/ms maximum slew rate to reduce the likelihood of crosstalk between adjacent signals. Maximum Cable Length As we have seen, the cable-length specification once included in the RS-232 standard has been replaced by a maximum load-capacitance specification of 2500pF. To determine the total length of cable allowed, one must determine the total line capacitance. Figure 6 shows a simple approximation for the total line capacitance of a conductor. As can be seen, the total capacitance is approximated by the sum of the mutual capacitance between the signal conductors and the conductor to shield capacitance (or stray capacitance in the case of unshielded cable). As an example, assume that the user decided to use no shielded cable when interconnecting the equipment. The mutual capacitance (Cm) of the cable is found in the cable's specifications to be 20pF per foot. Assuming that the receiver's input capacitance is 20pF, this leaves the user with 2480pF for the interconnecting cable. From the equation in Figure 6, the total capacitance per foot is 30pF. Dividing 2480pF by 30pF reveals that the maximum cable length is approximately 80 feet. If a longer cable length is required, the user must find a cable with a smaller mutual capacitance.
  55. 55. Figure 6. Interface cable-capacitive model, per unit length. Auto Shutdown is a trademark of Maxim Integrated Products, Inc. 3.3 Software implementation 3.3.1 INTRODUCTION TO KEIL SOFTWARE Keil Micro Vision is an integrated development environment used to create software to be run on embedded systems (like a microcontroller). It allows for such software to be written either in assembly or C programming languages and for that software to be simulated on a computer before being loaded onto the microcontroller. WHAT IS μVision3? μVision3 is an IDE (Integrated Development Environment) that helps write, compile, and debug embedded programs. It encapsulates the following components: · A project manager. · A make facility. · A Tool configuration.
  56. 56. · An Editor. · A powerful debugger. FOLLOWED IN CREATING AN APPLICATION IN uVision3: To create a new project in uVision3: 1. Select Project - New Project 2. Select a directory and enter the name of the project file. 3. Select Project –Select Device and select a device from Device Database. 4. Create source files to add to the project 5. Select Project - Targets, Groups, and Files. Add/Files, select Source Group1, add the source files to the project. 6. Select Project - Options and set the tool options. Note that when the target device is selected from the Device Database all-special options are set automatically. Default memory model settings are optimal for most applications. 7. Select Project - Rebuild all target files or Build target To create a new project, simply start Micro Vision and select “Project”=>”New Project” from the pull–down menus. In the file dialog that appears, choose a name and base directory for the project. It is recommended that a new directory be created for each project, as several files will be generated. Once the project has been named, the dialog shown in the figure below will appear, prompting the user to select a target device. In this lab, the chip being used is the “AT89S52,” which is listed under the heading “Atmel”
  57. 57. . Fig-Window for choosing the target device Next, Micro Vision must be instructed to generate a HEX file upon program compilation. A HEX file is a standard file format for storing executable code that is to be loaded onto the microcontroller. In the “Project Workspace” pane at the left, right–click on “Target 1” and select “Options for ‘Target 1’ ”.Under the “Output” tab of the resulting options dialog, ensure that both the “Create Executable” and “Create HEX File” options are checked. Then click “OK” As shown in the two figures below.
  58. 58. Fig- Project workspace pane Fig-Project Options Dialog Next, a file must be added to the project that will contain the project code. To do this, expand the “Target 1” heading, right–click on the “Source Group 1” folder, and select “Add files…” Create a new blank file (the file name should end in “.asm”), select it, and click “Add.” The new file should now appear in the “Project Workspace” pane under the “Source Group 1” folder. Double-click on the newly created file to open it in the editor. All code for this lab will go in this file. To compile the program, first save all source files by clicking on the “Save All” button, and then click on the “Rebuild All Target Files” to compile the program as shown in the figure below. If any errors or warnings occur during compilation, they will be displayed in the output window at the bottom of the screen. All errors and warnings will reference the line and column number in which they occur along with a description of the problem so that they can be easily located. Note that only errors indicate that the compilation failed, warnings do not (though it is generally a good idea to look into them anyway).
  59. 59. Fig. “Save All” and “Build All Target Files” Buttons When the program has been successfully compiled, it can be simulated using the integrated debugger in Keil Micro Vision. To start the debugger, select “Debug”=>”Start/Stop Debug Session” from the pull–down menus. At the left side of the debugger window, a table is displayed containing several key parameters about the simulated microcontroller, most notably the elapsed time (circled in the figure below). Just above that, there are several buttons that control code execution. The “Run” button will cause the program to run continuously until a breakpoint is reached, whereas the “Step Into” button will execute the next line of code and then pause (the current
  60. 60. position in the program is indicated by a yellow arrow to the left of the code).
  61. 61. Fig. μVision3 Debugger window Breakpoints can be set by double–clicking on the grey bar on the left edge of the window containing the program code. A breakpoint is indicated by a red box next to the line of code. Fig ‘Reset’, ‘Run’ and ‘Step into’ options The current state of the pins on each I/O port on the simulated microcontroller can also be displayed. To view the state of a port, select “Peripherals”=>”I/O Ports”=>”Port n” from the pull–down menus, where n is the port number. A checked box in the port window indicates a
  62. 62. high (1) pin, and an empty box indicates a low (0) pin. Both the I/O port data and the data at the left side of the screen are updated whenever the program is paused. The debugger will help eliminate many programming errors, however the simulation is not perfect and code that executes properly in simulation may not always work on the actual microcontroller. DATABASE A unique feature of the Keil μVision3 IDE is the Device Database, which contains information about more than 400 supported microcontrollers. When you create a new μVision3 project and select the target chip from the database, μVision3 sets all assembler, compiler, linker, and debugger options for you. The only option you must configure is the memory map. SIMULATION The μVision3 Debugger provides complete simulation for the CPU and on-chip peripherals of most embedded devices. To discover which peripherals of a device are supported, in μVision3 select the Simulated Peripherals item from the Help menu. You may also use the web-based Device Database. We are constantly adding new devices and simulation support for on-chip peripherals so be sure to check Device Database often. 3.3.2PROGRAMMER The programmer used is a powerful programmer for the Atmel 89 series of microcontrollers that includes 89C51/52/55, 89S51/52/55 and many more. It is simple to use & low cost, yet powerful flash microcontroller programmer for the Atmel 89 series. It will Program, Read and Verify Code Data, Write Lock Bits, Erase and Blank
  63. 63. The debugger will help eliminate many programming errors, however the simulation is not perfect and code that executes properly in simulation may not always work on the actual microcontroller. DATABASE A unique feature of the Keil μVision3 IDE is the Device Database, which contains information about more than 400 supported microcontrollers. When you create a new μVision3 project and select the target chip from the database, μVision3 sets all assembler, compiler, linker, and debugger options for you. The only option you must configure is the memory map. SIMULATION The μVision3 Debugger provides complete simulation for the CPU and on-chip peripherals of most embedded devices. To discover which peripherals of a device are supported, in μVision3 select the Simulated Peripherals item from the Help menu. You may also use the web-based Device Database. We are constantly adding new devices and simulation support for on-chip peripherals so be sure to check Device Database often. 3.3.2PROGRAMMER The programmer used is a powerful programmer for the Atmel 89 series of microcontrollers that includes 89C51/52/55, 89S51/52/55 and many more. It is simple to use & low cost, yet powerful flash microcontroller programmer for the Atmel 89 series. It will Program, Read and Verify Code Data, Write Lock Bits, Erase and Blank Check. All fuse and lock bits are programmable. This programmer has intelligent onboard firmware and connects to the serial port. It can be used with any type of computer and
  64. 64. requires no special hardware. All that is needed is a serial communication port which all computers have. All devices also have a number of lock bits to provide various levels of software and programming protection. These lock bits are fully programmable using this programmer. Locks bits are useful to protect the program to be read back from microcontroller only allowing erase to reprogram the microcontroller. Major parts of this programmer are Serial Port, Power Supply and Firmware microcontroller. Serial data is sent and received from 9 pin connector and converted to/from TTL logic/RS232 signal levels by MAX232 chip. A Male to Female serial port cable, connects to the 9 pin connector of hardware and another side connects to back of computer. All the programming ‘intelligence’ is built into the programmer so you do not need any special hardware to run it. Programmer comes with window based software for easy programming of the devices. 3.3.3 VOICE RECOGNITION SOFTWARE The way of this concept function is when a user speaks out some command, then the voice is captured through microphone as the input devices. Once the voice is captured, the usage of a decoding system that will convert the analog (voice) to digital (binary signal). Later, the input voice is compared with the data stored in the memory early before the testing. The output of the comparison is the voice matched with any of the command trained and certain signal is produce as the input for the controlling system.
  65. 65. In this project whenever we want to control the machine from our voice then first of we enable the button of voice control. As we speaks through the mike on/off then the control panel works as per condition. Whenever we want to control the machine computer then first of we enable the button of pc control. As we enable the button then with the help mouse we on /off the control panel as per our requirement. Once we enable the button then Red indicator is lit on the screen then computer send a code to the microcontroller via RS 232 com port. Data is transfer via serial port on the baud rate of 9600 bps. Data transfer in the 8 bit package. Data receive by the controller receive pin via Max 232 IC. IC max232 is RS232 to TTL converter IC. As the code is receive by the controller inside and then switch on/off the electrical appliances in. When the output is on then connected L.E.D. is on and when the output is off then connected L.E.D is off. For this project we transfer the data from computer in the form of serial communication. When we want to control the appliances through Wireless remote then first of all we enable the remote option. In the project we use RC5 TV remote. There is lot of remote are available, but in this project we use RC5 base remote fro switching. For Any remote control device we must know the protocol of infra red transmission. In the infra red transmission we send the different codes on modulated frequency. Each time when we press any switch from the remote then one modulated signal is transfer to the receiver circuit. On the receiver end we receive this code with the help of infra red receiver eye. Receiver eye receive the code then demodulated the frequency. Code from the eye is further connected to then microcontroller for further process. Microcontroller receives the code and after processing Toggle the electrical switch regular rally. In our project we use MICROSOFT VISUAL BASIC to run appliance controller.
  66. 66. Chapter 4 Working Description 4.1 MAKING PRINTED CIRCUIT BOARD (P.C.B.) 4.1.1 INTRODUCTION— Making a Printed Circuit Board is the first step towards building electronic equipment by any electronic industry. A number of methods are available for making P.C.B., the simplest method is of drawing pattern on a copper clad board with acid resistant (etchants) ink or paint or simple nail polish on a copper clad board and do the etching process for dissolving the rest of copper pattern in acid liquid. 4.1.2 MATERIAL REQUIRED The apparatus needs for making a P.C.B. is:- · Copper Clad Sheet · Nail Polish or Paint · Ferric Chloride Powder. (Fecl) · Plastic Tray · Tap Water etc. 4.1.3 PROCEDURE The first and foremost in the process is to clean all dirt from copper sheet with say spirit or trichloro ethylene to remove traces grease or oil etc. and then wash the board under running tap water. Dry the surface with forced warm air or just leave the board to dry naturally for some time.
  67. 67. Making of the P.C.B. drawing involves some preliminary consideration such as thickness of lines/ holes according to the components. Now draw the sketch of P.C.B. design (tracks, rows, square) as per circuit diagram with the help of nail polish or enamel paint or any other acid resistant liquid. Dry the point surface in open air, when it is completely dried, the marked holes in P.C.B. may be drilled using 1Mm drill bits. In case there is any shorting of lines due to spilling of paint, these may be removed by scraping with a blade or a knife, after the paint has dried. After drying, 22-30 grams of ferric chloride in 75 ml of water may be heated to about 60 degree and poured over the P.C.B. , placed with its copper side upwards in a plastic tray of about 15*20 cm. Stirring the solution helps speedy etching. The dissolution of unwanted copper would take about 45 minutes. If etching takes longer, the solution may be heated again and the process repeated. The paint on the pattern can be removed P.C.B. may then be washed and dried. Put a coat of varnish to retain the shine. Your P.C.B. is ready. 4.1.4 REACTION Fecl3 + Cu ----- CuCl3 + Fe Fecl3 + 3H2O --------- Fe (OH)3 + 3HCL 4.1.5 PRECAUTION 1. Add Ferric Chloride (Fecl3) carefully, without any splashing. Fecl3 is irritating to the skin and will stain the clothes. 2. Place the board in solution with copper side up. 3. Try not to breathe the vapors. Stir the solution by giving see-saw motion to the dish and solution in it. 4. Occasionally warm if the solution over a heater-not to boiling. After some time the unshaded parts change their color continue to etch. Gradually the base material will become visible. Etch for two minutes more to get a neat pattern. 5. Don't throw away the remaining Fecl3 solution. It can be used again for next Printed Circuit Board P.C.B.
  68. 68. 4.1.6 USES Printed Circuit Board are used for housing components to make a circuit for compactness, simplicity of servicing and case of interconnection. Thus we can define the P.C.B. as : Prinked Circuit Boards is actually a sheet of bakelite (an insulating material) on the one side of which copper patterns are made with holes and from another side, leads of electronic components are inserted in the proper holes and soldered to the copper points on the back. Thus leads of electronic components terminals are joined to make electronic circuit. In the boards copper cladding is done by pasting thin copper foil on the boards during curing. The copper on the board is about 2 mm thick and weights an ounce per square foot. The process of making a Printed Circuit for any application has the following steps (opted professionally): · Preparing the layout of the track. · Transferring this layout photographically M the copper. · Removing the copper in places which are not needed, by the process of etching (chemical process) · Drilling holes for components mounting. 4.1.7 PRINTED CIRCUIT BOARD Printed circuit boards are used for housing components to make a circuit, for compactness, simplicity of servicing and ease of interconnection. Single sided, double sided and double sided with plated-through-hold (PYH) types of p.c boards are common today. Boards are of two types of material (1) phenolic paper based material (2) Glass epoxy material. Both materials are available as laminate sheets with copper cladding. Printed circuit boards have a copper cladding on one or both sides. In both boards, pasting thin copper foil on the board during curing does this. Boards are prepared in sizes of 1 to 5 metre wide and up to 2 meters long. The thickness of the boards is 1.42 to 1.8mm. The copper on the boards is about 0.2 thick and weighs and ounce per square foot.
  69. 69. 4.2 Soldering Process Building project in the proper manner is really an art, something which must be précised and learned through trial and error, it is not all that difficult. The main thing is to remember to take each step slowly and carefully according to the instructions giving making since that everything at it should be before proceeding further. 4.2.1 TOOLS: The electronics workbench is an actual place of work with comfortably & conveniently & should be supplied with compliment of those tools must often use in project building. Probably the most important device is a soldering tool. Other tool which should be at the electronic work bench includes a pair of needle nose pliers, diagonal wire cutter, a small knife, an assortment of screw driver, nut driver, few nuts & bolts, electrical tape, pucker etc. Diagonal wire cutter will be used to cut away any excess lead length from copper side of P.C.B. 7 to cut section of the board after the circuit is complete. The needle nose pliers are most often using to bend wire leads & wrap them in order to form a strong mechanical connection. 4.2.2 MOUNTING & SOLDERING: Soldering is process of joining together two metallic parts. It is actually a process of function in which an alloy, the solder, with a comparatively low melting point
  70. 70. penetrates the surface of the metal being joined & makes a firm joint between them on cooling & solidifying. 4.2.3 THE SOLDERING KIT 1. SOLDERING IRON: As soldering is a process of joining together two metallic parts, the instrument, which is used, for doing this job is known as soldering Iron. Thus it is meant for melting the solder and to setup the metal parts being joined. Soldering Iron is rated according to their wattage, which varies from 10- 200 watts. 2. SOLDER: The raw material used for soldering is solder. It is composition of lead & tin. The good quality solder (a type of flexible naked wire) is 60% Tin +40% Lead which will melt between 180 degree to 200 degree C temperature. 3. LUXES OR SOLDERING PASTE: When the points to solder are heated, an oxide film forms. This must be removed at once so that solder may get to the surface of the metal parts. This is done by applying chemical substance called Flux, which boils under the heat of the iron remove the oxide formation and enable the metal to receive the solder. 4. BLADES OR KNIFE: To clean the surface & leads of components to be soldered is done by this common instrument.
  71. 71. 5. SAND PAPER: The oxide formation may attack at the tip of your soldering iron & create the problem. To prevent this, clean the tip with the help of sand paper time to time or you may use blade for doing this job. Apart from all these tools, the working bench for soldering also includes desoldering pump, wink wire (used for desoldering purpose), file etc. 4.2.4 HOW TO SOLDER? Mount components at their appropriate place; bend the leads slightly outwards to prevent them from falling out when the board is turned over for soldering. No cut the leads so that you may solder them easily. Apply a small amount of flux at these components leads with the help of a screwdriver. Now fix the bit or iron with a small amount of solder and flow freely at the point and the P.C.B copper track at the same time. A good solder joint will appear smooth & shiny. If all appear well, you may continue to the next solder connections. 4.2.5 TIPS FOR GOOD SOLDERING 1. Use right type of soldering iron. A small efficient soldering iron (about 10-25 watts with 1/8 or 1/4 inch tip) is ideal for this work. 2. Keep the hot tip of the soldering iron on a piece of metal so that excess heat is dissipated. 3. Make sure that connection to the soldered is clean. Wax frayed insulation and other substances cause poor soldering connection. Clean the leads, wires, tags etc. before soldering. 4. Use just enough solder to cover the lead to be soldered. Excess solder can cause a short circuit. 5. Use sufficient heat. This is the essence of good soldering. Apply enough heat to the component lead. You are not using enough heat, if the solder barely melts and forms a round ball of rough flaky solder. A good solder joint will look smooth, shining and spread
  72. 72. type. The difference between good & bad soldering is just a few seconds extra with a hot iron applied firmly. 4.2.6 PRECAUTIONS 1. Mount the components at the appropriate places before soldering. Follow the circuit description and components details, leads identification etc. Do not start soldering before making it confirm that all the components are mounted at the right place. 2. Do not use a spread solder on the board, it may cause short circuit. 3. Do not sit under the fan while soldering. 4. Position the board so that gravity tends to keep the solder where you want it. 5. Do not over heat the components at the board. Excess heat may damage the components or board. 6. The board should not vibrate while soldering otherwise you have a dry or a cold joint. 7. Do not put the kit under or over voltage source. Be sure about the voltage either dc or ac while operating the gadget. 8. Do spare the bare ends of the components leads otherwise it may short circuit with the other components. To prevent this use sleeves at the component leads or use sleeved wire for connections. 9. Do not use old dark color solder. It may give dry joint. Be sure that all the joints are clean and well shiny. 10. Do make loose wire connections especially with cell holder, speaker, probes etc. Put knots while connections to the circuit board, otherwise it may get loose.
  73. 73. CHAPTER 5 RESULT AND DISCUSSION 5.1 RESULT AND DISCUSSION Since this system is related to the voice or the speech by the user that will use to control this system, thus there is some issue that arises when using this system. The problems are the pronunciation of the user when doing the training process, pronunciation when using the system, the repetition of the same word used to train the system with different number and lastly the length of the word used. For the pronunciation matter, the system takes it at a quite high level of sensitivity. The main reason is when a word is trained into the system, the HM2007 IC chip will perform ADC. Which later convert the word into a series of data with correspondent to the time. So when the user wishes to use the system, thus he or she must produce the word with the correct pronunciation as in the training process. While for the problem of the repetition of word used to train 2 different numbers, it will create an issue of common output value for both of the number trained. This issue will cause the system to enable to perform it duties perfectly as when the user use the word that trained it will either display one of the number which mean there is a probability of executing wrong command.
  74. 74. 5.2 CONCLUSION This project discussed the development of the voice recognition home automation system which can be used to replace the old and conventional way to switch on the power of an electrical device. This system consists of a voice recognition circuit, a microcontroller circuit and a set of relay. The voice recognition home automation system has been successfully developed and through this project we have gained much experience especially in the field of applying the technique of troubleshooting an electrical circuit and also in programming the microcontroller. This project is a very simple project compare to any of those who are already in the industry and commercialized but yet we hope that this project can be research on further to create a better design that can be applied to a larger scale of controlling. Besides that, we also hope that this project can be jumping stone for the application as one of the smart home necessity. Besides the achieving of the main objective, by using this system, it can help reduce any occurrence of getting shock due to the failure of the switch and it offer a more safety way to turn on the switch. Moreover if this system is fully equipped in a house it can reduce the addition of the wall switch and what left is only the plug point for user to plug in their devices only.
  75. 75. 5.3 APPENDICS // This is declaration of variable used char *someText1; char *someText2; char *someText3; int state; int plug1; int plug2; int plug3; // module connections char D_DataPort at PORTH; sbit D_CS1 at LATJ0_bit; sbit D_CS2 at LATJ1_bit; sbit D_RS at LATJ2_bit; sbit D_RW at LATJ3_bit; sbit D_EN at LATJ4_bit; sbit D_RST at LATJ5_bit; sbit GLCD_CS1_Direction at TRISJ0_bit; sbit D_CS2_Direction at TRISJ1_bit; sbit D_RS_Direction at TRISJ2_bit; sbit D_RW_Direction at TRISJ3_bit; sbit D_EN_Direction at TRISJ4_bit; sbit D_RST_Direction at TRISJ5_bit; // End module connections void delay1S(){ // 0.5 seconds delay function Delay_ms(500); } void delay2S(){ // 2.0 seconds delay function Delay_ms(2000); }
  76. 76. void main() { ADCON1|=0x0F; CMCON |= 7; TRISD = 0xff; // port D as input TRISA = 0x1f; // port A as analog input TRISE = 0x00; // port E as output PORTE = d_Init(); // Initialize d_Fill(0xFF); // Setting the Font d_Set_Font(Character8x7, 8, 7, 32); d_Write_Text("Welcome ", 67, 1, 2); d_Write_Text("to", 90, 2, 2); d_Write_Text("VRHAS", 75, 3, 2); delay2S(); d_Fill(0xFF); // Clear GLCD someText1="off"; // Initialize the display someText2="off"; // Initialize the display someText3="off"; // Initialize the display while(1){ d_Write_Text("VRHAS", 75, 1, 2); delay1S(); d_Write_Text("S1", 70, 2, 2); d_Write_Text(someText1, 95, 2, 2); d_Write_Text("S2", 70, 3, 2); d_Write_Text(someText2, 95, 3, 2); d_Write_Text("S3", 70, 4, 2); d_Write_Text(someText3, 95, 4, 2); delay1S(); // Distance sensor input while (PORTA.F1==0) {} // user input command
  77. 77. if (PORTD==0X01) state=1; else if (PORTD==0X02) state=2; else if (PORTD==0X03) state=3; else if (PORTD==0x04) state=4; else if (PORTD==0x05) state=5; else if (PORTD==0x06) state=6; else if (PORTD==0x07) state=7; else if (PORTD==0x08) state=8; switch (state) { case 0: break; case 1:plug1= 1; // setting output someText1= "on"; //update display break; case 2:plug1= 0; // setting output someText1= "Off"; //update display break; case 3:plug2=1; // setting output someText2= "On"; //update display break; case 4:plug2=0; // setting output someText2= "Off"; //update display 35 break; case 5:plug3=1; // setting output someText3= "On"; break; case 6:plug3=0; // setting output someText3= "Off"; //update display break; case 7:plug1=0; // setting output
  78. 78. plug2=0; // setting output plug3=0; // setting output someText1= "Off"; //update display someText2= "Off"; //update display someText3= "Off"; //update display break; case 8:plug1=1; // setting output plug2=1; // setting output plug3=1; // setting output someText1= "on"; //update display someText2= "On"; //update display someText3= "On"; //update display break; default: break; } LATE.F1=plug1; // Actual output LATE.F3=plug2; // Actual output LATE.F5=plug3; // Actual output } }33
  79. 79. 5.4 REFERENCES 1. Han Siong, J. Automated Home Lighting System. Degree.thesis. Faculty of Electrical Engineering, Universiti Teknologi Malaysia. 2009. 2. – 3. 4. 5. Automation Testing By Saurabh Chandra “TATA MCGRAW HILLS” 6. 7.