Speed Control Using Switches.docx

  • Uploaded by: Arun Kumar Reddy Yaramala
  • 0
  • 0
  • April 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Speed Control Using Switches.docx as PDF for free.

More details

  • Words: 14,109
  • Pages: 63
Abstract

A pulse width modulator (PWM) is a device that may be used as an efficient DC motor speed controller or light dimmer. This project is a versatile device that can control DC devices which draw up to a few amps of current. The circuit may be used in either 12 or 24 Volt systems with only a few minor wiring changes. This device has been used to control the speed of the DC motor and to control brightness of an automotive tail lamp. A PWM circuit works by making a square wave with a variable on-to-off ratio, the average on time may be varied from 0 to 100 percent. In this manner, a variable amount of power is transferred to the load. The main advantage of a PWM circuit over a resistive power controller is the efficiency, at a 50% level, the PWM will use about 50% of full power, almost all of which is transferred to the load, a resistive controller at 50% load power would consume about 71% of full power, 50% of the power goes to the load and the other 21% is wasted heating the series resistor.

One additional advantage of pulse width modulation is that the pulses reach the full supply voltage and will produce more torque in a motor by being able to overcome the internal motor resistances more easily. Two push-to-on switches are provided for increasing / decreasing the speed of the motor. Two more push-to-on switches are provided to rotate the motor in Clock wise / Counter clock wise direction. 16X2 LCD is connected to display the speed level of the motor and the direction. LED indication is also provided for visual indication. A buzzer is provided for audio indication of DC motor speed variation and change in direction. Whenever the speed is increased / decreased, the system acknowledges by a short beep. This buzzer is driven by transistor driver circuit.This project uses regulated 5V, 500mA & 12V, 500mA power supply. 7805 and 7812 three terminal voltage regulators are used for voltage regulation. Bridge type full wave rectifier is used to rectify the ac out put of secondary of 230/12V step down transformer.

INTRODUCTION The purpose of a motor speed controller is to take a signal representing the demanded speed, and to drive a motor at that speed. The controller may or may not actually measure the speed of the motor. If it does, it is called a Feedback Speed Controller or Closed Loop Speed Controller, if not it is called an Open Loop Speed Controller. Feedback speed control is better, but more complicated. Motors come in a variety of forms, and the speed controller's motor drive output will be different dependent on these forms. As the speed of a DC motor is directly proportional to the supply voltage, so if we reduce the supply voltage from 12 Volts to 6 Volts, the motor will run at half the speed. How can this be achieved when the battery is fixed at 12 Volts? The speed controller works by varying the average voltage sent to the motor. It could do this by simply adjusting the voltage sent to the motor, but this is quite inefficient to do. A better way is to switch the motor's supply on and off very quickly. If the switching is fast enough, the motor doesn't notice it, it only notices the average effect. This work is performed with the help of a technology called “Embedded Systems”

INTRODUCTION TO EMBEDDED SYSTEMS An embedded system can be defined as a computing device that does a ‘specific focused job. Appliances such as the air-conditioner, VCD player, DVD player, printer, fax machine, mobile phone etc. are examples of embedded systems. Each of these appliances will have a processor and special hardware to meet the specific requirement of the application along with the embedded software that is executed by the processor for meeting that specific requirement. The embedded software is also called “firm ware”. The desktop/laptop computer is a general purpose computer. You can use it for a variety of applications such as playing games, word processing, accounting, software development and so on. In contrast, the software in the embedded systems is always fixed listed below: Embedded systems do a very specific task, they cannot be programmed to do different things. . Embedded systems have very limited resources, particularly the memory. Generally, they do not have

secondary storage devices such as the CDROM or the floppy disk. Embedded systems have to work against some deadlines. A specific job has to be completed within a specific time. In some embedded systems, called real-time systems, the deadlines are stringent. Missing a deadline may cause a catastrophe-loss of life or damage to property. Embedded systems are constrained for power. As many embedded systems operate through a battery, the power consumption has to be very low. · Some embedded systems have to operate in extreme environmental conditions such as very high temperatures and humidity.

Application Areas Nearly 99 per cent of the processors manufactured end up in embedded systems. The embedded system market is one of the highest growth areas as these systems are used in very market segmentconsumer electronics, office automation, industrial automation, biomedical engineering, wireless communication, data communication, telecommunications, transportation, military and so on.

Consumer appliances: At home we use a number of embedded systems which include digital camera, digital diary, DVD player, electronic toys, microwave oven, remote controls for TV and air-conditioner, VCO player, video game consoles, video recorders etc. Today’s high-tech car has about 20 embedded systems for transmission control, engine spark control, air-conditioning, navigation etc. Even wristwatches are now becoming embedded systems. The palmtops are powerful embedded systems using which we can carry out many general-purpose tasks such as playing games and word processing.

Office automation: The office automation products using embedded systems are copying machine, fax machine, key telephone, modem, printer, scanner etc.

Industrial automation: Today a lot of industries use embedded systems for process control. These include pharmaceutical, cement, sugar, oil exploration, nuclear energy, electricity generation and transmission. The embedded systems for industrial use are designed to carry out specific tasks such as monitoring the temperature, pressure, humidity, voltage, current etc., and then take appropriate action based on the monitored levels to control other devices or to send information to a centralized monitoring station. In hazardous industrial environment, where human presence has to be avoided, robots are used, which are programmed to do specific jobs. The robots are now becoming very powerful and carry out many interesting and complicated tasks such as hardware assembly.

Medical electronics: Almost every medical equipment in the hospital is an embedded system. These equipments include diagnostic aids such as ECG, EEG, blood pressure measuring devices, X-ray scanners; equipment used in blood analysis, radiation, colonscopy, endoscopy etc. Developments in medical electronics have paved way for more accurate diagnosis of diseases.

Computer networking: Computer networking products such as bridges, routers, Integrated Services Digital Networks (ISDN), Asynchronous Transfer Mode (ATM), X.25 and frame relay switches are embedded systems which implement the necessary data communication protocols. For example, a router interconnects two networks. The two networks may be running different protocol stacks. The router’s function is to obtain the data packets from incoming pores, analyze the packets and send them towards the destination after doing necessary protocol conversion. Most networking equipments, other than the end systems (desktop computers) we use to access the networks, are embedded systems . Telecommunications: In the field of telecommunications, the embedded systems can be categorized as subscriber terminals and network equipment. The subscriber terminals such as key telephones, ISDN phones, terminal adapters, web cameras are embedded systems. The network equipment includes multiplexers, multiple access systems, Packet Assemblers Dissemblers (PADs), sate11ite modems etc. IP phone, IP gateway, IP gatekeeper etc. are the latest embedded systems that provide very low-cost voice communication over the Internet.

Wireless technologies: Advances in mobile communications are paving way for many interesting applications using embedded systems. The mobile phone is one of the marvels of the last decade of the 20’h century. It is a very powerful embedded system that provides voice communication while we are on the move. The Personal Digital Assistants and the palmtops can now be used to access multimedia services over the Internet. Mobile communication infrastructure such as base station controllers, mobile switching centers are also powerful embedded systems.

Insemination: Testing and measurement are the fundamental requirements in all scientific and engineering activities. The measuring equipment we use in laboratories to measure parameters such as weight, temperature, pressure, humidity, voltage, current etc. are all embedded systems. Test equipment such as oscilloscope, spectrum analyzer, logic analyzer, protocol analyzer, radio communication test set etc. are embedded systems built around powerful processors. Thank to miniaturization, the test and measuring equipment are now becoming portable facilitating easy testing and measurement in the field by field-personnel.

Security: Security of persons and information has always been a major issue. We need to protect our homes and offices; and also the information we transmit and store. Developing embedded systems for security applications is one of the most lucrative businesses nowadays. Security devices at homes, offices, airports etc. for authentication and verification are embedded systems. Encryption devices are nearly 99 per cent of the processors that are manufactured end up in~ embedded systems. Embedded systems find applications in . every industrial segment- consumer electronics, transportation, avionics, biomedical engineering, manufacturing, process control and industrial automation, data communication, telecommunication, defense, security etc. Used to encrypt the data/voice being transmitted on communication links such as telephone lines. Biometric systems using fingerprint and face recognition are now being extensively used for user authentication in banking applications as well as for access control in high security buildings. Finance: Financial dealing through cash and cheques are now slowly paving way for transactions using smart cards and ATM (Automatic Teller Machine, also expanded as Any Time Money) machines. Smart

card, of the size of a credit card, has a small micro-controller and memory; and it interacts with the smart card reader! ATM machine and acts as an electronic wallet. Smart card technology has the capability of ushering in a cashless society. Well, the list goes on. It is no exaggeration to say that eyes wherever you go, you can see, or at least feel, the work of an embedded system!

Overview of Embedded System Architecture Every embedded system consists of custom-built hardware built around a Central Processing Unit (CPU). This hardware also contains memory chips onto which the software is loaded. The software residing on the memory chip is also called the ‘firmware’. The embedded system architecture can be represented as a layered architecture as shown in Fig. The operating system runs above the hardware, and the application software runs above the operating

system. The same architecture is applicable to any computer including a desktop computer. However, there are significant differences. It is not compulsory to have an operating system in every embedded system. For small appliances such as remote control units, air conditioners, toys etc., there is no need for an operating system and you can write only the software specific to that application. For applications involving complex processing, it is advisable to have an operating system. In such a case, you need to integrate the application software with the operating system and then transfer the entire software on to the memory chip. Once the software is transferred to the memory chip, the software will continue to run for a long time you don’t need to reload new software.

Now, let us see the details of the various building blocks of the hardware of an embedded system. As shown in Fig. the building blocks are; · Central Processing Unit (CPU) · Memory (Read-only Memory and Random Access Memory) · Input Devices · Output devices · Communication interfaces · Application-specific circuitry

Central Processing Unit (CPU): The Central Processing Unit (processor, in short) can be any of the following: microcontroller, microprocessor or Digital Signal Processor (DSP). A micro-controller is a low-cost processor. Its main attraction is that on the chip itself, there will be many other components such as memory, serial communication interface, analog-to digital converter etc. So, for small applications, a micro-controller is the best choice as the number of external components required will be very less. On the other hand, microprocessors are more powerful, but you need to use many external components with them. D5P is used mainly for applications in which signal processing is involved such as audio and video processing.

Memory: The memory is categorized as Random Access 11emory (RAM) and Read Only Memory (ROM). The contents of the RAM will be erased if power is switched off to the chip, whereas ROM retains the contents even if the power is switched off. So, the firmware is stored in the ROM. When power is switched on, the processor reads the ROM; the program is program is executed.

Input devices: Unlike the desktops, the input devices to an embedded system have very limited capability. There will be no keyboard or a mouse, and hence interacting with the embedded system is no easy task. Many embedded systems will have a small keypad-you press one key to give a specific command. A keypad may be used to input only the digits. Many embedded systems used in process control do not have any input device for user interaction; they take inputs from sensors or transducers 1’fnd produce electrical signals that are in turn fed to other systems. Output devices: The output devices of the embedded systems also have very limited capability. Some embedded systems will have a few Light Emitting Diodes (LEDs) to indicate the health status of the system modules, or for visual indication of alarms. A small Liquid Crystal Display (LCD) may also be used to display some important parameters. Communication interfaces: The embedded systems may need to, interact with other embedded systems at they may have to transmit data to a desktop. To facilitate this, the embedded systems are provided with one or a few communication interfaces such as RS232, RS422, RS485, Universal Serial Bus (USB), IEEE 1394, Ethernet etc. Application-specific circuitry: Sensors, transducers, special processing and control circuitry may be required fat an embedded system, depending on its application. This circuitry interacts with the processor to carry out the necessary work.

The entire hardware has to be given power supply either through the 230 volts main supply or through a battery. The hardware has to designed in such a way that the power consumption is minimized.

Block Diagram

Contrast Control Speed 16X2 LCD Display Speed

89S52 MCU

TRIAC

Motor

Enter

Power supply

+5V to all sections Step down T/F

Bridge Rectifier

Filter Circuit

Regulator Regulator

+12V to DC motor

POWER SUPPLY: The input to the circuit is applied from the regulated power supply. The a.c. input i.e., 230V from the mains supply is step down by the transformer to 12V and is fed to a rectifier. The output obtained from the rectifier is a pulsating d.c voltage. So in order to get a pure d.c voltage, the output voltage from the rectifier is fed to a filter to remove any a.c components present even after rectification. Now, this voltage is given to a voltage regulator to obtain a pure constant dc voltage.

230V AC

D.C 50Hz

Output

Step down

Bridge

transformer

Rectifier

Filter

Regulator

Fig: Power supply

Transformer: Usually, DC voltages are required to operate various electronic equipment and these voltages are 5V, 9V or 12V. But these voltages cannot be obtained directly. Thus the a.c input available at the mains supply i.e., 230V is to be brought down to the required voltage level. This is done by a transformer. Thus, a step down transformer is employed to decrease the voltage to a required level.

Rectifier: The output from the transformer is fed to the rectifier. It converts A.C. into pulsating D.C. The rectifier may be a half wave or a full wave rectifier. In this project, a bridge rectifier is used because of its merits like good stability and full wave rectification. Filter: Capacitive filter is used in this project. It removes the ripples from the output of rectifier and smoothens the D.C. Output received from this filter is constant until the mains voltage and load is maintained constant. However, if either of the two is varied, D.C. voltage received at this point changes. Therefore a regulator is applied at the output stage. Voltage regulator: As the name itself implies, it regulates the input applied to it. A voltage regulator is an electrical regulator designed to automatically maintain a constant voltage level. In this project, power supply of 5V and 12V are required. In order to obtain these voltage levels, 7805 and 7812 voltage regulators are to be used. The first number 78 represents positive supply and the numbers 05, 12 represent the required output voltage levels.

MICROCONTROLLERS Microcontrollers’ producers have been struggling for a long time for attracting more and more choosy customers. Every couple of days a new chip with a higher operating frequency, more memory and more high-quality A/D converters comes on the market. Nevertheless, by analyzing their structure it is concluded that most of them have the same (or at least very similar) architecture known in the product catalogs as “8052 compatible”. What is all this about? The whole story began in the far 80s when Intel launched its series of the microcontrollers labelled with MCS 051. Although, several circuits belonging to this series had quite modest features in comparison to the new ones, they took over the world very fast and became a standard for what nowadays is ment by a word microcontroller. The reason for success and such a big popularity is a skillfully chosen configuration which satisfies needs of a great number of the users allowing at the same time stable expanding ( refers to the new types of the microcontrollers ). Besides, since a great deal of software has been developed in the meantime, it simply was not profitable to change anything in the microcontroller’s basic core. That is the reason for having a great number of various microcontrollers which actually are solely upgraded versions of the 8052 family. What is it what

makes this microcontroller so special and universal so that almost all the world producers manufacture it today under different name? FEATURES OF AT89S52:  4K Bytes of Re-programmable Flash Memory.  RAM is 128 bytes.  2.7V to 6V Operating Range.  Fully Static Operation: 0 Hz to 24 MHz.  Two-level Program Memory Lock.  128 x 8-bit Internal RAM.  32 Programmable I/O Lines.  Two 16-bit Timer/Counters.  Six Interrupt Sources.  Programmable Serial UART Channel.  Low-power Idle and Power-down Modes 

4 Kb program memory is not much at all.



128Kb RAM (including SFRs as well) satisfies basic needs, but it is not imposing amount.



4 ports having in total of 32 input/output lines are mostly enough to make connection to peripheral environment and are not luxury at all.

As it is shown on the previous picture, the 8052 microcontroller have nothing impressive at first sight: The whole configuration is obviously envisaged as such to satisfy the needs of most programmers who work on development of automation devices. One of advantages of this microcontroller is that nothing is missing and nothing is too much. In other words, it is created exactly in accordance to the average user‘s taste and needs. The other advantage is the way RAM is organized, the way Central Processor Unit (CPU) operates and ports which maximally use all recourses and enable further upgrading.

8052 Microcontroller's pins

Pins 1-8: Port 1 Each of these pins can be configured as input or output.

Pin 9: RS Logical one on this pin stops microcontroller’s operating and erases the contents of most registers. By applying logical zero to this pin, the program starts execution from the beginning. In other words, a positive voltage pulse on this pin resets the microcontroller. Pins10-17: Port 3 Similar to port 1, each of these pins can serve as universal input or output . Besides, all of them have alternative functions: Pin 10: RXD Serial asynchronous communication input or Serial synchronous communication output. Pin 11: TXD Serial asynchronous communication output or Serial synchronous communication clock output. Pin 12: INT0 Interrupt 0 input Pin 13: INT1 Interrupt 1 input Pin 14: T0 Counter 0 clock input Pin 15: T1 Counter 1 clock input Pin 16: WR Signal for writing to external (additional) RAM Pin 17: RD Signal for reading from external RAM Pin 18, 19: X2, X1 Internal oscillator input and output. A quartz crystal which determines operating frequency is usually connected to these pins. Instead of quartz crystal, the miniature ceramics resonators can be also used for frequency stabilization. Later versions of the microcontrollers operate at a frequency of 0 Hz up to over 50 Hz.

Pin 20: GND Ground Pin 21-28: Port 2 If there is no intention to use external memory then these port pins are configured as universal inputs/outputs. In case external memory is used then the higher address byte, i.e. addresses A8-A15 will appear on this port. It is important to know that even memory with capacity of 64Kb is not used ( i.e. note all bits on port are used for memory addressing) the rest of bits are not available as inputs or outputs. Pin 29: PSEN If external ROM is used for storing program then it has a logic-0 value every time the microcontroller reads a byte from memory. Pin 30: ALE Prior to each reading from external memory, the microcontroller will set the lower address byte (A0-A7) on P0 and immediately after that activates the output ALE. Upon receiving signal from the ALE pin, the external register (74HCT373 or 74HCT375 circuit is usually embedded ) memorizes the state of P0 and uses it as an address for memory chip. In the second part of the microcontroller’s machine cycle, a signal on this pin stops being emitted and P0 is used now for data transmission (Data Bus). In this way, by means of only one additional (and cheap) integrated circuit, data multiplexing from the port is performed. This port at the same time used for data and address transmission. Pin 31: EA By applying logic zero to this pin, P2 and P3 are used for data and address transmission with no regard to whether there is internal memory or not. That means that even there is a program written to the microcontroller, it will not be executed, the program written to external ROM will be used instead. Otherwise, by applying logic one to the EA pin, the microcontroller will use both memories, first internal and afterwards external (if it exists), up to end of address space. Pin 32-39: Port 0 Similar to port 2, if external memory is not used, these pins can be used as universal inputs or outputs. Otherwise, P0 is configured as address output (A0-A7) when the ALE pin is at high level (1) and as data output (Data Bus), when logic zero (0) is applied to the ALE pin.

Pin 40: VCC Power supply +5V Input/Output Ports (I/O Ports) All 8052 microcontrollers have 4 I/O ports, each consisting of 8 bits which can be configured as inputs or outputs. This means that the user has on disposal in total of 32 input/output lines connecting the microcontroller to peripheral devices. A logic state on a pin determines whether it is configured as input or output: 0=output, 1=input. If a pin on the microcontroller needs to be configured as output, then a logic zero (0) should be applied to the appropriate bit on I/O port. In this way, a voltage level on the appropriate pin will be 0. Similar to that, if a pin needs to be configured as input, then a logic one (1) should be applied to the appropriate port. In this way, as a side effect a voltage level on the appropriate pin will be 5V (as it is case with any TTL input). This may sound a bit confusing but everything becomes clear after studying a simplified electronic circuit connected to one I/O pin.

Input/Output (I/O) pin

This is a

simplified overview of what is connected

to a pin

inside the microcontroller. It concerns all

pins

except those included in P0 which do not

have

embedded pullup resistor.

Output pin

A logic zero (0) is applied to a bit in the P register. By turning output FE transistor on, the appropriate pin is directly connected to ground. Input pin

A

logic one (1) is applied to a bit in the P register. Output FE transistor is turned off.

The

appropriate pin remains connected to voltage power supply through a pull-up resistor of high resistance.A logic state (voltage) on any pin can be changed or read

at

any moment. A logic zero (0) and logic one

(1)

are not equal. A logic one (0) represents almost short circuit to ground. Such a pin is configured as output.

A logic one (1) is “loosely” connected to voltage power supply through resistors of high resistance. Since this voltage can be easily “pulled down” by an external signal, such a pin is configured as input.

Port 0

It is specific to this port to have a double purpose. If external memory is used then the lower address byte (addresses A0-A7) is applied on it. Otherwise, all bits on this port are configured as inputs or outputs. Another characteristic is expressed when it is configured as output. Namely, unlike other ports consisting of pins with embedded pull-up resistor ( connected by its end to 5 V power supply ), this resistor is left out here. This, apparently little change has its consequences:

If any pin on this port is configured as input then it performs as if it “floats”. Such input has unlimited input resistance and has no voltage coming from “inside”.

When the pin is configured as output, it performs as “open drain”, meaning that by writing 0 to some port’s bit, the appropriate pin will be connected to ground (0V). By writing 1, the external output will keep on “floating”. In order to apply 1 (5V) on this output, an external pull-up resistor must be embedded.

Only in case P0 is used for addressing external memory ( only in that case), the microcontroller will provide internal power supply source in order to establish logical ones on pins. There is no need to add external pullup resistors.

Port 1

This is a true I/O port, because there are no role assigning as it is the case with P0. Since it has embedded pull-up resistors it is completely compatible with TTL circuits. Port 2

Similar to P0, when using external memory, lines on this port occupy addresses intended for external memory chip. This time it is the higher address byte with addresses A8-A15. When there is no additional memory, this port can be used as universal input-output port similar by its features to the port 1.

Port 3

Even though all pins on this port can be used as universal I/O port, they also have an alternative function. Since each of these functions use inputs, then the appropriate pins have to be configured like that. In other words, prior to using some of reserve port functions, a logical one (1) must be written to the appropriate bit in the P3 register. From hardware’s perspective , this port is also similar to P0, with the difference that its outputs have a pull-up resistor embedded.

Current limitations on pins

When configured as outputs ( logic zero (0) ), single port pins can "receive" current of 10mA. If all 8 bits on a port are active, total current must be limited to 15mA (port P0: 26mA). If all ports (32 bits) are active, total maximal current must be limited to 71mA. When configured as inputs (logic 1), embedded pull-up resistor provides very weak current, but strong enough to activate up to 4 TTL inputs from LS series. It may be seen from description of some ports, that even though all pins have more or less similar internal structure, it is necessary to pay attention to which of them will be used for what and how. For example: If they are used as outputs with high voltage level (5V), then port 0 should be avoided because its pins do not have added resistor for connection to +5V. Only low logic level can be obtained therefore, if another port is used for the same purpose, one should have in mind that pull-up resistors have a relatively high resistance. Consequently it can be counted on only several hundreds microamperes of current coming out of a pin.

8052 Microcontroller Memory Organisation The microcontroller memory is divided into Program Memory and Data Memory. Program Memory (ROM) is used for permanent saving program being executed, while Data Memory (RAM) is used for temporarily storing and keeping intermediate results and variables. Depending on the model in use ( still referring to the whole 8052 microcontroller family) at most a few Kb of ROM and 128 or 256 bytes of RAM can be used. However… All 8052 microcontrollers have 16-bit addressing bus and can address 64 kb memory. It is neither a mistake nor a big ambition of engineers who were working on basic core development.

It is a matter of very clever memory organization which makes these controllers a real “ programmers’ tidbit“ . Program Memory

The oldest models of the 8052 microcontroller family did not have internal program memory . It was added from outside as a separate chip. These models are recognizable by their label beginning with 803 ( for ex. 8031 or 8032). All later models have a few Kbytes ROM embedded, Even though it is enough for writing most of the programs, there are situations when additional memory is necessary. A typical example of it is the use of so called lookup tables. They are used in cases when something is too complicated or when there is no time for solving equations describing some process. The example of it can be totally exotic (an estimate of self-guided rockets’ meeting point) or totally common( measuring of temperature using non-linear thermo element or asynchronous motor speed control). In those cases all needed estimates and approximates are executed in advance and the final results are put in the tables ( similar to logarithmic tables ).

How does the microcontroller handle external memory depends on the pin EA logic state:

EA=0 In this case, internal program memory is completely ignored, only a program stored in external memory is to be executed. EA=1 In this case, a program from builtin ROM is to be executed first ( to the last location). Afterwards, the execution is continued by reading additional memory. in both cases, P0 and P2 are not available to the user because they are used for data nd address transmission. Besides, the pins ALE and PSEN are used too.

Data Memory

As already mentioned, Data Memory is used for temporarily storing and keeping data and intermediate results created and used during microcontroller’s operating. Besides, this microcontroller family includes many other registers such as: hardware counters and timers, input/output ports, serial data buffers etc. The previous versions have the total memory size of 256 locations, while for later models this number is incremented by additional 128 available registers. In both cases, these first 256 memory locations (addresses 0-FFh) are the base of the memory. Common to all types of the 8052 microcontrollers. Locations available to the user occupy memory space with addresses from 0 to 7Fh. First 128 registers and this part of RAM is divided in several blocks. The first block consists of 4 banks each including 8 registers designated as R0 to R7. Prior to access them, a bank containing that register must be selected. Next memory block ( in the range of 20h to 2Fh) is bit- addressable, which means that each bit being there has its own address from 0 to 7Fh. Since there are 16 such registers, this block contains in total of 128 bits with separate addresses (The 0th bit of the 20h byte has the bit address 0 and the 7th bit of th 2Fh byte has the bit address 7Fh). The third group of registers occupy addresses 2Fh-7Fh ( in total of 80 locations) and does not have any special purpose or feature. Additional Memory Block of Data Memory

In order to satisfy the programmers’ permanent hunger for Data Memory, producers have embedded an additional memory block of 128 locations into the latest versions of the 8052 microcontrollers. Naturally, it’s not so simple…The problem is that electronics performing addressing has 1 byte (8 bits) on disposal and due to that it can reach only the first 256 locations. In order to keep already existing 8-bit architecture and compatibility with other existing models a little trick has been used. Using trick in this case means that additional memory block shares the same addresses with existing locations intended for the SFRs (80h- FFh). In order to differentiate between these two

physically separated memory spaces, different ways of addressing are used. A direct addressing is used for all locations in the SFRs, while the locations from additional RAM are accessible using indirect addressing.

How to

extend memory?

In case on-chip memory is not enough, it is possible to add two external memory chips with capacity of 64Kb each. I/O ports P2 and P3 are used for their addressing and data transmission.

From the users’ perspective, everything functions quite simple if properly connected because the most operations are performed by the microcontroller itself. The 8052 microcontroller has two separate reading signals RD#(P3.7) and PSEN#. The first one is activated byte from external data memory (RAM) should be read, while another one is activated to read byte from external program memory (ROM). These both signals are active at logical zero (0) level. A typical

example of such memory extension using special chips for RAM and ROM, is shown on the previous picture. It is called Hardward architecture. Even though the additional memory is rarely used with the latest versions of the microcontrollers, it will be described here in short what happens when memory chips are connected according to the previous scheme. It is important to know that the whole process is performed automatically, i.e. with no intervention in the program. 

When the program during execution encounters the instruction which resides in exter nal memory (ROM), the microcontroller will activate its control output ALE and set the first 8 bits of address (A0-A7) on P0. In this way, IC circuit 74HCT573 which "lets in" the first 8 bits to memory address pins is activated.



A signal on the pin ALE closes the IC circuit 74HCT573 and immediately afterwards 8 higher bits of address (A8-A15) appear on the port. In this way, a desired location in addtional program memory is completely addressed. The only thing left over is to read its content.



Pins on P0 are configured as inputs, the pin PSEN is activated and the microcon troller reads content from memory chip. The same connections are used both for data and lower address byte.

Similar occurs when it is a needed to read some location from external Data Memory. Now, addressing is performed in the same way, while reading or writing is performed via signals which appear on the control outputs RD or WR . Addressing

While operating, processor processes data according to the program instructions. Each instruction consists of two parts. One part describes what should be done and another part indicates what to use to do it. This later part can be data (binary number) or address where the data is stored. All 8052 microcontrollers use two ways of addressing depending on which part of memory should be accessed: Direct Addressing

On direct addressing, a value is obtained from a memory location while the address of that location is specified in instruction. Only after that, the instruction can process data (howdepends on the type of instruction: addition, subtraction, copy…). Obviously, a number being changed during operating a variable can reside at that specified address. For example: Since the address is only one byte in size ( the greatest number is 255), this is how only the first 255 locations in RAM can be accessed in this case the first half of the basic RAM is intended to be used freely, while another half is reserved for the SFRs. Indirect Addressing

On indirect addressing, a register which contains address of another register is specified in the instruction. A value used in operating process resides in that another register. For example: Only RAM locations available for use are accessed by indirect addressing (never in the SFRs). For all latest versions of the microcontrollers with additional memory block ( those 128 locations in Data Memory), this is the only way of accessing them. Simply, when during operating, the instruction including “@” sign is encountered and if the specified address is higher than 128 ( 7F hex.), the processor knows that indirect addressing is used and jumps over memory space reserved for the SFRs. On indirect addressing, the registers R0, R1 or Stack Pointer are used for specifying 8-bit addresses. Since only 8 bits are avilable, it is possible to access only registers of internal RAM in this way (128 locations in former or 256 locations in latest versions of the microcontrollers). If memory extension in form of additional memory chip is used then the 16-bit DPTR Register (consisting of the registers DPTRL and DPTRH) is used for specifying addresses. In this way it is possible to access any location in the range of 64K. SFRs (Special Function Registers) SFRs are a kind of control table used for running and monitoring microcontroller’s operating. Each of these registers, even each bit they include, has its name, address in the scope of RAM and clearly defined purpose ( for example: timer control, interrupt, serial connection etc.). Even

though there are 128 free memory locations intended for their storage, the basic core, shared by all types of 8052 controllers, has only 21 such registers. Rest of locations are intensionally left free in order to enable the producers to further improved models keeping at the same time compatibility with the previous versions. It also enables the use of programs written a long time ago for the microcontrollers which are out of production now.

A Register

(Accumulator)

This is a general-purpose register which serves for storing intermediate results during operating. A number (an operand) should be added to the accumulator prior to execute an instruction upon it. Once an arithmetical operation is preformed by the ALU, the result is placed into the accumulator. If a data should be transferred from one register to another, it must go through accumulator. For such universal purpose, this is the most commonly used register that none

microcontroller can be imagined without (more than a half 8052 microcontroller's instructions used use the accumulator in some way). B Register

B register is used during multiply and divide operations which can be performed only upon numbers stored in the A and B registers. All other instructions in the program can use this register as a spare accumulator (A).

During programming, each of registers is called by name so that their exact address is not so important for the user. During compiling into machine code (series of hexadecimal numbers recognized as instructions by the microcontroller), PC will automatically, instead of registers’ name, write necessary addresses into the microcontroller.

R Registers (R0-R7)

This is a common name for the total 8 generalpurpose registers (R0, R1, R2 ...R7). Even they are not true SFRs, they deserve to be discussed here because of their purpose. The bank is active when the R registers it includes are in use. Similar to the accumulator, they are used for temporary storing variables and intermediate results. Which of the banks will be active depends on two bits included in the PSW Register. These registers are stored in four banks in the scope of RAM.

DESCRIPTION

Theory of DC motor speed control The speed of a DC motor is directly proportional to the supply voltage, so if we reduce the supply voltage from 12 Volts to 6 Volts, the motor will run at half the speed. How can this be achieved when

the battery is fixed at 12 Volts? The speed controller works by varying the average voltage sent to the motor. It could do this by simply adjusting the voltage sent to the motor, but this is quite inefficient to do. A better way is to switch the motor's supply on and off very quickly. If the switching is fast enough, the motor doesn't notice it, it only notices the average effect. When you watch a film in the cinema, or the television, what you are actually seeing is a series of fixed pictures, which change rapidly enough that your eyes just see the average effect - movement. Your brain fills in the gaps to give an average effect. Now imagine a light bulb with a switch. When you close the switch, the bulb goes on and is at full brightness, say 100 Watts. When you open the switch it goes off (0 Watts). Now if you close the switch for a fraction of a second, then open it for the same amount of time, the filament won't have time to cool down and heat up, and you will just get an average glow of 50 Watts. This is how lamp dimmers work, and the same principle is used by speed controllers to drive a motor. When the switch is closed, the motor sees 12 Volts, and when it is open it sees 0 Volts. If the switch is open for the same amount of time as it is closed, the motor will see an average of 6 Volts, and will run more slowly accordingly. The graph below shows the speed of a motor that is being turned on and off fairly slowly:

Applying the above described technique to control the speed of the motor the resultant wave form will be as shown in the figure below which resembles the “PWM SIGNAL”. Hence we call it as PWM Technique for controlling the speed of a motor. PWM, or Pulse Width Modulation, is a method of controlling the amount of power to a load without having to dissipate any power in the load driver

This signal can be generated in many ways as we have many IC’s which can generate this signal. The different ways for generating this PWM signal are as follows.

1. Analogue method 2. Digital method 3. Discrete IC 4. Onboard microcontroller Though there are these many methods to generate these signals we concentrate mainly on ONBOARD MICROCONTROLLER method which is described in the next sections.

Light-emitting diode (LED) Light-emitting diodes are elements for light signalization in electronics. They are manufactured in different shapes, colors and sizes. For their low price, low consumption and simple use, they have almost completely pushed aside other light sources- bulbs at first place. They perform similar to common diodes with the difference that they emit light when current flows through them.

It is important to know that each diode will be immediately destroyed unless its current is limited. This means that a conductor must be connected in parallel to a diode. In order to correctly determine value of this conductor, it is necessary to know diode’s voltage drop in forward direction, which depends on what material a diode is made of and what colour it is. Values typical for the most frequently used diodes are shown in table below: As seen, there are three main types of LEDs. Standard ones get ful brightness at current of 20mA. Low Current diodes get ful brightness at ten times lower current while Super Bright diodes produce more intensive light than Standard ones.

Since the 8052 microcontrollers can provide only low input current and since their pins are configured as outputs when voltage level on them is equal to 0, direct connectining to LEDs is carried out as it is shown on figure (Low current LED, cathode is connected to output pin).

Switches and Pushbuttons There is nothing simpler than this! This is the simplest way of controlling appearance of some voltage on microcontroller’s input pin. There is also no need for additional explanation of how these components operate.

Nevertheless, it is not so simple in practice... This is about something commonly unnoticeable when using these components in everyday life. It is about contact bounce- a common problem with m e c h a n i c a l switches. If contact switching does not happen so quickly, several consecutive bounces can be noticed prior to maintain stable state. The reasons for this are: vibrations, slight rough spots and dirt. Anyway, whole this process does not last long (a few micro- or miliseconds), but long enough to be registered by the microcontroller. Concerning pulse counter, error occurs in almost 100% of cases!

The simplest solution is to connect simple RC circuit which will “suppress” each quick voltage change. Since the bouncing time is not defined, the values of elements are not strictly determined. In the most cases, the values shown on figure are sufficient. If complete safety is needed, radical measures should be taken! The circuit, shown on the figure (RS flip-flop), changes logic state on its output with the first pulse triggered by contact bounce. Even though this is more expensive solution (SPDT switch), the problem is definitely resolved! Besides, since the condensator is not used, very short pulses can be also registered in this way. In addition to these hardware solutions, a simple software solution is commonly applied too: when a program tests the state of some input pin and finds changes, the check should be done one more time after certain time delay. If the change is confirmed it means that switch (or pushbutton) has changed its position. The advantages of such solution are obvious: it is free of charge, effects of disturbances are eliminated too and it can be adjusted to the worst-quality contacts.

LIQUID CRYSTAL DISPLAY: LCD stands for Liquid Crystal Display. LCD is finding wide spread use replacing LEDs (seven segment LEDs or other multi segment LEDs) because of the following reasons: 1. The declining prices of LCDs. 2. The ability to display numbers, characters and graphics. This is in contrast to LEDs, which are limited to numbers and a few characters. 3. Incorporation of a refreshing controller into the LCD, thereby relieving the CPU of the task of refreshing the LCD. In contrast, the LED must be refreshed by the CPU to keep displaying the data. 4. Ease of programming for characters and graphics.

These components are “specialized” for being used with the microcontrollers, which means that they cannot be activated by standard IC circuits. They are used for writing different messages on a miniature LCD.

A model described here is for its low price and great possibilities most frequently used in practice. It is based on the HD44780 microcontroller (Hitachi) and can display messages in two lines with 16 characters each . It displays all the alphabets, Greek letters, punctuation marks, mathematical symbols etc. In addition, it is possible to display symbols that user makes up on its own. Automatic shifting message on display (shift left and right), appearance of the pointer, backlight etc. are considered as useful characteristics.

Pins Functions

There are pins along one side of the small printed board used for connection to the microcontroller. There are total of 14 pins marked with numbers (16 in case the background light is built in). Their function is described in the table below:

Function

Pin Number

Name

Logic State

Description

Ground

1

Vss

-

0V

Power supply

2

Vdd

-

+5V

Contrast

3

Vee

-

0 - Vdd

Control of operating

4

RS

5

R/W

6

E

0

D0 – D7 are interpreted as commands

1

D0 – D7 are interpreted as data

0

Write data (from controller to LCD)

1

Read data (from LCD to controller)

0

Access to LCD disabled

1

Normal operating

From 1 to 0 Data/commands are transferred to LCD 7

D0

0/1

Bit 0 LSB

8

D1

0/1

Bit 1

9

D2

0/1

Bit 2

10

D3

0/1

Bit 3

11

D4

0/1

Bit 4

12

D5

0/1

Bit 5

13

D6

0/1

Bit 6

14

D7

0/1

Bit 7 MSB

Data / commands

LCD screen:

LCD screen consists of two lines with 16 characters each. Each character consists of 5x7 dot matrix. Contrast on display depends on the power supply voltage and whether messages are displayed in one or two lines. For that reason, variable voltage 0-Vdd is applied on pin marked as Vee. Trimmer potentiometer is usually used for that purpose. Some versions of displays have

built in backlight (blue or green diodes). When used during operating, a resistor for current limitation should be used (like with any LE diode).

LCD Basic Commands All data transferred to LCD through outputs D0-D7 will be interpreted as commands or as data, which depends on logic state on pin RS: RS = 1 - Bits D0 - D7 are addresses of characters that should be displayed. Built in processor addresses built in “map of characters” and displays corresponding symbols. Displaying position is determined by DDRAM address. This address is either previously defined or the address of previously transferred character is automatically incremented. RS = 0 - Bits D0 - D7 are commands which determine display mode. List of commands which LCD recognizes are given in the table below:

Command

RS RW D7 D6 D5 D4 D3 D2 D1 D0 Execution Time

Clear display

0

0

0 0 0 0

0

0

0 1

1.64mS

Cursor home

0

0

0 0 0 0

0

0

1 x

1.64mS

Entry mode set

0

0

0 0 0 0

0

1 I/D S

40uS

Display on/off control

0

0

0 0 0 0

1

D

40uS

Cursor/Display Shift

0

0

0 0 0 1 D/C R/L x

x

40uS

Function set

0

0

0 0 1 DL N

x

40uS

Set CGRAM address

0

0

0 1

Set DDRAM address

0

0

1

DDRAM address

40uS

Read “BUSY” flag (BF)

0

1 BF

DDRAM address

-

Write to CGRAM or DDRAM

1

0 D7 D6 D5 D4 D3 D2 D1 D0

40uS

Read from CGRAM or DDRAM

1

1 D7 D6 D5 D4 D3 D2 D1 D0

40uS

I/D 1 = Increment (by 1) 0 = Decrement (by 1) S 1 = Display shift on 0 = Display shift off

F

U B

x

CGRAM address

40uS

R/L 1 = Shift right 0 = Shift left DL 1 = 8-bit interface 0 = 4-bit interface

D 1 = Display on

N 1 = Display in two lines

0 = Display off

0 = Display in one line

U 1 = Cursor on

F 1 = Character format 5x10 dots

0 = Cursor off

0 = Character format 5x7 dots

B 1 = Cursor blink on 0 = Cursor blink off

D/C 1 = Display shift 0 = Cursor shift

LCD Connection Depending on how many lines are used for connection to the microcontroller, there are 8-bit and 4-bit LCD modes. The appropriate mode is determined at the beginning of the process in a phase called “initialization”. In the first case, the data are transferred through outputs D0-D7 as it has been already explained. In case of 4-bit LED mode, for the sake of saving valuable I/O pins of the microcontroller, there are only 4 higher bits (D4-D7) used for communication, while other may be left unconnected. Consequently, each data is sent to LCD in two steps: four higher bits are sent first (that normally would be sent through lines D4-D7), four lower bits are sent afterwards. With the help of initialization, LCD will correctly connect and interpret each data received. Besides, with regards to the fact that data are rarely read from LCD (data mainly are transferred from microcontroller to LCD) one more I/O pin may be saved by simple connecting R/W pin to the Ground. Such saving has its price. Even though message displaying will be normally performed, it will not be possible to read from busy flag since it is not possible to read from display. LCD Initialization Once the power supply is turned on, LCD is automatically cleared. This process lasts for approximately 15mS. After that, display is ready to operate. The mode of operating is set by default. This means that: 1. Display is cleared 2. Mode DL = 1 Communication through 8-bit interface N = 0 Messages are displayed in one line

F = 0 Character font 5 x 8 dots 3. Display/Cursor on/off D = 0 Display off U = 0 Cursor off B = 0 Cursor blink off 4. Character entry ID = 1 Addresses on display are automatically incremented by 1 S = 0 Display shift off Automatic reset is mainly performed without any problems. Mainly but not always! If for any reason power supply voltage does not reach full value in the course of 10mS, display will start perform completely unpredictably. If voltage supply unit can not meet this condition or if it is needed to provide completely safe operating, the process of initialization by which a new reset enabling display to operate normally must be applied. Algorithm according to the initialization is being performed depends on whether connection to the microcontroller is through 4- or 8-bit interface. All left over to be done after that is to give basic commands and of course- to display messages.

Fig: Procedure on 8-bit initialization.

TRIAC

TRIAC schematic symbol TRIAC, from Triode for Alternating Current, is a genericized tradename for an electronic component that can conduct current in either direction when it is triggered (turned on), and is formally called a bidirectional triode thyristor or bilateral triode thyristor. TRIACs belong to the thyristor family and are closely related to Silicon-controlled rectifiers (SCR). However, unlike SCRs, which are unidirectional devices (i.e. can conduct current only in one direction), TRIACs are bidirectional and so current can flow through them in either direction. Another difference from SCRs is that TRIACs can be triggered by either a positive or a negative current applied to its gate electrode, whereas SCRs can be triggered only by currents going into the gate. In order to create a triggering current, a positive or negative voltage has to be applied to the gate with respect to the A1 terminal (otherwise known as MT1). Once triggered, the device continues to conduct until the current drops below a certain threshold, called the holding current.

The bidirectionality makes TRIACs very convenient switches for AC circuits, also allowing them to control very large power flows with milliampere-scale gate currents. In addition, applying a trigger pulse at a controlled phase angle in an AC cycle allows one to control the percentage of current that flows through the TRIAC to the load (phase control), which is commonly used, for example, in controlling the speed of low-power induction motors, in dimming lamps and in controlling AC heating resistors.

Physics of the device

Figure 1: Triggering modes.

To explain how TRIACs work, one has to individually analyze the triggering in each one of the four quadrants. The four quadrants are illustrated in Figure 1, according to the voltage on the gate and the A2 terminals with respect to the A1 terminal. The A1 and A2 terminals are sometimes referred to as MT1 and MT2, respectively.[1] The relative sensitivity depends on the physical structure of a particular triac, but as a rule, quadrant I is the most sensitive (least gate current required) and quadrant IV is the least sensitive (most gate current required).[clarification needed Why is Q-IV the least sensitive? See discussion]

In quadrants 1 and 2, A2 is positive, and current flows from A2 to A1 through P, N, P and N layers. The N

Figure 2: TRIAC semiconductor construction.

region attached to A2 does not participate significantly. In quadrants 3 and 4, A2 is negative, and current flows from A1 to A2, also through P, N, P and N layers. The N region attached to A2 is active, but the N region attached to A1 only participates in the initial triggering, not the bulk current flow. In most applications, the gate current comes from A2, so quadrants 1 and 3 are the only operating

modes.

Triggering in Quadrant I

Figure 3: Operation in Quadrant I

Quadrant I operation occurs when the gate and A2/MT2 Figure 4: Equivalent electric circuit are positive with respect to A1/MT1. Figure 1 for a triac in Q-I operation mode. The precise mechanism is illustrated in Figure 3. The gate current makes an equivalent NPN transistor switch on, which in turn draws current from the base of an equivalent PNP transitor, turning it on also. Part of the gate current (dotted line) is lost through the ohmic path across the p-silicon, flowing directly into MT1 without passing through the NPN transistor base. In this case, the injection of holes in the p-silicon makes the stacked n, p and n layers beneath MT1 behave like a NPN transistor, which turns on due to the presence of a current in its base. This, in turn, causes the p, n and p layers over MT2 to behave like a PNP transistor, which turns on because its n-type base becomes forward-biased with the emitter (MT2). Thus, the triggering scheme is the same as an SCR and the equivalent circuit is outlined in Figure 4. However, the structure is different from SCRs. In particular, in TRIACs there is always a small current flowing directly from the gate to MT1 through the p-silicon without passing through the p-n junction between the base and the emitter of the equivalent NPN transistor. This current is indicated in Figure 3 by a dotted red line and it is the reason why a TRIAC needs more gate current to turn on than a comparably rated SCR.[2] Generally, this quadrant is the most sensitive one of the four; this is because it is the only quadrant in which the gate current is injected directly into the base of one of the main device transistors.[clarification

needed

Why

is

Q-I

the

most

sensitive?

See

discussion]

Triggering in Quadrant II Quadrant II operation occurs when the gate is negative and A2/MT2 is positive with respect to A1/MT1. Figure 1 Figure 5 gives a graphical explanation of the triggering process. The turn-on of the device is three-fold and starts when the current from MT1 flows into the gate through the p-n junction under the gate. This switches on a structure composed by an NPN transistor and a PNP transistor, which has the gate as cathode (the turn-on of this structure is indicated by "1" in the figure). As current into the gate increases, the potential of the left side of the p-silicon under the gate rises towards MT1, since the difference in potential between the gate and MT2 tends to lower: this establishes a current between the left side and Figure 5: Operation in Quadrant II. the right side of the p-silicon (indicated by "2" in the figure), which in turn switches on the NPN transistor under the MT1 terminal and as a consequence also the pnp transistor between MT2 and the right side of the upper p-silicon. So, in the end, the structure which is crossed by the major portion of the

current

is

the

same

as

Quadrant

I

operation

("3"

in

Figure

5).[2]

Triggering in Quadrant III Quadrant III operation occurs when the gate and A2/MT2 is negative with respect to MT1. Figure 1 The whole process is outlined in Figure 6. The process happens in different steps here too. In the first phase, the pn junction between the MT1 terminal and the gate becomes forward-biased (step 1). As forward-biasing implies the injection of minority carriers in the two layers joining the junction, electrons are injected in the p-layer under the gate. Some of these electrons do not recombine and escape to the underlying n-region (step 2). This in turn lowers the potential of the n-region, acting as the base of a pnp transistor which switches on (turning the transistor on without directly lowering the base potential Figure 6: Operation in Quadrant III. is called remote gate control). The lower p-layer works as the collector of this PNP transistor and has its voltage heightened: actually, this p-layer also acts as the base of an NPN transistor made up by the last three layers just over the MT2 terminal, which, in turn, gets activated. Therefore, the red arrow labeled with a "3" in Figure 6 shows the final conduction path of the current.[2]

Triggering in Quadrant IV Quadrant IV operation occurs when the gate is positive and A2/MT2 is negative with respect to MT1. Figure 1 Triggering in this quadrant is similar to triggering in Quadrant III. The process uses a remote gate control and is illustrated in Figure 7. As current flows from the player under the gate into the n-layer under MT1, minority carriers in the form of free electrons are injected into the p-region and some of them are collected by the underlying np-junction and pass into the adjoining nregion without recombining. As in the case of a triggering in Quadrant III, this lowers the potential of the n-layer and turns on the PNP transistor formed by the n-layer and the two p-layers next to it. The lower p-layer works as the Figure 7: Operation in Quadrant IV. collector of this PNP transistor and has its voltage heightened: actually, this p-layer also acts as the base of an NPN transistor made up by the last three layers just over the MT2 terminal, which, in turn, gets activated. Therefore, the red arrow labeled with a "3" in Figure 6 shows the final conduction path of the current.[2] Generally, this quadrant is the least sensitive of the four[clarification needed Why is Q-IV the least sensitive? See discussion]

In addition, some models of TRIACs cannot be triggered in this quadrant but only in the

other three. Typical issues There are some drawbacks one should know when using a TRIAC in a circuit. In this section, a few are summarized.

Gate threshold current, latching current and holding current A TRIAC starts conducting when a current flowing into or out of its gate is sufficient to turn on the relevant junctions in the quadrant of operation. The minimum current able to do this is called gate threshold current and is generally indicated by IGT. In a typical TRIAC, the gate threshold current is generally few milliampères, but one has to take into account also that: 

IGT depends on the temperature: indeed, the higher the temperature, the higher the reverse currents in the blocked junctions. This implies the presence of more free carriers in the gate region, which lowers the gate current needed.



IGT depends on the quadrant of operation, since a different quadrant implies a different way of triggering, as explained in the section "Physics of the device". As a rule, the first quadrant is the most sensitive (i.e. requires the least current to turn on), whereas the fourth quadrant is the least sensitive.



When turning on from an off-state, IGT depends on the voltage applied on the two main terminals MT1 and MT2. Higher voltage between MT1 and MT2 cause greater reverse currents in the blocked junctions requiring less gate current similar to high temperature operation. Generally, in datasheets, IGT is given for a specified voltage between MT1 and MT2.

When the gate current is discontinued, if the current flowing between the two main terminals is more than the so-called latching current, the device keeps conducting, otherwise the device might turn off. Latching current is the minimum that can make up for the missing gate current in order to keep the device internal structure latched. The value of this parameter varies with: 

gate current pulse (amplitude, shape and width)



temperature



control circuit (resistors or capacitors between the gate and MT1 increase the latching current because they steal some current from the gate before it can help the complete turn-on of the device)



quadrant of operation

In particular, if the pulse width of the gate current is sufficiently large (generally some tens of microseconds), the TRIAC has completed the triggering process when the gate signal is discontinued and the latching current reaches a minimum level called holding current. Holding current is the minimum required current flowing between the two main terminals that keeps the device on after it has achieved commutation in every part of its internal structure. In datasheets, the latching current is indicated as IL, while the holding current is indicated as IH. They are typically in the order of some milliampères. Static dv/dt A high dv/dt between A2/MT2 and A1/MT1 may turn on the TRIAC when it is off. Typical values of critical static dv/dt are in the tens of volts per microsecond. The turn-on is due to a parasitic capacitive coupling of the gate terminal with the A2/MT2 terminal, which lets currents flow into the gate in response to a large rate of voltage change at A2/MT2. One way to cope with this limitation is to design a suitable RC or RCL snubber network. in many cases this is sufficient to lower the impedance of the gate towards A1/MT1. By putting a resistor or a small capacitor (or both in parallel) between these two terminals, the capacitive current generated during the transient, flows out of the device without activating it. A careful reading of the application notes provided by the manufacturer and testing of the particular device model to design the correct network is in order. Typical values for capacitors and resistors between the gate and A1/MT1 may be up to 100nF and up to 1kΩ.[3]

In datasheets, the static dv/dt is usually indicated as

and, as mentioned before, is in

relation to the tendency of a TRIAC to turn on from the off state after a large voltage rate of rise even without applying any current in the gate. Critical di/dt A high rate of rise of the current flowing between A1/MT1 and A2/MT2 (in either direction) when the device is turning on can damage or destroy the TRIAC even if the pulse duration is

very short. The reason is that during the commutation, the power dissipation is not uniformly distributed across the device. When switching on, the device starts to conduct current before the conduction finishes to spread across the entire junction. The device typically starts to conduct the current imposed by the external circuitry after some nanoseconds or microseconds but the complete switch on of the whole junction takes a much longer time, so too swift a current rise may cause local hot spots that can permanently damage the TRIAC.

In datasheets, this parameter is usually indicated as

and is typically in the order of the tens of

ampère per microsecond.[1] Commutating dv/dt and di/dt The commutating dv/dt rating applies when a TRIAC has been conducting and attempts to turn off with a partially reactive load, such as an inductor. The current and voltage are out of phase, so when the current decreases below the holding value, the triac attempts to turn off, but because of the phase shift between current and voltage, a sudden voltage step takes place between the two main terminals, which turns the device on again.

In datasheets, this parameter is usually indicated as

and is generally in the order of up

to some volts per microsecond. The reason why commutating dv/dt is less than static dv/dt is that, shortly before the device tries to turn off, there is still some excess minority charge in its internal layers as a result of the previous conduction. When the TRIAC starts to turn off, these charges alter the internal potential of the region near the gate and A1/MT1, so it is easier for the capacitive current due to dv/dt to turn on the device again. Another important factor during a commutation from on-state to off-state is the di/dt of the current from A1/MT1 to A2/MT2. This is similar to the recovery in standard diodes: the higher the di/dt, the greater the reverse current. Because in the TRIAC there are parasitic resistances, a

high reverse current in the p-n junctions inside it can provoke a voltage drop between the gate region and the A1/MT1 region which may make the TRIAC stay turned on.

In a datasheet, the commutating di/dt is usually indicated as

and is generally in the

order of some ampères per microsecond. The commutating dv/dt is very important when the TRIAC is used to drive a load with a phase shift between current and voltage, such as an inductive load. Suppose one wants to turn the inductor off: when the current goes to zero, if the gate is not fed, the TRIAC attempts to turn off, but this causes a step in the voltage across it due to the afore-mentioned phase shift. If the commutating dv/dt rating is exceeded, the device will not turn off. Application Low power TRIACs are used in many applications such as light dimmers, speed controls for electric fans and other electric motors, and in the modern computerized control circuits of many household small and major appliances. However, when used with inductive loads such as electric fans, care must be taken to assure that the TRIAC will turn off correctly at the end of each half-cycle of the AC power. Indeed, TRIACs can be very sensitive to high values of dv/dt between A1/MT1 and A2/MT2, so a phase shift between current and voltage (as in the case of an inductive load) leads to sudden voltage step that can make the device turn on in an unwanted manner.[2] Unwanted turn-ons can be avoided by using a snubber circuit (usually of the RC or RCL type) between A1/MT1 and A2/MT2. Snubber circuits are also used to prevent premature triggering, caused for example by voltage spikes in the mains supply. Because turn-ons are caused by internal capacitive currents flowing into the gate as a consequence of a high voltage dv/dt, a gate resistor or capacitor (or both in parallel) may be connected between the gate and A1/MT1 to provide a low-impedance path to A1/MT1 and further prevent false triggering. This, however, increases the required trigger current or adds

latency due to capacitor charging. On the other hand, a resistor between the gate and A1/MT1 helps draw leakage currents out of the device, thus improving the performance of the TRIAC at high temperature, where the maximum allowed dv/dt is lower. Values of resistors less than 1kΩ and capacitors of 100nF are generally suitable for this purpose, although the fine-tuning should be done on the particular device model.[3] For higher-powered, more-demanding loads, two SCRs in inverse parallel may be used instead of one TRIAC. Because each SCR will have an entire half-cycle of reverse polarity voltage applied to it, turn-off of the SCRs is assured, no matter what the character of the load. However, due to the separate gates, proper triggering of the SCRs is more complex than triggering a TRIAC. In addition to commutation, a TRIAC may also not turn on reliably with non-resistive loads if the phase shift of the current prevents achieving holding current at trigger time. To overcome that, pulse trains may be used to repeatedly try to trigger the TRIAC until it finally turns on. The advantage is that the gate current does not need to be maintained throughout the entire conduction angle, which can be beneficial when there is only limited drive capability available. Example data Variable name Parameter

Typical value Unit

Gate threshold Voltage

1.5 [4][5]

V

Gate threshold Current

10 - 50 [5]

mA

Repetitive peak off-state Voltages

600 - 800 [4]

V

RMS on-state current Non-repetitive peak 4 - 40 [5]

on-state forward voltage

1.5 [5]

A V

Alternistor Alternistor is a trade name for a proprietary class of TRIAC with an improved turn-off (commutation) characteristic. The term "Alternistor" was used for the first time by Thomson Semiconductors (now named ST Microelectronics). These devices are made specifically for improved commutation when controlling a highlyinductive load, such as a motor, an application which causes problems for "normal" Triacs due to high voltage/current angles. Most Triacs' commutation with inductive loads can be improved by use of a snubber network, but Alternistors are made specifically for this purpose and they dispense with the snubber requirement altogether. This improvement is achieved at the expense of the ability to trigger the device in the 4th quadrant (negative voltage and positive gate current). However, this is usually no problem, because this trigger mode is seldom used since even normal TRIACs are least sensitive there. ST Microelectronics has another version of improved commutation Triac, not marketed under the proprietary "Alternistor" moniker, using the trademark "SNUBBERLESS".

INDUCTION MOTOR

An induction motor or asynchronous motor is an AC electric motor in which the electric current in the rotor needed to produce torque is obtained by electromagnetic induction from the magnetic field of the stator winding. An induction motor can therefore be made without electrical connections to the rotor. An induction motor's rotor can be either wound type or squirrel-cage type. Three-phase squirrel-cage induction motors are widely used as industrial drives because they are self-starting, reliable and economical. Single-phase induction motors are used extensively for smaller loads, such as household appliances like fans. Although traditionally used in fixed-speed service, induction motors are increasingly being used with variable-frequency drives (VFDs) in variable-speed service. VFDs offer especially important energy savings opportunities for existing and prospective induction motors in variable-torque centrifugal fan, pump and compressor load applications. Squirrel cage induction motors are very widely used in both fixed-speed and variable-frequency drive (VFD) applications.

In both induction and synchronous motors, the AC power supplied to the motor's stator creates a magnetic field that rotates in synchronism with the AC oscillations. Whereas a synchronous

motor's rotor turns at the same rate as the stator field, an induction motor's rotor rotates at a somewhat slower speed than the stator field. The induction motor stator's magnetic field is therefore changing or rotating relative to the rotor. This induces an opposing current in the induction motor's rotor, in effect the motor's secondary winding, when the latter is short-circuited or closed through an external impedance.[28] The rotating magnetic flux induces currents in the windings of the rotor;[29] in a manner similar to currents induced in a transformer's secondary winding(s). The induced currents in the rotor windings in turn create magnetic fields in the rotor that react against the stator field. Due to Lenz's Law, the direction of the magnetic field created will be such as to oppose the change in current through the rotor windings. The cause of induced current in the rotor windings is the rotating stator magnetic field, so to oppose the change in rotorwinding currents the rotor will start to rotate in the direction of the rotating stator magnetic field. The rotor accelerates until the magnitude of induced rotor current and torque balances the applied mechanical load on the rotation of the rotor. Since rotation at synchronous speed would result in no induced rotor current, an induction motor always operates slightly slower than synchronous speed. The difference, or "slip," between actual and synchronous speed varies from about 0.5% to 5.0% for standard Design B torque curve induction motors.[30] The induction motor's essential character is that it is created solely by induction instead of being separately excited as in synchronous or DC machines or being self-magnetized as in permanent magnet motors.[28] For rotor currents to be induced, the speed of the physical rotor must be lower than that of the stator's rotating magnetic field ( ); otherwise the magnetic field would not be moving relative to the rotor conductors and no currents would be induced. As the speed of the rotor drops below synchronous speed, the rotation rate of the magnetic field in the rotor increases, inducing more current in the windings and creating more torque. The ratio between the rotation rate of the magnetic field induced in the rotor and the rotation rate of the stator's rotating field is called "slip". Under load, the speed drops and the slip increases enough to create sufficient torque to turn the load. For this reason, induction motors are sometimes referred to as "asynchronous motors".[31] An induction motor can be used as an induction generator, or it can be unrolled to form a linear induction motor which can directly generate linear motion. The generating mode for induction motors is complicated by the need to excite the rotor, which begins with only residual magnetization. In some cases, that residual magnetization is enough to self-excite the motor under load. Therefore, it is necessary to either snap the motor and connect it momentarily to a live grid or to add capacitors charged initially by residual magnetism and providing the required reactive power during operation. Similar is the operation of the induction motor in parallel with a synchronous motor serving as a power factor compensator. A feature in the generator mode in parallel to the grid is that the rotor speed is higher than in the driving mode. Then active energy is being given to the grid.[2] Another disadvantage of induction motor generator is that it consumes a significant magnetizing current I0 = (20-35)%.

KEIL SOFTWARE:

Keil compiler is a software used where the machine language code is written and compiled. After compilation, the machine source code is converted into hex code which is to be dumped into the microcontroller for further processing. Keil compiler also supports C language code. STEPS TO WRITE AN ASSEMBLY LANGUAGE PROGRAM IN KEIL AND HOW TO COMPILE IT:

1. Install the Keil Software in the PC in any of the drives. 2. After installation, an icon will be created with the name “Keil uVision3”. Just drag this icon onto the desktop so that it becomes easy whenever you try to write programs in keil. 3. Double click on this icon to start the keil compiler. 4. A page opens with different options in it showing the project workspace at the leftmost corner side, output window in the bottom and an ash coloured space for the program to be written. 5. Now to start using the keil, click on the option “project”. 6. A small window opens showing the options like new project, import project, open project etc. Click on “New project”. 7. A small window with the title bar “Create new project” opens. The window asks the user to give the project name with which it should be created and the destination location. The project can be created in any of the drives available. You can create a new folder and then a new file or can create directly a new file. 8. After the file is saved in the given destination location, a window opens where a list of vendors will be displayed and you have to select the device for the target you have created. 9. The most widely used vendor is Atmel. So click on Atmel and now the family of microcontrollers manufactured by Atmel opens. You can select any one of the microcontrollers according to the requirement.

10. When you click on any one of the microcontrollers, the features of that particular microcontroller will be displayed on the right side of the page. The most appropriate microcontroller with which most of the projects can be implemented is the AT89C51. Click on

this microcontroller and have a look at its features. Now click on “OK” to select this microcontroller. 11. A small window opens asking whether to copy the startup code into the file you have created just now. Just click on “No” to proceed further. 12. Now you can see the TARGET and SOURCE GROUP created in the project workspace. 13. Now click on “File” and in that “New”. A new page opens and you can start writing program in it. 14. After the program is completed, save it with any name but with the .asm extension. Save the program in the file you have created earlier. 15. You can notice that after you save the program, the predefined keywords will be highlighted in bold letters. 16. Now add this file to the target by giving a right click on the source group. A list of options open and in that select “Add files to the source group”. Check for this file where you have saved and add it. 17. Right click on the target and select the first option “Options for target”. A window opens with different options like device, target, output etc. First click on “target”. 18. Since the set frequency of the microcontroller is 11.0592 MHz to interface with the PC, just enter this frequency value in the Xtal (MHz) text area and put a tick on the Use on-chip ROM. This is because the program what we write here in the keil will later be dumped into the microcontroller and will be stored in the inbuilt ROM in the microcontroller. 19. Now click the option “Output” and give any name to the hex file to be created in the “Name of executable” text area and put a tick to the “Create HEX file” option present in the same window. The hex file can be created in any of the drives. You can change the folder by clicking on “Select folder for Objects”. 20. Now to check whether the program you have written is errorless or not, click on the icon exactly below the “Open file” icon which is nothing but Build Target icon. You can even use the shortcut key F7 to compile the program written. 21. To check for the output, there are several windows like serial window, memory window, project window etc. Depending on the program you have written, select the appropriate window to see the output by entering into debug mode. 22. The icon with the letter “d” indicates the debug mode. 23. Click on this icon and now click on the option “View” and select the appropriate window to check for the output.

24. After this is done, click the icon “debug” again to come out of the debug mode. 25. The hex file created as shown earlier will be dumped into the microcontroller with the help of software called Proload.

PROLOAD: Proload is a software which accepts only hex files. Once the machine code is converted into hex code, that hex code has to be dumped into the microcontroller placed in the programmer kit and this is done by the Proload. Programmer kit contains a microcontroller on it other than the one which is to be programmed. This microcontroller has a program in it written in such a way that it accepts the hex file from the keil compiler and dumps this hex file into the microcontroller which is to be programmed. As this programmer kit requires power supply to be operated, this power supply is given from the power supply circuit designed above. It should be noted that this programmer kit contains a power supply section in the board itself but in order to switch on that power supply, a source is required. Thus this is accomplished from the power supply board with an output of 12volts or from an adapter connected to 230 V AC. 1. Install the Proload Software in the PC. 2. Now connect the Programmer kit to the PC (CPU) through serial cable. 3. Power up the programmer kit from the ac supply through adapter. 4. Now place the microcontroller in the GIF socket provided in the programmer kit. 5. Click on the Proload icon in the PC. A window appears providing the information like Hardware model, com port, device type, Flash size etc. Click on browse option to select the hex file to be dumped into the microcontroller and then click on “Auto program” to program the microcontroller with that particular hex file. 6. The status of the microcontroller can be seen in the small status window in the bottom of the page. 7. After this process is completed, remove the microcontroller from the programmer kit and place it in your system board. Now the system board behaves according to the program written in the microcontroller.

Related Documents

Speed Control
November 2019 34
Pwm Motor Speed Control
November 2019 39
Speed Control System
May 2020 24

More Documents from "Art Doe"