You are on page 1of 27
INFRARED ROBOTIC BY USING MICROCONTROLLER AHMAD RASHIDI BIN AHMAD FAUZY This report was submitted in partial Fulfillment of Requirement for The Bachelor Degree of Electronic Engineering, Fakulti Kejuruteraan Elektronik dan Kejuruteraan Komputer ‘eknikal Kebangsaan Malaysia APRIL, 2007 vi ABSTRAK The project ‘Infrared Robotic Using Microcontroller’ is to produce robot which will avoid when see the obstacles in front. It’s like a small wheel robot that avoids obstacles which it senses with its active infrared sensors. Each rear wheel has its own motor; the single front wheel is not powered. The robot steers “like a tank” by rotating the rear wheels in opposite direction. These robots are controlled using PICI6F84A Microcontroller. The behaviors of the robot are searching an object in front. The three wheels of the robot were in a triangular configuration. This robot is able to move forward, turn left and turn right. This project deals with the design and construction of robot structure and also the related circuits. The sensors are built with infrared LEDs which are running at 36 kHz and two 36 kHz remote control receiver modules. When the 36 kHz infrared light from the LEDs is reflected by an object, one of the receiver modules will be triggered and the PIC16F84 microcontroller will steer the robot away from the objects by reversing one of the motors. One unit of Cytron servo motor C36S is used as determines direction for the robot. The DC Servo motor is used to move robot forwards and back. PICI6F84A microcontroller is programmed using PIC Basic PRO programming. MPLAB and PICshell software are used to assemble and download machine code into the microcontroller. vii ABSTRAK Projek ‘Tortoise robot’ adalah bagi menghasilkan sebuah robot yang akan ‘mengelak halangan apabila melihat sesuatu objek dihadapan. la menyerupai sebuah robot roda kecil yang akan mengelak halangan apabila pengesan infra merah diaktifkan. ikawal menggunakan mikropengawal PIC16F84A. Sifat robot adalah mengesan objek dihadapan. Tiga buah roda robot berada di satu konfigurasi segitiga. Robot ini adalah Robot ini boleh bergerak ke hadapan, belok ke kiri dan kanan. Projek ini bethadapan dengan rekabentuk dan pembinaan robot struktur dan juga litar-litar yang berkaitan. Pengesan dibina dari infra merah dimana berfungsi dalam pancaran 36kHz dan dua kawalan jauh 36kHz sebagai modul penerima. Apabila 36kHz inframerah daripada LEDs dipantulkan oleh suatu objek, satu modul penerima akan dicetuskan dan mikropengawal PIC16F84 akan memandu robot jauh daripada benda-benda oleh dengan menggerakkan satu motor secara mengundur. Satu unit Cytro servo motor C380 digunakan untuk menentukan arah pada robot. Servo motor arus terus juga digunakan untuk mengerakakan robot kehadapan dan kebelakang.PICI6F84A_ mikropengawal diprogramkan menggunakan pemprogram PIC Basic PRO. Perisian MPLAB dan perisian PICshell digunakan untuk benukar dan memuat turun mesin kod ke dalam mikropengawal. CHAPTERI INTRODUCTION 1.1 Infrared Robotic Using Microcontroller Nowadays robots can be found in mostly industries which perform routines, and redundant tasks that are cannot be performed by human labor such as task that was too difficult or too dangerous and to critical to be done by a human, Furthermore recent technologie advances have made it possible to use robotic devices to provide safe and intensive rehabilitation to persons. Robots are usually controlled by computer; computers are nothing more than simple adding machines (they just add incredibly fast). In order for the computer to operate the robot, they must be programmed, but they also need to be able to sense the environment and provide that sensory information to the program so that pre-programmed decisions and movements can be sent to the robot in response [1]. Robotics is about building systems. Controller(s), sensors, a power source, and motors are a few of the many subsystems that make up a robot. There are many different kinds of robots — robotic arms, analog insect- like robots and digital While a microcontroller according to Levine, a microcontroller is essentially an inexpensive single chip computer which means the entire computer system lies within the confines of a sliver of silicon encapsulated inside the plastic housing of an integrated circuit [3]. Since robotics is about building a system with a microcontroller inside, an Infrared Robotic by Using Microcontroller had been developed to create a robotic system that can avoid when see the obstacle. This Robot controlled using PIC Microcontroller. PIC Microcontroller are device that can perform the basic of a stand- alone electron jons through perform a variety of programmed functions. appl It’s like a small three robot that avoids obstacles which it senses with its active infrared sensors. Each rear wheel has its own motor; the single front wheel is not powered. The robot steers “like a tank” by rotating the rear wheels in opposite direction ‘The sensors are built with infrared LEDs which are running at 36 kHz and two 36 kHz remote control receiver modules. When the 36 kHz infrared light from the LEDs is reflected by an object, one of the receiver modules will be triggered and the PIC16F84 microcontroller will steer the robot away from the objects by reversing one of the motors, Figure 1.1: Infrared Robotic Using Microcontroller 1.2 Problem Statement With the increasing of technology in robotic area, there are so many researches that had been done to replace human works. Current research in robotic tends to be in two main areas that is in artificial intelligence and related field of machine vision [4]. According to Selig, a typical artificial intelligence problem in robotics might be to find a clear path for a robot through a cluttered environment; however most of research in this area is towards making intelligent machines [4]. There are so many robotic that had been designed to used either in industries or for research education. In many pre us works, a wide range of sensors and various methods for detecting and avoiding obstacles for mobile robot purpose have been proposed. Good references related to the developed sensor systems and proposed detection and avoidance algorithms can be found in [5] [6] 7] (8]. Generally, this project was also a solution to obstacle avoidance, but this project, was a low cost solution, using a PIC application and infrared LEDs which are running at 36 kHz and two 36 kHz remote control receiver modules as a sensor. There was a previous project that also a low cost solution to obstacle avoidance for a mobile robot had been designed bu (5). it was using a single ultrasonic sensor panning an angle of 180 This Infrared Robotic by Using Microcontroller can be divided into two parts, robot structural construction (hardware) and robotic control system construction (software). This project is also focuses on construction of robot structure that able to move smoothly and stable in all condition and possesses terrific strength to be moved freely that can avoid obstacles. ‘The construction involves the skills of attaching components onto circuits, programming the micro controller and installation of sensors to the robot to drive it into specific movement. The final step is to combine both software and hardware specifications and manipulates controlling system to control the movement of the robot. 13 Project Objectives In developing this project, objectives was the main concen to make sure that all the this project will successfully done, The objectives of this Infrared Robotic by Using Microcontroller project was: 14 was: To build the Infrared Robotic by Using Microcontroller. To know and understood about microcontroller (PIC) theory To learn PIC (peripheral interface controller) characteristic and programming. iv. To implement the PIC on the robots circuit. v. To ensure that robot will avoid when hit the obstacle. Scope of Work The scope of work for this Infrared Robotic by Using Microcontroller project iii Build a mechanical structure and motor placement for a device that can perform a basic of stand-alone electronic applications through perform a function that will avoid when hit any obstacle. Build a mechanical structure and motor placement for a device that can sense any obstacle within 10 centimeters using infrared sensors. Controlled the Infrared Robotic using PIC program that fed with input from sensors and drive the motors base on specific command as programmed. iv. Wrote a suitable programming for PIC microcontroller to control the robot’s movement to ensure the smooth movement of the robot and able to respond sensi vely to the sensor 15 Project Flow Research, Analysis & Literature survey Project proposal ¥ Order and purchase component + Develop programming for Robot x Construct the Robot ¥ Program PIC on Master robots ¥ Maintenance & upgrade Robots Starts develop Slave Robot. CHAPTER 2 LITERATURE REVIEW 21 OVERVIEW A robot is a mechanical or virtual, artificial agent. A robot is usually an electro- mechanical system, which, by its appearance or movements, conveys a sense that it has intent or agency of its own. The word robot can refer to both physical robots and virtual software agents, but the latter are often referred to as bots [1] [2]. A typical robot must have several, but not all of the followi 1g properties: © Isnot natural’ / has been artificially created. © Can sense its environment. © Can manipulate things in its environment. © Has some degree of intelligence or ability to make choices based on the environment or automatic control / preprogrammed sequence. * Is programmable. * Can move with one or more axes of rotation or translation, ‘* Can make dexterous coordinated movements. ‘* Appears to have intent or agency (reification, anthropomorphisation or pathetic fallacy [7]). There is no one definition of robot which satisfies everybody, and many people have written their own. For example, International standard ISO 8373 defines a "robot" as: “An_ automatically controlled, reprogrammable, multipurpose, manipulator programmable in three or more axes, which may be either fixed in place or mobile for use in industrial automation applications. [9]” Joseph Engelberger, a pioneer in industrial robotics, once remarked “I can't define a robot, but | know one when I see one."[10]” The Cambridge Online Dictionary defines robot as: “A machine used to perform jobs automatically, which is controlled by a computer [11]” Robots are indispensable in many manufacturing industries. The reason is that the cost per hour to operate a robot is a fraction of the cost of the human labor needed to perform the same function, More than this, once programmed, robots repeatedly perform functions with a high accuracy that surpasses that of the most experienced human operator. Human operators are, however, far more versatile, Humans can switch job s easily. Robots are built and programmed to be job specific. Today's most advanced industrial robots will soon become “dinosaurs.” Robots are in the infancy stage of their evolution. As robots evolve, they will become more versatile, emulating the human capacity and ability to switch job tasks easily. Robots are good for such tasks because the tasks can be accurately defined and must be performed the same every time, with little need for feedback to control the exact process being performed. Industrial robots can be manufactured in a wide range of sizes and so can handle more tasks requiring heavy lifting than a human could. They are also useful in environments which are unpleasant or dangerous for humans to work in, for example bomb disposal, and work in space (example Canadarm2) or underwater, in mining, and for the cleaning of toxic waste. Robots are also used for patrolling these toxic areas. While the personal computer has made an indelible mark on society, the personal robot hasnt made an appearance. Obviously there’s more to a personal robot than a personal computer. Robots require a combination of elements to be effective: sophistication of intelligence, movement, mobility, navigation, and purpose. 2.2 GENERAL COMPARISSON Generally, Infrared Robotic by Using Microcontroller is a one small robot with three wheels that avoid obstacles which it senses with its active infrared sensors. Each rear wheel has its own motor that the single front wheel is not powered. Compare to another robot, the same concepts of sensing principle is applied in this project but the different is in location of the infrared sensors where that will be placed horizontal in the rear of the Infrared Robotic robot. The robot steers “like a tank” by rotating the rear wheels in opposite direction. ‘The sensors are built with infrared LEDs which are running at 36 kHz and two 36 kHz remote control receiver modules. When the 36 kHz infrared light from the LEDs is reflected by an object, one of the receiver modules will be triggered and the PICI6F84 microcontroller will steer the robot away from the objects by reversing one of the motors. In this project, the robot will be programmed to move backwards as the sensors for obstacles avoidance (pin6 and pin7) which are located at the rear part of the Infrared Robotic robot. A like our eyes, both IR sensors will keep on sensing obstacles while the robot is moving. Infrared transmitter will emit infrared in a straight line. If the infrared light hits an object, it will reflect and the infrared receiver will detect the infrared light. If this occurs, the robot will take some actions to avoid that obstacle. Since the IR sensor using is a short distance sensor, the maximum sensing distance is limited to 3em. Any obstacles that appear outside the sensing distance will not be detected. The rotation speed of the motors is reduced by the “worm-wheel” of the motor axes which drive the cogs of the wheel axes. The circuit behind this robot can be divided in 3 parts: 1) A double motor drive to drive two small electric motors forward/ reverse/ full stop. 2) Two infrared emitters and receivers to sense objects. 3) A “brain” which is a PIC 16F84A microcontroller which will drive the motors in reaction to the sensor readings. The Figure 2.1 will show the robot will be avoid when the sensor detecting obstacles in the front. When any of the infrared receivers detects reflected infrared lights, the robot will move in the inverse direction and make a turn avoiding the obstacle. Sensors detecting obstacles Obstacle Figure 2.1: Obstacle Avoidance Robot 10 2.2.1 Line Following Robot The line following robot, as shown in Figure 2.2 is a line follower 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. Basically, the line following is a colored line that is different from the color of the floor whereby the robot will only follow the line. Line Following Robot be capable of following the line by using IR sensors that are added at the bottom of the robot. The IR sensor will act as the “eyes” for the robot. Atmel's AVR® microcontrollers have a RISC core running single cycle instructions and a well-defined /O structure that limits the need for external components. Internal oscillators, timers, UART, SPI, pull-up resistors, pulse width modulation, ADC, analog comparator and watch-dog timers are some of the features that will find in AVR devices. AVR instructions are tuned to decrease the size of the program whether the code is written in C or Assembly. With on-chip in-system programmable Flash and EEPROM, the AVR is a perfect choice in order to optimize cost and get product to the market quickly. Black Line Figure 2. Line Following Robot [http://www.cytron.com.my/projectDIY .asp] i This is the concept of line following robot. When the middle sensor detects the line, the robot will move forward. This is because the line is in the center of the robot. But when the left sensor or the right sensor detects the black line, this means that the robot has strayed from the line, If the robot strayed to the right, the left sensor will detect the line and the brain will react by turning left to go back to the line. Robot Specification Motor : motor Energy Source : Battery 9v Control System >‘ Master/slave bicore on HC240, HC245 driver, Miller-type solar engine Sensors : Feeler switch 2.2.2. Wall Following Robot Instead of following a line on the floor, the robot is also capable of moving along a wall in order to reach a certain destination. This is just like a blind man touching a wall and using it to direct him to reach a place. For this chapter, we will be utilizing either one of the infrared sensors (sen4 and sen5). The Figure 2.3 will show the Wall Following Robot that follow the wall by detect the infrared sensors. When the robot following along the wall, only one of the infrared sensors will be used (either right or left sensor). Left sensor will be used for following wall on the left and vice versa. The Wall Following Robot is expected to move along the wall at a programmed distance with the maximum sensing distance area of 3em. But robot would not know if it has moved closer to the wall at the distance less than 3em since it can detect the area in the region of 3em. As aresult, it might hit the wall. To elaborate, if the IR sensor senses the wall, the robot should move away from it. On the other hand, if the sensor could not detect 12 the wall, it would move closer to it. To summarize, this method will make the Wall Following Robot to move right-left-right-left along the wall heading to its destination. LED illuminates (wall detected) Wall not detected Figure 2.3 Wall following robot in action Robot Specification Motor : 2 motor Energy Source : Battery 9v. Control System Master/slave bicore on HC240, HC245 driver, Miller-type solar engine Sensors FI Infrared sensors 2.2.3 Ants Behavior Robots Ants Behavior Robots are wheeled robots that move using 2 motors. Figure 2.4 shows the visual of the Ams Behavior Robots. In the beginning, this robot is installed with feelers and tilt switch as additional to photodiodes, but it failed to work due to problems occurred when the robot reversing. The robot circuit is constructed based on standard micro core. Then, Namiki motor installed to the robot was replaced with FWI 1 to improve it. Lastly, the back feelers were installed to this robot so that the robot able to response to barriers while reversing. One main problem identified in building the Ants Behavior Robots is in designing the legs. Unsuitability of legs design might cause sluggish movement of the robot and it might as well disable the robot's movement igure 2.4: Ants Behavior Robots [http://justenoughvolts.solarbotics.net] Robot Specification Motor : 2 types of motor (Namiki and Mabuchi FWD) with modified toys gear system. Energy Source : 2 unit Gold Solar Cell Panasonic 37*33 Control System Master/slave bicore on HC240, HC245 driver, Miller-type solar engine Sensors 7 Feeler switch 14 2.2.4 Blue Robots Blue Robot is a four-legged robot that moves using 2 motors. Figure 2.5 shows the visual of the Blue robot. In the beginning, this robot is installed with feelers and tilt switch as additional to photodiodes, but it failed to work due to problems occurred when the robot reversing. The robot circuit is constructed based on standard micro core. However, this process took a very long time, and the standard micro core was replaced with master/slave bicore and timer on/off was replaced with Miller-type solar engine. Then, Namiki motor installed to the robot was replaced with FWI I to improve it. Lastly, the back feelers were installed to this robot so that the robot able to response to barriers while reversing. Servo motor Figure 2.5: Blue Robot [http://justenoughvolts.solarbotics.net] Robot Speci Motor Energy Source Control System Sensors 2.2.5 The Sprawl Robot 2 types of motor (Namiki and Mabuchi FWJJ) with modified toys gear system. 2 unit Goldcells installed parallel. Solar Cell Panasonic 37*33 Master/slave bicore on HC240, HC245 driver, Miller-type solar engine Feeler switch The Sprawl Robot, as shown in Figure 2.6, is a six legged robot that moves. using 6 pneumatics cylinders. The energy source for this robot is 9V battery and pneumatic. It was designed in year 2003 by Professor Mark Cutkosky. This robot is able to move on unstable surfaces such as sands, stones, grass field, snow and mimicking cockroach movements [http://scmtech.net/default.htm]. This Spraw! Robot is equipped with a pair of feelers used to respond to barriers ahead. Figure 2.6: Sprawl Robot [http://scmtech.net/default.htm] 16 Robot Specifications Pneumatic : 6 1.2*1.1mm cylinders Energy source : Duracell 9V (Supply for electronic circuits) Weight : 6.8 ounces Size 5.6 “L x 5.25"W x 2.7°H. (add 4.5” to L for feelers) Speed : 20 seconds per meter on slippery surface. 2.3. DEVICES AND COMPONENTS ‘There are many types of devices and components can be use for constructing Infrared Robotic by Using Microcontroller. In this robotic, the main devices and components is consists of servo motor, infrared sensors and main controller. 2.3.1 Motor Selection Robot builders generally encounter three types of motor. The motors are DC motors, servo motors and stepper motors. Each type of motor has its own strength and weaknesses. The type of motor chosen for a project is based on its intended usage Besides those factors such as cost, availability and physical characteristics of the motor such as dimensions and weight must be considered thoroughly before making any decision on the motor used. 2.3.1.1 Servo Motor There are actually two types of servomotors available. The DC servomotor illustrated at the right in Figure 2.7 is for industrial use and are much heavier, powerful and expensive. It is sometime used in building bigger robot. The other type of servomotor as illustrated at the left in Figure 3.3 is the pager type, call pager type 17 because it looks like a pager. Pager type servomotor, or simply called a servomotor are used widely in building robots. The nature of the servo motor, wide selection of torque, low weight, cartridge type casing, precise positioning of the servo and robust, make it an obvious choice for the biped robot. The I ati \s of servomotors are its price which is a bit expensive and that most of the model can't be obtained in Malaysia, For this project, the servos are obtained from Futaba retailers at Singapore namely, Hobby Supplies Pte. Ltd. and Toykar Pte, Ltd There is a new type of servomotor available at the market. It is the digital servomotor. Basically the ph; -al characteristic of the digital servo is pretty much the same as conventional analogue servo. The difference is that the digital servo has a faster response time and consumes more power. It is not feasible to use a digital servomotor in this project because of the fast response, high power needed and it is expensive. The model and specifications of the servomotor used in this project will be discussed in detail in the following chapter. Figure 3.3 shows the example of Servo Motor. Figure 2.7: Servo motor Figure 2.8: Disassembled Servo Motor Servo motors are used in closed loop control systems in which work is the control variable, Figure 2.8. The digital servo motor controller directs operation of the servo motor by sending velocity command signals to the amplifier, which drives the servo motor. An integral feedback device (resolver) or devices (encoder and tachometer) are either incorporated within the servo motor or are remotely mounted, often on the load itself. These provide the servo motor's position and velocity feedback that the controller compares to its programmed motion profile and uses to alter its velocity signal. Servo motors feature a motion profile, which is a set of instructions programmed into the controller that defines the servo motor operation in terms of time, position, and velocity. The ability of the servo motor to adjust to differences between the motion profile and feedback signals depends greatly upon the type of controls and servo motors used. See the servo motors Control and Sensors Product section. Three basic types of servo motors are used in modern servo systems: ac servo motors, based on induction motor designs; de servo motors, based on de motor designs; and ac brushless servo motors, based on synchronous motor designs, | | Digital ‘Servo controller amplifier Veli feedback L Servol fj Servol Ni | Load Position feedback (encoder or resolver) Figure 2.9 - Typical de servo motor system with either encoder or resolver feedback. Some older servo motor systems use a tachometer and encoder for feedback 2.3.1.2 DC Motor DC motor or direct current motor is the most common of all motors. There are many types of DC motors like brushless motor, coreless motor, fix magnet motor 5-pole motor, servomotor and many more manufactured to cater for a wide range of usage. DC motors take direct current voltages as input and convert it into rotation movement. DC motors generally have two wires, and can be powered directly from a battery or other DC power supply. DC motor can also be powered through driver circuits that can also regulate the speed and directions of the motor. DC motors are reversible by reversing the polarity of the voltage supplied to the motor. The usual voltage of DC motor use in robotics is 6V and 12V motor. The current rating depends on the make of the robot but it is usually between 1 Amp and 3 Amp. Varying the voltage input into the motor will vary the speed of the motor accordingly. DC motors have the ability to tun at high revolution per minute but has low torque. The most significant limitation of DC motors is the low output torque. Figure 2.10 shows the examples of DC motor. 20 Figure 2.10: DC Motor 2.3.2. Infrared Sensor Infrared (IR) sensor that used in the robot is the Infrared proximity detectors, which detect the presence of an object in front of the sensor. They consist of a combination of an infrared light emitting device and an infrared light sensor. These sensors are merely proximity detectors; they cannot determine the range of the obstacle in front. The range of these sensors is also limited to a maximum of 80cm. There are two essential components in the infrared sensor: a) IR transmitter b) IR receiver ‘The infrared transmitter is similar to a normal LED, only that the light emitted is infrared light, hence, it cannot be seen with human eyes. For that reason, we have difficulties figuring out whether the emitter is working or not. When the infrared be reflected. Figure 2.11 shows the infrared receiver that is attached together with the infrared transmitter emits infrared light to a reflective surface, the light transmitter would detect the reflected light. If the IR sensor is pointed to a black or 21 non-reflective surface, the infrared emitted will be absorbed by the surface and therefore the receiver is unable to receive or only received little infrared. White or reflective Black or non-reflective surface surface Figure 2.11: Reflect by the infrared sensor jure 2.12: Infrared sensor 22 When the IR receiver receives infrared, it will generate voltage at its pin. The generated voltage is in the range from OV to SV depending on the intensity of the infrared it receives. The voltage will drop to zero if there is no infrared received. Problem arises because the microcontroller only recognizes di tal input which is OV and SV. If the infrared reflected is less, the receiver would probably produce a 2V or 3V and microcontroller is unable to deal with these analog values. Thus, we need a comparator (LM324) to solve this problem. By using this comparator, the output voltage from IR receiver will be compared to an input voltage through a variable resistor. The comparator will compare both input voltages and generate them either to OV or SV whereby we can connect it to our microcontroller. 2.3.3. Microcontroller ‘A microcontroller is an inexpensive single-chip computer. Single chip computer ‘means that the entire computer system lies within the confines of the integrated circuit chip. The microcontroller on the encapsulated sliver of silicon has features similar to those of our standard personal computer. Microcontroller is our best choice to be the control system in controlling a mobile autonomous robot because its ability to store and run unique programs, memory space just nice for building a hobby robot. The relatively low cost feature of microcontroller is the most important factors to be the best choice for robot builder! There are many different brand of microcontroller available in the market now such as Atmel, Rabbit, Intel, Motorola, Phillips, Microchip and others. The type of microcontroller that will be used i this project is PIC 16F877A. Control system of a robot always being the most challenging part for most students who are interested in building a simple mobile robot. There are various alternatives available for the controller of a robot such as Handy Board, DSP board, FPGA, PLC, 3 microcontroller, PC based controller, etc. Among these controllers, microcontroller is the most suitable and recommended for building a robot. Basic language, assembly language, and C language are among the programming language which can be used to program the PIC that can be learned and used easily, \ Figure 2.13: PICI6F84A. CHAPTER 3 PROJECT METHODOLOGY 3.1. INTRODUCTION The project methodology had been divided into two parts. The first part is on the development of hardware while the second part is on the development of software (algorithm for PIC). Hardware refers to the development of the device itself including the circuit construction and soldering process. As for the software, it is focused on the program development specifically during the simulation, compilation and PIC burning process. 3.1.1 Hardware Development From the literature review, all the most suitable components and devices for this project had already defined. The PIC 16F84A had chosen as the main controller an IR sensor had chosen as the incoming signal, servo motor as drive for the robot and PIC microcontroller are device that can perform the basic of a stand-alone electronic applications through perform a variety of programmed functions.

You might also like