Academia.eduAcademia.edu

Outline

line follower

Abstract

simple line follower

CHAPTER 1 INTRODUCTION 1.1 INTRODUCTION What is an autonomous robot? Autonomous robot are robots that can perform with a high degree of autonomy, which is particularly desirable in fields such as space exploration, cleaning floors, mowing lawn, and waste water treatment. Some modern factory robots are “autonomous” within the strict confines of their direct environment. It may not be that every degree of freedom exists in their surrounding environment, but the factory robot‟s workplace is challenging and can often contain chaotic, unpredictable variables. The exact orientation and position of the next object of work and even the type of object and the required task must be determined. This can vary unpredictably. One important area of robotics research is to enable robot to cope with its environment whether this be on land, underwater, in the air, underground, or in space. A fully autonomous robot has the ability to: 1. Gain information about environment. 2. Work for an extended period without human intervention. 3. Move either all or part of itself throughout its operating environment without human assistance. 4. Avoid situation that are harmful to people, property, or itself unless those are part of its design specifications. What is a line follower? 1 Line follower is a machine that can follow a path. The path can be visible like a black line on a white surface (or vice-versa) or it can be invisible like a magnetic field. Why build a line follower? Sensing a line for the robot to stay on course, while constantly correcting wrong moves using feedback mechanism forms a simple yet effective closed loop system. As a programmer, we get an opportunity to „teach‟ the robot how to follow the line thus giving it a human-like property of responding to stimuli. Practical applications of a line follower: Automated cars running on roads with embedded magnets; guidance system for industrial robots moving on shop floor etc. What is application of robot? Robot can replace human‟s job in industry because robot can do many things faster than humans. Robots do not need to be paid, eat, drink, or go to the bathroom like people. They can do repetitive work that is absolutely boring to people and they will not stop, slow down, or fall asleep like a human. Individual stationary sensors have limited ranges and applications. Robotic site security sentries are able to work long hours at a consistently high level of precision and vigilance. People are interested in places that are sometimes full of danger, like outer space, or the deep ocean. Thus, when they cannot go there themselves, they make robots which are able to go there for exploration. The robots are able to carry cameras and other instruments so that they can collect information and send it back to their human operators. The continuing development of autonomous robot technologies furthers our abilities to explore the universe. 1.2 PROBLEM STATEMENT Classical line following robot is slow response to the error occur will easily leave its track that drawn on the floor. This problem will cause the motion of the robot to be unsmooth. Although the line following robot can follow the black lines, its motion still needs to be improved. 2 1.3 OBJECTIVE The objective of this project is: i. To design and construct the platform of line following robot using infrared sensors. Infrared (IR) radiation is electromagnetic radiation of a wavelength longer than that of visible light. ii. To apply and study the concept of drive motor. Motor is a machine or device that converts any form of energy into mechanical energy or imparts motion. A servomotor is a rotary actuator that allows for precise control of angular position, velocity and acceleration. iii. To study about PIC as a MICROCONTROLLER Criteria for choosing a microcontroller is because it must meet the task at hand efficiently and cost effectively, then the availability of software and hardware development tools such as compilers, assemblers, debuggers, and emulators, and lastly microcontroller have a wide availability in needed quantities both now and in the future 1.4 SCOPE PROJECT This scope of work is listed as below: i. Infrared sensor was used to detect the black line. ii. Continuous dc motors were chosen to drive the line following robot. iii. PIC18F4580 microcontroller is selected as a controller of robot. 3 CHAPTER 2 LITERATURE REVIEW 2.1 INTRODUCTION Generally, line follower robot is mobile robot that is designed to detect and follow the line. The path or track is usually predetermined by user and the robot needs to complete the path or track until the finish line. The path or track is basically physical white line on the floor or as complex path marking schemes for example embedded line, magnetic markers and laser guide markers. The basic operations of line follower robot are as follow: 1. The line follower robot will sense or detect the line position with optical sensors and the optical sensors are usually placed at the front end of the robot. 2. The robot will have steering mechanism in order for the robot to move straight, turn left or turn right. 3. The speed of the robot will be controlled according to the lane condition. It means that for curvy lane, the speed of the robot is decrease in order to obtain smooth turn. There are number of microcontrollers, motors and sensor in the market with varying specification. Therefore in this chapter we choose the most suitable microcontroller, motor and sensor to be used for our project. 4 2.2 BACKGROUND A line following robot is an autonomous robot which is capable of following a black line drawn on the floor. It can sense a line and maneuver the robot to stay on black line, while constantly correcting wrong moves using open loop system. Programmer has to „teach‟ the robot how to follow the black line. 2.3 RESEARCH FOR LINE FOLLOWER ROBOT 2.3.1 Line Follower Robot from CPP Robotic Club This following robot has been by a lot of people around the world, in this chapter we shows an example of line following robot that had been done by others, for example the line follower from CPP Robotics Club in figure 2.3.1. This line following robot will easily leave its track from the black line drawn on the floor because it is an open loop system. This problem will make the motion of the robot to be unsmooth. Although line follower robot can follow the black line its motion still need to be improved. As a result, applying digital PID algorithm control is a closed loop systems can smoothing the tracking motion. It is because PID control is a closed loop systems that will feedback and correct the error occurred with fast response. 5 Figure 2.3.1 Line follower robot from CPP Robotics Club 2.3.2 Design and Development of Autonomous Line Tracking Robot Using Microcontroller (UTEM) Problem statement: The design and development of an autonomous line tracking robot is a very complicated task. There are many aspects that should be considered such as mechanical system, electrical circuit and microprocessor programming. All these aspects need to be fully integrated between each other. So that, the autonomous robot can be perfectly functional to achieve the tasks provided. In order to make sure this autonomous robot system fully integrate, the challenges are to decide and choose the best device should be implemented in this autonomous robot system. Furthermore, there are many types of rnicrocontroller, sensor device and driven motor in the market. Each of them has difference specifications, capability and functions. The biggest obstacle is to program the microcontroller based on the information gathered from the robot's line sensors. Basically each sensor provides the information to controller based on the signal that they got and the controller will decide what to do base on the programming loaded. 6 For line sensor case, its information based on the rate of reflected light that have been detected by detector. In different environment or brightness of area, the rate of light detected by detector is fully different. So, the strong programming languages knowledge are needed to synchronize environment changes with the execute program in the microcontroller. Objectives: The main aim of this project is to design and develop an autonomous line tracking robot using microcontroller. This is achieved through these objectives: 1. To design and develop a suitable mechanical structure of an autonomous mobile robot. 2. To develop electronics hardware that is able to integrate sensor and electrical motor with the micro controller. 3. To develop a complete program for the microcontroller to achieve the required task of line tracking. Scopes: In order to design and development an autonomous line tracking robot using microcontroller, project scopes need to be defined for assist and guide the development of the project. The main scopes for this project are: 1. Data collection: Collect necessary data through literature review on existing autonomous line tracking robots, microcontroller, line sensor, driven motor and circuit design. 2. Design electronics and mechanical system: Create a circuit diagram for electronics part and design robot structure. 7 3. Integration: Build a complete set of autonomous robot by integrate the mechanical structure and electronics device. 4. Programming and Testing Build the complete set of program for microcontroller unit and run the testing for the complete autonomous robot. Figure 2.3.2 Autonomous Line Tracking Robot Using Microcontroller (UTEM) 2.3.3 Line following Robotic Vehicle using Microcontroller The project is designed to develop a robotic vehicle that follows a specific path. This project uses a microcontroller of 8051 family for its operation. A pair of photo sensors comprising IR transmitter and photo diode is interfaced to the controller to detect the specified path for its movement. Line follower robot is a useful robot that is used in ware houses, industries, and stores etc, where it follows a dedicated path. This proposed system of a line following robot fulfils the desired functionality and demonstrates the working of it. It uses a pair of photo sensors, comprising of 8 one IR transmitter and a photo diode in each. It guides the robot to follow a specified path by giving appropriate signal to the microcontroller. Two DC motors are used interfaced to the microcontroller through a motor driver IC. Input signals given to the microcontroller from the sensors and then the controller takes the appropriate action according to the program written in it and drives motors as desired. Further the project can be enhanced by adding more advanced sensors to it. This will add more features to the existing project. For example, we can use ultrasonic sensors for detect any obstacle in front of the robot and to take appropriate action. Figure 2.3.3.1 Line following Robotic Vehicle using Microcontroller 9 Figure 2.3.3.2 Block diagram for Line following Robotic Vehicle using Microcontroller 10 2.4 RESEARCH COMPONENT 2.4.1 PIC 18F4580 Microchip Technology‟s series of microcontrollers is called Peripheral Interface Controller (PIC) chips. This PIC are designed for applications requiring high performance and low cost. PIC is generally assumed as programmable interface controller. PIC is the Integrated circuit (IC) which was developed to control the peripheral device, dispersing the function of the main CPU. When compared to human being, the brain is the main CPU and the PIC shares the parts which is equivalent to the autonomic nervous. Figure 2.4.1 PIC18F4580 Input and Output Pins 11 2.4.2 DC Motor DC motors are so called because they are powered by a current placed across the electrodes of the motor. The speed rating of a DC motor is the top speed it can run at. The actual speed the motor runs at is a function of how strong the current is that is applied to the motor. DC motors can be run both forwards and backwards depending on the direction of the applied current. Special circuits called "H-bridges" allow the use of switches and transistors to change the direction a motor moves without having to change any of the wires. For the most part, DC motors come with very high speed ratings, and thus very low torque. Gears and transmissions allow us to convert the speed of a DC motor into torque that can be used for other tasks, such as moving heavy robots or lifting objects. Figure 2.4.2 DC Motor 2.4.3 L293D MOTOR DRIVER L293D is a typical Motor driver or Motor Driver IC which allows DC motor to drive on either direction. L293D is a 16-pin IC which can control a set of two DC motors simultaneously in any direction. It means that you can control two DC motor with a single L293D IC. It works on the concept of H-bridge. H-bridge is a circuit which allows the voltage to be flown in either direction. As you know voltage need 12 to change its direction for being able to rotate the motor in clockwise or anticlockwise direction, hence H-bridge IC are ideal for driving a DC motor. In a single l293D chip there two h-Bridge circuit inside the IC which can rotate two dc motor independently. Due its size it is very much used in robotic application for controlling DC motors. Given below is the pin diagram of a L293D motor controller. There are two Enable pins on l293d. Pin 1 and pin 9, for being able to drive the motor, the pin 1 and 9 need to be high. For driving the motor with left H-bridge you need to enable pin 1 to high. And for right H-Bridge you need to make the pin 9 to high. If anyone of the either pin1 or pin9 goes low then the motor in the corresponding section will suspend working. It‟s like a switch. Working of L293D The 4 input pins for this l293d, pin 2,7 on the left and pin 15, 10 on the right as shown on the pin diagram. Left input pins will regulate the rotation of motor connected across left side and right input for motor on the right hand side. The motors are rotated on the basis of the inputs provided across the input pins as LOGIC 0 or LOGIC 1. In simple you need to provide Logic 0 or 1 across the input pins for rotating the motor. Figure 2.4.3.1 L293 Logic Table 13 Figure 2.4.3.2 L293D Pin Diagram Figure 2.4.3.3 Circuit Diagram for L293D motor driver IC controller 14 2.4.4 IR Sensor IR Sensors work by using a specific light sensor to detect a select light wavelength in the Infra-Red (IR) spectrum. By using an LED which produces light at the same wavelength as what the sensor is looking for, you can look at the intensity of the received light. When an object is close to the sensor, the light from the LED bounces off the object and into the light sensor. Figure 2.4.4.1 How IR Sensor works Since the sensor works by looking for reflected light, it is possible to have a sensor that can return the value of the reflected 15 light. This type of sensor can then be used to measure how "bright" the object is. This is useful for tasks like line tracking. Detecting Brightness Since the sensor works by looking for reflected light, it is possible to have a sensor that can return the value of the reflected light. This type of sensor can then be used to measure how "bright" the object is. This is useful for tasks like line tracking. Figure 2.4.4.2 Depiction of the operation of an IR Sensor to measure brightness 16 Figure 2.4.4.2 Type of IR Sensor we use 2.4.5 VOLTAGE REGULATOR IC 7805 Voltage regulator IC's are the IC‟s that are used to regulate voltage. IC 7805 is a 5V Voltage Regulator that restricts the voltage output to 5V and draws 5V regulated power supply. It comes with provision to add heatsink. The maximum value for input to the voltage regulator is 35V. It can provide a constant steady voltage flow of 5V for higher voltage input till the threshold limit of 35V. If the voltage is near to 7.5V then it does not produce any heat and hence no need for heatsink. If the voltage input is more, then excess electricity is liberated as heat from 7805. It regulates a steady output of 5V if the input voltage is in rage of 7.2V to 35V. Hence to avoid power loss try to maintain the input to 7.2V. In some circuitry voltage fluctuation is fatal (for e.g. Microcontroller), for such situation to ensure constant voltage IC 7805 Voltage Regulator is used. IC 7805 is a series of 78XX voltage regulators. It‟s a standard, from the name the last two digits 05 denotes the amount of voltage that it regulates. Hence a 7805 would regulate 5v and 7806 would regulate 6V and so on. 17 The schematic given below shows how to use a 7805 IC, there are 3 pins in IC 7805, pin 1 takes the input voltage and pin 3 produces the output voltage. The GND of both input and out are given to pin 2. Pin Description: Pin No Function Name 1 Input voltage (5V-18V) Input 2 Ground (0V) Ground 3 Regulated output; 5V (4.8V-5.2V) Output Figure 2.4.5 Schematic Diagram for IC7805 18 Figure 2.4.5.1 IC7805 2.5 HAND TOOLS AND MACHINE In process to build this project, many hand tools and machine has been used for the making of this project. The hand tools can be found in electrical workshop or used own hand tools. For machine, those tools can be found only in electrical workshop only because the cost of machine is too high for student and the workshop already providing the machine for all students. The hand tools and machine that we used in this project is: 2.5.1 Multimeter A multimeter or a multi tester, also known as a VOM (volt-ohm- meter) is electronic measuring equipment that combines several measurements function in one unit. A typical multimeter would include basic features such as the ability to measure voltage, current and resistance. We use this tool for test path from point to point if there have any path did not connect. Besides that, we used this tool in troubleshooting case to make sure no path touching to other path. 19 Figure 2.5.1 Multimeter 2.5.2 Drill A drill is a tool fitted with cutting tools attachment or driving tool attachment, usually a drill bit used for drilling holes in various materials. We used this tool for punch the holes for component in at our PCB board. The size for drill bit is based on the component size. Figure 2.5.2 Drill 20 2.5.3 Solder Solder is the tool that used to melting a soldering iron for component pin. Solder commonly used in electronics, plumbing and assembly of metal part. This is important tools for make sure the component pin have connect with copper path at board. Figure 2.5.3 Solder 2.5.4 Soldering Iron This tool was actually used with solder, without this tools the component will not soldering to the board because the solder design for melting this iron to component pin for make the component connect with copper path. 21 Figure 2.5.2 Soldering Iron 2.5.5 Soldering Sucker This tool is used for suck the soldering iron that melting because of the user makes a wrong soldering. This tool will suck the soldering iron that melting until it‟s clean for the user pull the component out. Figure 2.5.5 Soldering Sucker 2.5.6 Cutter This tool is used for cutting the wire. Besides that tis tool is used for cutting the component pin that too long after finished soldering the component onto board. 22 Figure 2.5.6 Cutter 2.5.7 Hand Drill This tool is used to make a hole such as metal, plastic and wood. We also used this tool for some work such as drilling our robot base for placing the IR sensor and make a hole to put a bold and nut. The drill bit also can be change in any variable size we want. Figure 2.5.7 Hand Drill 23 2.5.8 Grinder This tool is used for cutting and smoothing many things such as metal and wood. This is very helpful tool to us in order to finish our project body. We use this tool for many works such as, cutting our body project and smooth it. Figure 2.5.8 Grinder 24 CHAPTER 3 METEODOLOGY 3.1 INTRODUCTION Methodology is the complete planning for the whole final project flow to smoothen the final project flow, methodology need to be arranged properly as neat as possible. It help the project to achieve its achievement on each stage and not flow outside the topic or in more specific, the final result will be achieve according to the problem statement stated. Therefore, it is important to know and understand deeply every single process in project methodology. Among needed to be done is finding enough information about line follower robot. In overall, the step and procedures involved in building this project involved with few main stages. Among the stage are mentioned below: 1. Project flow chart 2. Procedures in finishing project 3. Procedures in building programming 4. Flow chart circuit 5. Component 6. Gant chart 25 3.2 PROJECT FLOW CHART Start Literature Review (Motor, sensor, PIC Microcontroller) Hardware Design (Design and construct, platform, PIC Microcontroller board, Sensors circuit) Software Design (Develop a program, compile the program, Download program into PIC) Test and Development (Test the circuit sensor to the board, test the PIC microcontroller) Result Follow the black line drawn on the floor while smoothing tracking motion Report Writing END 26 3.2.1 Explanation of Project Flow Chart A flowchart is a type of diagram that represents an algorithm or process, showing the steps as boxes of various kinds, and their order by connecting them with arrows. This diagrammatic representation illustrates a solution to given problem. Process operation is represented in these boxes, and arrows. The arrows are implied by the sequencing of operations. Flowcharts are used in analysing, designing, documenting or managing a process or program. In this flow chart, there a several levels experienced prior to the project completion: 1. Beginning At the beginning of flow chart is a first step in project progress. This level is a beginning where ideas for builds types of project. Besides that, this level includes titling project, problem statement, objective and scope of project. At this level, titling project, problem statement, objective and scope must explained properly. So, it is important to choose the suitable project with financial means and knowledge. 2. Middle At this level its includes work process such as doing some research to project components, listing the component, buying a components, doing research for electronic circuit, draw an electronic circuit or wiring, draw a circuit to PCB, etching process, hardware installation and punch a hole onto PCB board, soldering and troubleshooting. In research aspect, listing and buying a components or any addition components circuit that been used, a research must doing first for determine the types, total and suitability components for circuit. Electronic circuit will have components such as resistor, 27 I.C, capacitor and other else. So, the circuit that involving basic components must do some research first. Research process must have avoided the problem in installation circuit. In buying components process also must emphasized so as to avoid loss and wasteful in terms of money. After list all the component, financial budget must be made to make all the listing component can be purchased all. Besides that research in component also help in ensure whether the component sol in foreign market or in internet. After the component is enough for the project, work process such as draw a circuit in software, convert the circuit into PCB layout, punch a hole in PCB board and soldering a component must implemented in accordance with specified time. Lastly, troubleshooting process must be made to ensure all components have connected according to what is drawn on the circuit. 3. End Lastly, at the end of this flow chart is where the project has successful completion and operation have run. For this level, the project must updates from day to day to make it function well. 28 3.3 PROCEDURE IN BUILD THE CIRCUIT In building the project, there steps needed to be done before the project can be complete. Those needed to be done precisely because from precision, comes quality. During completing this project, there a few steps that we undergo. Among them will be further explained below. 1. Finding and choosing project title. This is the step needed to be done before work can be done on the project. Project title needed to in line with diploma level because this is the final project for the Diploma in Electrical Engineering course. The project title chosen must also be able to create creativity and innovation while symbolizing the thinking level of an individual and also how high the knowledge level of an individual in electrical engineering. After the project title is chosen, the project must be able to attract people attention and interest to learn more about the project. An interesting project will symbolize the early status of the project. 2. Choosing suitable circuit After a title is chosen, the next step is choose the suitable circuit related to the project at the same time analysing components needed for the circuit so that it will be easy to obtain and will not cause problem to obtain it. This because rate components will make a great impact to the project because the time required to obtain the components will be take a long time. 29 3.3.1 Proteus 8 Professional Proteus 8.0 is a Virtual System Modelling (VSM) that combines circuit simulation, animated components and microprocessor models to co- simulate the complete microcontroller based designs. This is the perfect tool for engineers to test their microcontroller designs before constructing a physical prototype in real time. This program allows users to interact with the design using on-screen indicators and/or LED and LCD displays and, if attached to the PC, switches and buttons. One of the main components of Proteus 8.0 is the Circuit Simulation, a product that uses a SPICE3f5 analogue simulator kernel combined with an event-driven digital simulator that allow users to utilize any SPICE model by any manufacturer. Proteus VSM comes with extensive debugging features, including breakpoints, single stepping and variable display for a neat design prior to hardware prototyping. In summary, Proteus 8.0 is the program to use when you want to simulate the interaction between software running on a microcontroller and any analog or digital electronic device connected to it. Figure 3.3.1.1 Circuit for Line Follower Robot 30 Figure 3.3.1.2 Circuit for PCB Board Figure 3.3.1.3 PCB layout for the circuit 31 Figure 3.3.1.4 The 3D Visualisation for the circuit Figure 3.3.1.5 The XPS file for the circuit The file.xps is use to print the circuit into the PCB Board. 32 3.4 STEP FOR PROGRAMMING AND TEST THE CIRCUIT IN PROTEUS 3.4.1 Install MPLAB IDE v8.83 MPLAB® X IDE is a software program that runs on a PC (Windows®, Mac OS®, Linux®) to develop applications for Microchip microcontrollers and digital signal controllers. It is called an Integrated Development Environment (IDE), because it provides a single integrated "environment" to develop code for embedded microcontrollers. MPLAB® X Integrated Development Environment brings many changes to the PIC® microcontroller development tool chain. Unlike previous versions of the MPLAB® IDE which were developed completely in-house, MPLAB® X IDE is based on the open source NetBeans IDE from Oracle. 3.4.2 Install PICkit 2 v2.55 PICkit is a family of programmers for PIC microcontrollers made by Microchip Technology. They are used to program and debug microcontrollers, as well as program EEPROM. Some models also feature logic analyzer and serial communications (UART) tool. The people who develop open-source software for the PICkit use a mailing list for collaboration. The PICkit 2 uses an internal PIC18F2550 with FullSpeed USB. The latest PICkit 2 firmware allows the user to program and debug most of the 8 and 16 bit PICmicro and dsPIC members of the Microchip product line. The PICkit 2 is open to the public, including its hardware schematic, firmware source code (in C language) and application programs (in C# 33 language). End users and third parties can easily modify both the hardware and software for enhanced features. e.g. GNU/Linux version of PICKit 2 application software, DOS style CMD support, etc. The PICkit 2 has a programmer-to-go (PTG) feature, which can download the hex file and programming instructions into on-board memory (128K byte I2C EEPROM or 256K byte I2C EEPROM), so that no PC is required at the end application. The Microchip version of PICkit 2 has a standard 128K byte memory. 256K byte memory can be achieved by modifying the hardware or from third party. Additionally, a 500 kHz three-channel logic analyser and a UART tool are built into the PICKit 2. These features are missing from the PICkit 3. Since release of V2.55, PICkit 2 PC software now support maximum 4M bytes of memory for programmer-to-go feature. This modification makes the PICKit 2 support 8x more memory than the PICKit 3. This enhancement has been contributed by Au Group Electronics and the PICkit 2 firmware is also reported to be submitted to Microchip PICkit 2 team in the middle of March 2009. 3.4.3 Write the programming and test the circuit After completing the programming code in MPLAB, the code were tested in the circuit Proteus if the circuit were works then the code is inserted into the PIC using PICkit. 34 Figure 3.4.3 How to insert the code into PIC in Proteus 3.5 PRODUCING THE CIRCUIT ON PCB BOARD 3.5.1 Producing PCB PCB is procedures base on the circuit build. There are several steps to ensure that PCB procedure is neat and tidy: i. PCB is procedure based on the circuit build. ii. Obtain the components needed iii. Circuit testing on the bread board iv. Identity components exact size and measurement v. Arrange components so that it will look nice and tidy. This also minimizes circuit size. vi. Print the PCB to determine connections vii. Make etching process viii. Drill holes for components ix. Install components on PCB and start soldering 35 3.5.1.1 UV Exposure Before using the UV Exposure, make sure there were no light, because if the board exposure to light except the UV, the board will damage. So, it‟s important if we switch „OFF‟ the lamp before open the plastic that cover the board. After put the board in UV, set the timer for about 85 second. 3.5.1.2 Develop Process i. This process is done to get rid of the light-sensitive layer on the PCB that are exposed to UV rays. ii. PCB should be soaked in a solution of corrosive coating developer to have been exposed to UV rays and will leave the circuit on PCB design iii. Make sure the PCB is not soaked too long to avoid Over Develop. 36 3.5.1.3 Etching Process i. Etching process is done to get rid of unneeded layer of copper layer on the PCB using etchant liquid. ii. This solvent would corrode the copper layer on PCB is not covered by the print produced by the process developer. iii. The duration this process depends on the concentration, temperature and size of the PCB solvent produced. 37 3.5.1.4 Drilling Process i. After the PCB is done with etching process, wash the PCB with water to remove any debris. ii. Then, drill hole on the PCB for the components to fit in using a hand drill. The size of drill is according to the components. 3.5.1.5 Installing and Soldering Electronic Component on PCB By referring to the printed circuit assembly and soldering the components in a certain position. When performing brazing process, the security measures and vigilance must be practiced in order to avoid any possibility of such damage to the component, and the hand injury. To ensure that this project works or not, is irrelevant if the test one by one the components you want to install. After the completion of the installation of all the components, it is better if the test is carried out again to make sure the circuit really works by providing a supply of 5v. 38 39 3.6 FLOW CHART CIRCUIT START CONFIGURATION INPUT/OUTPUT L1 INITIAL CONDITION NO START BUTTON L2 YES ROBOT FORWARD 1 L3 YES SENSOR 1=OFF ROBOT TURN NO LEFT ROBOT FORWARD 2 L4 SENSOR YES 2=OFF ROBOT TURN RIGHT NO 40 3.7 COMPONENT NO DESCRIPTION QUANTITY UNIT AMOUNT PRICE 1 IR Line Tracking Sensor 2 RM 20.00 RM 40.00 2 Capacitor 4 RM 0.15 RM 0.60 3 IC L293D 1 RM 11.00 RM 11.00 4 PCB UV Board 1 RM 13.00 RM 13.00 5 DC Motor 2 RM 9.00 RM 18.00 6 LED 1 FREE - 7 Diode 2 RM 0.30 RM 0.60 8 Battery 9V 2 FREE - 9 Voltage Regulator 1 RM 1.00 RM 1.00 10 Resistor 220 3 RM 0.80 RM 2.40 11 Resistor 10k 3 RM 0.80 RM 2.40 12 Crystal 1 RM 2.00 RM 2.00 13 Push Button 2 FREE - TOTAL AMOUNT = RM 91.00 41 3.7 GANT CHART PROGRE 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 SS Student Registrati on Discussio n& Guidance Circuit Testing & Troublesh ooting Submit 50% Draft Report Submit 75% Draft Report Pre Presentati on Submit 100% Draft Report Final Presentati on & Demo 42 Submit Hard Cover Project Report Final Examinati on 43 CHAPTER 4 FINDINGS AND ANALYSIS 4.1 INTRODUCTION In any electronic circuit is created, the most important aspect is the operating circuit. With the operation of the circuit, so it'll be easier for followers and modify electronic circuits to be more sophisticated and has the potential to be marketed into the electronics industry of a circuit is poor, it will be the circuit that will entice users to use the equipment. In this chapter, we will tell about on how we choose this project, what is the statement of this project, the problem that we faced when do this project, and how do we solved the problem. Lastly, we will describe the operation of the circuit projects by build the programming for a „line follower robot‟. This project is a fairly sophisticated circuit to ease the lives of consumers in their daily lives. It is also useful for those who are less fortunate because it can help their lives without the help of others. 44 4.2 STATEMENT OF THE PROBLEM PROJECT During the times we doing this project, we had a lot of trouble even though it had been planned earlier. Throughout this project, we had a few problems, not least the problems in the etching process. We had to do this etching process three times as prior use of develop acid. This is due to our own fault that includes UV board in place without checking etching acid content in the carrier. In terms of project circuit, we face some problems. Then, we had to do the new circuit, because our old circuit is not function. After that we had some problem about the component, we had to order the component in cytron, and it was so expensive. 4.3 PROBLEM SOLVING PROJECT Based on the problems faced in the first etching process and functionally of the circuit, we do the etching on the second process carefully by making a mold of acid etching itself based on information obtained from the lecturer quarterly to avoid sabotage from other groups. Meanwhile, to solve the problem of over of brown acid, we took the initiate to do the etching process carefully. 4.4 PROGRAMMING During this project we used some sort of programming that using MPLAB. Our project need programming because our circuit use PIC18F4580 to make our controller circuit operated. This PIC is used to command the controller to control our circuit operation. In our project, we use assembly language programming to control the movement of our robot. 45 4.4.1 INTRODUCTION TO PIC ASSEMBLY PROGRAMMING In this section we discuss about Assembly language format and define some widely used terminology associated with Assembly language programming. While the CPU can work only in binary, it can do so at very high speed. It is quite tedious and slow for human, however to deal with 0s and 1s is called machine language. Although the hexadecimal system was used as a more efficient way to represent binary numbers, the process of working in machine code was still cumbersome for humans. Eventually, Assembly languages were develop, which provided mnemonics for the machine code instructions, plus other features that made programming faster and less prone to error. The term mnemonic is frequently used in computer science and engineering literature to refer to codes and abbreviations that are relativity easy to remember. Assembly language programs must be translated into machine code by a program called an assembler. Assembly language is referred to as a low-level language because it deals directly with the internal structure of the CPU. To program in Assembly language, the programmer must know all the registers of the CPU and the size of each, as well as other details. Today, one can use many different programming languages, such as BASIC, Pascal, C, C++, Java, and numerous others. These languages are called high-level languages because the programmer does not have to be concerned with the internal details of the CPU. Whereas an assembler is used to translate an Assembly language program into machine code, high level languages are translated into machine code by program called a compiler. For instance, to write a program in C, one must use a C compiler to translate the program into machine language. 46 4.4.2 STRUCTURE OF ASSEMBLY LANGUAGE An assembly language program consist of, among other things, a series of lines of Assembly language instructions. An Assembly language instruction consists of a mnemonic, optionally followed by one or two operands. The operands are the data items being manipulated, and the mnemonics are the commands to the CPU, telling it what to do with those items. An Assembly language program is a series of statements, or lines, which are either Assembly language instructions such as ADDLW and MOVWF, or statements called directives. While instructions tell the CPU what to do, directives give directions to the assembler. In other words, one directive is for the start of the program and the other for the end of the program. An Assembly language instruction consists of four fields: [ label ] mnemonic [ operands ] [ ;comment ] 4.4.3 ASSEMBLING AND LINKING A PIC PROGRAM The steps to create an executable Assembly language program are outlined as follows: 1. First we use a text editor to type our programming. In the case of the PIC microcontrollers, we use the MPLAB IDE, which has a text editor, assembler, linker, simulator and much more all in one software package. It is excellent development software that supports all the PIC chips and is free. Assembler has the file names follow the usual DOS conventions, but the source file has the extension “asm”. The “asm” extension for the source file is used by an assembler in the next step. 47 2. The “asm” source file containing the program code created in step 1 is fed to the PIC assembler. The assembler converts the instructions into machine code. The assembler will produce an object file and an error file. The extension for the object file “o”. The extension for the error file, which contains any syntax error and their line numbers, is “err”. The error file can be viewed with any text editor. 3. Assemblers require a third step called linking. The link program takes one or more object files and produces a hex file, a list file, a map file, an intermediate object file, and a debug file. The hex file has the extension “hex”, the list file extension is “lst”, the map file extension is “map”, the intermediate object file extension is “out”, and the debug file extension is “cod”. After a successful link, the hex file is ready to be burned into the PIC‟s program ROM and is downloaded into the PIC Trainers. 48 4.4.4 Programming in Assembly Language using MPLAB LIST P=18F4580, F=INHX32 #include <P18F4580.INC> CONFIG OSC = HS ; Oscillator High Speed #define SEN1 PORTC,0 #define SEN2 PORTC,1 #define SW1 PORTC,3 #define M1_EN PORTC,2 #define M1_FRWD PORTB,1 #define M1_RVSE PORTB,2 #define M2_EN PORTD,7 #define M2_FRWD PORTB,4 #define M2_RVSE PORTB,5 RESET_VECTOR CODE 0x0000 GOTO Main ;go to start of main code 49 Main: BSF TRISC,0 BSF TRISC,1 BSF TRISC,3 BCF TRISC,2 BCF TRISD,7 MOVLW B'00000000' ;WREG= 11111111 (binary) MOVWF TRISB MOVLW B'00000000' ;WREG = 11111111 (binary) MOVWF TRISD CLRF PORTB CLRF PORTC CLRF PORTD L1 BTFSC SW1 BRA L1 L2 BSF M1_FRWD BSF M2_FRWD BSF M1_EN 50 BSF M2_EN L3 BTFSC SEN1 GOTO MOTOR_FRWD_2 BCF M2_EN BRA L3 MOTOR_FRWD_2 BSF M1_FRWD BSF M2_FRWD BSF M1_EN BSF M2_EN L4 BTFSC SEN2 GOTO L2 BCF M1_EN BRA L4 BSF M1_FRWD BSF M2_FRWD BSF M1_EN BSF M2_EN END 51 Figure 4.4.4 The result of the programming for line follower robot 4.5 TESTING PROJECT CIRCUIT This test was be doing after PCB board was been etching. This purpose is to test the track of a circuit that should be touched between one and another line was touch. When a track was touch between one and another, a circuit or component will be damaged when we connect a supply into a circuit. So, we must do a testing process of circuit to prevent this problem been arise. This test was applied by using multimeter. After we test the circuit, we found that there is have touched track between another track. So, we just use test pen to scratch the track that is connected to each other. 4.5.1 Testing of overall project This test is done by testing the IR sensor and also the movement of the motor. Then we test the programming by insert the programming into the circuit in Proteus. 52 Figure 4.5.1 Testing the overall project using Proteus For this circuit, we assume that the toggle switch is the IR Sensor, when the push button is „ON‟, the motor will move forward and the sensor will detect the line, either it was left or right. When the sensor 1 detect the line, the motor 1 will stop, and motor 2 will still move forward until the sensor 1 cannot detect the line. Same goes for the sensor 2, motor 2 will stop and motor 1 will keep moving, until the sensor 2 cannot detect the line. The robot will continue its track except we stop it by click the reset button. 53 4.6 TABLE FOR MOTOR MOVEMENT 4.6.1 Motor 1 RC2 RB1 RB2 Direction 1 0 0 OFF 1 0 1 ACW 1 1 0 CW 1 1 1 OFF 0 X X OFF 4.6.2 Motor 2 RD5 RB5 RB4 Direction 1 0 0 OFF 1 0 1 ACW 1 1 0 CW 1 1 1 OFF 0 X X OFF 54 CHAPTER 5 DISCUSSION AND CONCLUSION 5.1 INTRODUCTION When we want to earn something in the project, discussion should be first and priority. That discussion aimed to collect the most important data to produce a quality project and achieving project objectives. Discussion was conducted with the same team members and supervisor to seek advice and guidance on the project will be produced. The discussion should include various aspects such as project name, purpose, objective, problem statement, scope, design, project costs, and list of project components. Discussion important to ensure ideas and help in the production of the project can be delivered and can be selected based on suitability. In addition, through discussions it can help promote a sense of working together as a group and to experience how to communicate well. Without discussion was possible to produce a quality project and achieve its objectives. 5.2 PROJECT FINDINGS Our project is to build a robot which is only following the black line which it called „line follower robot‟. By looking at the title of this project is certainly related to the sensitivity of the robot to work for an extended period without human 55 intervention. This project also builds to avoid situation that are harmful to people, property, or itself unless those are part of its design specifications. 5.3 ADVANTAGES AND DISADVANTAGES Each project will have produced its own advantages and disadvantages due to obstacles and limitations encountered during this project. Obstacles and limitations that exist cause project produced less and less in terms of quality safety. This is a list of the advantages and shortcomings of the project. 5.3.1 Advantages i. Physical design is stable ii. Not heavy iii. Easy to carry because of its small figure iv. Only use the battery as the supply 5.3.2 Disadvantages i. The component inside the robot is expensive, for example IR sensor, RM20.00. ii. Battery power is not enough iii. Hard to find the component in local, must order the component in cytron. 5.4 IMPROVEMENT IN THE FUTURE Production of this project is to make the human life easier, by improving the robot using PIC microcontroller and also the improving the programming to control 56 the robot automatically. However improvement needs to be done to ensure the project quality and good safety level. The proposed improvement is: i. Modifying components of the electronic circuit to enhance the effective in terms of the speed of DC motor and effective of IR sensor. ii. Use the PID controller for more efficient movement. iii. Use the servo motor for the line follower speed. 5.5. EXPECTATION AND HOPE Having worked hard to complete the project, then the project is finally completed and ready for test. Expectation for this project is not very high, just to make sure it is produced by the idea of a team capable of achieving the project objective. We hope this project has further continuation or innovation again to form a neat, strong, stable and most importantly it has to be quality for marketing. Refer to idea and suggestions to improve the production of this project, many more modifications or innovations can be made based on this project. 5.6 DISCUSSION By creating the line-following robot, we learned the basics of energy flow and exactly what building a circuit entails. We found out how voltage is potential energy, and how wires can run in series or in parallel depending on how many points the wires share. We understood the purpose of resistors, to transform excess energy into heat, and we discovered the function of transistors, the comparator, variable resistors, photo resistors, headlights, diodes, motors, and light emitting diodes (LEDs). We could use less resistance. 57 Building the robot consisted of a heavy revision and modification process. For example, knowing that the inside of the robot would be crowded with our circuit and power source. In this chapter, the discussion of the statement of the problem, the solution, the advantages and disadvantages of the system will be described in more detail. All the discussion in this chapter is also done based on the findings. 5.7 CONCLUSION The line following robot project challenged the group to cooperate, communicate, and expand understanding of electronics, mechanical systems, and their integration with programming. The successful completion of every task demonstrated the potential of mechatronic systems and a positive group dynamic. This project would not have been successful without every member of the group contributing and communicating during the problem-solving process, and without the knowledge and advice of Mr. Benny Azmi. Overall, the line following robot was a tremendous success and an incredible learning opportunity for everyone involved. 58