Mobile Robot Monitoring System Using LEGO Mindstorms.
MOBILE ROBOT MONITORING SYSTEM USING LEGO MINDSTORMS
NIK RUS KHUZAIMAH BINTI NIK AZIZAN
This report is submitted in partial fulfillment of requirements for the Bachelor Degree of
Electronic Engineering (Computer Engineering) with honours
Fakulti Kejuruteraan Elektronik & Kejuruteraan Komputer
Universiti Teknikal Malaysia Melaka
APRIL2007
© Universiti Teknikal Malaysia Melaka
UNIVERSTI TEKNIKAL MALAYSIA MELAKA
FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER
BORANGPENGESAHANSTATUSLAPORAN
PROJEK SARJANA MUDA II
Tajuk Projek
Mobile Robot Monitoring System Using LEGO
Mindstorms
Sesi
Pengajian
06/07
Saya
N IK RUS KHUZA IMAH BINTI NIK AZIZAN
(HURUF BESAR)
mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan syaratsyarat kegunaan sepert i berikut:
I.
Laporan adalah hakmilik Universiti Teknikal Malaysia Melaka.
2.
Perpustakaan dibenarkan membuat salinan untu k tujuan pengajian sahaja.
3.
Perpustakaan dibenarkan membuat salinan laporan ini sebagai bahan pertukaran antara institusi
pengaj ian tinggi.
4.
Sila tandakan ( ..J ) :
D
D
0
SULIT*
(Mengandungi maklumat yang berdarjah keselamatan atau
kepentingan Malaysia seperti yang tennaktub di dalam AKTA
RAHSIA RASMI 1972)
TERHAD*
(Mengandungi maklumat terhad yang telah ditentukan oleh
organisasi!badan di mana penyelidikan dijalankan)
TIDAK TERHAD
Disahkan oleh:
Alamat Tetap: 256, Fasa 2H, Persiaran SM2H/7,
32040 Seri Manjung, Perak
Tarikh: 27 APRIL 2007
nuBlfajセ@
li ABD MANAP
f'ensyarah
Y:akultt Kej Elektro:-:ik tla:-t Kej Kom,uter (FKEKK)
Universltt Teknik.l: Ma'ays1a Melaka (UTeM),
K;uun! ャ・ヲエHZNセョ」ゥ@
1200,
Ayer Kereh, 75-451 Melaka
Tarikh: 27 APR IL 2007
© Universiti Teknikal Malaysia Melaka
UNIVERSTI TEK NIKAL M ALAYSIA MELAKA
FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER
BORANG PENGESAHAN STATUS LAPORAN
PROJEK SARJANA MUDA II
Tajuk Projek
M obile Robot Monitoring System Using LEGO
Mindstorms
Sesi
Pengajian
06/07
Saya
NIK RUS KHUZAIMAH BTNTI NIK AZIZAN
(HURUF BESAR)
mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan syaratsyarat kegunaan seperti ber ikut:
I.
Laporan adalah hakmilik Universiti Teknikal Malaysia Melaka.
2.
Perpustakaan dibenarkan membuat salinan untuk tuj uan pengajian s ahaja.
3.
Perpustakaan d ibenarkan membuat salinan laporan ini sebagai bahan pert ukaran antara institus i
pengaj ian ti nggi.
4.
Sila tandakan ( ..J ) :
D
SULIT *
(Mengandungi maklumat yang berdarjah keselamatan atau
kepentingan Malaysia seperti yang termaktub di dalam AKTA
RAHSIA RASMII972)
D
TERHAD*
(Mengandungi maklumat terhad yang telah ditcntukan oleh
organisasi/badan di mana penyelidikan dijalankan)
0
T IOAK TERHAD
Disahkan oleh:
Alamat Tetap: 256. Fasa 2 H, Persiaran SM2H/7,
NUJitULFAJAJit 8 ABD MANAP
l'l!msyarah
32040 Seri Manjung, Perak
Tarikh: 27 APRIL 2007
J=akultt Kej Elektro:-:ik q セ@ K8! kッュセエオ
・ イ@ {FKEKK)
Univer<i Teknik.1: Ma'aysaa Melaka (UTeM),
kゥャイオョセ@
ャ・イQ\[Nセョ」ゥ@
1200,
Ayer Xereh, 7545t Melaka
Tarikh: 27 APRIL 2007
© Universiti Teknikal Malaysia Melaka
II
"I hardly declare that this report is the result of my own work except for quotes as cited
in the references"
Signature
セM
Author
: Nik Rus Khuzaimah Binti Nik Azizan
Date
: 27 APRIL 2007
© Universiti Teknikal Malaysia Melaka
lll
"I hereby declare that I have read this report and in my opinion this report is sufficient in
terms of scope and quality for the award of Bachelor of Electronic Engineering
(Computer Engineering) with honours."
Signature
Supervisor's Name
Date
セ@
: En Nurulfa]ar Bin Abd Manap
: 27 APRIL 2007
© Universiti Teknikal Malaysia Melaka
lV
Just For My Mom And My Dad
© Universiti Teknikal Malaysia Melaka
v
ACKNOWLEDGEMENT
I would like to extend my sincere gratitude to my supervisor, Mr. Nurulfajar B
Abd Manap, for his assistance and guidance towards the progress of this thesis project.
Throughout the year, Mr. Nururlfajar has been patiently monitoring my progress and
guided me in the right direction and offering encouragement. Obviously the progress I
had now will be uncertain without her assistance. Special thanks must also go to Mr.
Sani Irwan B Salim, lecturer of Faculty of Electronic and Computer Engineering for his
advice and help.
My special appreciation and thanks to all my friends for their invaluable
assistance towards this thesis project. Most of all, I am very grateful to my family
especially my dearest parent, Mr. Nik Azizan B Nik 'Ariffm and Mrs. Junaidah Bt
A wang and all my siblings for their unfailing encouragement and fmancial support they
given me over the years.
© Universiti Teknikal Malaysia Melaka
Vl
ABSTRACT
The mobile robot monitoring system using LEGO Mindstorms tool is a mobile
robot that has a behavior which is monitoring system. This rob.ot ·win monitor and sense
the object around them using camera Lego. This project highlights the hardware
development and programming development. The hardware development of mobile
robot monitoring system based on Lego while for programming development is used C
language: This project programming needs other programming to display the image and
make the camera as a sensor. The image data will be sent to the user computer using IR
Tower. This IR Tower is interacting as interface hetween computer and the camera. In
this project, two different methods programming Not Quite C and ROBOLAB is used
which is able to move for Not Quite C and display the image for ROBOLAB using
camera Lego through the user computer.
© Universiti Teknikal Malaysia Melaka
vu
ABSTRAK
Projek Mobile Robot Monitoring System using LEGO Mindstorms adalah projek
dimana robot yang mempunyai sistem pengawasan sebagai sifat robot itu. Robot ini
akan mengawas dan sebagai pengesan pada objek disekelilingnya dengan menggunakan
kamera yang disediakan oleh Lego Mindstorms. Projek ini mengetengahkan
pembangunan hardware dan software. Bagi pembangunan hardware projek ini
menggunakan kamera Lego sebagai komponen yang utama. Sementara itu, bagi
pembangunan software, projek ini menggunakan bahasa C. Bagi projek ini, ia
memerlukan satu lagi software untuk menjadikan kamera ini memaparkan gambarajah
dan menjadikan kamera sebagai pcngesan. Gambaran yang diperolebi oleh projek ini,
akan di paparkan pada komputer pengguna melalui IR Tower. IR Tower ini dijadikan
sebagai penghubung antara komputer penggna dengan kamera. Dalam projek ini, dua
cara program yang berbeza iaitu Not Quite C (NQC) dan ROBOLAB digunakan dimana
Not Quite C digunakan untuk pergerakan robot manakala ROBOLAB digunakan untuk
memaparkan gambarajah dari kamera
© Universiti Teknikal Malaysia Melaka
viii
CONTANT
CHAPTER ITEM
PAGE
PROJECT TITLE
SUPERVISOR DECLARETION
I
II
ii
DECLARETION
iii
DEDICATION
iv
ACKNOWLEDGMENT
v
ABSTRACT
vi
ABSTRAK
vii
CONTANT
viii
LIST OFTABLE
xi
LIST OF FIGURE
xii
INTRODUCTION
l.OBACKGROUND
1
1.1 OBJECTIVES
3
1.2 SCOPE OF WORKS
3
1.3 PROBLEM STATEMENT
3
1.4 SUMMARY OF METHODOLOGY
5
1.5 THESIS OUTLINE
5
LITERATURE REVIEW
7
© Universiti Teknikal Malaysia Melaka
IX
2.0 INTRODUCTION
7
2.1 RCX PROGRAMMABLE BRICK
8
2.2 RCX FEATURES AND WORKS
9
2.3 SOFTWARE/PROGRAMMING IN RCX
m
13
2.3.1 ROBOLAB
14
2.3.2 Not Quite C
16
2.3.3 leJOS ·
18
2.3.4 pbFORTH
19
2.3.5 C and C++ under BrickOS
19
2.4 HARDWARE DEVICE IN LEGO
20
2.4J Sensor
20
2.4.2 Motor
21
2.4.3 Camera
22
2.5 LEGO PROJECT
23
PROJECT METHODOLOGY
26
3.0 INTRODUCTION
26
3.1 BLOCK DIAGRAM OF MOBILE ROBOT MONITORING
27
SYSTEM
3.2 HARDWARE DESIGN
27
3.2.1 Stage I
28
3.2.2 Stage 2
29
3.2.3 Stage 3
30
3.2.4 Stage 4
32
3.3 SOFTWARE DESIGN
33
3.3. 1 ROBOLAB
33
3.3.2 NQC
35
© Universiti Teknikal Malaysia Melaka
X
3.4 FLOW CHART OF THE MOBILE ROBOT MONITORING
SYSTEM
IV
v
36
RESULTS
38
4.0 INTRODUCTION
38
4.1 RESULTS
39
4.1.1 Robot Prototype
39
4.1.2 Operation ofThe Mobile Robot
41
4.1.3 Programming Project
42
4.1.4 Platform
48
DISCUSSION, CONCLUSION AND SUGGESTION
49
5.0 INTRODUCTION
49
5.1 DISCUSSION
50
5.2 CONCLUSION
51
5.3 PROJECT APPLICATION
52
5.3.1 Home Security
52
5.3.2 Baby Sitter
52
5.4 SUGGESTION
53
REFERENCE
54
APPENDIX
56
© Universiti Teknikal Malaysia Melaka
XI
LIST OFTABLE
TABLE 2. 1:
RCX HARDWARE SPECIFICATIONS
TABLE 2.2: MOTOR SPEC£FICATION
© Universiti Teknikal Malaysia Melaka
10
22
XII
LIST OF FIGURE
FIGURE 2.1: RCX
8
FIGURE 2.2: CONNECTIONS RCX WITH I NPUT & OUTPUT
9
FIGURE 2.3(A): TOP VIEW OF RCX BOARD
11
FIGURE 2.3(s): BOTTOM VIEW OF RCX BOARD
11
FIGURE 2.4: LoGICAL STRUCTURE
12
FIGURE 2.5: SIMPLE PROGRAMMING
13
FIGURE 2.6: SCREENS HOT OF SIMPLE ROBOLAB
15
FIGURE 2.7: BRICX COMMAND CENTER FOR NQC
16
FIGURE 2.7: TOUCH SENSOR
20
FIGURE 2.8 : LIGHT SENSOR
21
FIGURE 2.9: MOTOR 9V
21
FIGURE 2.10: LEGO CAMERA
22
FIGURE 3.1: BLOCK DIAGRAM OF MOBILE ROBOT
27
FIGURE 3.2: 1ST MODEL MOBILE ROBOT (SKETCH)
28
FIGURE 3.3: 2ND MODEL MOBILE ROBOT
29
FIGURE 3.4: FRAME OF THE ROBOT
30
FIGURE 3.5: FRAME OF THE ROBOT
31
FIGURE 3.6: 3RD MODEL MOBILE ROBOT
31
FIGURE 3.7: 4THMODEL MOBILE ROBOT
32
FIGURE 3.8: ROBOLAB PROGRAMMING
34
FIGURE 3.9: FLOW OF M ETHODOLOGY
36
FIGURE 4.1: MOBILE ROBOT MONITORING SY STEM
40
FIGURE 4.2: FLOW OF MOBILE ROBOT OPERATION
41
FIGURE 4.3(A): MAIN FLOW CHART
42
FIGURE 4.3{B): PART A FLOW CHART
43
© Universiti Teknikal Malaysia Melaka
Xlll
FIGURE 4.3(C): PART B FLOW CHART
44
FIGURE 4.3(D): PART C FLOW CHART
45
F IGURE 4.3(E): FINAL FLOW CHART
46
FIGURE 4.4: MOBILE ROBOT PLATFORM
48
© Universiti Teknikal Malaysia Melaka
CHAPTER I
INTRODUCTION
1.0 Background
Nowadays, there a lot of robot that has created to make an easy life for human.
sッュセ@
of robot is used at home, as a research and the most using it at industry. Robot is a
mechanical or virtual, artificial agent and usually an electro-mechanical system which
by its appearance or movements conveys a sense that it has intent or agency of its own.
Robot also can be defme an automatically controlled reprogrammable, multipurpose,
manipulator programmable in three or more axes; which may be either fixed in place or
mobile for used in the industrial automation application.
A typical robot must not natural which is copy the creation from the previous.
This robot can sense its environments and can manipulate things around it. All the
intelligence of the robot is program by humans to make this
セッ「エ@
have a degree of
intelligence. This mean the robot can be programmable and controlled by computer.
With the intelligence, they can move with one or more axes of rotation. There are two
types of robot which are industry and mobile. An industrial robot is officially defmed by
ISO as an automatically controlled, reprogrammable, multipurpose manipulator
programmable in three or more axes. The field of industrial robotics may be more
practically defined as the study, design and use of robot systems for manufacturing.
© Universiti Teknikal Malaysia Melaka
2
Typical applications of industrial robots include welding, painting, ironing, assembly,
pick and place, palletizing, product inspection, and testing, all accomplished with high
endurance, speed, and precision [13].
A mobile robot is an automatic machine that is capable of movement in a given
environment. It has the capability to move around in their environment and is not fixed
to one physical location. ln contrast, industrial robots usually consist of a jointed arm
and gripper assembly that is attached to a fixed surface. Mobile robots may be classified
by the environment in which they travel land robots, aerial robots, and underwater
robots. Mobile robots are the focus of a great deal of current research. Mobile robots are
also found in industry, military and security environments. The classification of the
mobile robot needs the main behaviors of the robot which are navigation and
monitoring.
The behaviors of the robot navigation and monitoring are related with each other.
Monitoring need navigator to navigate the environment the robot. Otherwise, this robot
cannot display or make a monitor around it because this robot cannot sense things
around them.
© Universiti Teknikal Malaysia Melaka
3
1.1 Objectives
The purposes of doing this project are:
• To develop a mobile robot monitoring system using LEGO Mindstorm.
• To design a robot to capture an object image using Lego's camera.
• To developed RCX programming using NQC programming.
1.2 Scope of Works
The scope of this project is to design mobile robot monitoring system using
LEGO MINDSTORM. This project have two part of designing which are design the
hardware for the mobile robot while the other one is software for the mobile
programming. The main device for this project is camera which is used to monitor and
detect an object surround the robot. However, the camera cannot. be detected by Not
Quit C programming. Therefore, this robot will have two different programming in the
RCX programmable. The movement of the robot will use 'sensor and camera to sense the
object surround the robot to capture the image. The robots have to turn left or right or
stop before it captures the objects.
1.3 Problem Statement
Nowadays, there are many of application of developing a robot such as using
PIC, DSP Processor, RCX LEGO, etc. PIC, DSP and RCX all are the controller or main
brain for the robot. They have same function which is for install the program into it. All
the movement, behaviors and etc for the robot is in the brain. Between All of controller,
the RCX is much easier then other because LEGO is available for a starting user which
is available for children and adults.
© Universiti Teknikal Malaysia Melaka
4
In this project, I chose to design my robot using LEGO Mindstorm. LEGO
Mindstorm is easy to develop a robot because it has a lot of brick that can be used to
assemble the robot and already have their own controller which is called RCX
Programmable. Although the cost of the LEGO is quite expensive, for the beginner it is
available.
There are two behaviors for mobile robot which is monitoring and navigation.
For this robot, I chose monitoring for my robot behavior. One of the greatest challenges
in designing mobile robot monitoring system is dealing with camera. In LEGO
Mindstorm, they have their own camera which is called Vision Command. This Vision
Command has to connect to the computer to power it up. Vision Command also has the
built-in USB port. Thus this project has a limited move with the camera Besides that,
the program needs to have an interface for the programming between Vision Command
and RCX programming. In particular, it is very difficult for a developer to anticipate all
possible contingencies in advance, much less decide how to capture the object image.
The ultimate goal is to have the robot can monitor the entire situation and capture by
user control, based on explicit models of the robot's sensors, behaviors and environment.
The requirements for this robot are:
• Camera (for capturing the ima"ge and being sensor).
• Light sensor (to detect the object).
The advantages of this robot:
• Can be monitored environment more accurate then CCTV or human.
• Can sense and capture the image of the object.
The disadvantages of this robot:
• Have limitation movement with the camera.
• Need more sensors to sense the object
© Universiti Teknikal Malaysia Melaka
5
1.4 Summary of Methodology
All the method that is used to achieve the objective of this project is based on the
flow chart that has been designed from the beginning of this project. The detail
explanation method of mobile robot will be in Chapter III.
Before the designing the prototype of the robot hardware, four model robots has
been designed to make sure the robot is available for the monitoring system robot. This
robot should be available used with camera because the core of this project is monitoring
which mean it should has to use camera.
After the finished of the robot, the programming should be programmed in RCX
which is as the robot brain. All the program will be download to the RCX. For this
robot, the programming that has been used is ROBOLAB and Not Quit C. the using of
two method of the programming will be explain more in Chapter ill.
1.5 Thesis Outline
This thesis represent by ftve chapters. The following is the outline of the mobile
robot monitoring system using LEGO Mindstorms project in chapter by chapter.
Chapter 1:
This chapter discuss about the brief overview about the project such as
introduction, objectives, problem statement and ウセ
Chapter II:
ッー・@
of the proj ect.
This chapter describe about the research and the information of the
project. Every facts and information which found through journals or the
other references will be compared and the better methods have been
chosen for the project.
© Universiti Teknikal Malaysia Melaka
6
Chapter III:
This chapter discuss about the project methodology used in this project
such as software that have been used for the programming and the stages
· of designing the project until the last design. All these methodology will
be the best result for the project.
Chapter IV:
This chapter describes about the project fmding such as results and the
analysis.
Chapter V:
This chapter is the conclusion ofthe project. The upgraded of this mobile
robot is described in suggestion of this project. Discussion is described
the problem is occurring went the project in progress.
© Universiti Teknikal Malaysia Melaka
7
CHAPTER II
LITERATURE REVIEW
2.0 Introduction
For this chapter, literature review will describe more about the component that
will be used for this project. Literature review will give an idea about what component
and design that will be used after all the suitable specification for this project have been
studied. This specification is needed to know the suitable character that will be used so
that this project is success in giving the right output.
This project will used LEGO Mindstorms features to design the robot. The entire
components that have been used are all from LEGO Mindstorms. Lego Mindstorms is a
line of Lego sets combining programmable bricks with electric motors, sensors, Lego
bricks, and Lego Technic pieces (such as gears, axles, beams, and pneumatic parts) to
build robots and other automated or interactive systems [9]. Lego Mindstorms may be
used to build a model of an embedded system with computer-controlled
electromechanical parts. Many kinds of real-life embedded systems, from elevator
controllers to industrial robots modeled using Mindstorms.
© Universiti Teknikal Malaysia Melaka
8
LEGO Mindstonns has been nearly 15 years in the making. It comes through
collaboration between LEGO and the Massachusetts Institute of Technology (MIT).
Fred Martin, an MIT research scientist, helped develop much of the microprocessor
technology ultimately used in MindStorrns, and it was Dr. Seymour Papert's vision to
stuff a computer inside a LEGO brick. Papert, a pioneer in artificial intelligence and the
creator of the Logo programming language, worked with LEGO to put his Logo into
LEGO bricks [7].
2.1 RCX Programmable Brick
The heart of the MindStorms kit is the Robotic Command Explorer (RCX). It is
often called the "programmable brick," or "smart brick," because it resembles a standard
Lego piece in many of its characteristics, through a great power hides within it [ l OJ. The
RCX is a microcomputer than interfaces with input and output devices. About the size of
two decks of playing cards, the RCX uses sensors to take input from its environment,
process the data, and signal up to three motors to tum on and off in forward or reverse at
any one of 8 speeds. This "smart brick" can process over I 000 commands per second
[7][10]. The RCX Programmable is shown in figure 2.1. the RCX serves as the brain of
LEGO MINDSTORMS inventions. It uses sensors to take input from its environment,
processes data, and signals output motors to turn On and off [6].
Figure 2.1: RCX
© Universiti Teknikal Malaysia Melaka
9
For the beginner, RCX and LEGO element will be used to build the robot. Then
by using RCX Code, a simple programming language will be used to create the program.
After that, the programs have to download to the RCX using a special infrared
transmitter tower. Finally, the creation can be interacted with the environment, fully
independent from the computer.
Figure 2.2: Connections RCX with Input & Output
2.2 RCX Features and Works
Version 1.0 RCX bricks feature a power adapter jack to allow continuous
operation instead of the limited operation time when using batteries. In version 2.0, the
power adapter jack was removed. Power adapter-equipped RCX bricks are popular for
stationary robotics projects such as robot arms or for controlling Lego model trains. In
the latter context, the RCX needs to be programmed with Digital Command Control
(DCC) software required for automated model train operation [9].·
© Universiti Teknikal Malaysia Melaka
NIK RUS KHUZAIMAH BINTI NIK AZIZAN
This report is submitted in partial fulfillment of requirements for the Bachelor Degree of
Electronic Engineering (Computer Engineering) with honours
Fakulti Kejuruteraan Elektronik & Kejuruteraan Komputer
Universiti Teknikal Malaysia Melaka
APRIL2007
© Universiti Teknikal Malaysia Melaka
UNIVERSTI TEKNIKAL MALAYSIA MELAKA
FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER
BORANGPENGESAHANSTATUSLAPORAN
PROJEK SARJANA MUDA II
Tajuk Projek
Mobile Robot Monitoring System Using LEGO
Mindstorms
Sesi
Pengajian
06/07
Saya
N IK RUS KHUZA IMAH BINTI NIK AZIZAN
(HURUF BESAR)
mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan syaratsyarat kegunaan sepert i berikut:
I.
Laporan adalah hakmilik Universiti Teknikal Malaysia Melaka.
2.
Perpustakaan dibenarkan membuat salinan untu k tujuan pengajian sahaja.
3.
Perpustakaan dibenarkan membuat salinan laporan ini sebagai bahan pertukaran antara institusi
pengaj ian tinggi.
4.
Sila tandakan ( ..J ) :
D
D
0
SULIT*
(Mengandungi maklumat yang berdarjah keselamatan atau
kepentingan Malaysia seperti yang tennaktub di dalam AKTA
RAHSIA RASMI 1972)
TERHAD*
(Mengandungi maklumat terhad yang telah ditentukan oleh
organisasi!badan di mana penyelidikan dijalankan)
TIDAK TERHAD
Disahkan oleh:
Alamat Tetap: 256, Fasa 2H, Persiaran SM2H/7,
32040 Seri Manjung, Perak
Tarikh: 27 APRIL 2007
nuBlfajセ@
li ABD MANAP
f'ensyarah
Y:akultt Kej Elektro:-:ik tla:-t Kej Kom,uter (FKEKK)
Universltt Teknik.l: Ma'ays1a Melaka (UTeM),
K;uun! ャ・ヲエHZNセョ」ゥ@
1200,
Ayer Kereh, 75-451 Melaka
Tarikh: 27 APR IL 2007
© Universiti Teknikal Malaysia Melaka
UNIVERSTI TEK NIKAL M ALAYSIA MELAKA
FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN KOMPUTER
BORANG PENGESAHAN STATUS LAPORAN
PROJEK SARJANA MUDA II
Tajuk Projek
M obile Robot Monitoring System Using LEGO
Mindstorms
Sesi
Pengajian
06/07
Saya
NIK RUS KHUZAIMAH BTNTI NIK AZIZAN
(HURUF BESAR)
mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan syaratsyarat kegunaan seperti ber ikut:
I.
Laporan adalah hakmilik Universiti Teknikal Malaysia Melaka.
2.
Perpustakaan dibenarkan membuat salinan untuk tuj uan pengajian s ahaja.
3.
Perpustakaan d ibenarkan membuat salinan laporan ini sebagai bahan pert ukaran antara institus i
pengaj ian ti nggi.
4.
Sila tandakan ( ..J ) :
D
SULIT *
(Mengandungi maklumat yang berdarjah keselamatan atau
kepentingan Malaysia seperti yang termaktub di dalam AKTA
RAHSIA RASMII972)
D
TERHAD*
(Mengandungi maklumat terhad yang telah ditcntukan oleh
organisasi/badan di mana penyelidikan dijalankan)
0
T IOAK TERHAD
Disahkan oleh:
Alamat Tetap: 256. Fasa 2 H, Persiaran SM2H/7,
NUJitULFAJAJit 8 ABD MANAP
l'l!msyarah
32040 Seri Manjung, Perak
Tarikh: 27 APRIL 2007
J=akultt Kej Elektro:-:ik q セ@ K8! kッュセエオ
・ イ@ {FKEKK)
Univer<i Teknik.1: Ma'aysaa Melaka (UTeM),
kゥャイオョセ@
ャ・イQ\[Nセョ」ゥ@
1200,
Ayer Xereh, 7545t Melaka
Tarikh: 27 APRIL 2007
© Universiti Teknikal Malaysia Melaka
II
"I hardly declare that this report is the result of my own work except for quotes as cited
in the references"
Signature
セM
Author
: Nik Rus Khuzaimah Binti Nik Azizan
Date
: 27 APRIL 2007
© Universiti Teknikal Malaysia Melaka
lll
"I hereby declare that I have read this report and in my opinion this report is sufficient in
terms of scope and quality for the award of Bachelor of Electronic Engineering
(Computer Engineering) with honours."
Signature
Supervisor's Name
Date
セ@
: En Nurulfa]ar Bin Abd Manap
: 27 APRIL 2007
© Universiti Teknikal Malaysia Melaka
lV
Just For My Mom And My Dad
© Universiti Teknikal Malaysia Melaka
v
ACKNOWLEDGEMENT
I would like to extend my sincere gratitude to my supervisor, Mr. Nurulfajar B
Abd Manap, for his assistance and guidance towards the progress of this thesis project.
Throughout the year, Mr. Nururlfajar has been patiently monitoring my progress and
guided me in the right direction and offering encouragement. Obviously the progress I
had now will be uncertain without her assistance. Special thanks must also go to Mr.
Sani Irwan B Salim, lecturer of Faculty of Electronic and Computer Engineering for his
advice and help.
My special appreciation and thanks to all my friends for their invaluable
assistance towards this thesis project. Most of all, I am very grateful to my family
especially my dearest parent, Mr. Nik Azizan B Nik 'Ariffm and Mrs. Junaidah Bt
A wang and all my siblings for their unfailing encouragement and fmancial support they
given me over the years.
© Universiti Teknikal Malaysia Melaka
Vl
ABSTRACT
The mobile robot monitoring system using LEGO Mindstorms tool is a mobile
robot that has a behavior which is monitoring system. This rob.ot ·win monitor and sense
the object around them using camera Lego. This project highlights the hardware
development and programming development. The hardware development of mobile
robot monitoring system based on Lego while for programming development is used C
language: This project programming needs other programming to display the image and
make the camera as a sensor. The image data will be sent to the user computer using IR
Tower. This IR Tower is interacting as interface hetween computer and the camera. In
this project, two different methods programming Not Quite C and ROBOLAB is used
which is able to move for Not Quite C and display the image for ROBOLAB using
camera Lego through the user computer.
© Universiti Teknikal Malaysia Melaka
vu
ABSTRAK
Projek Mobile Robot Monitoring System using LEGO Mindstorms adalah projek
dimana robot yang mempunyai sistem pengawasan sebagai sifat robot itu. Robot ini
akan mengawas dan sebagai pengesan pada objek disekelilingnya dengan menggunakan
kamera yang disediakan oleh Lego Mindstorms. Projek ini mengetengahkan
pembangunan hardware dan software. Bagi pembangunan hardware projek ini
menggunakan kamera Lego sebagai komponen yang utama. Sementara itu, bagi
pembangunan software, projek ini menggunakan bahasa C. Bagi projek ini, ia
memerlukan satu lagi software untuk menjadikan kamera ini memaparkan gambarajah
dan menjadikan kamera sebagai pcngesan. Gambaran yang diperolebi oleh projek ini,
akan di paparkan pada komputer pengguna melalui IR Tower. IR Tower ini dijadikan
sebagai penghubung antara komputer penggna dengan kamera. Dalam projek ini, dua
cara program yang berbeza iaitu Not Quite C (NQC) dan ROBOLAB digunakan dimana
Not Quite C digunakan untuk pergerakan robot manakala ROBOLAB digunakan untuk
memaparkan gambarajah dari kamera
© Universiti Teknikal Malaysia Melaka
viii
CONTANT
CHAPTER ITEM
PAGE
PROJECT TITLE
SUPERVISOR DECLARETION
I
II
ii
DECLARETION
iii
DEDICATION
iv
ACKNOWLEDGMENT
v
ABSTRACT
vi
ABSTRAK
vii
CONTANT
viii
LIST OFTABLE
xi
LIST OF FIGURE
xii
INTRODUCTION
l.OBACKGROUND
1
1.1 OBJECTIVES
3
1.2 SCOPE OF WORKS
3
1.3 PROBLEM STATEMENT
3
1.4 SUMMARY OF METHODOLOGY
5
1.5 THESIS OUTLINE
5
LITERATURE REVIEW
7
© Universiti Teknikal Malaysia Melaka
IX
2.0 INTRODUCTION
7
2.1 RCX PROGRAMMABLE BRICK
8
2.2 RCX FEATURES AND WORKS
9
2.3 SOFTWARE/PROGRAMMING IN RCX
m
13
2.3.1 ROBOLAB
14
2.3.2 Not Quite C
16
2.3.3 leJOS ·
18
2.3.4 pbFORTH
19
2.3.5 C and C++ under BrickOS
19
2.4 HARDWARE DEVICE IN LEGO
20
2.4J Sensor
20
2.4.2 Motor
21
2.4.3 Camera
22
2.5 LEGO PROJECT
23
PROJECT METHODOLOGY
26
3.0 INTRODUCTION
26
3.1 BLOCK DIAGRAM OF MOBILE ROBOT MONITORING
27
SYSTEM
3.2 HARDWARE DESIGN
27
3.2.1 Stage I
28
3.2.2 Stage 2
29
3.2.3 Stage 3
30
3.2.4 Stage 4
32
3.3 SOFTWARE DESIGN
33
3.3. 1 ROBOLAB
33
3.3.2 NQC
35
© Universiti Teknikal Malaysia Melaka
X
3.4 FLOW CHART OF THE MOBILE ROBOT MONITORING
SYSTEM
IV
v
36
RESULTS
38
4.0 INTRODUCTION
38
4.1 RESULTS
39
4.1.1 Robot Prototype
39
4.1.2 Operation ofThe Mobile Robot
41
4.1.3 Programming Project
42
4.1.4 Platform
48
DISCUSSION, CONCLUSION AND SUGGESTION
49
5.0 INTRODUCTION
49
5.1 DISCUSSION
50
5.2 CONCLUSION
51
5.3 PROJECT APPLICATION
52
5.3.1 Home Security
52
5.3.2 Baby Sitter
52
5.4 SUGGESTION
53
REFERENCE
54
APPENDIX
56
© Universiti Teknikal Malaysia Melaka
XI
LIST OFTABLE
TABLE 2. 1:
RCX HARDWARE SPECIFICATIONS
TABLE 2.2: MOTOR SPEC£FICATION
© Universiti Teknikal Malaysia Melaka
10
22
XII
LIST OF FIGURE
FIGURE 2.1: RCX
8
FIGURE 2.2: CONNECTIONS RCX WITH I NPUT & OUTPUT
9
FIGURE 2.3(A): TOP VIEW OF RCX BOARD
11
FIGURE 2.3(s): BOTTOM VIEW OF RCX BOARD
11
FIGURE 2.4: LoGICAL STRUCTURE
12
FIGURE 2.5: SIMPLE PROGRAMMING
13
FIGURE 2.6: SCREENS HOT OF SIMPLE ROBOLAB
15
FIGURE 2.7: BRICX COMMAND CENTER FOR NQC
16
FIGURE 2.7: TOUCH SENSOR
20
FIGURE 2.8 : LIGHT SENSOR
21
FIGURE 2.9: MOTOR 9V
21
FIGURE 2.10: LEGO CAMERA
22
FIGURE 3.1: BLOCK DIAGRAM OF MOBILE ROBOT
27
FIGURE 3.2: 1ST MODEL MOBILE ROBOT (SKETCH)
28
FIGURE 3.3: 2ND MODEL MOBILE ROBOT
29
FIGURE 3.4: FRAME OF THE ROBOT
30
FIGURE 3.5: FRAME OF THE ROBOT
31
FIGURE 3.6: 3RD MODEL MOBILE ROBOT
31
FIGURE 3.7: 4THMODEL MOBILE ROBOT
32
FIGURE 3.8: ROBOLAB PROGRAMMING
34
FIGURE 3.9: FLOW OF M ETHODOLOGY
36
FIGURE 4.1: MOBILE ROBOT MONITORING SY STEM
40
FIGURE 4.2: FLOW OF MOBILE ROBOT OPERATION
41
FIGURE 4.3(A): MAIN FLOW CHART
42
FIGURE 4.3{B): PART A FLOW CHART
43
© Universiti Teknikal Malaysia Melaka
Xlll
FIGURE 4.3(C): PART B FLOW CHART
44
FIGURE 4.3(D): PART C FLOW CHART
45
F IGURE 4.3(E): FINAL FLOW CHART
46
FIGURE 4.4: MOBILE ROBOT PLATFORM
48
© Universiti Teknikal Malaysia Melaka
CHAPTER I
INTRODUCTION
1.0 Background
Nowadays, there a lot of robot that has created to make an easy life for human.
sッュセ@
of robot is used at home, as a research and the most using it at industry. Robot is a
mechanical or virtual, artificial agent and usually an electro-mechanical system which
by its appearance or movements conveys a sense that it has intent or agency of its own.
Robot also can be defme an automatically controlled reprogrammable, multipurpose,
manipulator programmable in three or more axes; which may be either fixed in place or
mobile for used in the industrial automation application.
A typical robot must not natural which is copy the creation from the previous.
This robot can sense its environments and can manipulate things around it. All the
intelligence of the robot is program by humans to make this
セッ「エ@
have a degree of
intelligence. This mean the robot can be programmable and controlled by computer.
With the intelligence, they can move with one or more axes of rotation. There are two
types of robot which are industry and mobile. An industrial robot is officially defmed by
ISO as an automatically controlled, reprogrammable, multipurpose manipulator
programmable in three or more axes. The field of industrial robotics may be more
practically defined as the study, design and use of robot systems for manufacturing.
© Universiti Teknikal Malaysia Melaka
2
Typical applications of industrial robots include welding, painting, ironing, assembly,
pick and place, palletizing, product inspection, and testing, all accomplished with high
endurance, speed, and precision [13].
A mobile robot is an automatic machine that is capable of movement in a given
environment. It has the capability to move around in their environment and is not fixed
to one physical location. ln contrast, industrial robots usually consist of a jointed arm
and gripper assembly that is attached to a fixed surface. Mobile robots may be classified
by the environment in which they travel land robots, aerial robots, and underwater
robots. Mobile robots are the focus of a great deal of current research. Mobile robots are
also found in industry, military and security environments. The classification of the
mobile robot needs the main behaviors of the robot which are navigation and
monitoring.
The behaviors of the robot navigation and monitoring are related with each other.
Monitoring need navigator to navigate the environment the robot. Otherwise, this robot
cannot display or make a monitor around it because this robot cannot sense things
around them.
© Universiti Teknikal Malaysia Melaka
3
1.1 Objectives
The purposes of doing this project are:
• To develop a mobile robot monitoring system using LEGO Mindstorm.
• To design a robot to capture an object image using Lego's camera.
• To developed RCX programming using NQC programming.
1.2 Scope of Works
The scope of this project is to design mobile robot monitoring system using
LEGO MINDSTORM. This project have two part of designing which are design the
hardware for the mobile robot while the other one is software for the mobile
programming. The main device for this project is camera which is used to monitor and
detect an object surround the robot. However, the camera cannot. be detected by Not
Quit C programming. Therefore, this robot will have two different programming in the
RCX programmable. The movement of the robot will use 'sensor and camera to sense the
object surround the robot to capture the image. The robots have to turn left or right or
stop before it captures the objects.
1.3 Problem Statement
Nowadays, there are many of application of developing a robot such as using
PIC, DSP Processor, RCX LEGO, etc. PIC, DSP and RCX all are the controller or main
brain for the robot. They have same function which is for install the program into it. All
the movement, behaviors and etc for the robot is in the brain. Between All of controller,
the RCX is much easier then other because LEGO is available for a starting user which
is available for children and adults.
© Universiti Teknikal Malaysia Melaka
4
In this project, I chose to design my robot using LEGO Mindstorm. LEGO
Mindstorm is easy to develop a robot because it has a lot of brick that can be used to
assemble the robot and already have their own controller which is called RCX
Programmable. Although the cost of the LEGO is quite expensive, for the beginner it is
available.
There are two behaviors for mobile robot which is monitoring and navigation.
For this robot, I chose monitoring for my robot behavior. One of the greatest challenges
in designing mobile robot monitoring system is dealing with camera. In LEGO
Mindstorm, they have their own camera which is called Vision Command. This Vision
Command has to connect to the computer to power it up. Vision Command also has the
built-in USB port. Thus this project has a limited move with the camera Besides that,
the program needs to have an interface for the programming between Vision Command
and RCX programming. In particular, it is very difficult for a developer to anticipate all
possible contingencies in advance, much less decide how to capture the object image.
The ultimate goal is to have the robot can monitor the entire situation and capture by
user control, based on explicit models of the robot's sensors, behaviors and environment.
The requirements for this robot are:
• Camera (for capturing the ima"ge and being sensor).
• Light sensor (to detect the object).
The advantages of this robot:
• Can be monitored environment more accurate then CCTV or human.
• Can sense and capture the image of the object.
The disadvantages of this robot:
• Have limitation movement with the camera.
• Need more sensors to sense the object
© Universiti Teknikal Malaysia Melaka
5
1.4 Summary of Methodology
All the method that is used to achieve the objective of this project is based on the
flow chart that has been designed from the beginning of this project. The detail
explanation method of mobile robot will be in Chapter III.
Before the designing the prototype of the robot hardware, four model robots has
been designed to make sure the robot is available for the monitoring system robot. This
robot should be available used with camera because the core of this project is monitoring
which mean it should has to use camera.
After the finished of the robot, the programming should be programmed in RCX
which is as the robot brain. All the program will be download to the RCX. For this
robot, the programming that has been used is ROBOLAB and Not Quit C. the using of
two method of the programming will be explain more in Chapter ill.
1.5 Thesis Outline
This thesis represent by ftve chapters. The following is the outline of the mobile
robot monitoring system using LEGO Mindstorms project in chapter by chapter.
Chapter 1:
This chapter discuss about the brief overview about the project such as
introduction, objectives, problem statement and ウセ
Chapter II:
ッー・@
of the proj ect.
This chapter describe about the research and the information of the
project. Every facts and information which found through journals or the
other references will be compared and the better methods have been
chosen for the project.
© Universiti Teknikal Malaysia Melaka
6
Chapter III:
This chapter discuss about the project methodology used in this project
such as software that have been used for the programming and the stages
· of designing the project until the last design. All these methodology will
be the best result for the project.
Chapter IV:
This chapter describes about the project fmding such as results and the
analysis.
Chapter V:
This chapter is the conclusion ofthe project. The upgraded of this mobile
robot is described in suggestion of this project. Discussion is described
the problem is occurring went the project in progress.
© Universiti Teknikal Malaysia Melaka
7
CHAPTER II
LITERATURE REVIEW
2.0 Introduction
For this chapter, literature review will describe more about the component that
will be used for this project. Literature review will give an idea about what component
and design that will be used after all the suitable specification for this project have been
studied. This specification is needed to know the suitable character that will be used so
that this project is success in giving the right output.
This project will used LEGO Mindstorms features to design the robot. The entire
components that have been used are all from LEGO Mindstorms. Lego Mindstorms is a
line of Lego sets combining programmable bricks with electric motors, sensors, Lego
bricks, and Lego Technic pieces (such as gears, axles, beams, and pneumatic parts) to
build robots and other automated or interactive systems [9]. Lego Mindstorms may be
used to build a model of an embedded system with computer-controlled
electromechanical parts. Many kinds of real-life embedded systems, from elevator
controllers to industrial robots modeled using Mindstorms.
© Universiti Teknikal Malaysia Melaka
8
LEGO Mindstonns has been nearly 15 years in the making. It comes through
collaboration between LEGO and the Massachusetts Institute of Technology (MIT).
Fred Martin, an MIT research scientist, helped develop much of the microprocessor
technology ultimately used in MindStorrns, and it was Dr. Seymour Papert's vision to
stuff a computer inside a LEGO brick. Papert, a pioneer in artificial intelligence and the
creator of the Logo programming language, worked with LEGO to put his Logo into
LEGO bricks [7].
2.1 RCX Programmable Brick
The heart of the MindStorms kit is the Robotic Command Explorer (RCX). It is
often called the "programmable brick," or "smart brick," because it resembles a standard
Lego piece in many of its characteristics, through a great power hides within it [ l OJ. The
RCX is a microcomputer than interfaces with input and output devices. About the size of
two decks of playing cards, the RCX uses sensors to take input from its environment,
process the data, and signal up to three motors to tum on and off in forward or reverse at
any one of 8 speeds. This "smart brick" can process over I 000 commands per second
[7][10]. The RCX Programmable is shown in figure 2.1. the RCX serves as the brain of
LEGO MINDSTORMS inventions. It uses sensors to take input from its environment,
processes data, and signals output motors to turn On and off [6].
Figure 2.1: RCX
© Universiti Teknikal Malaysia Melaka
9
For the beginner, RCX and LEGO element will be used to build the robot. Then
by using RCX Code, a simple programming language will be used to create the program.
After that, the programs have to download to the RCX using a special infrared
transmitter tower. Finally, the creation can be interacted with the environment, fully
independent from the computer.
Figure 2.2: Connections RCX with Input & Output
2.2 RCX Features and Works
Version 1.0 RCX bricks feature a power adapter jack to allow continuous
operation instead of the limited operation time when using batteries. In version 2.0, the
power adapter jack was removed. Power adapter-equipped RCX bricks are popular for
stationary robotics projects such as robot arms or for controlling Lego model trains. In
the latter context, the RCX needs to be programmed with Digital Command Control
(DCC) software required for automated model train operation [9].·
© Universiti Teknikal Malaysia Melaka