In the name of ALLAH the most benefits and the most

0 downloads 0 Views 2MB Size Report
This is to certify that thesis/project titled as “Floor Cleaning Robot” ..... Servo motors are used in applications such as robotics, CNC machinery or automated .... Its user manual is available on arduino's website and programming techniques ...
In the name of ALLAH the most benefits and the most merciful

Floor Cleaning Robot

Supervisor: Engr. Yasir Anwar Lecturer (CPED UCE&T BZU Multan)

Submitted By: Muhammad Sarmad Mahmood Malik 2013-CPE-04 Mohsin Raza

2013-CPE-32

Shahbaz Munir

2013-CPE-41 Session (2013-2017)

DEPARTMENT OF COMPUTER ENGINEERING University College of Engineering & Technology BAHAUDDIN ZAKARIYA UNIVERSITY MULTAN ii

CERTIFICATE This is to certify that thesis/project titled as “Floor Cleaning Robot” undertaken by the following student, has been found satisfactory, in partial fulfillment of the requirements for the degree of B.Sc. Computer Engineering.

Completed By:

Muhammad Sarmad Mahmood Malik

(2013-CPE-31)

Mohsin Raza

(2013-CPE-32)

Shahbaz Munir

(2013-CPE-41)

Supervised by .………………………………………… Engr. Yasir Anwar

Head of Department ………………………………………….. Dr. Muhammad Imran Malik

iii

Dedication

We dedicated this to our parents, teachers, friends and fellow members without whom it was about impossible for us to complete our thesis work

Thank you all for helping to give me a life I love today

iv

Acknowledgment All Praise to Allah Almighty lord of all the worlds, the most beneficent the most merciful, owner of the Day of Judgment. We pray to Allah to bestow His blessings and salutations of peace upon our noble Prophet Muhammad (PBUH). We pay our humblest gratitude to Allah who bestowed upon us his blessing which guided and helped us to complete this report. With the thanks providence that we have come to the other corner of the knowledge and even then the point of satisfaction never comes to end.

First, we would like to thank our mentor Engr. Yasir Anwar, our project supervisor, for guiding us through each and every step of the process with knowledge and support. We would also like to thank respected faculty members, who showed immense patience and understanding throughout the project and provided suggestions.

We would like to acknowledge all the assistance and contributions of Computer Engineering Department UCE&T BZU, Multan for supporting us with all that we needed. Starting from the books and ending with the full care that it provided us, helped us to be a professional in the field of Information Technology. I also would like to thanks to all those personnel who helped me in any way throughout our project. May Allah Almighty bless happy, healthy, peaceful and prosperous lives to all those who remained the active part of this success story.

v

TABLE OF CONTENT

CHAPTER 1: INTRODUCTION TO FLOOR CLEANING ROBOT____________________ 1 1.1

Introduction ___________________________________________________________________ 1

1.2

Motivation and aim _____________________________________________________________ 1

1.3

Parts of the project _____________________________________________________________ 2

CHAPTER 2: HARDWARE_____________________________________________________________ 3 2.1 List of Hardware components _______________________________________________________ 3 2.1.1

Arduino MEGA_____________________________________________________________ 3

2.1.2

Ultrasonic module (HC-SR04) _________________________________________________ 6

2.1.3

Regulator LM7805 __________________________________________________________ 8

2.1.4

Servo Motor _____________________________________________________________ 11

2.1.5

DC gear motors ___________________________________________________________ 14

CHAPTER 3: SOFTWARE ___________________________________________________________ 16 3.1 Software used __________________________________________________________________ 16 3.1.1

Arduino IDE ______________________________________________________________ 16

3.1.2

Easy PC__________________________________________________________________ 18

CHAPTER 4: DESIGN AND IMPLEMENTATION __________________________________ 21 4.1

Design and implementation _____________________________________________________ 21

4.1.1 Component design and Programing _____________________________________________ 22 4.1.2 Platform and chassis __________________________________________________________ 31 4.1.3

Finalizing and operation ____________________________________________________ 35

CHAPTER 5: COMPLETE SOURCE PROGRAM ____________________________________ 39 REFERENCES _________________________________________________________________________ 52

vi

LIST OF FIGURES

Figure 2.1: Arduino MEGA _____________________________________________ 3 Figure 2.2: Arduino description __________________________________________ 5 Figure 2.3: Ultrasonic module ___________________________________________ 7 Figure 2.4: LM7805 regulator____________________________________________ 9 Figure 2.5: LM7805 regulator circuit _____________________________________ 10 Figure 2.6: Servo Motor _______________________________________________ 12 Figure 2.7: Servo controlling sonar’s rotation ______________________________ 13 Figure 2.8: DC gear motors of robot ______________________________________ 15 Figure 3.1: Arduino IDE user interface ___________________________________ 17 Figure 3.2: Top view of Easy-PC ________________________________________ 19 Figure 4.1: Design and implementation ___________________________________ 21 Figure 4.2 Flow Chart _________________________________________________ 22 Figure 4.3: PCB Design _______________________________________________ 23 Figure 4.4: Motor controller ____________________________________________ 23 Figure 4.5: Battery ___________________________________________________ 24 Figure 4.6: Distribution Hub ____________________________________________ 25 Figure 4.7: Ultrasonic sensor ___________________________________________ 26 Figure 4.8: Ultrasonic sensor ___________________________________________ 27 Figure 4.9: Bush in Back side of robot ____________________________________ 28 Figure 4.10: Skotch-Brite at front bottom of robot ___________________________ 29 Figure 4.11: Vacuum cleaner after cutting and fitting ________________________ 30 Figure 4.12: Charger of Robot __________________________________________ 31 Figure 4.13: DC Gear Motor ____________________________________________ 32 Figure 4.14: cassis ____________________________________________________ 32 Figure 4.15: Top view of Chassis ________________________________________ 33 Figure 4.16: Platform Sheets____________________________________________ 34 Figure 4.17: base of robot ______________________________________________ 35 Figure 4.18: Flow chart of Robot ________________________________________ 36

vii

viii

LIST OF TABLES

Table 2.1: Features of Arduino ____________________________________________ 7 Table 2.2: Pin Configuration of ultrasonic module _____________________________ 9 Table 2.3: Electrical parameters of ultrasonic module __________________________ 9 Table 4.1: Battery Rating ________________________________________________ 25

ix

LIST OF ACRONYMS

A

Ampere

AC

Alternating Current

DC

Direct Current

GND

Ground

I/O

Input Output

IC

Integrated Circuit

IDE

Integrated Development Environment

LED

Light Emitting Diode

PCB

Printed Circuit Board

PID

Proportional Integral Derivative

PWM

Pulse Width Modulation

RPM

Revolutions per Minute

USB

Universal Serial Bus

x

Abstract With the advancement of technology, robots are getting more attention of researchers to make life of mankind comfortable. This thesis presents the design, development and fabrication of prototype Floor Cleaning Robot (CLEAR). All hardware and software operations are controlled by Arduino MEGA. This robot can perform sweeping task. Robot operates in autonomous mode and track its path intelligently in such a way that it can clean all the room without human assistance. Ultrasonic sensor is used to detect hurdles. The whole circuitry is connected with 12V battery. This may be prove helpful in improving life style of mankind.

xi

CHAPTER 1: INTRODUCTION TO FLOOR CLEANING ROBOT

1.1 Introduction New era is starting to develop robots among both professionals and non-professional electronics users. With the increased use of open source software and more recently open source hardware, as well as the downfall in prices in the world of electronic tools, engineers find themselves in a situation where they can think of and carry out a vast range of projects. With the use of these open source tools we developed this project. The focus of this project is to design and implement an intelligent robot. It can operate all its operations automatically by using its own intelligence. Artificial intelligence is implemented using sensors and programmed accordingly. This project is a prototype robot which can be extended to a large scale with high perceptive features and operations that it can perform more reliably for community [1].

1.2 Motivation and aim Apart from the small technicalities and conceptual challenges faced in this project, there is one above all, which is meant to serve as a breaking point in the world of common user robotics, amateurs, and engineers, and this is enabling a certain robot that operate automatically in all situations and decide that it can do on its own. As a word is moving towards automation and in this busy life people think about such a device that perform their residential cleaning purposes. As rooms or residential places are not so smooth, there are many hurdles and goods in their way. So we have to design such a robot that not only perform cleaning actions from A to Z but also detect hurdles on its way and take its way automatically [2]. 1

People desire to use things that are efficient and helpful for reducing their tasks. For keeping this in mind there was the main challenge that robot should clean the floor efficiently and accurately. For this purpose we use not only vacuum cleaner but also brushes for pure cleaning and water suckers so that water can also clean if it will be on the path. Apart from achieving intelligent hurdle detection and efficient cleaning another important objective is to develop the robot and it must be of low cost and user friendly. So we design a robot that is not only cost effective but also easy to operate. The forth objective is to provide the robot with a high autonomy in the sense of hours of use without the need for recharging. At the moment, the robot uses a power battery, but this feature can be more efficient by using dynamic charging mechanism.

1.3 Parts of the project The first part of our project is to manufacture and assemble the robot’s structure discussed in later chapter. In the second part we discuss the software for controlling and operation of our robot. The third part concerns the design, implementation and programming the electronic components for this project. First the microcontroller board called Arduino MEGA based on the ATmega2560 running at 16 MHz serves as a nerve center for the robot. The purpose of this board is to detect the hurdles automatically and follow the most appropriate path. Second there is sonar sensor that deals with the hurdle detection and communication for our robot [3]. The nerve center is an open source electronics platform, which users can build their own using electronics IC and other components necessary or buy preassembled. The programming software can be downloaded for free. The sonar sensor, is not open source hardware, but can be configured by following its user’s manual.

2

CHAPTER 2: HARDWARE

2.1 List of Hardware components 1. Arduino MEGA 2. Ultrasonic sensor HC-SR04 3. Regulator LM7805 4. DC gear motors 5. IBT-2 motor driver

2.1.1 Arduino MEGA Top view of arduino MEGA is shown in the figure (2.1). It has 54 digital pins, 16 analog pins and other supply pins and pins that perform specific task such as connecting master slave arduino pair and other [4].

Figure 2.1: Arduino MEGA 3

Features of Arduino Microcontroller

ATmega2560

Operating Voltage

5V

Input Voltage (recommended)

7-12V

Digital I/O Pins

54 (of which 15 provide PWM output)

Analog Input Pins

16

DC Current per I/O Pin

40 mA

DC Current for 3.3V Pin

50 mA

Flash Memory

256 KB of which 8 KB used by bootloader

SRAM

8 KB (ATmega328p)

EEPROM

4 KB (ATmega328p)

Clock Speed

16 MHz Table no 2.1: Features of arduino

4

Figure 2.2: Arduino description

Power Arduino can be turned ON by providing supply via USB cable or power cable that provides 5V. A DC adapter can also be used that outputs 5V and can be used to power arduino. Arduino can operate at voltage ranging from 6 to 12 volt but if we apply less than 6 volt than arduino pins will provide less than 5V. The power pins are as follows: 

VIN. We can power arduino with this pin also. We need to connect this pin to 5V supply that will turn ON arduino.



5V.This pin provides 5V that can be used for general purpose functions that require 5V to operate such as sensor and other components.



3V3. This Pin provides 3.3 volt and 50mA current. Just like 5V pin it can also be used for general purpose.



GND. These are the pins used to connect to ground.

Functions 54 digital pins of arduino can be used as input or output. We can program the pin is input by following command pinMode(PinName, INPUT); Similarly we can assign the pin as output by following command: pinMode(PinName, OUTPUT);

Serial: 0 (RX) and 1 (TX). These pins are used for serial communication and can send and receive serial data. 5

External Interrupts: 2 and 3. These pins are configures by the user for interrupts on different function. We can configure it so that interrupt is called when specific action take place. PWM: 2 to 13: These pins provide Pulse width modulated signal. LED: 13. On board LED is tied to pin 13 of arduino and it turns ON when there is high signal at this pin and turns OFF when there is LOW signal at this pin. Arduino UNO has 16 analog pins that provide voltage signal varying from 0 to 5 volts. It gives 1023 different states of the signal. The upper bound or reference can be changes programmatically using analogRefrence() function.

2.1.2 Ultrasonic module (HC-SR04) Ultrasonic Definition The human ear can hear sound frequency around 20HZ ~ 20KHZ, and the sound that is beyond the ability of human beings 20KHZ is called ultrasonic.

Module pin definitions Type

HC-SR04

Pin Symbol

Pin Function Description

VCC

5V power supply

Trig

Trigger pin

Echo

Receive pin

GND

Power ground

Table 2.2: Pin configuration of ultrasonic module

6

Figure 2.3: Ultrasonic module

Electrical parameters Electrical Parameters (HC-SR04 Ultrasonic Module) Operating Voltage

DC-5V

Operating Current

15 mA

Operating Frequency

40 KHZ

Farthest Range

4m

Nearest Range

2 cm

Measuring Angle

15 Degree

Input Trigger Signal

10us TTL pulse

Output Echo Signal Dimensions

Output TTL level signal, proportional with range 45*20*15 mm

Table 2.3: Electrical parameters of Ultrasonic module

Module operating Principle As the module initializes, Trig and Echo port should be set low. First, we must transmit at least 10us high level pulse to the Trig pin (module automatically sends eight 40K square wave), and then wait for catching the rising edge output by echo port, and start timing by 7

opening the timer. Next, capture the falling edge output by echo port, and read the time of the counter, which is the ultrasonic running time in the air. According to the formula: test distance = (high level time * ultrasonic spreading velocity in air) / 2, distance to the obstacle can be calculated [7].

Ultrasonic Application Ultrasonic Application Technology was introduced in recent decades. With development in electronic technology and the ultrasonic advance, there is an increase in the applications of ultrasonic:  Ultrasonic for measuring distance, depth and thickness;  Ultrasonic testing;  Ultrasound imaging;  Ultrasonic machining, i.e. drilling;  Ultrasonic cleaning;  Ultrasonic welding;

2.1.3 Regulator LM7805 7805 is an easy to use voltage regulator IC which has 1A max current and 5 volts output. The regulator takes an unregulated voltage as input, and converts the fluctuating input voltage into a perfectly regulated power output of 5 volts. For example, when 12 volt lead acid battery is fully charged it can supply about 12.70 volts and when the same battery is fully discharged, it gives out 10.50 volts. Under charging state or load, there can be even more difference. If battery is used as an input source for 7805, output voltage will remain 5 irrespective of the difference in voltage that comes during charging and discharging states.

8

Pin description  3-Terminal Regulators  Output Current up to 1.5 A  Internal Thermal-Overload Protection  High Power-Dissipation Capability  Internal Short-Circuit Current Limiting  Output Transistor Safe-Area Compensation

Figure 2.4: LM7805 regulator

Circuit The two capacitors that are used in circuit are not necessary to use, but for maximizing the voltage regulation, it is good to use these capacitors. The values of the capacitors that used in this circuit have not been written on stone, these values can be changed slightly. 7805 IC has a thermal shutdown feature that works for protecting the IC in case of overheating. Thus, it is safe to use 7805 without using a heat sink plate if load is less than 200mA. However for load over 200mA, we must use a heat sink plate. Heat sink plate 9

should be large enough so that it could bring 7805 heat to such a level that is comfortable to touch. 7805 is a linear voltage regulator, so it has low efficiency and also voltage drop out. Lot of energy is wasted as heat. Wasted energy can be calculated by using the following formula. With this formula, we can make and estimate regarding the size of the heatsink plate we use. (Input Voltage – 5) x Output Current Suppose the input 15 volt and required output current is .5 Amp by using above formula. (15–5) x0.5=10×0.5=5W

Figure 2.5: LM7805 regulator circuit 5W energy is being wasted upon heating and thus a heatsink plate in decent size will be needed. The actual energy that is being used is only (5 x 0.5Amp) =2.5W. So, the wasted energy is two times the utilized energy. On the other hand, if we give 7805 9V as an input, only 2W {(9-5) x 0.5} energy will be wasted as heat. So the conclusion is that at higher input voltages the regulator becomes less efficient. We can try to stay slightly over 7.5V. Do not use very low input, i.e. below 7.5V as in this case regulator will not provide regulated output voltage. For input voltages less than 10

7.5V, a low dropout voltage regulator such as LM2940 should be used. LM2940 and 7805 have same pin connections. No extra components are needed for creating a 5 volt regulated power supply with 7805. However it is a good idea to use one capacitor on input and one on output pins to get a smooth output voltage. It is not necessary to use these capacitors also. As per specs, the input range of 7805 should be between 7.5V to 35V and we haven’t tried more than 15V also. Maximum output current of 7805 is 1A when a good sized heatsink plate is used with. If we want to use more than one 7805 in parallel to get current more than 1A, we should put 0.5 Ohm (10W) resistor on the output pin of each transistor for covering the slight difference in the voltage as technically no two 7805 have the same output voltage.

Applications These applications include on-card regulation to eliminate the distribution and noise problems associated with single-point regulation. We can get up-to 1.5 A of each of these regulators. The internal current-limiting features and thermal-shutdown feature of these regulators make these regulators more immune to load. In addition to use as fixed-voltage regulators, adjustable voltage and current can also be obtained by these devices using external components, and we can also use these as the power-pass element in precision

2.1.4 Servo Motor We fix Servo motor by the help of Glue Gun to rotate sonar sensor form 0 to 90’ and 90’ to 180’ or vice versa. A servomotor is a rotary actuator or linear actuator that allows for precise control of angular or linear position, velocity and acceleration. It consists of a suitable motor coupled to a sensor for position feedback. It also requires a relatively sophisticated controller, often a dedicated module designed specifically for use with servomotors [9]. 11

Figure 2.6: Servo Motor Servo motors are not a specific class of motor although the term servomotor is often used to refer to a motor suitable for use in a closed-loop control system. Servo motors are used in applications such as robotics, CNC machinery or automated manufacturing.

Mechanism of Servo A servomotor is a closed-loop servomechanism that uses position feedback to control its motion and final position. The input to its control is a signal (either analogue or digital) representing the position commanded for the output shaft. The motor is paired with some type of encoder to provide position and speed feedback. In the simplest case, only the position is measured. The measured position of the output is compared to the command position, the external input to the controller. If the output position differs from that required, an error signal is generated which then causes the motor to rotate in either direction, as needed to bring the output shaft to the appropriate position. As the positions approach, the error signal reduces to zero and the motor stops. The very simplest servomotors use position-only sensing via a potentiometer and bangbang control of their motor; the motor always rotates at full speed (or is stopped). This type of servomotor is not widely used in industrial motion control, but it forms the basis of the simple and cheap servos used for radio-controlled models.

12

More sophisticated servomotors use optical rotary encoders to measure the speed of the output shaft and a variable-speed drive to control the motor speed. Both of these enhancements, usually in combination with a PID control algorithm, allow the servomotor to be brought to its commanded position more quickly and more precisely, with less overshooting.

Servo motor pin configuration We can connect small servo motors directly to an Arduino to control the shaft position very precisely. Because servo motors use feedback to determine the position of the shaft, we can control that position very precisely. As a result, servo motors are used to control the position of objects, rotate objects, move legs, arms or hands of robots, move sensors etc. with high precision. Servo motors are small in size, and because they have built-in circuitry to control their movement, they can be connected directly to an Arduino.

Figure 2.7: Servo controlling sonar’s rotation Most servo motors have the following three connections:  Black/Brown ground wire.  Red power wire (around 5V).  Yellow or White PWM wire. In this experiment, we will connect the power and ground pins directly to the Arduino 5V and GND pins. The PWM input will be connected to one of the Arduino's digital output pins. 13

2.1.5 DC gear motors A gear motor is a specific type of electrical motor that has been designed for providing a high torque while maintaining a low speed, motor output. The motors have many uses in many different applications, and are used in many devices in our homes also. Gear motors are commonly found in can openers, garage door openers, washing machine time control knobs and electric alarm clocks. Common commercial applications of the gear motor can be found in hospital beds, commercial jacks, cranes and many other applications [8].

Basic Principles of Operation A gear motor can be either an AC (alternating current) or a DC (direct current) electric motor. The output of most gear motors is between 1,200 to 3,600 revolutions per minute (RPMs). There are two different speed specifications of these motors: normal speed and the stall-speed torque specifications. Gear motors are commonly used for reducing the speed in a series of gears. This is done by an integrated series of gears or a gear box that is attached to the shaft and motor rotor through a second reduction shaft. The second shaft is connected to the series of gears or gearbox for creating a series of reduction gears. Generally speaking, the longer the train of reduction gears, the lower the output of the end, or final, gear will be. A good example of this principle is an electric time clock (the type that uses hour, minute and second hands). The synchronous AC motor that supplies power the time clock spins the rotor usually at around 1500 revolutions per minute. However, a series of reduction gears is used for slowing down the movement of the hands on the clock. For example, if rotor is spinning at about 1500 revolutions per minute, the reduction gears will allow the final secondhand gear to spin at only one revolution per minute also. This is how the secondhand makes one complete revolution per minute on the face of the electric time clock. 14

Gear Motors and Increased Force Gear motors are used in a large number of commercial applications where a piece of equipment is needed for exerting a high amount of force for moving a very heavy object. Examples of these types of equipment include a crane or lift Jack. If we've ever seen a crane in action, we can better understand that how a gear motor works. As we might have noticed, a crane is used for lifting and moving very heavy objects. The electric motor used in most cranes is a type of gear motor that makes use of the basic principles of speed reduction for increasing torque or force. Gear motors that are used in cranes are usually specialty types that need a very low rotational output speed in order to create very large amounts of torque. However, the principles of the gear motor used in a crane and in electric time clock are exactly the same. Using a series of large gear, output speed of the rotor can be reduced until the rotating, RPM speed, of the final gear is very low. The low RPM speed helps in creating a high amount of force which can be used for lifting and moving the heavy objects. We used DC gear motor as shown below:

Figure 2.8: DC gear motors of robot

15

CHAPTER 3: SOFTWARE 3.1 Software used These are the software that we use throughout our project. 

Arduino IDE



Easy-PC

3.1.1 Arduino IDE Introduction Arduino is a tool that can be used to make computers that are more closer to human than standard PCs. It is powered by microcontroller and it is also an open source tool that user can program according to their requirement. By using the arduino’s pins we can perform function according to our will because we just need to program it and its ready to use. You can download arduino IDE at http://arduino.cc/ for download and it’s free. It has a user friendly interface and easy to use environment for user that are using it for the first time. Its user manual is available on arduino’s website and programming techniques area also described for user that are not familiar with it. Latest version of arduino is arduino 1.6.1 and when we open it, it has basic structure of program already written in the editor. Arduino IDE has many sample programs available for user. One that is used most frequently by the user to check the working of arduino is blink LED program. This is a simple program that blinks LED when uploaded to arduino.

16

Figure 3.1: Arduino IDE user interface

Why using Arduino? Lots of open source tool are available globally and their respective software are also available to use them efficiently. Arduino is most frequently used because of following reasons: 

Cheap – Arduino boards are easily available and they are not costly as compared with other open source platforms. 17



Cross-platform – Arduino supports cross platform implementation as it can be easily installed and used to different operating systems such as windows/Mac and Linux.



User friendly – Arduino programming IDE is user friendly and to some extent selfexplanatory. Few easy steps can enable us to use it with great ease and efficiency.



Extendable- As we know, arduino IDE is as open source software so it is available for programmer to extend it according to their requirements.

Arduino Software download Arduino IDE software is available for download at: http://arduino.cc/en/Main/Software

Creating your first program: Basics of creating and running the program. 1. Right click and select open to start arduino IDE 2. Write your code in the editor. 3. Save your code file which is called sketch in arduino’s terminology. 4. Compile your program. 5. Using the serial cable came with arduino board connect arduino to computer 6. Change setting according to your requirements. 7. Click on the arrow at top left to upload the program to arduino board. 8. I am using Tera Term to connect arduino and check the program uploaded.

3.1.2 Easy PC Introduction Easy-PC is a software for designing PCB boards. It can design all type of electronic circuits from simple to complex circuits with ease. Most professional use this software for designing their circuit boards. We also use this software for designing distribution hub PCB board. You can find it here: https://www.numberone.com/. 18

Figure 3.2: Top view of Easy-PC

Why using Easy-PC? There are many PCB design software that are using now a days but Easy-PC is easy to use and reliable. Moreover it contain many functionalities that are very useful for designing circuits. It has many features that other software don’t have.  Fast to learn & easy to use Everything in Easy-PC has been designed with ease of use in mind. In most cases, the main menus are hardly used with shortcut menus being used in all contexts.

19

 Easy part creation Library creation wizards enable you to create Schematic Symbols, PCB Footprints and Components simply and efficiently. Wizards guide you step-bystep through a sequence of operations resulting in the automatic generation of new library items, simply and efficiently.  Design rules checking The Design Rule Check examines your designs and checks for a number of possible errors to help you avoid downstream problems in generating the layout.  Integrated autorouters Easy-PC has two highly efficient and comprehensive autorouters which are fully integrated into the program. The Tracerouter comes as standard with the purchase of an Easy-PC license, whilst the Pro-Router can be purchased additionally if your designs require its powerful capability.

20

CHAPTER 4: DESIGN AND IMPLEMENTATION 4.1

Design and implementation

Complete design and implementation procedure involves following steps: 1. Components design and programming 2. Platform and chassis 3. Finalizing and operation

Component design and programing

• Design of circuits and solding

Plateform and Chassis • It involves all plateform design

Finalizing Implementaion • Final robot

Figure 4.1: Design and implementation We can describe it by using flow chart that is given below:

21

Figure 4.2 Flow Chart

4.1.1 Component design and Programing 1. Motor controller 2. Power supply 3. Distribution hub 4. Ultrasonic sensor 5. Brush 6. Scotch-Brite 7. Vacuum cleaner 8. Battery Charger

1.

Motor Controller

We used a dynamic motor controller to control motors of our robot. Diagram is given below:

22

Figure 4.3: PCB Design It controls only one motor, so for controlling two motors we need same motor controllers. Schematic diagram of IBT-2 is as below:

Figure 4.4: Motor controller 23

Operation The two pins, pin 1 and pin 2 are the sensing pins that are connected to arduino PWN pins and used to sense the current. Two sense input pins are used to operate motor in opposite directions. If one rotate motor in clockwise direction than the other will rotate motor in anti-clockwise direction [5]. Pin 3, 4 and 7 are connected to 5 volt and pin 8 is connected to ground. One other side, first two pins are connected to motors and other two pins are connected to 12 volt power supply. These 12 volts operate the motors according to the instructions given by the arduino by first two pins of first side. IBT-2 is very flexible to relay based h-bridge and more effective than that. It has more resisting power to stand with unwanted environment and operate in must more better way. It is very appreciated by many of the circuit designers. It has many such features that normal H-bridge circuit don’t have.

2.

Power supply

We used a two dry batteries as shown in the figure to power up our robot. It has following specifications.

Figure 4.5: Battery 24

Feature

Rating

Voltage

12V

Current

1.2 Ampere Table 4.1: Battery ratings

3.

Distribution hub

We need two different inputs i.e. 5V and 8V in our robot to power different components of the robot. Distribution hub is the main supply point of our robot that involves power lines for every component. We used 7805 regulator to get 5V power supply for sensors and arduino as they operate at 5V. We used male to female pins to connect sensors to the power supply. Following figure shows the distribution hub. USB female jack are used to providing supply to the arduino [12].

Figure 4.6: Distribution Hub

25

4.

Ultrasonic Sensor

We used HC-SR04 ultrasonic module for obstacle detection installed in front of the robot. Its pin configuration is shown in figure.

Figure 4.7: Ultrasonic sensor

Pin connections front Ultrasonic sensor  Vcc pin is connected to 5V provided by the regulator in the distribution hub.  GND is connected to ground female pins at the distribution hub.  Trig pin is connected to arduino digital pin 8.  Echo pin is connected to arduino digital pin 9. Pins are defined as #define TRIGGER_PIN 8 // Arduino pin tied to trigger pin on the ultrasonic sensor. #define ECHO_PIN

9 // Arduino pin tied to echo pin on the ultrasonic sensor.

Ultrasonic sensor (Back) We used HC-SR04 ultrasonic module for obstacle detection at the backside of the robot. It pin configuration is shown in figure 4.8. 26

Figure 4.8: Ultrasonic sensor

Pin connections front Ultrasonic sensor  Vcc pin is connected to 5V provided by the regulator in the distribution hub.  GND is connected to ground female pins at the distribution hub.  Trig pin is connected to arduino digital pin 10.  Echo pin is connected to arduino digital pin 11. Pins are defined as #define TRIGGER_PIN 10 // Arduino pin tied to trigger pin on the ultrasonic sensor. #define ECHO_PIN

5.

11 // Arduino pin tied to echo pin on the ultrasonic sensor.

Brush

We fix the brush at the back bottom side for cleaning the garbage that will remain. Brush, a device composed of bristles typically set into a handle and used especially for sweeping, smoothing. It is one of the most basic and versatile tools known to mankind, and the average household may contain several dozen varieties. The material of both the 27

block and bristles or filaments is chosen to withstand hazards of its application, such as corrosive chemicals, heat or abrasion.

Figure 4.9: Bush in Back side of robot

6.

Scotch-Brite:

We fix the Scotch-Brite and 12v motors with CD’s by the help of Glue Gun. Scotch-Brite is a line of abrasive cleaning pads produced by 3M. The original product line consisted of spun polypropylene fiber with about nine grit variations. Scotch-Brite also contains "Alox", which is a trade name for aluminum oxide.

28

Figure 4.10: Scotch-Brite at front bottom of robot

7.

Vacuum Cleaner We cut Vacuum Cleaner with saw cutter to get small size and fix on lower Acrylic

sheet with the help of Glue-Gun [10].  Operates on 12 Volts 29

 Vehicle Power Adapter Included  Washable Filter  Compact, Lightweight Design  Lightweight, compact, easy to use and affordable  Powerful suction  Rated input power: 60W  Color: As the picture shows  Size: 28*7.5*11 cm (approx.)

Figure 4.11: Vacuum cleaner after cutting and fitting

8.

Battery Charger: We designed a charger for 12 volt battery that charged the battery by USB socket. Charger consist of transformer, 2200uF / 25 volt capacitor and 2 diodes. Step down transformer convert the 220V to 12 volt. Next capacitor convert it into pulsating DC 30

next bridge diodes convert it into DV 17 volts. After this we connect USB female port to it. USB male port connect with battery male port [11].

Figure 4.12: Charger of Robot

4.1.2 Platform and chassis Robot platform selection is very important as it should look like a robot after completion. Chassis that we selected is 4 wheel drive platform. Two DC motors are used to gear up the robot. Rear wheels are connected to motors, and front wheel are connected to the gear system with two separate shafts. Left motor controls both left front and rear wheels and right motor controls both right rear and front wheels. Figure (4.13) shows the rear portion with motors.

31

Figure 4.13: DC Gear Motor

Next, front view of the chassis is shown in figure (4.14) and the shaft is clearly visible that control the front wheels.

Figure 4.14: cassis

32

Next, top view of the chassis is shown in figure (4.15). It has 8cm long bolts to hold the top base of the chassis.

Figure 4.15: Top view of Chassis Upper and Lower bases of the robot platform are made up of 3mm white colored acrylic sheets as shown in figure 4.16.

33

Figure 4.16: Platform Sheets First base is held by the 8cm long bolt with the help of nuts and similarly 2nd or top base is held by the bolts in the first base. Final robot chassis looks like this (Figure 4.17)

34

Figure 4.17: base of robot

4.1.3 Finalizing and operation This step involves two point to be discussed in detail given as: 1. Flow chart of the robot 2. Operation of the robot

1. Flow chart of the robot Flow chart describes flow control of the robot. It shows how robot will operate in specific situation. The chart is given below:

35

Figure 4.18: Flow chart of Robot

2. Operation: Out intelligent robot has following operations: i.

Forward movement

ii.

Right turn

iii.

Left turn

iv.

Backward movement

v.

Stop

vi.

Dynamic left right rotation

vii.

Obstacle detection and collision avoidance

These functions are discussed in detail.

36

i.

Forward movement

Our intelligent robot moves forward when we on power button. When no hurdle in front up to 20cm, arduino switches to the case in the program that gives high positive voltage to both motors which in turn moves the robot forward.

ii.

Right turn

When there will be hurdle in front of robot in a range of 20cm, robot will stop and servo motor moves sonar towards right. If there is no hurdle in a range of 30cm then robot will move towards right at an angle of 180o. This operation will perform in such a way that right motor will stop while left motor will move until robot rotate at 180o. This is accomplished by using a delay for 9 seconds.

iii.

Left turn

When there will be hurdle in front of robot in a range of 20cm, and also hurdle in right direction in a range of 30cm, robot will stop and servo motor moves sonar towards left. If there is no hurdle in a range of 30cm then robot will move towards left at an angle of 180o. This operation will perform in such a way that left motor will stop while right motor will move until robot rotate at 180o. This is accomplished by using a delay for 9 seconds.

iv.

Backward movement When there will be hurdle in front of robot in a range of 20cm, and also hurdle in right or left directions in a range of 30cm, robot will moves towards back. This operation will perform in such a way left and right motors moves clockwise and robot moves towards 37

back. This is accomplished by using a delay for 9 seconds. In this time slot robot will moves 6 inches back.

v.

Stop

Stopping the robot is done by taking the 0 signal at arduino pin. This stops both the motors by sending a low signal to the controller which in turn stops both the motors.

vi.

Dynamic left right rotation of robot

When robot first time moves towards right at 180o then other time it will moves towards left in first attempt. This is accomplished by using Boolean variable in programming that controls the dynamic motion of robot.

38

CHAPTER 5: COMPLETE SOURCE PROGRAM

#include #include

Servo myservo; // create servo object to control a servo int val; // variable to read the value from the random ftn

#define ECHO_PIN 10 #define TRIGGER_PIN 11 #define MAX_DISTANCE 200

int RPWMl_Output = 5; // Arduino PWM output pin 5; connect to IBT-2 pin 1 (RPWM) int LPWMl_Output = 6; int RPWMr_Output = 7; // Arduino PWM output pin 7; connect to IBT-2 pin 1 (RPWM) int LPWMr_Output = 8;

NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); int DistanceCm; int var;

39

int angle; bool leftOrRight;

bool frontHurdle; bool leftHurdle; bool rightHurdle;

void setup() {

// put your setup code here, to run once: leftOrRight=true; Serial.begin(9600); myservo.attach(9); // attaches the servo on pin 9 to the servo object angle=90;

pinMode(RPWMl_Output, OUTPUT); pinMode(LPWMl_Output, OUTPUT); pinMode(RPWMr_Output, OUTPUT); pinMode(LPWMr_Output, OUTPUT);

frontHurdle = true; 40

leftHurdle = true; rightHurdle =true; }

void loop() { // put your main code here, to run repeatedly:

DistanceCm = sonar.ping_cm(); Serial.print("Ping: "); Serial.println(DistanceCm); Serial.println(" cm "); Serial.print("Angle: "); Serial.println(angle);

if(frontHurdle == false && leftHurdle == false && rightHurdle == false) { analogWrite(LPWMl_Output, 255); analogWrite(RPWMl_Output, 0); analogWrite(LPWMr_Output, 255); analogWrite(RPWMr_Output, 0); 41

delay(2000); analogWrite(LPWMl_Output, 0); analogWrite(RPWMl_Output, 0); analogWrite(LPWMr_Output, 0); analogWrite(RPWMr_Output, 0); frontHurdle = true; leftHurdle = true; rightHurdle = true; var=1; }

if(angle==90 && DistanceCm0) {

analogWrite(LPWMl_Output, 0); analogWrite(RPWMl_Output, 0); analogWrite(LPWMr_Output, 0); analogWrite(RPWMr_Output, 0); Serial.println("I am in 1st loop"); if(leftOrRight==true){ 42

var=1; leftOrRight=false; } else if(leftOrRight==false) { var=4; leftOrRight=true; }

frontHurdle = false;

}

if(angle==0 && DistanceCm>=30) {

//rightHurdle = true;

Serial.println("There is no hurdle in my path");

43

analogWrite(LPWMl_Output, 0); analogWrite(RPWMl_Output, 255); analogWrite(LPWMr_Output, 0); analogWrite(RPWMr_Output, 0);

delay(20); angle=90; myservo.write(90); delay(9000); analogWrite(LPWMl_Output, 0); analogWrite(RPWMl_Output, 0); analogWrite(LPWMr_Output, 0); analogWrite(RPWMr_Output, 0); }

if(angle==180 && DistanceCm>=30) {

//leftHurdle = true;

Serial.println("There is no hurdle in my path"); 44

analogWrite(LPWMl_Output, 0); analogWrite(RPWMl_Output, 0); analogWrite(LPWMr_Output, 0); analogWrite(RPWMr_Output, 255);

delay(20); angle=90; myservo.write(90); delay(9000); analogWrite(LPWMl_Output, 0); analogWrite(RPWMl_Output, 0); analogWrite(LPWMr_Output, 0); analogWrite(RPWMr_Output, 0); } if(angle==90 && DistanceCm>20) {

//frontHurdle = true;

Serial.println("There is no hurdle in my path"); 45

analogWrite(LPWMl_Output, 0); analogWrite(RPWMl_Output, 255); analogWrite(LPWMr_Output, 0); analogWrite(RPWMr_Output, 255); }

if(angle==0 && DistanceCm0) {

Serial.println("I am in 2nd loop"); analogWrite(LPWMl_Output, 0); analogWrite(RPWMl_Output, 0); analogWrite(LPWMr_Output, 0); analogWrite(RPWMr_Output, 0); var=2; rightHurdle = false; } 46

if(angle==180 && DistanceCm0) {

Serial.println("I am in 3rd loop"); analogWrite(LPWMl_Output, 0); analogWrite(RPWMl_Output, 0); analogWrite(LPWMr_Output, 0); analogWrite(RPWMr_Output, 0); var=3; leftHurdle = false; }

switch(var) { case 1: for(angle=90;angle>=0;angle--){ analogWrite(LPWMl_Output, 0); analogWrite(RPWMl_Output, 0); 47

analogWrite(LPWMr_Output, 0); analogWrite(RPWMr_Output, 0); myservo.write(angle); delay(20); Serial.println(angle); }

delay(500); Serial.println("I am OUT OF 1st loop"); delay(500); var=0; angle=0; break; Serial.println("------END------");

case 2: for(angle=0;angle=90;angle--){ myservo.write(angle); delay(20); Serial.println(angle); }

delay(500); Serial.println("I am OUT OF 3rd loop"); 49

delay(500); var=0; angle=90; break; Serial.println("------END------");

case 4: for(angle=90;angle