Monday, May 18, 2009

Project 1 : Speed Control of Induction Motor Using PIC Microcontroller

The hardware involved in this project is described in the following sections.




1. PIC Microcontroller
For controlling purpose, the PIC Microcontroller 16F877A has been chosen for this experiment because it is cheap, easily available, easy to load program and has less instruction for programming process. The PIC microcontroller 16F877A purchased comes with a Starter Kit set as shown in the figure below. Its specifications are as follow:

· 40-pins
· 35 single-word instructions to be learned
· Operating speed: DC – 20 MHz clock input and DC – 200ns instruction cycle
· Analog Features: 10 bit, 8 channel analog-to-digital converter
· 2 pin outs for PWM






2. Induction Motor

The induction motor used for the experiment is a three-phase induction motor from ABB UK with a frame size of 80B as shown in the figure below. The motor has the following specifications:
· Power: 0.75kW (1Hp)
· Rated Speed: 1410 rpm
· Rated Voltage: 230V
· Rated Torque: 5.08 Nm
· Maximum Torque: 19.812 Nm
· Rated Current: 3.306 A
· Pole: 4
· Moment of Inertia: 0.00156 kgm2Weight: 10.5 kg





3. Three-Phase Inverter

The function of the three-phase inverter is to vary the input voltage into the induction motor based on external signal (0-10V) from the PIC. The three-phase inverter used in this project is TOSHIBA Tosvert VF-S7 series industrial inverter as shown in the figure below.





4. Speed Sensor

In order to construct a close-loop system, speed sensor was used to sense the speed of the induction motor. Signal from the sensor is needed by the PIC as the input signal. The speed sensor for this project is an inductive proximity sensor that is connected to a Guntberg AT100 control unit as shown in the figure below. The Guntberg AT100 will decode the signal from the sensor and then display the speed of the induction motor in rpm.






5. Magnetic Brake

The induction motor is subjected to a loading from a 24V DC magnetic brake as shown in the figure below. The purpose of the magnetic brake is to reduce speed of the induction motor for close-loop system implementation. The magnetic brake has a maximum range of 10 Nm and is connected to a Guntberg AT200 control unit. The AT200 will control the magnitude of loading into the induction motor through the magnetic brake. Figure below shows the Guntberg AT200.








6. Potentiometer

The purpose of potentiometer is to vary the voltage by varying resistance value. For this project, a B5K potentiometer has been selected and it has maximum range of 4.14 kΩ. Figure below shows the potentiometer used for this project.




7. Operational Amplifier 741 (op-amp 741)

The function of the op-amp is to amplify signal (voltage) without changing the natural frequency of the signal. For the project, op-amp is used to amplify the voltage from PIC to the three-phase inverter. Using non-inverting amplifier, the voltage from PIC was amplified from 0-5V to 0-10V. The op-amp that used for this project is shown in the figure below.




Sunday, May 17, 2009

PIC Microcontroller

1. Introduction

In the 1980s an American IC manufacturer called Arizona Microchip Inc. produced simple microcontrollers which they called Peripheral Interface Controllers, or PICs. They had a small following, but their big break came in the early 1990s when they released the 16C5X series. Compared with other microcontrollers at the time, these new devices were astonishingly fast, efficient and easy for engineers to understand and program. Moreover, they were also inexpensive, readily available and obtainable in a wide range of different varieties. PICs are now among the most widely used microcontrollers in the world, with hundreds of millions being sold. Despite their popularity, they have never suffered the severe shortages which have plagued other manufacturers in recent times. In addition, PIC actually stands for several names as shown below:
· Peripheral Interface Controller
· Parallel Interface Controller
· Peripheral Interface Computer
· Parallel Interface Computer



2. PIC Microcontroller Basic Elements

As one type of microcontroller, PIC Microcontroller has built-in internal element as being discussed earlier. In addition, some PIC come with Pulse Width Modulation (PWM) module to generate modulate signal. The next chapter will discuss in detail about PWM. In this chapter, PIC Architecture, Instruction Set, clock/instruction cycle and PIC program memory will be explained.



3. PIC Architecture

The architecture of a microcontroller defines the way the internal components are connected. It sets the standard for all devices that connect to it and all the software that runs on it. It specifies how much memory is needed and how it is managed. It specifies register size, bus width and how data is processed. Most microcontrollers use one of two basic architectures, von Neumann or Harvard. Their major characteristics are described below.

· Von Neumann Architecture
Devices using von Neumann architecture have a single area of memory which is used to store instructions as well as data.

· Harvard ArchitectureHarvard architecture devices are divided into two distinct sections. One is used to store instructions (program memory) and the other is used to store data (data memory).


4. Instruction Set

Similar to spoken language which is divided into a number of recognizable words, the language used by the microcontroller is divided into a number of instructions. The list of instructions which the microcontroller understands is called the instruction set. The instruction set stipulates what functions the microcontroller can perform and how instructions need to be written to activate them. The architectures of microcontrollers may be further classified into the type of instruction sets they use.

· CISC (Complex Instruction Set Computer)
Microcontrollers using CISC systems have a large quantity of very detailed commands.

· RISC (Reduced Instruction Set Computer)
A reduced instruction set is made up of a number of key instructions.

To illustrate the difference between the two systems, the example of a 'divide' command can be used. A CISC system would have a dedicated 'divide' command. A RISC system may not contain the command 'divide', but will contain all the lower level instructions needed to perform a divide operation. The comparisons for the commands used to perform a divide operation between CISC and RISC are shown in the table below.

RISC computer architecture has reduced chip complexity by using simpler instructions which are also of more constant size. The RISC chip is faster than its CISC counterpart, and is designed and built more economically.



5. Clock / instruction cycle
Clock is microcontroller's main starter, and is obtained from an external component called an "oscillator". Clock from the oscillator enters a microcontroller via OSC1 pin where internal circuit of a microcontroller divides the clock into four even clocks Q1, Q2, Q3, and Q4 which do not overlap. These four clocks make up one instruction cycle (also called machine cycle) during which one instruction is executed.

Execution of instruction starts by calling an instruction that is next in string. Instruction is called from program memory on every Q1 and is written in instruction register on Q4. Decoding and execution of instruction are done between the next Q1 and Q4 cycles. The following diagram shows the relationship between instruction cycle and clock of the oscillator (OSC1) as well as that of internal clocks Q1-Q4. Program counter (PC) holds information about the address of the next instruction.




6. Program Memory

The hex file created by the assembler is programmed into the program memory of the PIC. The program memory will be one of several different types. These type RAM, ROM, EPROM, OTP EPROM, EEPROM and FLASH MEMORY.



7. Pulse Width Modulation (PWM)

The function for Pulse Width Modulation (PWM) is to control switching condition by producing sequence of quadrangle pulse as shown in the figure below.



PWM have three basic elements as shown in the figure below.

· Oscillator = to generate triangle wave.

· Gated Latch = to execute modulation to produce sequence of quadrangle pulse. Beside that, its has function as voltage comparator – comparing oscillator output voltage, Vosc with capacitor output voltage , Verror to produced sequence of quadrangle pulse, V1.

Capacitor = to stop any voltage changes for smoothing output voltage, Vo.


Saturday, May 16, 2009

Microcontroller

1. Introduction Of Microcontroller

The use of microcontroller in industrial and control design has become very common over past the decade. Due to that reason, many appliances become smaller from previous design and easy to use. The sophistication of current technology has made microcontroller possible to store hundreds of thousands of transistors inside it. That was a prerequisite for production of microprocessors, and the first computers were made by adding external peripherals such as memory, input-output lines, timers and other. Further increasing of the volume of the package resulted in creation of integrated circuits. These integrated circuits contained both processor and peripherals. That is how the first chip containing a microcomputer, or what would later be known as a microcontroller came about.
A microcontroller is a computer control system on a single chip. It has many electronic circuits built into it, which can decode written instructions and convert them to electrical signals. The microcontroller will then step through these instructions and execute them one by one. As an example a microcontroller could be instructed to measure the temperature of a room and turn on a heater if it goes cold. Microcontrollers are now changing electronics design. Instead of hard wiring a number of logic gates together to perform some function and now use instructions to wire the gates electronically. The list of these instructions given to the microcontroller is called a program. Each microcontroller has a number of I/O pins. These pins can be configured to be either used for inputs or outputs. They are specially designed for external devices to be quickly and easily connected with the minimum of hardware. For instance, an LED may be connected directly to an output. Microcontrollers are designed to be part of applications that do not need human intervention, they are therefore reliable. Nowadays there are many microcontroller manufacturers in the market like AMCC (Applied Micro Circuit Corporation), Atmel, Cypress MicroSystems, Freescale Semiconductor, Fujitsu, Holtek, Intel, Microchip, National Semiconductor, NEC, Philips semiconductors, Renesas Tech. Corp, STM Microelectronics, Texas Instruments, Toshiba, Western Design Center, Ubicom, Xilinx, Zilog and Motorola.


2. Microcontroller Basic Elements

Microcontroller in design does not need to use more external component to do particular task. This is because microcontroller has several built-in basic elements that can replace the external component task.


2.1 Memory unit

Memory is part of the microcontroller that functions to store data. It is shown in the figure below. The easiest way to explain it is to describe it as one big closet with lots of drawers. The drawer has been marked to avoid confused and will be easily accessible. It is enough to know the designation of the drawer and its contents will be known.
For a certain input, the contents of a certain addressed memory location can be getting. Two new concepts are brought: addressing and memory location. Memory consists of all memory locations, and selecting one of the memory. Reading from a memory location, memory must also provide for writing onto it. This is done by supplying an additional line called control line. This line will designate as R/W (read/write). Control line is used in the following way: if r/w=1, reading is done, and if opposite is true then writing is done on the memory location. Memory is the first element, and need a few operations for the microcontroller.


2.2 Central Processing Unit

Three more memory locations are added to a specific block that will have a built in capability to multiply, divide, subtract, and move its contents from one memory location onto another as shown in the figure below. The parts that are added in are called "central processing unit" (CPU). Its memory locations are called registers.

Registers are therefore memory locations where the role is to help with performing various mathematical operations or any other operations with data wherever data can be found at the current situation. Two independent entities (memory and CPU) which are interconnected, and thus any exchange of data is hindered, as well as its functionality. If, for example, the contents of two memory locations are added and the results are return back again to memory, and need a connection between memory and CPU. Simply stated, that must have some "way" through data goes from one block to another.


2.3 Bus

That "way" is called "bus". Physically, it represents a group of 8, 16, or more wires there are two types of buses: address and data bus. The first one consists of as many lines as the amount of memory to address and the other one is as wide as data, and in this case are 8 bits or the connection line. First one serves to transmit address from CPU memory, and the second to connect all blocks inside the microcontroller as shown in the figure below.




As far as functionality, the situation has improved, but a new problem has also appeared: there are units that's capable of working by itself, but which does not have any contact with the outside world. In order to remove this deficiency, a block are added which contains several memory locations whose one end is connected to the data bus, and the other has connection with the output lines on the microcontroller which can be seen as pins on the electronic component.


2.4 Input-output unit

Those locations added are called "ports". There are several types of ports: input, output or bidirectional ports. When working with ports, first of all it is necessary to choose which port that need to work with, and then to send data to, or take it from the port.



When working with it, the port acts like a memory location. Something is simply being written into or read from it, and it could be noticed on the pins of the microcontroller. The figure above shows the input/output unit of microcontroller.


2.5 Serial communication

Beside the above matter, the possibilities of communication with an outside world were added to the already existing unit. However, this way of communicating has its drawbacks. One of the basic drawbacks is the number of lines which need to be used in order to transfer data. What if it is being transferred to a distance of several kilometers? The number of lines times number of kilometers doesn't promise the economy of the project. The number of lines must be reduced in such a way that its functionality would not. Suppose if three lines were involved, and that one line is used for sending data, other for receiving, and the third one is used as a reference line for both the input and the output side. In order for this to work, the rules of exchange of data need to be set. These rules are called protocol. Protocol is therefore defined in advance so there wouldn't be any misunderstanding between the sides that are communicating with each other. The following protocol is considered. The logical unit "1" is set up on the transmitting line until transfer begins. Once the transfer starts, lower the transmission line to logical "0" for a period of time (which will designate as T), so the receiving side will know that it is receiving data, and so it will activate its mechanism for reception. Now go back to the transmission side and start putting logic zeros and ones onto the transmitter line in the order from a bit of the lowest value to a bit of the highest value. Let each bit stay on line for a time period which is equal to T, and in the end, or after the 8th bit, let us bring the logical unit "1" back on the line which will mark the end of the transmission of one data. The protocol above is called in professional literature NRZ (Non-Return to Zero).



It is possible to receive and send data at the same time separate lines for receiving and sending were used. So called full-duplex mode block which enables this way of communication is called a serial communication block. Unlike the parallel transmission, data moves here bit by bit, or in a series of bits what defines the term serial communication comes from. After the reception of data it must be read from the receiving location and stored in memory as opposed to sending where the process is reversed. Data goes from memory through the bus to the sending location, and then to the receiving unit according to the protocol. The figure above shows the serial unit of microcontroller.


2.6 Timer unit

After the serial communication was explained, the data can be received, sent and processed.



However, in order to utilize it in industry a few additionally blocks were needed. One of those is the timer block which is significant because it can give information about time, duration, protocol etc. The basic unit of the timer is a free-run counter as shown in the figure above which is in fact a register whose numeric value increments by one in even intervals, so that by taking its value during periods T1(start time) and T2 (end time) and on the basis of their difference the time elapsed can be determined. This is a very important part of the microcontroller which requires constant understanding.


2.7 Watchdog

One more thing that needs attention is a flawless functioning of the microcontroller during its run-time. Suppose that as a result of some interference (which often does occur in industry) the microcontroller will stop executing the program, or worse, it starts working incorrectly.


Of course, when this happens with a computer, simply it can be reset and it will keep working. However, there is no reset button on the microcontroller and thus solve the problem. To overcome this obstacle, one more block was introduced called watchdog as shown in the figure above. This block is in fact another free-run counter where the program needs to write a zero for every time it executes correctly. In case that program gets "stuck", zero will not be written in, and counter will reset the microcontroller upon achieving its maximum value alone. This will result in executing the program again, and correctly this time around. That is an important element of every program to be reliable without man's supervision.


2.8 Analog to Digital Converter

As the peripheral signals usually are substantially different from the ones that microcontroller can understand (zero and one), they have to be converted into a pattern which can be comprehended by a microcontroller. This task is performed by a block for analog to digital conversion or by an ADC as shown in the figure below. This block is responsible for converting an information about some analog value to a binary number and for follow it through to a CPU block so that CPU block can further process it.



Finally, the microcontroller is now completed and needs to be assembled into an electronic component where it will access inner blocks through the outside pins. The figure below shows what a microcontroller looks like inside.






Thin lines which lead from the center towards the sides of the microcontroller represent wires connecting inner blocks with the pins on the housing of the microcontroller so called bonding lines. Chart on the following picture represents the center section of a microcontroller.




microcontroller
pic-microcontroller
pic-microcontroller

Add to Technorati Favorites

Project Using Microcontroller