Inspection Robot
-
Upload
salahiddin -
Category
Documents
-
view
224 -
download
3
Transcript of Inspection Robot
![Page 1: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/1.jpg)
RAFIK HARIRI UNIVERSITY
INSPECTION ROBOT
Done by
SALAHIDDIN EL-JAMMAL
AHMAD TARRAF
AHMAD RHIMY
Submitted to
DR.NIZAR AWAR
This senior project is submitted in a partial fulfillment of BS degree of Mechatronics
Engineering major of the college of Engineering
at Rafic Hariri University
MECHREF-LEBANON
April 2013
![Page 2: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/2.jpg)
Copyright © 2013. All Rights Reserved
Salahiddin El-Jammal(2010-0396)
Ahmad Tarraf(2010-6009)
Ahmad Rhimy(2010-0334)
![Page 3: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/3.jpg)
ii
ABSTRACT
This book describes a Remotely controlled Intelligent Tracked Inspection Vehicle
(RITIV) that relies on Mechatronics engineering to provide a more advanced solution for
inspecting in many dangerous arenas including dark or small caves, deep mines, forests,
snow areas, mine fields, battle fields, places poisoned with gases and radioactive materials,
and other dangerous or unreachable places.
The robot consists of three major parts: first one is the main body containing tracks
to overcome various obstacles. Second part is the camera and sensors for detecting any
surrounding that could affect the mechanism of the robot. Finally, a robotic arm is
implemented on the chassis of the robot which have the ability to carry any object from the
ground and safely transport it to the desired destination.
This book presents the whole process of development including electric schematics,
programs and codes, and a full description of the series of hardware used in this inspection
robot.
![Page 4: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/4.jpg)
iii
ACKNOWLEDGEMENT
For all the knowledge he helped us to gain and for all the help he provided us, we
dedicate this book to our advisor Dr. Nizar Awar. We would also like to thank all
instructors at RHU who lightened our way towards exploring the future through our
education. As Charles William Eliot said, “Books are the quietest and most constant of
friends; they are the most accessible and wisest of counselors, and the most patient of
teachers.”
Finally, we dedicate this book and all our success to our beloved parents who were
the major support for us and are the ones who raised us to become better individuals in the
society.
![Page 5: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/5.jpg)
iv
TABLE OF CONTENTS
ABSTRACT .....................................................................................................................ii
ACKNOWLEDGMENTS ...................................................................................... iii
TABLE OF CONTENTS ......................................................................................... iv
LIST OF FIGURES .................................................................................................... vi
LIST OF TABLES......................................................................................................vii
Chapter Page
1. INTRODUCTION ................................................................................................... 1
1.1.Background Information ....................................................................................... 1
1.2. Literature survey .................................................................................................. 2
2. PROJECT OVERVIEW ...................................................................................... 3
2.1. Statement of the problem ..................................................................................... 3
2.2. Description of the system ................................................................................... 4
2.2.1. Advantages of the system ..................................................................... 4
3. PROJECT HARDWARE ................................................................................... 6
3.1. Remote Control Tracked Vehicle ........................................................................ 6
3.2. Robotic Arm ........................................................................................................ 7
3.3. Wireless Camera ................................................................................................. 8
![Page 6: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/6.jpg)
v
3.4. PIC Microcontroller ............................................................................................ 9
3.5. Dynamics of the system .................................................................................... 10
3.5.1. Characteristics of the drag motors ..................................................... 10
3.5.2. Dynamic Analysis of the Robotic Arm .............................................. 10
4. SUBSYSTEM BEHAVIOR ............................................................................ 13
4.1. Receiver Circuit ................................................................................................. 13
4.1.1. Hardware ............................................................................................. 13
4.1.2. Functionality ....................................................................................... 14
4.2. Transmitter circuit.............................................................................................. 14
4.2.1. Hardware ............................................................................................. 14
4.2.2. Functionality ....................................................................................... 15
4.3. RasBerryPi ......................................................................................................... 16
5. PROGRAM CODES ........................................................................................... 20
5.1. Receiver Microcontroller Program ................................................................... 20
5.2. Transmitter Microcontroller Program ............................................................... 27
5.3. Synapse receiver/ Transmitter Program ............................................................ 29
6. PROBLEMS AND SOLUTIONS ................................................................ 30
7. COSTS AND EXPENSES ............................................................................... 32
8. CONCLUSION AND SKILLS LEARNED ........................................... 33
9. REFERENCES ........................................................................................................ 34
![Page 7: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/7.jpg)
vi
LIST OF FIGURES
Figure Page
1. Main Body of the Inspection Robot ................................................................................... 6
2. Robotic Arm ....................................................................................................................... 7
3. Camera (Raspberry Pi controlled) ...................................................................................... 8
4. PIC 16F877A ..................................................................................................................... 9
5. Modeling of the Arm ....................................................................................................... 10
6. Receiver Circuit Diagram ................................................................................................ 13
7. Transmitter Circuit Diagram ............................................................................................ 15
![Page 8: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/8.jpg)
vii
LIST OF TABLES
Table Page
1. Statistical data of mines injuries and death ........................................................................ 3
2. Costs ................................................................................................................................. 33
![Page 9: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/9.jpg)
1
CHAPTER 1
INTRODUCTION
1.1 Background Information
As the field of inspection is developing day after day, the necessity is making us
more in need to overcome all obstacles and to interact with the surroundings in order to
achieve our goals in inspection.
Going back in history, the act of inspection started in the United States on 1906, by
forming a local agency to inspect food and sold meat and groceries. It was called “Federal
Meat Inspection Act” FMIA. Through time, that agency developed to become responsible
for inspecting drugs, cosmetics and also food.
Until the 21th century, and when the world entered the wave of wars and military
action, inspection was not relying on food and drugs in one side, but it overcame that to be
responsible for scientific and military uses. So here came the great quote “necessity is the
mother of invention”, when technology enabled us to search –using the available sources-
to manufacture advanced modes of inspection robots that could face those obstacles and aid
in achieving some challenging zones such as mine fields, battle fields, or places poisoned
with gases and radioactive materials.
However, these kinds of robots with their cameras and advanced robotic arms will
be a very creative and helpful source in order to switch off a bomb or to activate a security
system and also helping us as Mechatronics engineers to follow the advanced plans in
control and manufacturing.
![Page 10: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/10.jpg)
2
1.2 Literature Survey
In the scope of inspection, danger is the major threat for human investigators. Many
inspectors have lost their lives or parts of their bodies during inspection journeys. There
have been many attempts to solve this problem by different approaches; one of the most
promising solutions is building inspection robots.
Inspection robots are remotely controlled robots that can take the mission of human
inspectors in dangerous or unreachable regions. Many attempts of building inspection
robots have been made but none of them have met the appropriate specifications with the
acceptable cost.
Although the science of robotics came in the 20th century, the robotics field in 20th
and 21th centuries has advanced and developed to associate the remote controlled robots
and machines that are capable of receiving and sending data and also correct some mistakes
done by human beings.
As our survey is including what important sites and references had many opinions
about robotics and inspection, some IEEE members proposed several ideas to enrich this
new field in the century. One of these ideas was Transmission line inspection robot and
deicing robot which was based on manufacturing an inspection robot that is equipped with
inspection sensors/instruments, deicing manipulator and communication device that could
perform on-line detection/inspection of mechanical/electrical failures.
However, the idea of designing and manufacturing inspection robots is spreading
worldwide, not only in NASA and military agencies, but also it has spread to include
universities and civilian research institutes.
![Page 11: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/11.jpg)
3
CHAPTER 2
PROJECT OVERVIEW
2.1 Statement of the Problem
According to statistics, it can be inferred that minefields’ are wide all over the
Lebanese lands due to the wars that the country faced in the past 30 years.
Due to a survey done by the United Nations Mine Action Service from the years 1990
till 1997 about the death and injury cases caused by minefields in Lebanon. The following
table is obtained showing the various numbers of civilians and army members that were
either killed or injured by the act of mines. (minestatisticsPlaceholder1)
Table1: Statistical data of mines injuries and death
VICTIMS
CIVILIANS MILITARY
Year Killed Injured Killed Injured
1990 12 15 - 8
1991 36 78 5 34
1992 11 41 3 14
1993 23 33 - 12
1994 23 32 2 10
1995 16 15 1 5
1996 6 18 1 1
1997 7 17 - 1
TOTAL 134 294 12 85
![Page 12: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/12.jpg)
4
Nowadays, these numbers are in a slight decrease because we are still having some
uninhabited lands in south Lebanon. So to overcome this conflict, inspection robots would
be manufactured to help finding these mines and save many lives. The idea of this project
is to create a smart robot capable of inspecting and finding such mines.
2.2 Description of the System
The inspection robot mainly consists of a fixed plastic body that is dragged by two
rubber tracks which enable it to walk through hard and rough surfaces such as minefields or
radioactive mediums, with its camera and the robotic arm it is able to receive and send data
to the user and carry any object and as we said, move it safely to a desired place.
2.2.1 Advantages of the System
Although many robots have been used for so long, this robot is capable of
performing some hard tasks that a human being is unable to do so. First, its plastic
body which is dragged by the rubber tracks is light so the movement would be
flexible. Also the efficiency to move from a frictional to a frictionless medium is
high. Second, the web controlled camera placed in the front of the body is
specialized by the long range that could reach 50 meters on Wi-Fi, (it can reach
more if a GSM module is implemented).
The Camera is controlled by WIFI (wireless network) and the range can
increase as the signal’s strength increase. Concerning the range largely depends on
the type of obstacles it faces (walls, rocks, trees…)
Third, the inspection robot is controlled by synapse wireless transceiver
modules which is a new technology wireless transceiver module. The one we are
using is RF200PD1 (reference). It may reach to 3 miles range. The normal bit rate
of this module is 2Mbps, (it reduces as the distance between the modules increase).
Fourth, the robotic arm is has a very simple and intelligent design consisting
of some metallic stands, three DC motors, and two stepper motors and plastic
![Page 13: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/13.jpg)
5
tweezers that is also light in weight and doesn’t affect the motion of the arm. The
arm is capable of holding some sensitive objects on one hand, and on the other
hand, it can be replaced by a metallic cutter that could help deactivating a bomb or
cut a metallic wire.
![Page 14: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/14.jpg)
6
CHAPTER 3
PROJECT HARDWARE
3.1 Remote Control Tracked Vehicle
The remotely controlled vehicle consists of a plastic body that has tracks on both
sides, these rubber tracks are capable of moving on frictional and frictionless surfaces
without any deviation away from the path using two DC motors. Note that these tracks are
connected by a mean of a metallic wire that allows the robot to take climbing position that
could enable it to climb on stares or rocks. And the remote controlled camera is placed on
the body of the robot. Finally, the whole system is powered by a 12 volts DC rechargeable
power supply that is placed in the back of the vehicle.
Figure.1: Main Body of the Inspection Robot.
![Page 15: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/15.jpg)
7
3.2 Robotic Arm
The robotic arm consists of one DC motor and four 5-volts Stepper motors and
plastic tweezers that can carry any object and as we said, transmit it safely to a desired
destination. Add to that this arm is formed by 4 main assembly parts: the rotor, the crane,
the wrist, and the clamps. All these main parts are controlled by the mean of a PIC
microcontroller.
Figure.2: Robotic Arm
![Page 16: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/16.jpg)
8
3.3 Wireless Camera
The camera used in the inspection robot works by a web server which is connected
to the same wireless network that is –in our case- an ANDROID HOTSPOT. The camera is
directly connected to the RasBerryPi, receiving the image of the surroundings and sending
it back to us without any disturbance or noise. In addition, the camera is controlled by the
RasBerryPi server for better image processing.
Figure.3: Camera (Raspberry Pi controlled)
![Page 17: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/17.jpg)
9
3.4 PIC Microcontroller
PIC or Peripheral Interface Microcontroller is made by microchip technology based
on Harvard architecture. PICs are popular due to their availability, low cost, and serial
programming.
PIC 16F877A is one of the best from its family. It comes with a 40 pin DIP pin out
with many peripherals.
Figure.4: PIC 16F877A
![Page 18: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/18.jpg)
10
MikroC was the programming language used to program the PIC and programmed via
a PIC programmer.
3.5 Dynamics of the System
3.5.1 Characteristics of drag motors
The motors used for dragging the robot are 12V 1A motors. They can drag
the robot with the arm by 4m/s (it may reach 2m/s if 1.5Kg weight is loaded on the
vehicle)
3.5.2 Dynamic Analysis of Robotic Arm
Figure.5: Modeling of the arm
The figure shows the layout of the Robotic Arm. At this position we will
have maximum stresses (maximum distance) the purpose from the following is to
find the maximum forces and moments (thereby the stresses) in the Arm. then we
will make an assumption for the base, and see if the base will be subjected to any
yielding or failure.
![Page 19: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/19.jpg)
11
Maximum compressive force
F =m1*g+m2*g
=0.200*9.81+0.15*9.81
=3.4 N
Maximum moment
µ = - m1*g*d1+m2*g*d2
= -0.200*9.81*5.5*0.001+0.15*9.81*24*0.01
= 0.0137 N.m
Since exact data are not given, we will assume a safety factor of 4.
We are dealing with an annealed stainless steel (303), Sy= 241 and MpaSut=
601 Mpa. So our designing yield stress and our designed ultimate stress are Sy’ =
60.25, and Sut’ = 150.25. Also we have ƹf =1.16>0.05, so we are dealing with a
ductile material.
After we have our strengths, it’s time to calculate our stresses; this situation
is a plane stress. Moreover, for the stress in the y-axis:
The cross-section area of the base axis is 3.5 mm2.
Γ3 =Γy = f/A
= F/π*r^2
= 3.4/(38*10^-6)
= -94444.4pa (in compression)
For the stress in the x-axis:
Γ1 =Γx=Mc/I
= Mc*64/π*d4
=64M/2*π *d3
= 32(0.0137)/π*(7*10-3)3
=407049.07 pa
![Page 20: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/20.jpg)
12
Being most conservative, we will assume maximum shear stress.
Γ1-Γ3=Sy
94444.4 + 407049.07=50.19 Kpa<60Mpa
So neither yielding, nor failure will occur.
To emphasis on our problem more, we will calculate the maximum mass that can be
placed before yielding.
F =m1*g+m2*g
=0.200*9.81+m*9.81
=1.962 + 9.81m
µ = - m1*g*d1+m2*g*d2
= -0.200*9.81*5.5*0.001+m*9.81*24*0.01
=-0.0010791+0.23544m
Γ1-Γ3 =Sy
32*µ/π*d3-F/A = Sy
32*(-0.0010791+0.23544m)/π*(7*10-3)3+1962+9.81m/ (38*10-6) = 60*106
Solving for m:
m=7.53 Kg
So the maximum mass that can be supported by the arm before yielding(according
to the previous assumption is) m=7.53 Kg
![Page 21: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/21.jpg)
4.1 Receiver Circuit
4.1.1 Hardware
• PIC 16F87
• Voltage Re
• Oscillator 2
• Reset Butto
• On/Off Sw
• Capacitors
• Resistors (
• Synapse (R
• 12 volts DC
• H-Bridge L
13
CHAPTER 4
SUBSYSTEMS BEHAVIOUR
16F877A
age Regulator 7805
llator 20 MHz
t Button
ff Switch
citors (100 NF, 22 PF)
stors (10 KΩ)
pse (RF engine)
olts DC power supply
ridge L298N
Figure.6: Receiver Circuit Diagram
![Page 22: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/22.jpg)
14
4.1.2 Functionality
• The clamp stepper motors’ control lines are connected to each other
reversely so that they rotate in opposite directions. That is; pin1 of motor
1 is connected to pin 4 of motor 2, pin2 to pin 3, pin3 to pin 2, and pin 4
to pin 1.
• The stepper motors are connected to driver circuited implemented on the
arm itself.
• The Drag, rotor, and crane motors are interfaced to the PIC by the means
of an H-Bridge.
• The Crane Down control pin uses PWM control for smooth descending
of the arm, while the Crane Down pin is directly connected to the H-
Bridge
4.2 Transmitter Circuit
4.2.1 Hardware
• PIC 16F877A
• Voltage Regulator 7805
• Play station controller
• Oscillator 20 MHz
• Reset Button
• On/Off Switch
• Capacitors (100 NF, 22 PF)
• Resistors (10 KΩ, 1 KΩ)
• Synapse (RF engine)
• 9 volts DC power supply
![Page 23: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/23.jpg)
4.2.2 Functional
• The inp
and to
logic 1
• The r
microc
• The pu
control
15
Figure.7: Transmitter Circuit Diagram
ionality
he input to each pin is connected to the ground th
nd to a push button which, when switched on, co
ogic 1 (5V).
he resistors are implemented on the circ
icrocontroller.
he push buttons are implemented on a PS2 Cont
ontrol of the robot
und through a 10K resistor
on, connects the pin to the
circuit with the PIC
Controller for convenient
![Page 24: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/24.jpg)
16
4.3 Raspberry Pi
These steps will explain how to set up the raspberry pi as a webcam server.
• The first step is to get the OS of the raspberry pi from its website.
• Then run an application called “Win32DiskImager”. The application will copy
the download image of the OS into the SD card (SD card> 2GB).
• After this connect the pi to the TV (either through the HDMI port, or through
the standard video transmitter). Once it boots you can change the password.
Then select enable SSH in a configuration window that will show up once the pi
is logged in (standard password are provided at the website).Then, the raspberry
pi will reboot.
• Now, we need to update and upgrade different programs on the raspberry pi
using the command apt-get. But the problem is that here in Lebanon we have
different mirrors.
• To change the mirrors, use the SSH using a program called putty, and a Ethernet
cable connected between the pi and the PC). But to use SSH, we need to know
the IP address of the pi. So, as the pi is connected to the TV, type "ifconfig" and
copy the IP address, now we don't need the TV any more.
To change the mirrors:
• Type: sudo nano /etc/apt/sources.list
• A new window will appear, Now change the mirror.
• Delete the old one. Paste this: deb http://archive.raspbian.org/raspbian wheezy
main
![Page 25: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/25.jpg)
17
• deb-src http://archive.raspbian.org/raspbian wheezy main or one of the closets
to your country (in our case Lebanon) from:
• http://www.raspbian.org/RaspbianMirrors
• (http://mirror.nus.edu.sg/raspbian/raspbian)
• (The best for me was: deb http://distributionus.hexxeh.net/
raspbian/archive/raspbian/ wheezy main contrib. non-free rpi)
• Then ctrl+x to exit, y to save, and enter.
• After that type sudo apt-get update (this will load the new links for the apps)
• And then sudo apt-get upgrade to upgrade the system (this will take some time).
• Now the pi is ready. If you want to lunch into a desktop environment, connect it
to the TV and type startx. This will launch the desktop environment.
• Now we can use the pi for different purposes.
We want to use the pi as a webcam server, where a wifi adapter will connect it to
the internet, and a camera will send data through the pi to the internet via an application
called “motion”. Therefore, we will first configure the wireless internet. To do so, we will
need a compatible wifi adapter.
After we plug in the adapter and camera, we type lsusb. This will show us the
connected deices. If the device is recognized,we will see a number and a name on a new
line, if not, it will show an empty buss with a specific number.
After we made sure that the device is compatible, we will start the configuration
(Configuring your Raspberry Pi for WPA_WPA2 in less than 5 minutes – YouTube this
video would explain a lot)
![Page 26: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/26.jpg)
18
After configuring the wifi and connecting the wifi adapter, we are now ready to
configure the webcam via a web server.
Install the application called motion. To do so, type sudo apt-get install motion.
Proceed with typing 'y'. This will run a command that will download motion via a
wireless.(id wireless is not connected, make sure to connect the Ethernet to the pi ,to check
it write ifconfig, and see if you have a value. Or make sure that you that the wifi connected
at the raspberry pi has internet access, in case of using the adapter).
To make sure that the webcam is working, type lsusb. You should be able to see the
device number and some id besides the code.
Make sure that the cam is Linux supported, if it's not, than try to use a webcam with
an open driver as we did. now after that, we will modify the cam properties according to
our preference. To do so, first we need to be a root user. Type sudo i. after that we can now
configure the motion file. Several things must be changed. First type sudo nano
/etc/motion/motion.conf
This will lead us to the configuration file. And we use nano to edit it. in there we
need to change the directory of the motion file to home. Also we need to set the port
number. Turn demon on and change the resolution to be compatible with the video device.
Now write sudo service motion restart. This will restart motion and we will be able
to open it in the port. Type ifconfig and copy the IP address.
Now, go to a browser (we recommend Firefox) .type in the IP address with ":" and
the port number and you will be able to stream the video at this address (if the computer is
connected to the same wifi.)
Something to add is that we can control the motors from the web by installing
similar apps. With this we will be able to control even the Robot from the web.
![Page 27: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/27.jpg)
19
One advantage of this is: if we us a wireless adapter like one that uses a SIM card
and a 3g network, we will be able to control the robot from any location. but since it is not
available, and it would increase the cost of our project a lot, we will use the synapse, which
has also a great range (3 miles) and is great for control application.
![Page 28: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/28.jpg)
20
CHAPTER 5
PROGRAM CODES
5.1 Receiver Microcontroller Program
char uart_rd; // Char variable to save the received
data
int i; // Counter used in the stepper motor
codes
int current_duty; //Integer variable to for the duty cycle
void rmf() // Right motor front
PORTA.B0=1;
PORTA.B1=0;
void rmb() // Right motor back
PORTA.B0=0;
PORTA.B1=1;
void rms() // Right motor stop
PORTA.B0=0;
PORTA.B1=0;
![Page 29: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/29.jpg)
21
void lmf() // Left motor front
PORTA.B2=1;
PORTA.B3=0;
void lmb() // Left motor back
PORTA.B2=0;
PORTA.B3=1;
void lms() // Left motor stop
PORTA.B2=0;
PORTA.B3=0;
void ClampClose(int k) // Clamp Close
for (i=0;i<k;++i)
PORTB.B0=1;PORTB.B1=1;PORTB.B2=0;PORTB.B3=0;
DELAY_MS(3);
PORTB.B0=0;PORTB.B1=1;PORTB.B2=1;PORTB.B3=0;
DELAY_MS(3);
PORTB.B0=0;PORTB.B1=0;PORTB.B2=1;PORTB.B3=1;
DELAY_MS(3);
PORTB.B0=1;PORTB.B1=0;PORTB.B2=0;PORTB.B3=1;
![Page 30: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/30.jpg)
22
if (i<k-1) DELAY_MS(3);
PORTB.B0=0;PORTB.B1=0;PORTB.B2=0;PORTB.B3=0;
void ClampRelease(int k) //Clamp Release
for (i=0;i<k;++i)
PORTB.B0=1;PORTB.B1=0;PORTB.B2=0;PORTB.B3=1;
DELAY_MS(3);
PORTB.B0=0;PORTB.B1=0;PORTB.B2=1;PORTB.B3=1;
DELAY_MS(3);
PORTB.B0=0;PORTB.B1=1;PORTB.B2=1;PORTB.B3=0;
DELAY_MS(3);
PORTB.B0=1;PORTB.B1=1;PORTB.B2=0;PORTB.B3=0;
if (i<k-1) DELAY_MS(3);
PORTB.B0=0;PORTB.B1=0;PORTB.B2=0;PORTB.B3=0;
void RotorR() // Rotor right
PORTB.B4=1;
PORTB.B5=0;
![Page 31: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/31.jpg)
23
void RotorL() //Rotor left
PORTB.B4=0;
PORTB.B5=1;
void RotorS() //Rotor stop
PORTB.B4=0;
PORTB.B5=0;
void CraneU() // Crane up
PORTD.B0=1;
PWM1_Stop();
void CraneD() // Crane down
PWM1_Start();
PWM1_Set_Duty(current_duty);
if (current_duty<255)
++current_duty;
DELAY_MS(10);
![Page 32: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/32.jpg)
24
void CraneS() // Crane stop
PORTD.B0=0;
current_duty = 0X43;
PWM1_Stop();
void WristU() // Wrist up
PORTB.B6=1;
PORTB.B7=0;
void WristD() // Wrist down
PORTB.B6=0;
PORTB.B7=1;
void WristS() // Wrist stop
PORTB.B6=0;
PORTB.B7=0;
![Page 33: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/33.jpg)
25
void main()
ADCON1=7;
TRISA=0X00;
TRISB=0X00;
TRISD=0X00;
TRISE=0X00;
PORTA=0X00;
PORTB=0X00;
PORTD=0X00;
PORTE=0X00;
UART1_Init(9600);
Delay_ms(100);
current_duty = 0X43;
while (1)
if (UART1_Data_Ready())
uart_rd = UART1_Read();
PORTE.B0=1;
DELAY_MS(1);
PORTE.B0=0;
DELAY_MS(1);
![Page 34: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/34.jpg)
26
switch (uart_rd)
case 'A':rmf (); break;
case 'B':rmb (); break;
case 'C':rms (); break;
case 'X':lmf (); break;
case 'Y':lmb (); break;
case 'Z':lms (); break;
case 'G':ClampClose(20); break;
case 'H':ClampRelease (20); break;
case 'I':WristU (); break;
case 'J':WristD (); break;
case 'K':WristS (); break;
case 'L':CraneU (); break;
case 'M':CraneD (); break;
case 'N':CraneS (); break;
case 'O':RotorR (); break;
case 'W':RotorL (); break;
case 'Q':RotorS (); break;
default: break;
![Page 35: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/35.jpg)
27
5.2 Transmitter Microcontroller Program
char uart_rd;
void main()
TRISB=0XFF;
TRISD=0XFF;
PORTD=0X00;
UART1_Init(9600);
Delay_ms(100);
while (1)
if (PORTB.B0 == 1 && PORTB.B1 == 0)
uart1_write('A');
else if (PORTB.B0 == 0 && PORTB.B1 == 1)
uart1_write('B');
else
uart1_write('C');
if (PORTB.B2 == 1 && PORTB.B3 == 0)
![Page 36: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/36.jpg)
28
uart1_write('X');
else if (PORTB.B2 == 0 && PORTB.B3 == 1)
uart1_write('Y');
else
uart1_write('Z');
if (PORTB.B4 == 1 && PORTB.B5 == 0)
uart1_write('G');
else if (PORTB.B4 == 0 && PORTB.B5 == 1)
uart1_write('H');
if (PORTB.B6 == 1 && PORTB.B7 == 0)
uart1_write('I');
else if (PORTB.B6 == 0 && PORTB.B7 == 1)
uart1_write('J');
else
uart1_write('k');
if (PORTD.B4 == 1 && PORTD.B5 == 0)
uart1_write('L');
else if (PORTD.B4 == 0 && PORTD.B5 == 1)
uart1_write('M');
else
uart1_write('N');
![Page 37: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/37.jpg)
29
if (PORTD.B6 == 1 && PORTD.B7 == 0)
uart1_write('O');
else if (PORTC.B6 == 0 && PORTC.B7 == 1)
uart1_write('W');
else
uart1_write('Q');
5.3 Synapse receiver/transmitter Program
otherNodeAddr = "\x04\x3E\xC3" # <= put the address of the PCs USB-attached node here @setHook(HOOK_STARTUP)
Def startupEvent (): InitUart (1, 9600) # <= put your desired baud rate here! FlowControl (1, False) # <= set flow control to True or False as needed CrossConnect (DS_UART1, DS_TRANSPARENT) UcastSerial (otherNodeAddr)
![Page 38: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/38.jpg)
30
CHAPTER 6
PROBLEMS AND SOLUTIONS
Many problems have faced us during the design and implementation of the
inspection robot:
• The video transmission was the most important and challenging problem in the
project. Since video transmission needs a high speed processor, relatively large
RAM size, and a much larger bit rate for wireless transmission, we had no
solution other than implementing a USB webcam on the raspberry pi which has
these specifications.
• The size of the robot was one of the greatest challenges during the design of our
project. Because the purpose of the robot is inspection, it should have a small
size in order to not be easily noticed and for easier movement.
• Power was another major problem in the design of the robot. Least power
consumption motors, drives, and electronics parts were used to maintain power.
• Descending the crane (the longest part of the arm) was a big problem since the
power needed to lift the crane is much more than the power needed to descend
it. We use PWM to manage (reduce) the power given to the motor of the crane
while falling down.
• Stabilizing the crane was another major problem during the implementation of
the robot. First, stepper motors were used to for the rotor and the wrist. But the
problem with the stepper motor is that it cannot hold the initial load loaded to it
when it is in the standby mode. Geared DC motors were used instead to fix this
problem.
• A problem which we have been struggling with from the beginning of the
semester is the wireless control. The available cheap RF modules had 2 major
problems. One was with the repeatability of the correct data transmitted or
![Page 39: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/39.jpg)
31
received, and the second was in the range of transmission. Synapse RF engines
were used to overcome this problem.
![Page 40: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/40.jpg)
32
CHAPTER 7
COSTS AND EXPENSES
Item Price Number Subtotal
PIC16F877A 4$ 2 8$
Track and motors 20$ 1 20$
Geared DC motors 10$ 3 30$
Stepper motors 5$ 2 10$
Stepper driver circuit 2.5$ 2 5$
H-bridge 3$ 3 9$
Synapse RF Engine 35$ 2 70$
Synapse programmer 30$ 1 30$
Raspberry pi 60$ 1 60$
USB Camera 15$ 1 15$
Wireless adapter 10$ 1 10$
Voltage regulator 0.5$ 3 1.5$
Oscillators (crystals) 1$ 2 2$
12V Power supply 15$ 1 15$
9V power supply 1.5$ 1 1.5$
PS2 joystick 10$ 1 10$
Others* 15$ 1 15$
Total 302$
Table 2: costs
*Others: include small electronics parts, glue, metallic bars, connectors, and others…
![Page 41: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/41.jpg)
33
CHAPTER 8
CONCLUSION AND SKILLS LEARNED
Building this robot had a significant effect in improving the technical engineering
skills which completed the theoretical knowledge about the field of inspection, and the
most valuable achievement was the team work and cooperating to complete all the duties
and to make sure that the parts are well assembled are properly functioning without any
problems.
Mechatronics is a major that presents innovative concepts in designing and creating
products that are enhanced and intelligent artifacts. Our main point of our project is that
starting from a small idea to protect civilians and military members ended with a well
designed handmade inspection robot that would overcome many hard conditions and
successfully fulfill all desired goals in the field of inspection.
This BS project has helped the members of the group to understand the integration
between subsystems and dealing with Microcontroller-programming problems and studying
of the mechanism of stepper and DC motors and combining their mechanisms in order to
accomplish the studied analyses with stresses and factors of safety and degrees of freedom.
After all, engineering is the technique and the skill that enabled us to improve our
way of thinking and moving from a scratching theoretical point of view to a designed and
assembled prototype that is ready to accomplish all duties. In college I read what they told
me and was much the better for it." John Updike, Esquire, 2008
![Page 42: Inspection Robot](https://reader033.fdocuments.us/reader033/viewer/2022051318/577cc9f31a28aba711a50799/html5/thumbnails/42.jpg)
34
REFERENCES
[1] (n.d.). Retrieved from http://www.undp.org.lb/programme/pro-
poor/crisisprevention/landmines/docs/report.pdf
[2] (n.d.). Retrieved from http://www.sierracollegemechatronics.com/quote/quotes.htm
[3] (n.d.). Retrieved from http://www.asme.org/kb/news---articles/articles/robotics/robots-
inspect-lines-while-hanging-from-above
[4] (n.d.). Retrieved from
http://ieeexplore.ieee.org/xpl/articleDetails.jsp?reload=true&arnumber=1491726
[5] (n.d.). Retrieved from http://publications.asl.ethz.ch/files/buehringer09cablecrawler.pdf
[6] cnki.com.cn. (2006). Retrieved from http://en.cnki.com.cn/Article_en/CJFDTOTAL-
WSDD201201018.htm
[7] solarbotics. (n.d.). Retrieved from https://solarbotics.com/download.php?file=1646