design of multi-detrct surface algorithm for home vacuum aplication - mohamad sahran b. kamilan -...

Upload: nasir-jamshed

Post on 03-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    1/27

    DESIGN OF MULTI- DETECT SURFACE ALGORITHM FOR

    HOME VACUUM APLICATION

    MOHAMAD SAHRAN BIN KAMILAN

    This Report Is Submitted In Partial Fulfillment of Requirements for the Degree

    of Bachelor in Electrical Engineering

    (Power Electronic & Drive)

    Fakulti Kejuruteraan Elektrik

    Universiti Teknikal Malaysia (UTeM)

    May 2008

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    2/27

    ABSTRACT

    The main objective of this project is to design and develop a multi-detect

    surface algorithm for home vacuum application. In this paper, vacuum controller,

    (advance controller for multi detect surface) will be explained and studied. Advance

    controller describes the discipline where control method are developed that attempt to

    emulate important characteristics of human intelligence. These characteristics include

    adaptation and learning, planning under large uncertainty and copying with large

    amount of data. This project concerned about the vacuum controller motor speed that

    installed an advance controller. The sensor will detect the surface of the variety floor

    and give the signal to the controller for determine the speed of the motor. The key

    point of this project is that this controller can function and could interface with sensor,

    and finally its own actuator that is rotation of the motor. For this projectused PIC

    16F873A, sensor and other components. This project is focusing on the automatics

    function system and control system that bases on a PIC 16F873A microcontroller. The

    usage of the vacuum controller motor speed is to present such items as the user's real

    environment. It can make our job easier and simple to use.

    v

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    3/27

    ABSTRAK

    Tujuan utama projek ini adalah untuk mencipta dan memajukan satu alat yang

    boleh mengesan atau membezakan pelbagai jenis permukaan dan seterusnya

    diaplikasikan pengunaannya dalam vakum di rumah. Oleh itu, dalam laporan ini

    pengawal vakum vacuum controller for-multi detect surface akan diterangkan.

    Advance controller merupakan satu displin dimana satu kawalan dimajukan dan

    ianya diadaptasikan atau dicontohi dari kepintaran manusia. Ciri- ciri ini ternasuklah

    adaptasi dan pembelajaran, merancang sesuatu yang tidak ditentukan dan menyalin

    serta membaca pelbagai data. Justeru itu, projek ini adalah mencipta sejenis vakum

    yang boleh mengawal kelajuan motor untuk menyedut sampah mengikut jenis

    permukaan yang dikesan oleh sensor dan ianya diadaptasikan dari advance

    controller teori. Kunci utama untuk menghasilkan alat ini adalah, alat pengawal yang

    boleh membaca dan menghantar isyarat dari sensordan seterusnya motor pada

    vakum berputar mengikut arahan yang diberi oleh alat pengawal. Sebagai contoh,

    untuk permukaan permaidani, vakum memerlukan kelajuan yang tinggi pada motor

    untuk menyedut sampah dan sebaliknya untuk permukaan lantai licin. Untuk projek

    ini, PIC 16F873A dan IR sensor digunakan berserta komponen elektronik lain.

    Keseluruhan dari projek ini boleh diringkaskan ialah aplikasi dari sistem fungsiautomatik. Hal ini kerana, kelajuan motor berubah dengan sendiri dan bersesuaian

    mengikut jenis permukaan yang dikesan. Akhir sekali, penghasilan vakum ini amatlah

    praktikal dan sesuai digunakan dalam kehidupan sebenar kerana ia adalah satu alat

    yang mudah digunakan dan menyenangkan kerja.

    vi

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    4/27

    CHAPTER 1.0

    INTRODUCTION

    Advance controller describes where control method are developed that attempt

    to emulate of human intelligence. Advances in sensors, actuators, computation

    technology and communication networks help provide the necessary for

    implementation this control hardware.

    Advance control methodologies are being applied to robotics and automation,

    communications, manufacturing, traffic control, to mention but a few application

    areas. Neural networks, fuzzy control, genetic algorithms, planning systems, expert

    systems, and hybrid systems are all areas where related work is taking place.

    For this project, the design of multi- detect surface algorithm for home vacuum

    application will be build to implement the advance controller. This project are bases

    on used PIC 16F873A, LM358 and infrared sensor as a main component for

    hardware development.

    The success of vacuum controller for multi detect surface operation will be used

    or implement for home vacuum application. This vacuum controller with automatic

    function is mainly to make human job more easily and convenient.

    1

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    5/27

    1.1 Problem Statement

    Nowadays, there are many type of vacuum, but not many vacuums that have

    an advance or intelligent function. So, vacuum controller for multi detect surface is

    build. This vacuum controller is easy to use with an automatic function to make our

    work more convenient in a life day.

    Otherwise, this vacuum is also low cost designing with low power uses. So,

    this vacuum construction is highly practical to develop for human uses.

    For this vacuum controller motor speed, it is difficult to design and upgrade

    from the type of vacuum that have a basic function. Besides, the controller is hard to

    design and have difficult construction.

    1.2 Project Objectives

    The following objective will be based on PIC 16F873A programming:

    1. To design and develop an intelligent controller of the basic type of vacuum.

    2. To make the controller can function and could interface with sensor.

    3. To develop a system that can control the speed of the rotation motor.

    4. To develop a system that has an automatic mode and function controlling.

    5. To build and upgrade the function of the basic vacuum that already has.

    2

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    6/27

    1.3 Scope of project

    The project final results;

    The vacuum controller will be able to control the speed of motor follow suit

    the surface of the floor. Based on the PIC 16F873A microcontroller as the heart of

    the system.

    Approach used in this project;

    To control the speed of motor in vacuum, firstly, the sensor will detect the

    variety of surface on floor. The sensors that will be used are transmitter and

    receiver IR sensor. This sensor emits infrared radiation or signal. Then send

    or transmit the signal to the controller that is PIC 16F873A.

    The controller will function and the systems will immediately response to

    determine the applicable speed of motor.

    Finally, the speed of rotation motor follow suits the type of surface floor to

    suck the rubbish.

    The project involved;

    #Hardware;

    The hardware development consists of the design, redesigns, testing and

    troubleshoots all the circuit involved. It contains of infrared sensor and PICcontroller as a control element. Proteus Professional 6 has been used for all design of

    the circuit.

    3

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    7/27

    #Software;

    The software part will base on the simulations for all the system parts and the

    program development used MikroC program. This program is important because it

    give the instruction all the journey of the hardware.

    #Firmware;

    This project consists of hardware development & software application and

    improvement for the existing system. The complete design and development

    hardware and software will combine to make vacuum controller for multi-detect

    surface. This combination as the final test for the firmware and to ensure this project

    is successful follow the planning.

    4

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    8/27

    CHAPTER 2.0

    LITERATURE REVIEW

    2.1 Introduction

    This chapter includes the study of hardware and software development. There

    are two aspects in process to be proceeding while doing this project that are software

    part and electrical part. For the electrical part, contain part on programmer for

    microcontroller PIC16F873A, LM358, IRF 530N control circuit and sensor. For

    software part, the MikroC programming C and the Proteus Professional will be used

    to simulate the circuit.

    2.2 Microcontroller

    All microcomputer systems, irrespective of their complexity, are based on

    similar building blocks. A microcontroller (or MCU) is a computer-on-a-chip used to

    control electronic devices.

    These are shown in Figure 1 and consist of the following:

    CPU - the part that does all logic and arithmetic functions

    RAM - storage for programs and/or program variables

    ROM - read-only parts of programs

    I/O - connection to external devices

    5

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    9/27

    Figure 2.1: Basic Building Blocks of a Computer

    Figure 2.2: A Microcontroller Based System

    Most microcontrollers contain circuitry to generate the system clock. This

    square wave is the heart beat of the microcontroller and all operations are

    synchronized to it. Obviously, it controls the speed at which the microcontroller

    functions. All that needed to complete the clock circuit would be the crystal or RC

    components. We can, therefore precisely select the operating speed critical to many

    applications.

    6

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    10/27

    To summarize, a microcontroller contains (in one chip) two or more of the

    following elements in order of importance:

    i. Instruction set

    ii. RAM

    iii. ROM, PROM or EPROM

    iv. I/O ports

    v. Clock generator

    vi. Reset function

    vii. Watchdog timer

    viii. Serial port

    ix. Interrupts

    x. Timers

    xi. Analog-to-digital converters

    xii. Digital-to-analog converters

    The CPU or microprocessor is the core component of any microcomputer and

    it requires the external components such as the ROM, RAM, I/O to accomplish its

    purpose. The difference between the microprocessor and the microcontroller arises

    because of their different end-usage. The microcontroller that will be investigated is

    the PIC16F873A.

    2.3 PIC 16F873A

    Basically, we are using programmable IC (PIC) microcontroller to design of

    such circuit easier since it allows the programming of specific behaviors in software.PIC microcontrollers are among the cheapest possible microcontrollers, they are

    considered relatively low-level microcontrollers and low power consumption which

    need some external parts to function.

    The PIC 16F873A (Programmable Interface Controller) devices are available

    only in 28-pin packages. The PIC 16F873A have one-half of the total on-chip

    memory of the PIC 16F876A and PIC 16F877A. This 28 pin devices have three I/O

    ports, five channels of A/D converter input channels, fourteen interrupts, PWM

    7

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    11/27

    output, capture and compare registers, power on reset, watchdog timer, power saving

    sleep mode, brown-out detection circuitry, in-circuit programming support, USART,

    and timers.

    Figure 2.3: PIC 16F873A. [8]

    The microcontroller acts like the brain of the control system. Microcontroller

    chip that has been selected for the purpose of controlling the speed of DC motor is

    PIC 16F873A manufactured by Microchip. A typical microcontroller contains all the

    memory and interfaces needed for a simple application, whereas a general purpose

    microprocessor requires additional chips to provide these functions.

    8

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    12/27

    Figure 2.4: The Pin Diagram of PIC 16F873A. [8]

    This chip is selected based on several reasons:

    Its size is small and equipped with sufficient output ports without having to

    use a decoder or multiplexer.

    Its portability and low current consumption.

    It has PWM inside the chip itself which allow us to vary the duty cycle of DC

    motor drive.

    It is a very simple but powerful microcontroller. Users would only need to

    learn 35 single word instructions in order to program the chip.

    It can be programmed and reprogrammed easily (up to 10,000,000 cycles)

    using the universal programmer in robotics lab.

    9

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    13/27

    Figure 2.5: Program Memory Map and Stack of PIC 16F873A. [8]

    2.3.1 Program Memory Organization

    The PIC 16F873A devices have the 13-bit program counter capable of

    addressing a 4K word x 14 bit program memory space. The Reset vector is at 0000h

    and the interrupt vector is at 0004h. There are three memory blocks in each of the

    PIC devices that are Stack Level, Reset Vector, and Interrupt Vector. The program

    memory and data memory have separate buses so that concurrent access can occur.

    2.3.2 I/O Ports

    For the PIC 16F873A that has been choosing for the controller hardware

    design, it has divide into three pin. These pins are PORTA and the TRISA Register,

    PORTB and the TRISB Register, PORTC and the TRISC Register. Some pins for

    10

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    14/27

    these I/O ports are multiplexed with an alternate function for the peripheral features

    on the device. In general, when a peripheral is enabled, that pin may not be used as a

    general purpose I/O pin. All this pins port will be describe in the block diagram

    below.

    2.3.2.1 PORTA and the TRISA Register

    Figure 2.6: Block Diagram of RA3- RA0 Pins. [8]

    11

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    15/27

    Figure 2.7: Block Diagram of RA4/TOCKI Pin. [8]

    Figure 2.8: Block Diagram of RA5 Pin. [8]

    12

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    16/27

    PORTA is a 6-bit wide, bidirectional port. The corresponding data direction

    register is TRISA. PORTA pins are multiplexed with analog inputs and the analog

    VREF input for both the A/D converters and the comparators. The operation of each

    pin is selected by clearing/setting the appropriate control bits in the ADCON1 and/or

    CMCON registers. The TRISA register controls the direction of the port pins even

    when they are being used as analog inputs. So we must ensure the bits in the TRISA

    register are maintained set when using them as analog inputs.

    Table 2.0: PORTA Functions. [8]

    2.3.2.2 PORTB and the TRISB Register

    Figure 2.9: Block Diagram of RB3-RB0 Pins. [8]

    13

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    17/27

    Figure 2.10: Block Diagram of RB7-RB4 Pins. [8]

    PORTB is an 8-bit wide, bidirectional port. The corresponding data direction

    register is TRISB. If there is an interrupt it can wake up the devices from sleep. The

    user, in the Interrupt Service Routine can clear the interrupt in following manner:

    Any read or write of PORTB. This will end the mismatch condition.

    Clear flag bit RBIF.

    Table 2.1: PORTB Functions. [8]

    14

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    18/27

    2.3.2.3 PORTC and the TRISC Register

    Figure 2.11: PORTC Block Diagram (Peripheral Output Override) RC,

    RC. [8]

    Figure 2.12: PORTC Block Diagram (Peripheral Output Override) RC. [8]

    15

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    19/27

    PORTC is an 8-bit wide, bidirectional port. The corresponding data direction

    register is TRISC. Setting a TRISC bit (= 1) will make the corresponding PORTC

    pin an input (the corresponding output driver in a High-Impedance mode). Clearing a

    TRISC bit (= 0) will make the corresponding PORTC pin an output.

    Table 2.2: PORTC Functions. [8]

    2.4 IRF 530N

    Power MOSFETs from International Rectifier utilize advanced processing

    techniques to achieve extremely low on-resistance per silicon area. This benefit

    combined with the fast switching speed device design that HEXFET power

    MOSFETs are well known for, provides the designer with an extremely efficient and

    reliable device for use in a wide variety of applications. This IRF 530N will combine

    with transistor as a switching element for DC motor. Besides, heat sinking is uses

    and important to these transistor as a thermal protection. The IRF 530N has three

    terminal that is source, gate and drain. The variety application of IRF 530N are:

    High current, High speed switching

    Solenoid and relay drivers

    Regulator

    DC-DC & DC-AC converter

    Motor control, Audio amplifier

    16

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    20/27

    Figure 2.13: IRF 530N Terminal. [7] Figure 2.14: IRF 530N Internal

    Schematic Diagram. [7]

    2.5 Infrared Sensor

    Sensors are a critical component in a motor control system. They are used to

    sense the current, position, speed and direction of the rotating motor. Recent

    advancements in sensor technology have improved the accuracy and reliability of

    sensors, while reducing the cost.

    Many sensors are now available that integrate the sensor and signal-

    conditioning circuitry into a single package. In most motor control systems, several

    sensors are used to provide feedback information on the motor.

    In this project, infrared sensor will used to compare the variety surface of the

    floor. These sensors are used in the control loop and to improve the reliability by

    detecting fault conditions or different condition.

    17

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    21/27

    Figure 2.15: Transmitter and Receiver Figure 2.16: IR TX-RX Pair SensorIR Sensor Signal

    Figure 2.17: The Pair of Infrared Sensor

    LED emits infrared radiation. This radiation illuminates the surface in front

    of LED. Surface reflects the infrared light. Depending on reflectivity of the surface,

    amount of light reflected varies. This reflected light is made incident on reverse

    biased IR sensor. When photons are incident on reverse biased junction of this diode,

    electron-hole pairs are generated, which results in reverse leakage current. Amount

    of electron-hole pairs generated depends on intensity of incident IR radiation.

    More intense radiation results in more reverse leakage current. This current

    can be passed through a resistor so as to get proportional voltage. Thus as intensity of

    incident rays varies, voltage across resistor will vary accordingly. This voltage can

    then be given to OPAMP based comparator. So, the output from the comparator can

    be read by uC. Alternatively, on-chip ADC can be use in AVR microcontroller to

    18

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    22/27

    measure this voltage. It is because microcontroller only can read the signal in ADC

    (Analog to Digital) signal and perform comparison in software.

    Figure 2.18: Circuit Diagram for IR Sensor Module. [4]

    This circuit is divided into two sections. IR TX and IR RX are to be soldered

    on small general purpose Grid PCB. From this module we can use three wires at

    about two feet long. Then, connect them to VCC, preset and to ground on main

    board. Lastly, the VCC should be connected to 5Vdc supply.

    2.6 LM 358- Low Power Dual Operational Amplifier

    LM358 is consists of two independent, high gain, internally frequency

    compensated operational amplifiers which were designed specifically to operate from

    a single power supply over a wide range of voltage. Operation from split power

    supplies is also possible and the low power supply current drain is independent of the

    magnitude of the power supply voltage. Application areas include transducer

    amplifier, DC gain blocks and all the conventional OP amp circuits which now can

    be easily implemented in single power supply systems.

    The features of LM 358:

    Internally frequency compensated for unity gain.

    19

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    23/27

    Large DC voltage gain: 100dB.

    Wide power supply range: 3V~32V (or1.5V~16V).

    Input common-mode voltage range includes ground.

    Large output voltage swing: 0V DC to VCC-1.5V DC.

    Power drain suitable for battery operation.

    Figure 2.19: LM 358 Pin Function. [5]

    2.7 Software Part

    2.7.1 MikroC Programming

    There are three most common ways can be used to program the PIC

    microcontroller, either using the assembly language, PIC Basic or C language. The

    assembly language and PIC Basic are considered to be quite messy and complicated

    to be used in programming. Furthermore, it may take more time to understand the

    deliverables of the built-in functions of assembly language compared to C.

    C language is more straightforward and takes shorter time to be understood.

    C compiler is made by the third parties to provide viability to the programmer in

    coding the PICs. The basic knowledge on C syntax, its built-in functions and pre-

    processor are essential in pursuing the project to program the microcontroller. Forthis project MikroC programmer is used.

    20

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    24/27

    Figure 2.20: The MikroC Software

    2.7.2 Proteus Professional 6

    To draw a complete circuit for a microcontroller, Proteus Professional 6 is

    used. This software is like a host features of the PCB layout. Proteus software also

    used to simulate the programming after the complete MikroC programming design. It

    means the programming that has been design will attach through the Proteus

    Software.

    The program is a brain of the controller that used to control operation of

    automation system. If error occurred while doing the programming, the program

    cannot be transfer. The program should be compiling first before attachment.

    21

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    25/27

    Figure 2.21: The Proteus Professional 6 Software

    22

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    26/27

    CHAPTER 3.0

    METHODOLOGY

    In this project, microcontroller will be used as the controller to control DC

    motor speed at desired speed. The block diagram of the system is shown in Figure

    3.1. It is a closed-loop control system.

    Figure3.1: Basic Block Diagram for DC Motor Speed Control

    The actual speed of DC motor will be measured by encoder and feedback to

    microcontroller. In microcontroller, it will calculate the error between the desired

    speeds with the actual speed. The error will determine duty cycle of pulse-width-

    modulation (PWM) in microcontroller. Then, the duty cycle will send to DC motor

    driver either accelerate or decelerate DC motor to maintain it at desired speed. So,

    the controller is so important and like the brain to determine the suitable speed of the

    motor.

    Motor

    Driver

    Sensor

    ControllerActual

    Speed

    Feedback

    Speed

    23

    DC

    Motor

  • 7/28/2019 Design of Multi-Detrct Surface Algorithm for Home Vacuum Aplication - Mohamad Sahran b. Kamilan - TJ223.P76.M

    27/27

    3.1 Methodology of the Project

    For designing and executing this project, there are few methods that should

    be taken for consideration. In ordering to fulfill this project done successfully follow

    the planning and schedule, there is a few method that should be taken:

    Yes

    Yes

    No

    No

    24

    Software development

    Write program

    Hardware

    development

    Make a research

    Circuit designing and

    testing

    Erro

    r Erro

    r

    TroubleshootTroubleshoot

    Compile

    A

    B

    START

    System Development