Top Banner
-ELECTRICAL ENGINEERING DEPARTMENT- DIPLOMA OF ELECTRICAL ENGINEERING LAST PROJECT REPORT TITLE HANDPHONE CONTROLLED ROBOT Prepared by : SANIY BIN HAJI AHMAD 07DET12S1002 MUHAMMAD ABU SOFIAN BIN ABU BAKAR 07DET12S1006 RIDZUAN BIN MAKLIN 07DET12S1003
114

Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Dec 25, 2015

Download

Documents

Laporan Projek Akhir POLITEKNIK (ELEKTRIK)
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

-ELECTRICAL ENGINEERING

DEPARTMENT-

DIPLOMA OF ELECTRICAL ENGINEERING

LAST PROJECT REPORT

TITLEHANDPHONE CONTROLLED ROBOT

Prepared by :

SANIY BIN HAJI AHMAD 07DET12S1002

MUHAMMAD ABU SOFIAN BIN ABU BAKAR 07DET12S1006

RIDZUAN BIN MAKLIN 07DET12S1003

Supervised by :

Mr Chin Ken Leong

Page 2: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Electrical Engineering Department Lecturer

RESEARCH ABOUT HANDPHONE CONTROLLED ROBOT

NAMEREGISTER NUMBER

1. SANIY BIN HAJI AHMAD07DET12S1002

2. MUHAMMAD ABU SOFIAN BIN ABU BAKAR07DET12S1006

3. RIDZUAN BIN MAKLIN07DET12S1003

ELECTRICAL ENGINEERING DEPARTMENT

KOTA KINABALU POLYTECHNIC

SESI JULAI 2012

LA

ST

PR

OJE

CT

RE

PO

RT

DIP

LO

MA

EL

EC

TR

ICA

L E

NG

INE

ER

ING

SE

SI JU

LA

I 2012

Page 3: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)
Page 4: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

RESEARCH ABOUT HANDPHONE CONTROLLED ROBOT

NAME REGISTER NUMBER

1. SANIY BIN HAJI AHMAD 07DET12S1002

2. MUHAMMAD ABU SOFIAN BIN ABU BAKAR 07DET12S1006

3. RIDZUAN BIN MAKLIN 07DET12S100

This proposal submitted to Electrical Engineering Department Of Kota Kinabalu Polytechnic as fulfil qualification to graduate in Diploma of Electrical Engineering

VERIFICATION PROJECT REPORT

Project report title is Handphone Controlled Robot.

Page 5: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Revised :

Supervisor Name : Mr Chin Ken Leong

Supervisor Signature :

Date :

Certified by :

Coordinator name :

Coordinator signature :

Date :

"We attribute this work is the result of our own work except excerpts which we have explained each source."

1. Signature :Name : Saniy Bin Haji AhmadRegister Number : 07DET12S1002Date :

2. Signature :Name : Muhammad Abu Sofian Bin Abu BakarRegister Number : 07DET12S1006Date :

3. Signature :Name : Ridzuan Bin MaklinRegister Number : 07DET12S1003Date :

Page 6: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

ACKNOWLEDGEMENTS

Alhamdulillah pray to Allah because favor and grace from Allah, finally got our

complete the full report as well as on electrical engineering projects. In preparing this

report, too many trials and challenges our task ahead, but had all of that we made as a

lesson and experience is quite valuable because tired tired we finally pays off when

the report was finally successfully completed perfectly and successfully. Gratitude

of thanks to our supervisor Mr Chin Ken Leong because helped us in all respect

especially when we almost lost enthusiasm because of the stalemate to figure out a

proper way to solve the problem in the face. In addition, the acknowledgement to all

the lecturers Kota Kinabalu Polytechnic as contribute guidance to us about this study.

This speech is intended to. This speech was addressed to both our parents because a

lot of support and help us financially, spirit and moral. Do not forget also to the Pitas

District Education Office, Sandakan Fire Department, prison Department Kepayan

and classmates and those involved directly and indirectly in helping us complete this

report successfully. Wassalam.

Page 7: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

ABSTRACT

A robot is an electro-mechanical device that can perform autonomous or

preprogrammed tasks. A robot may act under the direct control of a human (eg. the

robotic arm of the space shuttle) or autonomously under the control of a programmed

computer. Robots may be used to perform tasks that are too dangerous or difficult for

humans to implement directly (e.g. nuclear waste clean up) or may be used to

automate repetitive tasks that can be performed with more precision by a robot than

by the employment of a human (e.g. automobile production.)

This project aims at designing a robot, which has freedom of movement along

all the 3 axes and its motion is controlled by means of wheels. The user can control

the movements using a Cellphone from a remote place. The system is made more

useful by introducing artificial intelligence to it. By artificial intelligence, we mean

designing the robot is such a manner that in situation which require decision making,

the robot identifies the presence of the obstacle, alerts the user and moreover awaits

instruction from the user for the further action. Other condition, which the robot can

determine, is presence of fire. I.e., high temperature and presence of metals in

vicinity.

Page 8: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Contents

Chapter Case Page

Page Title i

Verification Project Report iii

Students Certificate iv

Acknowledge v

Abstract vi

Contents vii

List of Tables viii

List of Figures xii

List of Photos xiii

Page 9: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

1 INTRODUCTION

1.1 Introduction 1

1.1.1 Introduction of Robot 2

1.2 Problem Found 3

1.3 Objective 5

1.4 Scope Research 5

2 LITERATURE REVIEW

2.1 Introduction 8

2.2 MPLSB IDE 10

2.3 DTMF (Dual Tone Mode Frequency) 10

2.4 Infrared (IR) Object Detection Module 10

2.5 Bluetooth module 11

2.6 Integrated L293B 12

2.7 Microcontroller 13

3 METHODOLOGY

3.1 Introduction 19

3.1.1 Robotik and Microcontroller

3.2 Methodology Flow Chart 20

3.3 Phase 1 21

3.4 Phase 2 23

3.5 Phase 3 24

3.6 Phase 4 25

Page 10: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

4 FINDING

4.1 42

4.2 47

4.3 51

5 DISCUSSION

5.1 54

5.2 57

5.3 58

6 CONCLUSION

6.1 60

6.2 61

REFERENCE 65

ATTACHMENT A

ATTACHMENT B

ATTACHMENT C

Page 11: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

LIST OF TABLES

NO TABLES TABLES PAGES

3.1 29

4.1 43

4.2 45

4.3 47

4.4 49

5.1 57

Page 12: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

LIST OF FIGURES

NO OF FIGURE TITLE PAGE

3.1 22

4.1 44

5.1 56

6.1 56

Page 13: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

LIST OF PHOTOS

No.Photo Title

Pages

2.1 13

2.2 13

2.3 14

2.4 14

2.5 15

3.1 27

3.2 28

3.3 36

3.9 33

3.10 32

3.11 35

3.12 36

3.13 39

3.14 39

4.1 52

4.2 52

Page 14: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

LIST OF ATTACHMENTS ATTACHMENTS TITLE

A

B

C

Provided by : Saniy Bin Haji Ahmad

Page 15: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

CHAPTER 1

INTRODUCTION

1.1 Introduction

Robotics is the branch of technology that deals with the design, construction, opera-

tion, and application of robots, as well as computer systems for their control, sensory

feedback, and information processing. These technologies deal with automated ma-

chines that can take the place of humans in dangerous environments or manufactur-

ing processes, or resemble humans in appearance, behavior, and/or cognition. Many

of today's robots are inspired by nature contributing to the field of bio-inspired robot-

ics.

Photo 1.1 : Robot from 2 DC motor

Page 16: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

The concept of creating machines that can operate autonomously dates back to clas-

sical times, but research into the functionality and potential uses of robots did not

grow substantially until the 20th century. Throughout history, robotics has been often

seen to mimic human behavior, and often manage tasks in a similar fashion. Today,

robotics is a rapidly growing field, as technological advances continue, research, de-

sign, and building new robots serve various practical purposes, whether domestically,

commercially, or militarily. Many robots do jobs that are hazardous to people such as

defusing bombs, mines and exploring shipwrecks

1.2 Introduction Of Robot

1.2.1 As strange as it might seem, there really is no standard definition for a robot. How-

ever, there are some essential characteristics that a robot must have and this might

help you to decide what is and what is not a robot. It will also help you to decide

what features you will need to build into a machine before it can count as a robot.

1.2.2 A robot has these essential characteristics:

1.2.2.1 Sensing First of all your robot would have to be able to sense its surroundings. It

would do this in ways that are not unsimilar to the way that you sense your surround-

ings. Giving your robot sensors: light sensors (eyes), touch and pressure sensors

(hands), chemical sensors (nose), hearing and sonar sensors (ears), and taste sensors

(tongue) will give your robot awareness of its environment.

1.2.2.2 Movement A robot needs to be able to move around its environment. Whether

rolling on wheels, walking on legs or propelling by thrusters a robot needs to be able

to move. To count as a robot either the whole robot moves, like the Sojourner or just

parts of the robot moves, like the Canada Arm.

1.2.2.3 Energy A robot needs to be able to power itself. A robot might be solar powered,

electrically powered, battery powered. The way your robot gets its energy will de-

pend on what your robot needs to do.

1.2.2.4 Intelligence A robot needs some kind of "smarts." This is where programming en-

ters the pictures. A programmer is the person who gives the robot its 'smarts.' The ro-

Page 17: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

bot will have to have some way to receive the program so that it knows what it is to

do.

Photo1.2 : GSM controlled robot

Well it is a system that contains sensors, control systems, manipulators, power sup-

plies and software all working together to perform a task. Designing, building, pro-

gramming and testing a robots is a combination of physics, mechanical engineering,

electrical engineering, structural engineering, mathematics and computing. In some

cases biology, medicine, chemistry might also be involved. A study of robotics

means that students are actively engaged with all of these disciplines in a deeply

problem-posing problem-solving environment.

Photo 1.3 : Microcontroller

Page 18: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

1.3 Problem found

I.3.1 The application that we found in this research to communicated handphone with

microcontroller PIC18F4550 is as follows:

I.3.2 First application is using Dual Tone Multiple Frequency (DTMF) – Using two

mobile phones for effective transmission and reception by DTMF. The problem

using this application is cannot using PIC18F4550 . It can only used PIC16F and

PIC24F.

I.3.3 Second application we found is using arduino application – This application is

Android controlled robot by Bluetooth. The problem using this application is cannot

using microcontroller PIC18F, it just can used microcontroller from arduino and all

of application at smartphone is arduino application.

I.3.4 Third application is using Bluetooth robot there was install at smart phone and

controlled PIC 18F4550 by bluetooth through integrated L923B . This application

give us full of data except full circuit diagram from proteus. Given just a picture of

components that installed at PCB layout and has a label at all of the component. This

application is very suitable but the problem is full data from Bluetooth Robot website

that has been downloaded don’t give the circuit diagram from proteus. But the

picture PCB layout and all of the component included and we can redraw based on

picture PCB layout given with support and guide from supervisor.

Page 19: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

1.4 Objective

The objective of our project is to control the robot by mobile phone. In this project,

the robot is controlled by a mobile phone that makes a call to the mobile phone

attached to the robot. In the course of a call, if any button is pressed, a tone

corresponding to the button pressed is heard at the other end of the call. This tone is

called ‘dual-tone multiple frequency’ (DTMF) tone. The robot perceives this DTMF

tone with the help of the phone stacked in the robot. The received tone is processed

by the ATmega16 microcontroller with the help of DTMF decoder MT8870. The

decoder decodes the DTMF tone into its equivalent binary digit and this binary

number is sent to the microcontroller. The microcontroller is pre programmed to take

a decision for any given input and outputs its decision to motor drivers in order to

drive the motors for forward or backward motion or a turn. The mobile that makes a

call to the mobile phone stacked in the robot acts as a remote. So this simple robotic

project does not require the construction of receiver and transmitter units. DTMF

signaling is used for telephone signaling over the line in the voice-frequency band to

the call switching centre. The version of DTMF used for telephone tone dialing is

known as ‘Touch-Tone’. DTMF assigns a specific frequency (consisting of two

separate tones) to each key so that it can easily be identified by the electronic circuit.

The signal generated by the DTMF encoder is a direct algebraic summation, in real

time, of the amplitudes of two sine (cosine) waves of different frequencies, i.e.,

pressing ‘5’ will send a tone made by adding 1336 Hz and 770 Hz to the other end of

the mobile phone.

1.5 Scope Research

Scope research in this project is including all of literature review is as follows :

Most suitabale application to communicated handphone to PIC18F4550

Input Device

Input Interface

Programming Microcontroller PIC18F4550

Output Interface

Output Device

Page 20: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

CHAPTER 2

LITERATURE REVIEW

2.1. INTRODUCTION OF SCIENTIFIC ASPECT

Remote control vehicles have various scientific uses including hazardous

environments, working in the deep ocean, and space exploration. RCV is used by

police to detect bombs,or some chemicals,etc. It detects chemicals or whatever with

its high-power sensors. The majority of the probes to the other planets in our solar

system have been remote control vehicles, although some of the more recent ones

were partially autonomous. The sophistication of these devices has fueled greater

debate on the need for manned spaceflight and exploration. The Voyager I spacecraft

is the first craft of any kind to leave the solar system. The martian

explorers Spiritand Opportunity have provided continuous data about the surface of

Mars since January 3, 2004.

Jason is the Woods Hole Oceanographic Institution's deep water explorer and can

withstand depths of up to 6,500 feet. The Scorpio ROV is a British submersible that

rescued the crew of the Russian AS-28 on August 7, 2005.

2.1.1 Military and law enforcement

Military usage of remotely controlled military vehicles dates back to the first half of

20th century. John Hays Hammond, Jr., invented and patented methods for wireless

control of ships starting in 1910. Soviet Red Army used remotely

controlled teletanks during 1930s in the Winter War and early stage of World War II.

There were also remotely controlled cutters and experimental remotely controlled

planes in the Red Army.

Page 21: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Remote control vehicles are used in law enforcement and military engagements for

some of the same reasons. The exposure to hazards are mitigated to the person who

operates the vehicle from a location of relative safety. Remote controlled vehicles are

used by many police department bomb-squads to defuse or detonate explosives.

See Dragon Runner,Military robot.

Unmanned Aerial Vehicles (UAVs) have undergone a dramatic evolution in

capability in the past decade. Early UAV's were capable of reconnaissance missions

alone and then only with a limited range. Current UAV's can hover around possible

targets until they are positively identified before releasing their payload of weaponry.

Backpack sized UAV's will provide ground troops with over the

horizon surveillance capabilities.

2.1.2 Recreation and hobby

See Radio-controlled model. Small scale remote control vehicles have long been

popular among hobbyists. These remote controlled vehicles span a wide range in

terms of price and sophistication. There are many types of radio controlled vehicles.

These include on-road cars, off-road trucks, boats, airplanes, and even helicopters.

The "robots" now popular in television shows such as Robot Wars, are a recent

extension of this hobby (these vehicles do not meet the classical definition of a robot;

they are remotely controlled by a human). Radio-controlled submarine also exist.

Recently, Sony Ericsson released a remote control car that could be controlled by

any Bluetooth cell phone. Radio is the most popular because it does not require the

vehicle to be limited by the length of the cable or in a direct line of sight with the

controller (as with the infrared set-up).

Page 22: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

2.2 FIRMWARE TOOLS

The following device programming software are sufficient and effective tools for

PIC firmware implementation. These will be briefly explained in the subsections.

2.2.1 MPLAB IDE

2.2.1.1 MPLAB® IDE is a powerful firmware development tool which supports many

compiling options and debugging interfaces hence provides a flexible and structural

development environment for the programmer. It can on run on Windows® platform

as a 32-bit application. The environment is simply a notepad application which is

assisted by supplementary features. The tool is freely provided by Microchip® and its

final release can be downloaded from: www.microchip.com (can be found at the

design section of the page). Previous versions can be found at the archive page:

http://www.microchip.com/stellent/idcplg?

IdcService=SS_GET_PAGE&nodeId=1406&dDoc Name=en023073 .

2.2.1.2 Here, the installation of the version 8.43 of MPLAB will be explained. The

installation procedure can differ according to the final release of the tool. Therefore,

consult the relevant documents before installing the final versions.

I) Download the MPLAB 8.43 from the webpage1:

http://www.microchip.com/stellent/idcplg?

IdcService=SS_GET_PAGE&nodeId=1406&dDoc

Name=en019469&part=SW007002

II) Extract the .zip package to a folder

III) If there is a previous installation of the software (older than 8.43), remove it prior to

installation.

IV) If the pages are updated, you can find the final versions (as well as the previous

releases) of the software tools presented in this document from the relevant sections

Page 23: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

of the microchip webpage or archives

V) In the extracted folder, run setup.exe with an administrative profile and follow the

recommended remarks, accept the license terms, select complete installation etc.

VI) At this stage, MPLAB will validate your installation which will take about 10-30

minutes depending on how you follow the instructions. If you forgot to remove the

previous installations, the program will first try to uninstall those configurations.

VII) After a while, the installation program will ask you to install the HI-TECH C

compiler which is the default compiler for PIC10/12/16 microcontrollers to be used

within MPLAB. Select Yes to install the final version of the compiler (9.70 is the

final release of this compiler for now).

Photo 2.1 : Installing MPLAB C Language

VIII) Click Next, accept the license agreement, note on the installation directory,

check the “Add the environment path” option.

IX) Restart your computer

After the installation of MPLAB IDE is complete, you can see the documentation

related to various tools and patches used in MPLAB.

Page 24: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Photo 2.2 : Release Notes and Installed Tools for MPLAB

2.2.1.3 If you have any problems with the installation steps, refer to the

documentations of MPLAB from its webpage. From the webpage, you can

also find useful links on writing codes in C with example applications

documented by MPLAB communities and forums, describing the application

procedures (hardware configurations, compiling options) as well

(http://www.microchip.com/stellent/idcplg?

IdcService=SS_GET_PAGE&nodeId=1408). In this document, only the

procedure regarding the implementation of a simple PIC-to-PC

communication via USB is presented. You are encouraged to refer to the

documentations, examples and forums of the software/hardware publishers in

the implementation steps of task-specific applications (A to D conversion,

PWM, Timers etc).

Page 25: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

2.2.2 MPLAB C18 Compiler

MPLAB® C18 compiler is one of the compiling tools for programming PIC18

MCUs. It is supported by MPLAB IDE as a compiler; hence very little effort is

needed by the programmer to compile the source code. There are also other C

compiler tools of MPLAB for programming 16 and 32 bit PIC microcontrollers

(PIC24 and PIC32). However, only the C18 compiler is considered in this tutorial as

it is the primary tool for programming the most commonly used PIC18 devices in the

market (PIC18F4550, PIC18F2550, PIC18F4450 etc.).

The tool was known as MPLAB C18 Compiler Student Edition and was able to

support code optimizations for 60 days. Lately, it was upgraded to separate final

(free) releases in which the code optimizations are limited for academic use. Free

versions of the C18 compiler with code optimizations for 60 days are available on

the webpage (Download the standard evaluation version):

Page 26: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

2.3 DTMF (dual tone multi frequency)

2.3.1 DTMF (dual tone multi frequency) is the signal to the phone company that

you generate when you press an ordinary telephone's touch keys. In the

United States and perhaps elsewhere, it's known as "Touchtone" phone

(formerly a registered trademark of AT&T). DTMF has generally replaced

loop disconnect ("pulse") dialling. With DTMF, each key you press on your

phone generates two tones of specific frequencies. So that a voice can't

imitate the tones, one tone is generated from a high-frequency group of tones

and the other from a low frequency group. Here are the signals you send

when you press your Touchtone phone keys:

DigitLow frequency

High frequency

1 697 1209 Hz2 697 13363 697 14774 770 12095 770 13366 770 14777 852 12098 852 13369 852 14770 941 1336* 941 1209# 941 1477

Table 2.1 : Touchtone phone keys

2.3.2 A number of companies make microchips that send and receive DTMF

signals. The Telephony Application Program Interface (TAPI) provides a

way for a program to detect DTMF digits.

Page 27: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

2.4 Infrared (IR) Object Detection Module Circuit Using IR LED and

Photodiode

Photo 2.3 : IR LED and Photodiode

2.4.1 The IR object detection module is quiet easy to make. This circuit below is a

low cost / low range infrared object detection module that you can easily

make at home using IR sensors. We will use a photodiode and IR LED to

make a simple circuit. IR led looks like a regular LED that you usually see in

Television Remote controls. I found a small kit for infrared IR sensor circuit

and sharing this here. For now I have added a regular LED to glow when

something is detected , you can replace it with a buzzer or something else the

way you wish.

2.4.2 The Main concept is simple , the IR led keeps transmitting IR infrared rays up

to some range (there is a potentiometer also in the design with the help of

which you can alter the range). When some object comes in the IR infrared

range, the IR waves hits the object and comes back at some angle, Photo

diode detects that IR  rays and hence works as a sensor.

Page 28: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

2.4.3 Requirements

1  -IR  LED 1 PR (photodiode) 1 1k resistance 1 220E resistance 1- 6k8 resistance 1 10k potentiometer

2.4.4 Circuit diagram

Photo 2.4 : IR Circuit Diagram

Page 29: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Photo 2.5 : PCB layout

2.4.4 For now in this circuit a LED is glowing as an example , You can use it the

way you wish, You can use it to run some DC motors and make a simple

robot. Or the logic 1 can be used to do complex operation with interface to

some microcontroller for some complex projects.

2.4 Bluetooth module

2.4.1 With the Dwengo Bluetooth module, you can communicate wireless to your

projects. You can build your own cell phone controlled robot  or a home au-

tomation system  . The Bluetooth module is based on a class 2 HC-06 mod-

ule and supports Bluetooth v2.0. Thanks to its serial interface (TTL level) the

Bluetooth module is easy to use.

2.4.2 The communication bandwidth of the module can be configured for 1200,

2400, 4800, 9600, 19200, 38400, 57600 or up to 115200 baud. When active,

the module uses 40 mA.

2.4.3 The Dwengo Bluetooth module has four pins: two are used for serial commu-

nication (RXD and TXD), while the other two are used as a power supply

(GND and 5V):

Page 30: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Photo 2.6 : Bluetooth Module

2.4.4 The easiest way to connect the Bluetooth module to your Dwengo board is by

using the breadboard. Connect pins GND and 5V to the - and + lines of the

breadboard. The RXD and TXD pins must be connected to the RC6 and RC7

pins of the Dwengo board:

Photo. 2.7 : Connection with microcontroller

2.4.5 If you connect the Bluetooth module in this way, it is important to discon-

nect jumper JP1-4 such that there is no connection between the RS232 chip

on the Dwengo board and the Bluetooth module!

2.4.6 After connecting the Bluetooth module to your Dwengo board, you can use

the USART module built into the PIC18F4550 to communicate with your

Bluetooth module. The standard configuration is 9600 baud, 8 data bits, 1

stop bit and no parity bit.

2.4.7 Whenever your Bluetooth module (and thus Dwengo board) is active it will

be recognized by your computer. Therefore you need to connect linvor with

your computer. The passphrase is 1234.

Page 31: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

2.4.8 To change the properties of the Bluetooth module you can use following AT

codes:

2.4.8.1 AT+PINabcd where abcd is the new passphrase

2.4.8.2 AT+BAUDx with x = 1 to 8 with which you can configure the bandwidth

from 1200 baud to 115200 baud, standard configuration is BAUD4 = 9600

baud

2.4.8.3 AT+NAMExyz where xyz is a new name for the Bluetooth module.

Page 32: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

2.5 L293B

PUSH-PULL FOUR CHANNEL DRIVERS

OUTPUT CURRENT 1A PER CHANNEL

PEAK OUTPUT CURRENT 2A PER CHANNEL

(non repetitive)

INHIBIT FACILITY

HIGH NOISE IMMUNITY

SEPARATE LOGIC SUPPLY

OVERTEMPERATURE PROTECTION

Photo 2.8 : Integrated L293B

2.5.1 DESCRIPTION

The L293B and L293E are quad push-pull drivers capable of delivering output

currents to 1A per channel. Each channel is controlled by a TTL-compatible logic

input and each pair of drivers (a full bridge) is equipped with an inhibit input which

turns off all four transistors. A separate supply in-put is provided for the logic so that

it may be run off a lower voltage to reduce dissipation.

Page 33: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

2.5.2 Additionally, the L293E has external connection of

2.5.2.1 PIN CONNECTION

Figure 2.1 : Pin connection for L293B

Figure 2.2 : Pin connection for L293E

DIP16 - L293B

POWERDIP (16+2+2) - L293E

Page 34: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

2.5.2.2BLOCK DIAGRAMS

DIP16 - L293B

POWERDIP (16+2+2) - L293E

Page 35: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

2.5.2.3 SCHEMATIC DIAGRAM

Figure 2.3 : Schematic diagram

(*) In the L293 these points are not externally available. They are internally

connected to the ground (substrate). O Pins of L293 () Pins of L293E.

Page 36: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

2.5.3 ABSOLUTE MAXIMUM RATINGS

Symbol Parameter Value Unit

Vs Supply Voltage 36 V

Vss

Logic Supply

Voltage 36 V

Vi Input Voltage 7 V

Vinh Inhibit Voltage 7 V

Iout

Peak Output Current

(non repetitive t =

5ms) 2 A

Ptot

Total Power

Dissipation at Tground-

pins = 80°C 5 W

Table 2.2 : Absolute maximum ratings

Page 37: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)
Page 38: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

2.6 Microcontroller

Microcontroller in simple term means a small computer on a single chip. Wiki Its

like an artificial mind for any intelligent devices which is responsible for taking de-

cisions. [eg your robot needs to take decision, a microcontroller would do that for

us.]

Photo 2.9 : Microcontroller PIC18f4550

Microcontrollers are made through VLSI Fabrication. VLSI fabrication ? In simple

words , its a process of putting together thousands of transistors into One single small

chip. Hence microcontroller are used in embedded systems . Data processing can be

done through these microcontrollers .Hence Embedded system can be designed

through this kind of data processing capability. Typical examples would be hand-

held video games and mobile phones. A small computer on a single IC containing a

small processor , little memory and programmable input & output peripherals

is a microcontroller.

Page 39: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

2.6.1 Application of microcontroller

Photo 2.10 PIC18F4550 and based

If you have ever wondered what microcontrollers are doing these days then, all kinds

of devices has microcontrollers in it. Microcontroller chip is must for any devices

which measures,stores,controls,calculate or displays information. Automobile indus-

try is the largest user of microcontrollers. Microcontrollers are used in consumer

products too. LCD/LED display units, Keyboards,Modems, Digital camcorders,Opti-

cal players,Printers and other peripherals are devices where you can find microcon-

trollers inside.

Page 40: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

2.6.2 How microcontroller is different from microprocessor ?

Photo 2.11 : Connection microcontroller

Often the term microcontrollers and microprocessor are used interchangeably. But in

many ways microcontrollers differs from microprocessor. The most important would

be its functionality. Other components such as memory or components is needed in

order for a microprocessor to be used.

The very heart of the computer is the microprocessor. But microcontroller is de-

signed to be all of that in one. All necessary peripherals are already built into it so no

other external components are needed for its application.

Since all the components are already included in the microcontroller hence it makes

it perfect for various applications such as robots , as we are going to use here .

Page 41: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

2.6.3 Why microcontroller ?

Photo

2.12 :

Input interface to microcontroller

Microcontroller are usually cheaper as compared to microprocessor. You cannot in-

clude a Computer everywhere when small-small decision making jobs are needed to

be done in small electronic components like your mp3 player.

Hence microcontroller are used , which is good enough to handle small decision

making part of some basic devices.

“ A small scale Computer good enough to make basic and complex jobs.”

2.6.4 Cost ?

Microcontroller are relatively cheaper than a microprocessor what you can find

in a typical computer.

Page 42: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

2.6.5 What do we need to know about microcontroller ?

Microcontroller can be programmed , and has its own programming language and

compilers. Hence in our robotic applications it is going to serve as a mind which will

be responsible for taking all decisions. All the informations from various sensors will

be served to microcontroller and those informations will be processed according to

the logic we programmed into the microcontroller. Depending upon the capability

there are numerous kinds of microcontroller.

2.6.6 Importance of microcontroller

The microcontroller I used in my robot is PIC18F4550. Due to USB integration and

control the robot is very portable and do not require any separate control device to

operate, it is a plug and play device to any portable computer with a USB port .A

complete tutorial of programming, loading, body design, motion will be provided in

my portal as a material for beginners and in as easy language as possible.

Page 43: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

2.7 UART

The UART, or Universal Asynchronous Receiver / Transmitter, is a feature of

yourmicrocontroller useful for communicating serial data (text, numbers, etc.) to

your PC. The device changes incoming parallel information (within the

microcontroller/PC) to serial data which can be sent on a communication line.Adding

UART functionality is extremely useful for robotics. With the UART, you can add

an LCD, bootloading, bluetooth wireless, make a datalogger, debug code,

test sensors, and much more!Understanding the UART could be complicated, so we

filtered out the useless information and present to you only the useful need-to-know

details in an easy to understand way .

2.7.1 RS232

RS232 is the old standard and is starting to become obsolete. Few if any laptops even

have RS232 ports (serial ports) today, with USB becoming the new universal

standard for attaching hardware. But since the world has not yet fully swapped over,

you may encounter a need to understand this standard.

Back in the day circuits were noisy, lacking filters and robust algorithms, etc. Wiring

was also poor, meaning signals became weaker as wiring became longer (relates to

resistance of the wire). So to compensate for the signal loss, they used very high

voltages. Since a serial signal is basically a square wave, where the wavelengths

relate to the bit data transmitted, RS232 was standardized as +/-12V. To get both

+12V and -12V, the most common method is to use the MAX232 IC(or ICL232 or

ST232 - different IC's that all do the same thing), accompanied with a few capacitors

and a DB9 connector. But personally, I feel wiring these up is just a pain here is a

schematic if you want to do it yourself (instead of a kit):

Page 44: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Figure 2.3 : Schematic diagram EIA 232

2.7.2 EIA232F

Today signal transmission systems are much more robust, meaning a +/-12V signal is

unnecessary. The EIA232F standard (introduced in 1997) is basically the same as the

RS232 standard, but now it can accept a much more reasonable 0V to 5V signal.

Almost all current computers (after 2002) utilize a serial port based on this EIA-232

standard. This is great, because no longer need the annoying MAX232 circuit.

Page 45: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Photo 2.13 : Component requirements

And this is the assembled image. Notice that I added some useful wire

connectorsthat did not come with the kit so that I may easily connect it to the

headers on my microcontroller board. Also notice how two wires are connected to

power/ground, and the other two are for Tx and Rx.

2.7.3 TTL and USB 

Page 46: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Photo 2.14 : TTL and USB ready to use.

The UART takes bytes of data and transmits the individual bits in a sequential

fashion. At the destination, a second UART re-assembles the bits into complete

bytes.

2.7.4 Signal Adaptor Examples

Without going into the details, and without you needing to understand them, all you

really need to do is just buy an adaptor.

For example:

TTL -> TTL to RS232 adaptor -> PC

TTL -> TTL to EIA-232 adaptor -> PC

TTL -> TTL to EIA-232 adaptor -> EIA-232 to USB adaptor -> PC

TTL -> TTL to USB adaptor -> PC

TTL -> TTL to wireless adaptor -> wireless to USB adaptor -> PC

Page 47: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Photo 2.15 : RS232

Photo 2.16 : USB Cable

Below is us USB to wireless adaptor.It converts a USB type signal to a TTL type

signal, and then my Easy Radio wireless transmitter converts it again to a method

easily transmitted by air to robot:

Page 48: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Photo 2.17 : Connection with USB cable

And a close-up of the outputs. connected the ground, Tx, and Rx to wireless

transmitter. I will talk about Tx and Rx soon:

Photo 2.18 : Connection to microcontroller

Even bluetooth transceiver has the same Tx/Rx/Power/Ground wiring:

Page 49: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Photo 2.18 : Connection with GPS or CMU cam

If have a CMUcam or GPS, again, the same connections.

2.7.5 Other Terminology (Tx and Rx)

Figure 2.4 : UART Communication

Notice how Tx is connected to Rx, and Rx is connected to Tx. If connect Tx to Tx,

stuff will fry and kittens will cry may want to add a resistor of say ~2kohm coming

out of your UART to each pin. This connect Tx to Tx accidentally, the resistor will

absorb all the bad.

Page 50: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Tx pin -> connector wire -> resistor -> Rx pin

Baud Rate

Baud is a measurement of transmission speed in asynchronous communication. The

computer, any adaptors, and the UART must all agree on a single speed of

information - 'bits per second'.

Data bits, Parity, Stop Bits, Flow Control

The short answer:. These are basically variations of the signal, each with long

explanations of why would/wouldn't use them. Stick with the defaults, and make sure

follow the suggested settings of adaptor. Usually will use 8 data bits, no parity, 1

stop bit, and no flow control - but not always. Note that if are using a PIC

microcontroller would have to declare these settings in your code (google for sample

code, etc). I will talk a little more about this in coming sections, but mostly just don't

worry about it.

Bit Banging

What if by rare chance your microcontroller does not have a UART (check the

datasheet), or need a second UART but your microcontroller only has one? There is

still another method, called bit banging. To sum it up, send signal directly to a

digital input/output port and manually toggle the port to create the TTL signal. This

method is fairly slow and painful, but it works . .

Asynchronous Serial Transmission

As y should already know, baud rate defines bits sent per second. But baud only has

meaning if the two communicating devices have a synchronized clock. For example,

what if your microcontroller crystal has a slight deviation of .1 second, meaning it

thinks 1 second is actually 1.1 seconds long. This could cause baud rates to break.

Page 51: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

One solution would be to have both devices share the same clock source, but that just

adds extra wires.All of this is handled automatically by the UART, but if would like

to understand more, continue reading . . .

Asynchronous transmission allows data to be transmitted without the sender having

to send a clock signal to the receiver. Instead, the sender and receiver must agree on

timing parameters in advance and special bits are added to each word which are used

to synchronize the sending and receiving units.

When a word is given to the UART for Asynchronous transmissions, a bit called the

"Start Bit" is added to the beginning of each word that is to be transmitted. The Start

Bit is used to alert the receiver that a word of data is about to be sent, and to force the

clock in the receiver into synchronization with the clock in the transmitter. These two

clocks must be accurate enough to not have the frequency drift by more than 10%

during the transmission of the remaining bits in the word. (This requirement was set

in the days of mechanical teleprinters and is easily met by modern electronic

equipment.)

Page 52: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

When data is being transmitted, the sender does not know when the receiver has

'looked' at the value of the bit - the sender only knows when the clock says to begin

transmitting the next bit of the word.

When the entire data word has been sent, the transmitter may add a Parity Bit that the

transmitter generates. The Parity Bit may be used by the receiver to perform simple

error checking. Then at least one Stop Bit is sent by the transmitter.

When the receiver has received all of the bits in the data word, it may check for the

Parity Bits (both sender and receiver must agree on whether a Parity Bit is to be

used), and then the receiver looks for a Stop Bit. If the Stop Bit does not appear when

it is supposed to, the UART considers the entire word to be garbled and will report a

Framing Error to the host processor when the data word is read. The usual cause of a

Framing Error is that the sender and receiver clocks were not running at the same

speed, or that the signal was interrupted.

Regardless of whether the data was received correctly or not, the UART

automatically discards the Start, Parity and Stop bits. If the sender and receiver are

configured identically, these bits are not passed to the host.

If another word is ready for transmission, the Start Bit for the new word can be sent

as soon as the Stop Bit for the previous word has been sent.

In short, asynchronous data is 'self synchronizing'.

3 The Loop-Back Test 

The loop-back test is a simple way to verify that your UART is working, as well as

to locate the failure point of your UART communication setup.

For example, suppose you are transmitting a signal from microcontroller UART

through a TTL to USB converter tor laptop and it isn't working. All it takes is one

failure point for the entire system to not work.

The trick is to connect the Rx to the Tx, hence the loop-back test.

Page 53: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

For example, to verify that the UART is outputting correctly:

o connect the Rx and Tx of the UART together

o printf the letter 'A'

o have an if statement turn on a LED if 'A' is received

If it still doesn't work, you know that code was the failure point (if not more than one

failure point).

Then do this again on the PC side using HyperTerminal, directly connecting Tx and

Rx of your USB port.

And then yet again using the TTL to USB adaptor.

.

Top waveform: UART transmitted 0x0F 

Bottom waveform: UART received 0x0F

Page 54: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Adding UART Functions to AVR

To add UART functionality (or any AVR based microcontroller) need to make a few

minor modifications to your code and add a small amount of extra hardware.

Full and Half Duplex 

Full Duplex is defined by the ability of a UART to simultaneously send and receive

data. Half Duplex is when a device must pause either transmitting or receiving to

perform the other. A Half Duplex UART cannot send and receive data

simultaneously. While most microcontroller UARTs are Full Duplex, most wireless

transceivers are Half Duplex. This is due to the fact that it is difficult to send two

different signals at the same time under the same frequency, resulting in data

collision. If robot is wirelessly transmitting data, in effect it will not be able to

receive commands during that transmission, assuming it is using a Half Duplex

transmitter.

Page 55: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

CHAPTER 3

METHODOLOGY

INTRODUCTION:

ROBOTICS AND MICROCONTROLLER

Robotics is very vast and broad branch in terms of technology. Robotics is an

absolute implementation of artificial intelligence.

There are lots of things about robotics like motors, actuators, sensors, programming,

controlling and designing. Robots in today’s world are designed to enhance human

capability.Here in this website I will try to cover some of the topics. There are many

things that need to be considered when it comes to designing and implementation of

a robot like, sensor, power management, stability and much more.

Almost all the major manufacturing,research and aerospace industries use robots for

various purposes.

Here in this website I will try to provide tutorials for some of the basic robotic

projects that I have created till now.   Robotics and microcontroller works side by

side. The decision making part of any robotics components are microprocessor or

microcontroller that act as a brain for the robot.

Page 56: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

The vision, sensor, actuator, motors, sensor,power and voltage. All these factors and

components are regulated and processed by a Central processing unit or

Microcontroller (Microprocessor).

Here Central Processing Unit does not refer to CPU of a traditional computer but the

Unit which governs the activity of an artificial device.  All the input from various

sensory units are being sent to the CPU and then it been processed to send control

signals to motors. That’s how robots work.

Here in this website I will try to focus on some basic concepts and simple robotic

projects that you can make at home. If you are a beginner then probably you are at

right place for learning basic tutorials on robotics.I will also provide some basics of

programming on microcontrollers.

Methodology Flow Chart

Determine Title, Objective, Scope and Identify problem

Research implementation and selection type of handphone controlled robot.

Finding through internet. Email to developer and open website

at Bluetooth Robot application

Finding through handphone software (Playstore) –

Bluetooth Robot application

Data Analysis

PHASE 1

FASA 3

PHASE 2

FASA 4

Literature Review

Install MikroC Pro For Pic, learn user manual, draw schematic diagram by proteus and simulate/ list component

requirement and equiment to developed robot .

Install the equipment and circuit component

Programming the PIC18F4550

Test the Handphone Controlled Robot using bluetooth

Install the application

Bluetooth robot to smartphone.

Discussion & Conclusion

Page 57: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Figure : Methodology Flow Chart

PHASE 1

Determine Title, Objective, Scope and Identify problem

For the first step in this research, we has been guide by lecturer that have explained

to us how that criteria robot require to develope. After our group discussed about the

title, every body was agreed to make a research about Hanphone Controlled Robot

and lectrurer as supervisor for this Last project give us support and more explanation

to develope a system that we are agreed. After that, we has continued to list

objective, scope and identify the problem.

Literature Review

Second step in this project, we have received order from our supervisor to make a

research about the system that we choose to develope. Among of the research is as

follows:

Input interface (hardware)

Proteus /PIC KIT/ MPLAB for assembly and C language

Microcontroller (PIC18F4550)

Output interface (Robot using two DC motor)

Handphone communicated to PIC18F4550

Page 58: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

PHASE 2

Research Implementation

During this research to find the answer and understand all of literature review we are

realized the if we are using Cell Phone communicate with microcontroller by DTMF

the PIC it just PIC16F and PIC 24F only could be function with DTMF.

Then we are also realized if we are using Arduino we cannot used PIC18F4550 to

communicate with arduino, and then , Arduino need high cost to developed the

hardware even their have many applications to use Handphone Controlled Robot.

After that, we try to find some application can be interaction with PIC18f4550 in

smart phone. Then, we just found one application named Bluetooth Robot and the

description about the application that its can commnunicate to PIC18F4550 with

integrated L293B. The Bluetooth Robot application has been install to smart phone

and we are tried find the full of data to developed the robot. We has tried to email to

developer (Jose Garcia) and the we are found the website and there have the full of

data that we need.

Page 59: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

PHASE 3

Data Analysis

After the full of data to develope Bluetooth robot has been download. We are found

the software MicroC Pro for PIC C language by mikroelektronika and we just

install it to open the source code in C language guiding by user manual mikroC .

After that, we continued to analysis the circuit diagram for input and output

interface. The picture and label for all of component included in the document.

Through the data given, we can draw the circuit diagram , then simulate with support

and guide from our supervisor.

Page 60: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)
Page 61: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

PHASE 4

Install the equipment and circuit component

Then, simulation of circuit diagram in proteus was success, we used the list of

component and equipment that required and bought at electronic shop or by

online website. After that, we can install the component and create a robot using two

DC motor and programming the PIC18F4550 by MicroC Pro for PIC. Finally we

can test the robot has function or not by using application in smartphone (Bluetooth

Robot).

Page 62: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)
Page 63: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

PIC18F4550 Programming and Tutorial Hardware C

PIC18F

Microcontroller

Programming Tutorial

Tutorial

Introduction

Welcome, here in this tutorial series we are going to learn some

common methodologies for programming a pic18f. The tutorials here must be

perfect to get you started with pic18f microcontroller. We are going to learn about

the basics and various details that you need to consider while programming a pic18f

microcontroller. For making life easy I have also attached relevant coding

examples with explanation with each chapter of the tutorials that I am going to

show.

This tutorial is compiled

for beginners with pic18f

microcontrollers, who wish to learn

microcontroller coding in

Hardware C. We are also going to see the software tools, understand Microcontroller

pin diagram, Ports and its relevance, Programming and relevant data sheet of the

microcontroller, and I will also explain where and what to look for in a datasheet, as

it can be confusing for beginner. Please do to complain if you find the tutorial a bit

Page 64: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

lengthy, but shortcuts are never good choice. A navigation menu on the Top must be

helpful for you to switch between topic and chapters.

How many ways to program a Microcontroller?

There are many ways or styles to code a simple microcontroller program. What is

really necessary is to develop a perfect and good coding habit or methodology while

you code, to avoid confusion. For doing a same logical operation there can be

multiple ways in Hardware C. It will help you to optimize the coding you do.

Here I am going to explain some base line methods and also some common practices

that you need to follow while coding a pic18f microcontroller with suitable

examples. There can be hundred of ways of writing same code; I will just try to cover

some of the basic styles to get you started, from Simple to complex ways. Once you

understand the basics then it must be quiet easy for you to navigate your own

imagination and make the microcontroller respond according to your wish.  I will try

to explain each and every block with simple and easily understandable format. I

would also try to avoid Complex terms whenever it is possible.

Why Pic18f Microcontroller ?

Pic microcontrollers are comparatively inexpensive and easy to find, there are also

other microcontrollers Like Arduino Board which are little bit costly. Unless you

want to spend too much for you projects, pic programming kit would be perfect to

get you started. PIC18F is easily available and very powerful and quiet capable

microcontroller which can easily enable you to add some Logic and Intel to your

projects. All you need is a Microcontroller, An IDE and a Microcontroller

programmer Like pickit2 or JDM.

Page 65: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

PIC18F4550 Microcontroller Programming

For our hardware C programming tutorial we are going to use a PIC18F4550

microcontroller. PIC18F4550 is a 40 pin microcontroller by microchip and it has

been a favorite microcontroller in between microcontroller hobbyist. You can easily

switch over to pic18f2550 microcontroller as well, with little modification in the

code. However we are going to focus on pic18f4550 microcontroller for our tutorial

with hardware C. After writing and understanding microcontroller Code we are

going to upload the code into the microcontroller using hardware programmer.

.

Page 66: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Hardware C – Compiler and IDE

Hardware C is similar to the general C software programming language that

you compile with a BORLAND C compiler. However the compiler and Coding

methods for Hardware C are going to be different. It depends upon the

microcontroller. For coding a pic18f4550 you will need an IDE that supports the

respective microcontroller and also a Compiler that can compile the code

written on the IDE.

What is IDE?  Don’t confuse IDE with “Integrated Device Electronics”, Here IDE is

just an abbreviation for Integrated Development Environment which is a software

environment for writing codes. IDE makes life really easy for coders.

Mplab IDE and C18 Compiler

The IDE that we are going to use is microchips ”MPLAB IDE “and the compiler

would be “ C18 compiler “ from Microchip . MPLAB IDE will help you with a

Software platform where you can write your Hardware Code, ( Just like Eclipse

IDE ).  And the Compiler installed with MPLAB IDE will convert the Human

written code into Machine language.

Please note that the microcontroller can only understand the machine language (0

and 1). The code [instructions] written in the IDE is converted into “Machine code”

by the compiler.  After compilation the output will be generated in .hex format (A

filename with .hex) [  AN Example .hex  ], all we have to do is just to upload

that .HEX file into the microcontroller and then the pic18f4550 is ready for action.

Page 67: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

There are different types of compiler. Suppose if you working with a PIC30F series

microcontroller then the same MPLAB IDE will require a C30 Compiler engine to

Compiler your code. C30 and C18 are just the versions of compiler which is capable

of Converting your code into machine language (0’s and 1’s) which a

microcontroller would understand.

However since we are going to use a “PIC18F“ series of microcontroller so we will

use a C18 compiler.

A lite version of C18 compiler and MPLAB ide is completely free to

download from Microchips website. Apart form C18 Compiler, a Hi-Tech C

compiler can be also used for coding a pic18f4550 series of microcontroller. Hi-Tech

C makes it easy to write codes specially when I prefer to write LCD programs, Hi-

Tech C compiler is however not free if you wish to optimize the code, So we are

going to Stick to C18 Compiler, lite version.

You need to login into microchip account which is free to create before you can

download the C18 lite version and MPLAB IDE. The mplab refered in this tutorials

is version v8.60. You can download the latest Release from their website directly.

CELLPHONE INTERACT WITH DTMF TO CONTROLLED ROBOT

Radio control (often abbreviated to R/C or simply RC) is the use of radio signals to

remotely control a device. The term

Page 68: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

is used frequently to refer to the control of model vehicles from a hand-held radio

transmitter. Industrial, military, and scientific research organizations make [traffic]

use of radio-controlled vehicles as well.

A remote control vehicle is defined as any mobile device that is controlled by a

means that does not restrict its motion with an origin external to the device. This is

often a radio control device, cable between control and vehicle, or an infrared

controller. A remote control vehicle (Also called as RCV) differs from a robot in that

the RCV is always controlled by a human and takes no positive action autonomously.

One of the key technologies which underpin this field is that of remote vehicle

control. It is vital that a vehicle should be capable of proceeding accurately to a

target area; maneuvering within that area to fulfill its mission and returning equally

accurately and safely to base.

3.1 Methodology to prepare Handphone Controlled Robot

The method of project operation is given below.

Makes call to the mobile phone (as receiver) attached to the robot. Now after

answering the call, and in the course of the call, if any button is pressed control

corresponding to the button pressed is heard at the other end of the call. This tone is

called dual tone multi frequency tome (DTMF) robot receives this DTMF tone with

the help of phone stacked in the robot.

The received tone is processed by the 16F72 microcontroller with the help of DTMF

decoder MT8870 the decoder decodes the DTMF tone in to its equivalent binary

digit and this binary number is send to the microcontroller, the microcontroller is

preprogrammed to take a decision for any give input and outputs its decision to

Cell phone as a Transmitter

Cell phone as a Receiver

Interface

SPYROBO

Page 69: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

motor drivers in order to drive the motors for forward or backward motion or a

turn. The mobile that makes a call to the mobile

phone stacked in the robot acts as a remote. So this simple robotic project does not

require the construction of receiver and transmitter units. DTMF signaling is used for

telephone signaling over the line in the voice frequency band to the call switching

center. The version of DTMF used for telephone dialing is known as touch

tone. DTMF assigns a specific frequency (consisting of two separate tones) to each

key s that it can easily be identified by the electronic circuit. The signal generated by

the DTMF encoder is the direct al-gebric submission, in real time of the amplitudes

of two sine (cosine) waves of different frequencies, i.e. ,pressing 5 will send a tone

made by adding 1336hz and 770hz to the other end of the mobile.

1.5.1 Phase I:

This is the basic phase but the most time consuming phase as this phase involve the

The primary step toward the search of components& ICs which will be required.

For the designing of our project we require we some specific hardware and software

and then interfacing the components each other to accomplish the task required by

our project.

Hence our mainly consist of two parts-

1. Hardware

2. Software

3.1.1 Hardware Requirements

All of this components was bought at Cytron Technologies through the online

system. The main components of the hardware section of our project are given as:

Microcontroller (PIC18F8550)

Crystal Oscillator (4 MHz)

DTMF decoder IC(MT8870)

Motor driver (H-bridges using Relay switches)

DC Motor

Optocouplers

Voltage Regulator (IC 7805)

Head-phone

Page 70: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Wireless Camera

TV Resistors, Capacitors

Tuner Card,Resistors,Capacitors

1.5.2 Phase II:

In this phase we will try to develop the Interfacing design circuit in PCB. In PCB

first we will draw the interface circuit of land rover then after some Steps of pcb

designing we will fabricate the different ICs & microcontroller. A cell phone will be

also connected in the circuit with interfacing with DTMF Decoder IC.A motor driver

IC will interface with microcontroller& DC motors. In the below shows the block

wise interfacing of different ICs & devices.

1.5.3 Phase III:

This is the final phase of project aspects, in this phase we will write a program for

given the instruction to the microcontroller. a program is written in C language and

converted this source program in Hex code for burn it into microcontroller. For this

we will use mainly two software given below.

Compiler (Proton)

Source Code

Fig. 1.2 Block Diagram

CELL PHONE

CELL PHONE

DTMF DECODER

MICROCONTROLLER

MOTOR DRIVER

LEFT MOTORS RIGHT MOTORS

Page 71: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

This phase also include final testing of all coding, Interface circuit functioning &

performance of whole system. If any error will be generated then we will try to

remove this error by the modification on the circuit.

IMPACT OF THE PROPOSED WORK IN ACADEMICS AND INDUSTRY:

This project will have a huge impact on academics and industry. With the help of this

project we have tried to depict the modern & global application of cell phone.

Mobile phone for robotic control can overcome these limitations and provides the

advantage of robust control, working range as large as the coverage area of the

service provider, no interference with other controllers.

This project is very useful on the Military usage of remotely controlled military

vehicles .the vehicles are controlled by the cell phone then the range of control will

be broad& by the use of wireless camera we can detect the position of enemies.

The industry can find major application of this project in developing mobile operated

products as commercial projects. As security feature is most important factor of this

project so industries have scope of finding some relevant information in building up

of commercial land rover. They may be used in any search operations, where men

power cannot work.

This project will also prove beneficial in academics. The students can learn various

principles and terminologies proposed in this project which would help their cause of

advancing this technology by adding their innovative ideas and thoughts.

Page 72: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

CHAPTER 4

FINDING

Researching and Designing

gathering information

identifying specific details of the design which must be satisfied

identifying possible and alternative design solutions

planning and designing a appropriate structure which includes drawings

Design Of Robot

Differential drive is a method of controlling a robot with only two motorized wheels.

What makes this algorithm important for a robot builder is that it is also the simplest

control method for a robot. The term 'differential' means that robot turning speed is

determined by the speed difference between both wheels, each on either side of your

robot. For example: keep the left wheel still, and rotate the right wheel forward, and

Provided by :Muhammad Abu Sofian

07DET12S1006

Page 73: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

the robot will turn left.( Don't want to turn) As long as both wheels go at the same

speed, the robot does not turn - only going forward or reverse.

As shown in above figure wheels are attached with chassis made up of any metal

(like iron). Shaft of two DC motors (around 150 RPM or more) are directly coupled

with real wheels. So as both motors rotate CW, the land rover moves forward. And

as both motors rotate CCW, it will move backward. to turn it left right DC motor ro-

tates and to turn it right left DC motor rotates. Also it will take forward-left & for-

ward-right turn as well as backward-left & backward-right turn if required. For that,

either of the motors (left or right) is rotated CW or CCW. For example if left motor

rotates CW,will take forward-right turn and if it rotates CCW then backward-right

turn. Similarly for right DC motor.

The differential drive algorithm is useful for light chasing robots. This locomotion is

the most basic of all types, and is highly recommended for beginners. Mechanical

construction, as well as the control algorithm, cannot get any simpler than this.

pseudocode:

input sensor reading

make decision based on sensor reading.

Page 74: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Do   one of below actions:

to drive straight both wheels move forward at same speed

to drive reverse both wheels move back at same speed

to turn left the left wheel moves in reverse and the right wheel moves forward

to turn right the right wheel moves in reverse and the left wheel moves forward

Well it is a system that contains sensors, control systems, manipulators, power sup-

plies and software all working together to perform a task. Designing, building, pro-

gramming and testing a robots is a combination of physics, mechanical engineering,

electrical engineering, structural engineering, mathematics and computing. In some

cases biology, medicine, chemistry might also be involved.

Construction work can now begin, with:

structure

gear combinations

mechanical

placing sensors

hints and tricks

The major building blocks are cell phone, DTMF decoder, micro-controller, DC mo-

tor driver circuits.

Page 75: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Cell phone: - This is very first and the most important part of the system because due

to this only the entire system is activated and works. It will receive the signals from

another cell phone and gives them as input to DTMF decoder. First the system is ac-

tivated by calling the SIM card number inside the phone. Afterwards it will receive

DTMF code signals dialed from another cell phone and give it to DTMF decoder.

DTMF decoder: - The function of this block is self understood. It will take DTMF in-

put given by cell phone decode it and gives 4-bit digital output to micro controller. It

also generates an interrupt every time when it gives digital output

Micro-controller: - You can call this block as the heart of entire system because it ac-

tually performs all the controlling actions. Depending upon the code given by DTMF

decoder it will move the rover forward, backward, left or right by rotating both DC

motors

DC Motor driver: - It receives actuating signals from micro controller in terms of

high / low logic, amplifies (current) it and rotates 2 DC motors in both directions

DTMF decoder: -

As shown in figure it is made up form readily available MT8870 chip that is widely

used for DTMF based application. It receives DTMF tones and generates 4-bit digital

output corresponding to received DTMF signal of digits 0 - 9 and other signals (like

*, # etc) also. It receives input form cell phone to its pin no 2. It amplifies it through

internal op-amp amplifier. If it receives valid DTMF tone, it will produce pulse

Page 76: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

output on StD (pin no 15). This is indicated by green LED connected as shown. The

4-bit digital output is latched on pins 11 - 14 and that is given to micro controller.

The StD output is also given to interrupt pin of micro controller through transistor

that will generate negative pulse every time when DTMF signal is received. This

negative pulse will generate an interrupt. All the movements of robotic arm are

controlled by cell phone digit switches 1 to 8. The 4 bit digital output corresponding

to these switches form MT8870 are as given here

Sample Robotic

Page 77: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

SAMPLE INPUT OUTPUT 

  

INPUT (Speaker speaks) OUTPUT (Robot does)

forward moves forward

back moves back

right turns right

left turns left

hit hits the coin

stop stops doing current task

The code accepts incoming commands via telnet or voice recognition, then it sends

the commands out to a robot device. It is essentially an API for using a cellphone to

control a robot.

Highlighted functionality includes:

Voice recognition to speak to your robot

Text-to-speech so your robot can speak back

Compass orientation to point North, East, South, West, or any degree in

between

Remote control commands for forward, back, left, right, and stop

Audio recoding to use the phone's mic to record sounds

GPS to acquire the phone's location and speak the city and state

XMPP Chat to send chat commands to the robot

Diagram Using Microcontroler

Page 78: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

PIC Microcontrollers are quickly replacing computers when it comes to

programming robotic devices. These microcontrollers are small and can be

programmed to carry out a number of tasks and are ideal for school and industrial

projects. A simple program is written using a computer, it is then downloaded to a

microcontroller which in turn can control a robotic device.

http://www.technologystudent.com

Page 79: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Augmented Microcontrollers and Development Boards 

In a pure sense, a microcontroller is just an IC (integrated circuit, or a black chip

thing with pins coming out of it). However it is very common to add additional

external components, such as a voltage regulator, capacitors, LEDs, motor

driver,timing crystals, rs232, etc to the basic IC. Formally, this is called

an augmented microcontroller.

Timing Microcontrolled

The Final Equation create a delay of 5 seconds.

calculating:

655000 cycles/second -> 655 cycles/ms

655 cycles/ms * 1.5ms = 982.5 cycles ~= 982 cycles

http://www.robot-electronics.co.uk/

So to get servo to stop moving, send a signal of 1.5ms long, or 982:

Cycles A 'cycle' is the smallest amount of time it takes for your microcontroller to do 'nothing.'

For example, suppose I ran this while loop on a microcontroller: 

cycles=8;

void delay_cycles(unsigned long int cycles){while(cycles > 0)

cycles--;}

loop:make digital port highdelay_cycles(10);make digital port lowdelay_cycles(10);

loop:make digital port highdelay_cycles(65500) x 10;make digital port lowdelay_cycles(65500) x 10;

Page 80: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

turn servo on

delay_cycles(982);

turn servo off

Using the same equation for 1ms and 2ms, the extremes of servo motion, we calcu-

late some more:

655 cycles/ms * 1ms = 655 cycles 

655 cycles/ms * 2ms = 1310 cycles

For 5 seconds delay.

Next Finding Using Android

and then program this: 

loop 50 times: delay_cycles(65535);

Page 81: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

In this project 8051 and bluetooth module are communicating over uart @9600bps.

Bluetooth module HC-05 is controlled via simple AT commands. This module

comes in SMD package and works on 3.3v power supply. The BT module is a SPP

supported profile so it can be connected easily to any controller or embedded device.

In this profile the data sent and receive to module directly comes on the RX pin of

microcontroller. It becomes really easy to make your device bluetooth compatible.

L293D H-Bridge motor driver are used to control two DC motors. A readymade

compact size chassis is used to avoid the chassis assembly comlexities . The chassis

contains 2 decks the lower is used for BO motors fitting the upper is used as a battery

stack. On top plate the controller board is mounted by screw fitting.

- See more at: http://www.8051projects.net/download.php?

view.247#sthash.TXPtNQLw.dpuf

Page 82: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

CHAPTER 5

Discussion

A mobile robot is an automatic machine that is capable of movement in any given

environment.Mobile robots have the capability to move around in their environment

and are not fixed to one physical location. In contrast, industrial robots usually

consist of a jointed arm (multi-linked manipulator) and gripper assembly (or end

effector) that is attached to a fixed surface.

Mobile robots are also found in industry, military and security

environments. Domestic robots are consumer products, includingentertainment

robots and those that perform certain household tasks such as vacuuming or

gardening.

Our Robot is the branch of technology that deals with the design, construction,

operation, and application of robots, as well as computer systems for their control,

sensory feedback, and information processing. These technologies deal with

automated machines that can take the place of humans in dangerous environments or

manufacturing processes, or resemble humans in appearance, behavior, and/or

cognition. Many of today's robots are inspired by nature contributing to the field

of bio-inspired robotics.

Electric motors

The majority of robots use electric motors, often brushed and brushless DC motors in

portable robots, or AC motors in industrial robots and CNC machines. These motors

are often preferred in systems with lighter loads, and where the predominant form of

motion is rotational.

Provided by :Muhammad Abu Sofian

07DET12S1006

Page 83: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Sensing

Sensors allow robots to receive information about a certain measurement of the envi-

ronment, or internal components. This is essential for robots to perform their tasks,

and act upon any changes in the environment to calculate the appropriate response.

They are used for various forms of measurements, to give the robots warnings about

safety or malfunctions, and to provide real time information of the task it is perform-

ing.

Speech recognition

Interpreting the continuous flow of sounds coming from a human, in real time, is a

difficult task for a computer, mostly because of the great variability ofspeechThe

same word, spoken by the same person may sound different depending on

local acoustics, volume, the previous word, whether or not the speaker has a cold,

etc.. It becomes even harder when the speaker has a different accent.

Mobile manipulator is nowadays a widespread term to refer to robot systems built

from a robotic manipulator arm mounted on a mobile platform. Such systems

combine the advantages of mobile platforms and robotic manipulator arms and

reduce their drawbacks. For instance, the mobile platform extends the workspace of

the arm, whereas an arm offers several operational functionalities.

A mobile manipulation system offers a dual advantage of mobility offered by a

mobile platform and dexterity offered by the manipulator. The mobile platform

offers unlimited workspace to the manipulator. The extra degrees of freedom of the

mobile platform also provide user with more choices. However the operation of such

a system is challenging because of the many degrees of freedom and the unstructured

environment that it performs in.

Control

The mechanical structure of a robot must be controlled to perform tasks. The control

of a robot involves three distinct phases – perception, processing, and action (robotic

paradigms). Sensors give information about the environment or the robot itself (e.g.

Page 84: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

the position of its joints or its end effector). This information is then processed to cal-

culate the appropriate signals to the actuators (motors) which move the mechanical.

The processing phase can range in complexity. At a reactive level, it may translate

raw sensor information directly into actuator commands. Sensor fusion may first be

used to estimate parameters of interest (e.g. the position of the robot's gripper) from

noisy sensor data. An immediate task (such as moving the gripper in a certain direc-

tion) is inferred from these estimates. Techniques from control theory convert the

task into commands that drive the actuators.

At longer time scales or with more sophisticated tasks, the robot may need to build

and reason with a "cognitive" model. Cognitive models try to represent the robot, the

world, and how they interact. Pattern recognition and computer vision can be used to

track objects.Mapping techniques can be used to build maps of the world. Fi-

nally, motion planning and other artificial intelligence techniques may be used to fig-

ure out how to act. For example, a planner may figure out how to achieve a task

without hitting obstacles, falling over, etc.

Manual remote

A manually tele operated robot is totally under control of a driver with handphone or

other control device. The device may be plugged directly into the robot, may be a

wireless joystick, or may be an accessory to a wireless computer or other controller.

A tele-op'd robot is typically used to keep the operator out of harm's way.

Segregation of duties

Muhammad Abu Sofian Find a variety of information to produce the robot by

using software. Make sure components that can be

utilized into Pic18f.

Saniy Bin Hj. Ahmad Find information and circuit design and make a

survey on the circuit connection for assembling

circuits, and motors to function PIC18f

Ridzuan bin Maklin Find information and circuit design and make a

survey in connection to the sensor circuitry to ensure

that the robot has a security aspect

Page 85: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

CHAPTER 6

Conclusion

Human-robot interaction

If robots are to work effectively in homes and other non-industrial environments, the

way they are instructed to perform their jobs, and especially how they will be told to

stop will be of critical importance. The people who interact with them may have little

or no training in robotics, and so any interface will need to be extremely intuitive.

Science fiction authors also typically assume that robots will eventually be capable

of communicating with humans through speech, gestures, and facial expressions,

rather than a command-line interface.

Technological trends

Various techniques have emerged to develop the science of robotics and robots. One

method is evolutionary robotics, in which a number of differing robots are submitted

to tests. Those which perform best are used as a model to create a subsequent "gener-

ation" of robots. Another method is developmental robotics, which tracks changes

and development within a single robot in the areas of problem-solving and other

functions.

Provided by :Muhammad Abu Sofian

07DET12S1006

Page 86: Laporan Projek Akhir POLITEKNIK (ELEKTRIK)

Autonomously guided robot

An autonomously guided robot knows at least some information about where it is

and how to reach various goals and or waypoints along the way. "Localization" or

knowledge of its current location, is calculated by one or more means, using sensors

such motor encoders, vision, Stereopsis, lasers and global positioning systems.

Positioning systems often use triangulation, relative position and/or

Monte-Carlo/Markov localization to determine the location and orientation of the

platform, from which it can plan a path to its next waypoint or goal. It can gather

sensor readings that are time- and location-stamped, so that a hospital, for instance,

can know exactly when and where radiation levels exceeded permissible levels. Such

robots are often part of the wireless enterprise network, interfaced with other sensing

and control systems in the building.