Вы находитесь на странице: 1из 0

DESIGN AND IMPLEMENTATION OF REMOTELY OPERATED

UNDERWATER VEHICLE USING MICROCONTROLLER





A Project Submitted
By

1. Abir, Meraj Mustakim ID: 10-16284-1
2. Apu, Sajib Das ID: 10-16274-1
3. Biswas Prasun ID: 10-16290-1
4. Fattah, Md. Abu ID: 10-16304-1


Under the Supervision of
Dr. Md. Kamrul Hassan
Assistant Professor
American International University - Bangladesh

Department of
Electrical and Electronic Engineering
Faculty of Engineering


Summer Semester 2012-2013,
August, 2013


American International University - Bangladesh

DESIGN AND IMPLEMENTATION OF REMOTELY OPERATED
UNDERWATER VEHICLE USING MICROCONTROLLER


A Project submitted to the Electrical and Electronic Engineering Department of the Engineering Faculty,
American International University - Bangladesh (AIUB) in partial fulfillment of the requirements for the
degree of Bachelor of Science in Electrical and Electronic Engineering.



1. Abir, Meraj Mustakim ID: 10-16284-1
2. Apu, Sajib Das ID: 10-16274-1
3. Biswas Prasun ID: 10-16290-1
4. Fattah, Md. Abu ID: 10-16304-1





Department of
Electrical and Electronic Engineering
Faculty of Engineering


Summer Semester 2012-2013,
August, 2013




American International University - Bangladesh

Faculty of Engineering, American International University-Bangladesh (AIUB) i


DECLARATION
This is to certify that this Project is our original work. No part of this work has been submitted elsewhere
partially or fully for the award of any other degree or diploma. Any material reproduced in this project has
been properly acknowledged.


Students names & Signatures

1. Abir, Miraj Mustakim
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

2. Apu, Sajib Das
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

3. Biswas Prasun
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

4. Fattah, Md. Abu
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



Faculty of Engineering, American International University-Bangladesh (AIUB) ii


APPROVAL

The Project titled DESIGN AND IMPLEMENTATION OF REMOTELY OPERATED UNDERWATER
VEHICLE USING MICROCONTROLER has been submitted to the following respected members of the
Board of Examiners of the Faculty of Engineering in partial fulfillment of the requirements for the degree
of Bachelor of Science in Electrical and Electronic Engineering on August, 2013 by the following
students and has been accepted as satisfactory.

1. Abir, Meraj Mustakim ID: 10-16284-1
2. Apu, Sajib Das ID: 10-16274-1
3. Biswas Prasun ID: 10-16290-1
4. Fattah, Md. Abu ID: 10-16304-1





_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Supervisor
Dr. Md. Kamrul Hassan
Assistant Professor
Faculty of Engineering
American International University-
Bangladesh




_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Prof. Dr. ABM Siddique Hossain
Dean
Faculty of Engineering
American International University-
Bangladesh
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
External Supervisor
Dr. Md. Abu Bakar Siddiqui
Faculty
Faculty of Engineering
American International University-
Bangladesh




_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Dr. Carmen Z. Lamagna
Vice Chancellor
American International University-
Bangladesh
Faculty of Engineering, American International University-Bangladesh (AIUB) iii
ACKNOWLEDGEMENT

First, we would like to express our heartiest gratitude to our honorable supervisor Dr. Md. Kamrul
Hassan, Assistant Professor, Department of Electrical and Electronics Engineering, under Engineering
Faculty, American International University-Bangladesh (AIUB), who helped us with his knowledge and
guidance throughout the project. Because of his such guidance, invaluable assistance, abundant support
and inspiration with his brilliant insight we were able to finish our project successfully. Yet from the core
of our heart, we would like to thank him with immeasurable respect.
We would like to show our gratitude to Dr. Carmen Z. Lamagna, Vice Chancellor, American
International University-Bangladesh for her continuous encouragement and generosity during our years of
study.
We are also grateful to Prof. Dr. A.B.M Siddique Hossain, Professor and Dean, Faculty of Engineering,
who has shared his wisdom, experience and invaluable knowledge with us and provided us guidance from
time to time.
We would also like to thank Mr. Abdur Rahman, Assistant Professor and Head of the Department,
Faculty of Engineering, who helped us when we were in difficult situations and whose new rules and
regulations gave us the opportunity to work with comfort.
We are thankful to our respected external faculty Dr. Abu Bakar Siddiqui, Faculty of Engineering for
giving us support till the end of the project.
We would like to thank those who were directly or indirectly helped us in different stage of completing
this project.
We would also like to take this opportunity to thank our parents for their belief in us and their endless
moral support.
Lastly we are very much grateful to the Almighty for keeping us healthy and giving us strength to finish
this project.




1. Abir, Meraj Mustakim
2. Apu, Sajib Das
3. Biswas, Prasun
4. Fattah, Md. Abu
Faculty of Engineering, American International University-Bangladesh (AIUB) iv
ABSTRACT

The main objective of our project is to design and implement a remotely operated underwater vehicle
(ROV) using microcontroller. Microcontroller is very suitable for programming for this project because it
is efficient and at the same time it is cost effective. The microcontroller is programmed in such a way that
it can control the ROV according to the received command from another microcontroller of the remote.
Every switch is assigned to send different command to the host module from the remote module. The host
acts accordingly after receiving command from the remote module and operates the motors. Temperature,
pressure and obstacle sensors are interfaced with the host module. A camera is attached with the host
module which captures and transmits constant video output to a monitor placed beside remote module. To
get a clear view of the underwater environment powerful LED is attached in front of the ROV. Full
functioning ROV can be used as an underwater observation device to work in aquatic environment that
are problematic and risky for human. It can collect water sample from certain depth of water. After further
modification it can be used for underwater heavy duty purpose. Microcontroller of model PIC16F877A is
used for system programming. UART protocol is used to conduct communication between two working
unit. This robot can roam underwater to a certain level.





Faculty of Engineering, American International University-Bangladesh (AIUB) v
List of abbreviation

ROV - Remotely Operated underwater Vehicle.
AUV - Automated Underwater Vehicle.
BG - Buoyancy Gradient
BJT - Bipolar Junction Transistor.
COB - Center of Buoyancy.
COG - Center of Gravity.
CPU - Central Processing Unit.
FOV - Field of View.
TMS - Tether Management System.
HP - Horse Power.
PIC - Peripheral Interface Controller.
GLCD - Graphical Liquid Crystal Display.
IMU - Inertial Measurement Unit.
TFTLCD - Thin Film Transistor Liquid Crystal Display.
MCU - Microcontroller Controller Unit.
MOSFET - Metal Oxide Semiconductor Field Effect Transistor.
ADC - Analog to Digital Converter.
PWM - Pulse Width Modulator.
UART - Universal Asynchronous Receiver Transmitter.
USB - Universal Serial Bus.



Faculty of Engineering, American International University-Bangladesh (AIUB) vi

TABLE OF CONTENTS
DECLARATION ....................................................................................................................................... I
APPROVAL .............................................................................................................................................. II
ACKNOWLEDGEMENT ....................................................................................................................... III
ABSTRACT ............................................................................................................................................. IV
LIST OF ABBREVIATION .............................................................................................................................. V
LIST OF FIGURES ..................................................................................................................................... X
CHAPTER 1 ................................................................................................................................................. 1
INTRODUCTION ........................................................................................................................................... 1
Introduction ................................................................................................................................ 1 1.1
CLASSIFICATION .............................................................................................................................. 1 1.2
Earlier Research .......................................................................................................................... 2 1.3
RECENT RESEARCH ......................................................................................................................... 3 1.4
FIGURE 1.1 ROV PHOCA .......................................................................................................................... 3
APPLICATION OF ROV .................................................................................................................... 3 1.5
Potential Benefits of the Project ................................................................................................. 4 1.6
Objective of this Work ............................................................................................................... 4 1.7
The primary objectives are listed below ............................................................................................ 4 1.7.1
The secondary objectives are following ............................................................................................. 5 1.7.2
ADVANTAGE OVER TRADITIONAL METHODS .................................................................................... 5 1.8
LIMITATION TO THE STUDY ............................................................................................................. 5 1.9
Overview of the Project .............................................................................................................. 6 1.10
CHAPTER 2 ................................................................................................................................................. 7
METHODOLOGY.......................................................................................................................................... 7
Introduction ................................................................................................................................ 7 2.1
Basic Principles .......................................................................................................................... 7 2.2
Archimedes Law ................................................................................................................................ 7 2.2.1
Newtons Law ................................................................................................................................... 7 2.2.2
Hydrodynamics .................................................................................................................................. 8 2.2.3
Hull .................................................................................................................................................... 8 2.2.4
Pressure ............................................................................................................................................. 8 2.2.5
Buoyancy ........................................................................................................................................... 9 2.2.6
FIGURE 3.1 EFFECT OF BUOYANCY ON ROV .............................................................................................. 9
Density .............................................................................................................................................10 2.2.7
Relation of Buoyancy and Resistance with Density ..................................................................10 2.2.7.1
Conductivity .....................................................................................................................................10 2.2.8
Temperature ......................................................................................................................................11 2.2.9
Light Penetration ..............................................................................................................................11 2.2.10
SUMMARY ..................................................................................................................................... 11 2.3
CHAPTER 3 ............................................................................................................................................... 12
Faculty of Engineering, American International University-Bangladesh (AIUB) vii
PROJECT SYSTEM DESCRIPTION ............................................................................................................... 12
Introduction .............................................................................................................................. 12 3.1
System Architecture ................................................................................................................. 12 3.2
Controlling Unit ................................................................................................................................12 3.2.1
Remote Module ........................................................................................................................12 3.2.1.1
Host Module .............................................................................................................................14 3.2.1.2
Propulsion System ............................................................................................................................14 3.2.2
Sensors .............................................................................................................................................15 3.2.3
Communication ................................................................................................................................16 3.2.4
Summary ..........................................................................................................................................16 3.2.5
CHAPTER 4 ............................................................................................................................................... 17
MODELING ............................................................................................................................................... 17
Introduction .............................................................................................................................. 17 4.1
Drag Force Calculation ............................................................................................................. 17 4.2
Buoyancy Estimation ................................................................................................................ 18 4.3
Summary ................................................................................................................................... 19 4.4
CHAPTER 5 ............................................................................................................................................... 20
COMPONENTS AND PROTOCOLS USED IN THIS PROJECT ........................................................................... 20
Introduction .............................................................................................................................. 20 5.1
Sensors ...................................................................................................................................... 20 5.2
DS18B20 Digital Thermometer Sensor ............................................................................................20 5.2.1
GH-311 Ultrasound Motion Sensor ..................................................................................................21
Water Level Sensor ..........................................................................................................................22 5.2.3
IMU ..................................................................................................................................................23 5.2.4
Linear regulator IC (MC78XX/LM78XX/MC78XXA) ........................................................... 23 5.3
Crystal Oscillator ...................................................................................................................... 24 5.4
Relay ......................................................................................................................................... 25 5.5
BC 547 (dc) .............................................................................................................................. 27 5.6
Irf540 Power MOSFET ............................................................................................................ 28 5.7
Bilge Pump Replacement Motor .............................................................................................. 28 5.8
Fuse ........................................................................................................................................... 29 5.9
Battery ...................................................................................................................................... 30 5.10
Pump ......................................................................................................................................... 30 5.11
Camera and Light ..................................................................................................................... 31 5.12
Propeller and Coupler ............................................................................................................... 31 5.13
Liquid Cristal Display(LCD) .................................................................................................... 32 5.14
TFT LCD Display ..................................................................................................................... 32 5.15
UART PROTOCOL ...................................................................................................................... 32 5.16
Summery ................................................................................................................................... 33 5.17
CHAPTER 6 ............................................................................................................................................... 34
MICROCONTROLLER ................................................................................................................................. 34
Introduction .............................................................................................................................. 34 6.1
Faculty of Engineering, American International University-Bangladesh (AIUB) viii
Microchip PIC16F877A : Microcontroller Overview .............................................................. 35 6.2
Basic Working Units ................................................................................................................ 35 6.3
Central Processor Unit (CPU) ...........................................................................................................35 6.3.1
Memory ............................................................................................................................................35 6.3.2
ROM Memory ..........................................................................................................................35 6.3.2.1
EEPROM Memory ...................................................................................................................36 6.3.2.2
Random Access Memory ..........................................................................................................36 6.3.2.3
General-Purpose Registers ........................................................................................................36 6.3.2.4
Special Function Registers ........................................................................................................36 6.3.2.5
Some of its Main Features are Listed Below ............................................................................ 37 6.4
Special Microcontroller Features .............................................................................................. 37 6.5
PIC16f877A Pin Diagram ....................................................................................................... 38 6.6
Block Diagram of PIC16f877a ................................................................................................. 39 6.7
PIC16f877A Pin Configuration [19] ........................................................................................ 40 6.8
Summary ................................................................................................................................... 44 6.9
CHAPTER 7 ............................................................................................................................................... 45
PROGRAMMING AND APPLICATION OF THE SOFTWARE ............................................................................ 45
Introduction .............................................................................................................................. 45 7.1
The C Programming ................................................................................................................. 45 7.2
MikroC Pro Pic C Compiler .............................................................................................................46 7.2.1
Some Features of Mikroc_pro_PIC_v600.........................................................................................46 7.2.2
Single-click Debugging ............................................................................................................46 7.2.2.1
Faster, Better, More Productive ................................................................................................46 7.2.2.2
Design Develop Share ..............................................................................................................46 7.2.2.3
Library Manager .......................................................................................................................46 7.2.2.4
Edit Project ...............................................................................................................................47 7.2.2.5
Code Assistant ..........................................................................................................................47 7.2.2.6
Parameter Assistant...................................................................................................................47 7.2.2.7
Object Explorer .........................................................................................................................47 7.2.2.8
Active Comments .....................................................................................................................47 7.2.2.9
Quick Converter........................................................................................................................47 7.2.2.10
Code Folding ............................................................................................................................47 7.2.2.11
Software Simulator ...................................................................................................................48 7.2.2.12
Programming the Microcontroller ............................................................................................ 48 7.3
Introduction to Burner .............................................................................................................. 48 7.4
PICkit 2 Programming Software .......................................................................................... 49 7.5
Program Loading Steps ............................................................................................................ 50 7.6
Summary ................................................................................................................................... 51 7.7
CHAPTER 8 ............................................................................................................................................... 52
ROV SHELL, THRUSTER, CAMERA AND LIGHT HOUSING DESIGN AND CONSTRUCTION .......................... 52
INTRODUCTION .......................................................................................................................... 52 8.1
SHELL DESIGN ........................................................................................................................... 52 8.2
Shape ................................................................................................................................................52 8.2.1
THRUSTERS ................................................................................................................................ 54 8.3
Faculty of Engineering, American International University-Bangladesh (AIUB) ix
Fabricating the Protective Propeller Cowling........................................................................... 54 8.4
SUMMARY ..................................................................................................................................... 56 8.5
CHAPTER 9 ............................................................................................................................................... 57
SOFTWARE SIMULATION OF THE SYSTEM ................................................................................................. 57
Introduction .............................................................................................................................. 57 9.1
Simulation ................................................................................................................................. 57 9.2
Simulating the Circuit of Remote Module ........................................................................................57 9.2.1
Simulating the Circuit of Host Module .............................................................................................58 9.2.2
Simulation of Serial Communication by Coupling the Remote and Host .........................................60 9.2.3
Summary ................................................................................................................................... 60 9.3
CHAPTER 10 ............................................................................................................................................. 61
CIRCUIT IMPLEMENTATION AND OPERATION ........................................................................................... 61
INTRODUCTION .......................................................................................................................... 61 10.1
BLOCK DIAGRAM AND OPERATIONAL DESCRIPTION OF COMPLETE CIRCUIT .............................. 61 10.2
Description of the Block Diagram ....................................................................................................62 10.2.1
Test Connection of the Circuits ................................................................................................ 62 10.3
Speed control with PWM ..................................................................................................................62 10.3.1
Use of Optocoupler ...........................................................................................................................63 10.3.2
Bidirectional motor driver using relay ..............................................................................................63 10.3.3
Circuit Implementation on Bread Board ...........................................................................................64 10.3.4
Operation of Circuit .................................................................................................................. 65 10.4
Implementation on Vero Board ............................................................................................... 66 10.5
Planning a Vero Board Layout .........................................................................................................66 10.5.1
Placing Components on Vero Board .................................................................................................67 10.5.2
Dry Test .................................................................................................................................... 70 10.6
Wet Test .................................................................................................................................... 72 10.7
Static Wet Test .................................................................................................................................72 10.7.1
Dynamic Wet Test ............................................................................................................................73 10.7.2
TEST RESULTS ............................................................................................................................ 74 10.8
SUMMARY ..................................................................................................................................... 74 10.9
CHAPTER 11 ............................................................................................................................................. 75
DISCUSSIONS AND CONCLUSIONS ............................................................................................................. 75
DISCUSSIONS ................................................................................................................................. 75 11.1
LIMITATIONS ................................................................................................................................. 75 11.2
SUGGESTION FOR FUTURE WORK .................................................................................................. 76 11.3
CONCLUSIONS ............................................................................................................................... 77 11.4
REFERENCES ........................................................................................................................................... 78
APPENDIX ................................................................................................................................................. 80
CODE TO RUN THE REMOTE MODULE ...................................................................................................... 80
CODE TO RUN HOST MODULE .................................................................................................................. 84

Faculty of Engineering, American International University-Bangladesh (AIUB) x
LIST OF FIGURES
FIGURE 1.1 ROV PHOCA .......................................................................................................................... 3
FIGURE 3.1 EFFECT OF BUOYANCY ON ROV ..................................................................................... 9
FIGURE 2.1 REMOTE MODULE OPERATING SEQUENCE. .............................................................. 13
FIGURE 2.1 REMOTE MODULE OF ROV ............................................................................................. 13
FIGURE 2.2 HOST MODULE OPERATING SEQUENCE ..................................................................... 14
FIGURE 2.3 DEGREES OF FREEDOM ................................................................................................... 15
FIGURE 5.1 GH-311 ULTRASOUND MOTION SENSOR ..................................................................... 22
FIGURE 5.2 IMU ....................................................................................................................................... 23
FIGURE 5.3 IC MC 7805 ........................................................................................................................... 24
FIGURE 5.4 CRYSTAL OSCILLATOR ................................................................................................... 25
FIGURE 5.5 12V 5 AMP RELAY ............................................................................................................. 26
FIGURE 5.6 BC547 IC ............................................................................................................................... 27
FIGURE 5.7 BILGE PUMP MOTOR ........................................................................................................ 29
FIGURE 5.8 FUSE ..................................................................................................................................... 30
FIGURE 5.9 WATER PUMP ..................................................................................................................... 30
FIGURE 5.10 LED LIGHT AND CAMERA ............................................................................................. 31
FIGURE 5.11(A) PROPELLER COUPLER FIGURE 5.11(B) PROPELLER .................................... 31
FIGURE 5.12 DISPLAY 216 LCD .......................................................................................................... 32
FIGURE 5.13 UART COMMUNICATION TIMING DIAGRAM. .......................................................... 33
FIGURE 6.1 INTERNAL BLOCK DIAGRAM OF MICROCONTROLLER .......................................... 34
Faculty of Engineering, American International University-Bangladesh (AIUB) xi
FIGURE 6.2 PIC 16F877A PIN DIAGRAM ............................................................................................. 38
FIGURE 6.3 ARCHITECTURE OF PIC16F877A [18] ............................................................................. 39
FIGURE 7.1: TECHPIC ............................................................................................................................. 48
FIGURE7.2 PICKIT 2 PROGRAMMING SOFTWARE ...................................................................... 50
FIGURE 7.3 MANU BAR > TOOLS > CHECK COMMUNICATION ................................................... 50
FIGURE7.4 HEX FILE LOADED SUCCESFULLY ................................................................................ 51
FIGURE 7.5 PROGRAM LOADED SUCCESSFULLY ........................................................................... 51
FIGURE 8.1 TOP VIEW AND SIDE VIEW ............................................................................................. 53
FIGURE 8.2 SKETCH OF ROV ................................................................................................................ 53
FIGURE 8.3 HULL OF ROV ..................................................................................................................... 54
FIGURE 8.4 BILGE MOTOR AND PROPELLER UNIT ........................................................................ 54
FIGURE 8.5 BILGE MOTOR HOUSING ................................................................................................. 56
FIGURE 9.1 SIMULATION DIAGRAM OF REMOTE MODULE ........................................................ 58
FIGURE 9.2 SIMULATION DIAGRAM OF HOST MODULE .............................................................. 59
FIGURE 9.3 UART COMMUNICATION SIMULATION DIAGRAM .................................................. 60
FIGURE 10.1 BLOCK DIAGRAM OF THE COMPLETE CIRCUIT ..................................................... 61
FIGURE 10.2 PWM CONTROLLED MOTOR BLOCK DIAGRAM ...................................................... 62
FIGURE 10.3 OPTOCOUPLER BLOCK DIAGRAM .............................................................................. 63
FIGURE 10.4 BIDIRECTIONAL MOTOR DRIVER. .............................................................................. 63
FIGURE 10.5 CIRCUIT CONNECTION ON BREAD BOARD. ............................................................. 64
FIGURE 10.6 PLACING COMPONENT ON VERO BOARD (REMOTE MODULE) .......................... 67
Faculty of Engineering, American International University-Bangladesh (AIUB) xii
FIGURE 10.8 FINALIZED REMOTE MODULE ..................................................................................... 68
FIGURE 10.9 FINALIZED HOST MODULE ........................................................................................... 69
FIGURE 10.10 FULL FUNCTIONAL CIRCUIT (1) ................................................................................ 69
FIGURE 10.11 FULL FUNCTIONAL CIRCUIT (2) ................................................................................ 70
FIGURE 10.12 FINAL APPEARANCE OF ROV (1) ............................................................................... 71
FIGURE 10.13 FINAL APPEARANCE OF ROV (2) ............................................................................... 71
FIGURE 10.14 FINAL APPEARANCE OF ROV (3) ............................................................................... 72
FIGURE 10.15 STATIC WET TEST OF ROV ......................................................................................... 73
FIGURE 10.16 DYNAMIC WET TEST OF ROV .................................................................................... 73












Faculty of Engineering, American International University-Bangladesh (AIUB) xiii



Faculty of Engineering, American International University-Bangladesh (AIUB) 1


Chapter 1
Introduction
Introduction 1.1
A remotely operated underwater vehicle, conventionally known to us as ROV, is tethered robot
submarine, where operators control its movement, actions and other actions from a remote vessel. There is
another type of underwater vehicle AUV, which are autonomous and capable of operating itself
underwater to do specific task without any human assistance. ROV the traditional abbreviation stands
for remotely operated vehicle, which is distinguished from remote controlled vehicles where as remote
controlled vehicles are operated on land or in the air. ROVs are unmanned, highly maneuverable and
controlled by human. For remote operation this are connected to the operating panel with a neutrally
buoyant tether or often when working in rough condition or in deeper water a load carrying umbilical
cable is used, along with a tether management system (TMS). The tether management system (TMS)
stores and deploys the ROV tether cable so that the ROV is decoupled from motion of the surface vessel
and is able to operate at a larger radius. Usually its a garage like device which hold the ROV during
lowering through the high current zone, or on larger work class ROVs (a separate assembly which sits on
top of the ROV). TMS serves by changing the length of tether through the effect of cable drag to
minimize where there are underwater current. Electrical power, video and data signals are carried back
and forth between operator and ROV by the umbilical cable which contains a set of cables. There are two
main categories of ROVs: observation and work classes. The work class subdivides into light and heavy,
which specifies their maximum working depth. The capability of reaching depth of heavy class ROVs are
greater than 3000 meters. This requires very large propulsion system to generate the forces required to
tow the length to tether required.

Classification 1.2
Submersible ROVs are normally classified into categories based on their size, weight, ability or power.
Some common ratings are
Micro - typically Micro class ROVs are very small in size and weight. Todays Micro Class ROVs
can weigh less than 3 kg. These ROVs are used as an alternative to a diver, specifically in places
where a diver might not be able to physically enter such as a sewer, pipeline or small cavity.

Faculty of Engineering, American International University-Bangladesh (AIUB) 2


Mini - typically Mini Class ROVs weigh in around 15 kg. Mini Class ROVs are also used as a
diver alternative. One person may be able to transport the complete ROV system out with them on
a small boat, deploy it and complete the job without outside help. Some Micro and Mini classes
are referred to as "eyeball" class to differentiate them from ROVs that may be able to perform
intervention tasks.
General - typically less than 5 HP (propulsion); occasionally small three finger manipulators
grippers have been installed, such as on the very early RCV 225. These ROVs may be able to
carry a sonar unit and are usually used on light survey applications. Typically the maximum
working depth is less than 1,000 meters though one has been developed to go as deep as 7,000 m.
Light Work class - typically less than 50 hp (propulsion). These ROVs may be able to carry some
manipulators. Their chassis may be made from polymers such as polyethylene rather than the
conventional stainless steel or aluminum alloys. They typically have a maximum working depth
less than 2000 m.
Heavy Work class - typically less than 220 hp (propulsion) with an ability to carry at least two
manipulators. They have a working depth up to 3500 m.
Trenching/Burial - typically more than 200 hp (propulsion) and not usually greater than 500 hp
(while some do exceed that) with an ability to carry a cable laying sled and work at depths up to
6000 m in some cases.
Submersible ROVs may be "free swimming" where they operate neutrally buoyant on a tether from the
launch ship or platform, or they may be "garaged" where they operate from a submersible "garage" or
top hat" on a tether attached to the heavy garage that is lowered from the ship or platform. Both
techniques have their pros and cons; however very deep work is normally done with a garage [1].

Earlier Research 1.3
Remotely operated underwater vehicles (ROVs) were rst developed in the mid-1950s by the Royal
Navy, became more and more common. At rst they were used by dierent authorities to recover
torpedoes on the ocean oor and to clear mines. In the mid-1980s ROVs became an essential part of the
oshore oil and gas industry, since the pipes were placed deeper and further into the ocean. As we enter
the 21
st
century, ROVs are a commercial product that can be used for anything from exploration and
surveillance to rescue missions and maintenance. As the ROVs become more advanced, their price
increases. In the early 1980s Dalhousie University, in partnership with the Bedford Institute of
Oceanography, launched numerous expeditions to recover and analyze basalts of the mid-Atlantic ridge.

Faculty of Engineering, American International University-Bangladesh (AIUB) 3


Most of the drilling occurred near Mount Glooscap, named after a mythical first nations character from
Atlantic Canada. During this time exploration of mid-oceanic ridges was a topic of great interest [2].

Recent Research 1.4
In recent days different university, research organization, navy/marine corps and Business Corporation
are working on the development of ROV. They are emphasizing on building ROV that are capable of
doing heavy duty task like digging and underwater mining, conducting research in very deep underwater
environment etc.

For example, The ROV PHOCA will be an essential assistant in this context, being able to install, rebuild
as well as maintain scientific equipment at the sea floor. First sea trials for MoLab and the new ROV are
expected to take place in spring 2011. Another ROV Minerva has been used in biological research and
sampling, testing of equipment and development of new research technology, archaeological surveys,
supplying ground truth in geological investigations, commissioned research and much else. She's also an
appreciated tool in many courses at NTNU.

Figure 1.1 ROV PHOCA Figure 1.2 MINERVA

Application of ROV 1.5
Oil & Gas Industry
Salvage, recovery and rescue
Chemical Industries
Cooling water intakes and outlets
Fish farms
Power stations: hydroelectric, nuclear

Faculty of Engineering, American International University-Bangladesh (AIUB) 4


Corrosion and cathode measurements
Criminal investigations
Detection of objects (anti-collision / imaging sonar and side scan sonar)
Sample taking
Ships hulls, propellers and steering gears
Reservoirs / dams
Enclosures, pipes, cable
Diver observation and support
Environmental investigations
Investigating sunken objects (ships, wrecks, cars, motorbikes, airplanes etc.)
Destruction of mines [3].

Potential Benefits of the Project 1.6
1. This robot could be used to make detailed underwater map of the seafloor in a cost effective way.
2. It could be useful to our marine biologist to do underwater research and taking sample from
different level of sea.
3. After further modification and enhancement of upgraded technologies it has another area of
potential is to help in recovery from disasters by detecting drowned water vehicles in quickest
possible time.

Objective of this Work 1.7
The objective of our project was defined as follows
To design and implement a small, low cost ROV, runs by water propulsion, powered by on board battery
and controlled by microcontroller.

The primary objectives are listed below 1.7.1
Our ROV must be able to move in forward and reverse direction.
It will be able to dive up to a depth of 5 meters.
It will be able to collect water sample at certain depth.

Faculty of Engineering, American International University-Bangladesh (AIUB) 5


It will be able to work under water like capturing image and videos, detecting underwater objects
at primary level.

The secondary objectives are following 1.7.2
It will be able to measure the water level
Will be able to locate exact position of any object under water.
Tether Management System (TMS) will be added for better control

Advantage over traditional methods 1.8
There are some advantages of our ROV over traditional methods. Traditional ROVs are square and boxed
shaped, where as our design is torpedo shaped which gives some benefits.
This ROV has a streamline design which makes it less suerer of water damping eects as most of
other ROV designs do.
This ROV has a design which is durable and can be repaired easily.
It has specially 5 thrusters, which makes is better speed, higher maneuverability
The ballast is placed so that the ROV always strives to stabilize itself.

Limitation to the study 1.9
Though our method of study has advantages still it has some limitations
Due to acceleration with the back thruster will cause an unwanted roll rotation, according to
Newtons third law. This can cause problems, especially if the ROV uses on board camera for
observation. Due to the pendulum stability of our ROV, it will not turn over.
The thrusters may lose performance at higher speeds as it is in tunnel. It is dicult to remove the
on board circuits and recharge the batteries. To recharge batteries, the ROV have to be opened.


Faculty of Engineering, American International University-Bangladesh (AIUB) 6


Overview of the Project 1.10
Chapter 1 describes about an introduction to this project and a brief description of different
consideration.

Chapter 2 gives system description design advantages and disadvantages. It also discuss about the system
architecture.

Chapter 3 discussed about the methodology, basic principles different types of aquatic conditions and
hydrodynamics.

Chapter 4 focuses on modeling, necessary theoretical calculations, drag force and buoyancy estimation.

Chapter 5 have detailed description about the components and protocol used to accomplish the project.

Chapter 6 gives detailed description about microcontroller, its pin and register and operation.

Chapter 7 discussed about the programming and application of MikroCPro PIC compiler and programing
the microcontroller with PICkit
TM
programming software.

Chapter 8 discussed about the design and construction of ROV shell, thruster, camera and light housing.
Technique of waterproofing the ROV is also described here.

Chapter 9 discuss about the final software simulation of the system for real time application.
Gives brief discussion of the whole project and conclusion.

Chapter 10 gives circuit implementation, operation and block diagrams along with the test run of ROV.

Chapter 11 will reveal the discussions and limitations of the project. Then future suggestions. Lastly a
small conclusion of the whole project work is mentioned.




Faculty of Engineering, American International University-Bangladesh (AIUB) 7


Chapter 2
Methodology
Introduction 2.1
In this chapter the methodology of designing of ROV is discussed. The word methodology means the
systematic research for an applied field of study, theoretical analysis of the methods to be used. The
principles and theoretical analysis related with the work is a part of it. It stereotypically covers concepts
like paradigm, theoretical model, phases and quantitative or qualitative techniques and analysis. It does
not set out to provide solutions but helps with the theoretical underpinning for understanding which set of
methods or so can be useful to apply in a specific case. For theoretical work, the development
of paradigms satisfies most or all of the criteria for methodology. This procedure is logical, rather than a
physical, array of related elements.
It has been defined also as follows
The analysis of the principles of methods, rules, and postulates employed by a discipline.
The systematic study of methods that are, can be, or have been applied within a discipline.
The study or description of methods.

Basic Principles 2.2
Some basic principles are related with operation of ROV. Those are mentioned below.

Archimedes Law 2.2.1
Any object, wholly or partially immersed in a fluid, is buoyed up by a force equal to the weight of the
fluid displaced by the object.

Newtons Law 2.2.2
Second law: The acceleration of a body is directly proportional to, and in the same direction as, the net
force acting on the body, and inversely proportional to its mass. Thus, F = ma, where F is the net force
acting on the object is the mass of the object and as the acceleration of the object.
Third law: When one body exerts a force on a second body, the second body simultaneously exerts a
force equal in magnitude and opposite in direction to that of the first body.

Faculty of Engineering, American International University-Bangladesh (AIUB) 8


Hydrodynamics 2.2.3
Hydrodynamics is a sub discipline of fluid dynamics. It includes calculating force and moments on a
body. It describes different conditions based on some parameters like pressure, temperature, density, mass
etc. it also has relation with momentum equation for Newtonian fluid. This study also includes
compressible vs. incompressible, viscous vs. in viscid, steady vs. unsteady, laminar vs. turbulent flow
Newtonian vs. non Newtonian fluids are most important field of research of hydrodynamics. This factor
affects largely on a body in motion in water or any other fluid. Our ROV have to be able to operate on
different condition in water that varies due to change of weather or materials of water [4].

Hull 2.2.4
This is an important factor to design a ROV. Hull is related with the strength of the body of the ROV. It
depends on the material with which the body or shell is made. It also depends on the design. It is possible
to design a strong b body using comparatively less strong material. For example a sphere is more
sustainable and capable of handling more pressure from its surroundings than a cube made with same
material. Because if pressure is put on a single point it spreads over the body of the sphere and minimize
the pressure on a single point, thus gives better strength.

Pressure 2.2.5
Pressure is an important concern to be considered because it is related with the depth of operation of our
ROV. Pressure directly affects the speed of ROV. depending on the operating depth the strength of body,
power of the thrusters, design of the propeller, power needed, type of security measures, communication
system, lights , sensors and other components have to be designed. Depth of the water we are working in
and how our structure will handle the increasing pressure with depth is a key concern to design ROVS.
The column of air over every single square inch of surface weighs 14.7 lbs. at sea level. The metric
equivalent is 101 Kilopascals (kPa) or 101 mill bars. For every additional 33 feet (10 meters) you descend
into the ocean, pressure increases by an additional 14.7 lbs. per square inch (101 kPa). One additional
atmosphere (ATM) of pressure.

Sea level = 1 atmosphere = 101 Kilopascals or 14.7lbs/square inch.
33 feet deep = 2 atmospheres = 202 kPa or 29.5 lbs./square inch of surface area
66 feet deep = 3 atmospheres = 303 kPa or 44.2 lbs./square inch of surface area

Faculty of Engineering, American International University-Bangladesh (AIUB) 9


100 feet deep = 4 atmospheres =404 kPa or 59 lbs. /square inch of surface area
The answer to the question how does pressure affect an underwater robot?
The deeper the ROV goes, the more pressure exerted by the water column parts like motors and camera
casings. The deeper the ROV, the greater the pressure for water to enter these spaces and to compress
anything containing gas even rigid form insulation [5].

Buoyancy 2.2.6
Buoyancy is a force which is exerted on upward direction by any fluid. This force opposes the weight of
any drowning object. Pressure increases as depth increases as a resultant effect of the increasing weight of
the overlying layers of fluid in a column of fluid. For this reason a column of fluid, or body submerged in
the fluid, experiences greater pressure at the bottom of the column than at the top. This difference in
pressure results in a net force that tends to accelerate an object upwards. The value of that force exerted is
proportional to the difference of pressure between bottom and top of column of water. This explains why
an object of higher density than that of the fluid in which it is submerged tends to sink. If the object is
either less dense than the liquid or is shaped appropriately (as in a boat), the force can keep the object
afloat.

Figure 3.1 Effect of buoyancy on ROV
There are two forces acting upon your Remotely Operated Vehicle in water: Buoyancy is upward pushing
force; Gravity is downward pushing force. Neutral Buoyancy is achieved when both forces are equal.
There are two imaginary centers COB and COG. COB stands for center of buoyancy and COG is center
of gravity. If these two forces are working on an object in water, COB should be always above the COG.
Otherwise it will make the ROV unstable and it will turn over.
BG (Buoyancy Gradient) is the distance between COB and COG. Stability of the ROV depends on BG
the greater the distance between the COB and the COG, the more stable the vehicle, the smaller the BG,
the less stable but the more maneuverable [6].

Faculty of Engineering, American International University-Bangladesh (AIUB) 10



If COB and COG works on the same point the ROV will be highly maneuverable,
Two Important Physics Rules relating to ROV design
Floats must be located above heavier weights. (Stability is the issue here.)
Before ROV can sink, it must to float. An ROV shouldnt sink when it is put in the water it
should float at least a little. For bottom crawling ROVs that are made to sink because their
purpose is to sit and work on the bottom should not float before is sinks.

Density 2.2.7
Mass per unit volume is the density of a material. Different materials usually have different densities, and
density may be relevant to buoyancy. Less dense fluids float on more dense fluids if they do not mix. If
the average density (including any air below the waterline) of an object is less than water it will float in
water and if it is more than water it will sink in water. The density of a material varies with temperature
and pressure. This variation is typically small for solids and liquids.

Relation of Buoyancy and Resistance with Density 2.2.7.1
Buoyancy is directly related with density. If density increases, buoyancy increases. That makes it harder
for the ROV to sink. If we make Gravity greater than Buoyancy it will allow the ROV to sink. So
depending on the fluid density of the work environment to overcome the buoyancy the ROV shell should
be designed.

The operation and movement and maneuverability of the ROV depend on the resistance of the water. The
resistance increases is proportional to the increase of density of water. So depending on the density the
power of thruster should be determined to operate properly under high and low resistance [7].

Conductivity 2.2.8
To drive electromechanical motors of thrusters or electrical pump motor of hydraulic thruster, .most of the
ROV use electrical power. Electricity used for power controls, underwater lights, cameras, different
sensors motorized tools such as robotic arms, etc. too. The electrical power can be supplied to the ROV
from outside by tether or battery can be mounted inside. Depending on the required amount of power
suitable method is have to be choose. We have to check if there is a leak into the electrical or electronic

Faculty of Engineering, American International University-Bangladesh (AIUB) 11


Components of the ROV. Water conducts electricity and causes short circuits in the electronic
components - making them dysfunction. Its bad enough with fresh water, but salt water in the ocean is
several times more conductive than freshwater. Consequently, a leak of water into any electrical or
electronic components is a tragedy that may irreparably fry all the electrical components of the ROV. The
other concern id safety as divers working in the vicinity of an electrical leak may be in grave danger.

Temperature 2.2.9
Water has a very high specific heat. It absorbs much amount of heat. It is good because water acts like a
very efficient heat sink. This property of water is used to keep ROVs high power working thruster motors
cool. It shouldnt operate for long time in air as they emerge high amount of heat and the motors can be
damaged.

Light Penetration 2.2.10
Water filters our light to a varying degree depending on the frequency (color) of the light. Color of light
would change gradually with depth because the shorter wavelength light is filtered first. Light is also
distorted .Water acts as a lens. This affects the way cameras sees underwater. It ends up in reduction of
the cameras field of view (FOV or horizontal angle). The power of light necessary to work underwater
should be calculated as required for desired task.

Summary 2.3
In this chapter we discussed about some important factors of designing our ROV. Brief theoretical
discussion and methodology that are important aspect of planning and implementing the ROV is
discussed above in the chapter.


Faculty of Engineering, American International University-Bangladesh (AIUB) 12


Chapter 3
Project System Description
Introduction 3.1
This chapter shows the general system architecture and design for the project. It also describes the
advantage of our design and its implications. The equipment that are being used and possible future
enhancement of equipment is also discussed.

System Architecture 3.2
The basic system is composed of four major parts.
Controlling unit
Propulsion
sensors
Communication

Controlling Unit 3.2.1
This control unit consists of two parts. They are remote module and host module.

Remote Module 3.2.1.1
The remote module is the main controlling and monitoring unit of the system. It controls host module
when to initiate a communication and when to end it. It can communicate with the host module. The
controlling unit is connected to the host module through two wire serial UART communication. As they
are connected with multiple components both host and remote module communication is not parallel. The
function of the remote module is to send different command to host module. It also receives data sent
from the host module and shows it on the LCD display to make the controlling easy and comfortable for
the operator.. The operating sequence of the remote module is given in figure 2.1
The main components of the remote module are MCU, different type of switches, variable resistors, a
GLCD display, a TFT monitor etc. There are 15 switches for different control command TFT monitor for
looking under water and controlling the maneuver of the ROV.A structural design of remote module is
given in figure 2.2

Faculty of Engineering, American International University-Bangladesh (AIUB) 13



























Figure 2.1 Remote module operating sequence.

Figure 2.2 Remote module of ROV
REMOTE INITIALIZED
BAUD RATE: 1280
ADDRESS HOST MODULE
GENERATE COMMAND BIT; TRANSMIT 7-BIT HOST ADDRESS & R/W
BIT
WAIT FOR HOST
TO RESPOND
1
RECEIVE 8 BIT DATA
FROM HOST MCU
TRANSMIT 8 BIT DATA TO
HOST MCU
IF READ OPERATION IF WRITE OPERATION
DISPLAY OUTPUT IN GLCD VIA
UART

Faculty of Engineering, American International University-Bangladesh (AIUB) 14


Host Module 3.2.1.2
The host module senses the analog and digital outputs of the sensors. It uses ADC to sense analog output
from the sensors, temporarily stores the current data and then sends the data to the remote module, this
host module also receives data and command from the remote module and works accordingly by
executing the commands. For example: When it gets instructions from remote module, it can turn on or
off the thrusters and increase or decrease the duty cycle of a Pulse Modulated Signal (PWM) to change
the speed. The host operating sequence is shown in the following flow diagram.

Figure 2.3 Host module operating sequence.
Propulsion System 3.2.2
All commercially available ROVs use thrusters to provide propulsion. These are propellers attached to
either electrical or hydraulic motors. There are two types of propulsion system, water jets and propellers.
Commercially available ROVs use thrusters because of the efficiency difference between propellers and
water jets at low speeds. Water jets work by increasing the velocity of a relatively small mass of fluid by a
relatively large amount. Conversely, propellers work by increasing the velocity of a relatively large mass

Faculty of Engineering, American International University-Bangladesh (AIUB) 15


of fluid by a relatively small amount. As a result, propellers are more efficient at low speeds and water
jets at higher speeds. For example: water jets are usually used in high-speed catamarans and propellers in
low speed ships.

There are six independent degrees of freedom, three translational and three rotational. The number of
required degrees of freedom dictates the maneuverability of the ROV and affects the configuration of
the water jets on it. The aim as stated in the specification is to maximize the maneuverability of the
ROV. Using five thrusters we achieved six degree of freedom. For example, six degrees of freedom can
be achieved using six pumps in a configuration [3].


Figure 2.4 Degrees of freedom
Sensors 3.2.3
A sensor is a device that responds to a physical stimulus like heat, light, sound, pressure, magnetism, or a
particular motion and transmits a resulting impulse for the purpose of measurement or operating a control
system. The systems consist of quite a number of sensors. These sensor usually measure temperature,
humidity, presence of particular gases, light intensity etc. from its surrounding environment. Job of the
host module is to manipulate the output of the sensor suitable for analog to digital conversion or for other
data sampling methods, then perform the conversion and store it temporarily. After that the remote
module will collect these converted sensor data when it is needed and use it for displaying purpose. These
are the data from the environment which needs to be observed, analyzed and according to the observation

Faculty of Engineering, American International University-Bangladesh (AIUB) 16


some decisions will be taken by the computer and then commanded by the master to perform specific
actions to the slave devices.

Communication 3.2.4
Two wire serial communications is used for the communication between the remote module and host
module. The host module collects information from the remote module and sends this information to the
remote module for displaying purpose through the wire. The communication method used in the computer
bus is serial communication. Different kinds of serial communication can be used. Some of the popular
serial communication architectures are
RS-232
Universal Serial Bus (USB)
Ethernet
Serial Peripheral Interface (SPI) [8]
Among these communication architectures the USB, Ethernet are high speed communication systems.
Each communication method has its own communication protocol which differs from each other and is
somewhat complex. But the RS-232 is a very common serial communication method. It is easy to
implement but is a low-speed communication system. RS-232 is a low speed communication protocol.
On the other hand USB and Ethernet is high speed communication system. But in our project we used RS-
232 for serial communication because communication through Ethernet is complex and USB is only
effective and efficient for very short distance data transmission. On the other hand RS-232 is easy to
implement and can be used longer distance communication than USB, which is suitable for our project.
UART is a serial communication protocol that used two wire for communicating between two
microcontroller and a common ground. Its a fast and simple process and very compatible for our project.

Summary 3.2.5
A brief idea about the system works and probable use of the sensors is provided in this chapter. The
discussion above helps us to decide how to proceed with and take decision to accomplish the project goal
in different steps.


Faculty of Engineering, American International University-Bangladesh (AIUB) 17


Chapter 4
Modeling
Introduction 4.1
Modeling is a very important step of building the ROV. To accomplish the project in a systematic way it
is important to estimate some necessary steps for the ROV to work in the real life. Drag force calculation
and buoyancy estimation is two important step as these have direct relation with the ROV to work in
aquatic environment.

Drag Force Calculation 4.2
If a body is transitory through a fluid or medium then it faces retarding or opposing force this force is
called Drag Force. Drag force, or the force of fluid friction for a falling body, increases with speed. A
falling object will reach a speed at which the force of air friction will be equal to and opposite the force of
gravity. At that point, the object will no longer accelerate. Its speed will remain constant, and we call that
speed its terminal velocity.

In case operating an ROV or an AUV, its not the main concern how quickly the ROV can accelerate , the
important consideration is how fast it go the water current it is able to hold station in. for this reason the
ROV mass is not most important factor. We have to emphasize on the drag of the ROV.
Equation for calculating drag force:

(4.1)

(For seawater is around 1027kg/m^3 but for a simplicity round this to 1000kg/m^3) [9].
To find drag force accurately the most important thing is accurate estimate for the Cd. For calculating the
Cd there are some rough estimation. A flat plate or a cable, for example, has C
d
approximately around 1.2
if the ROV has a smooth outer shell. For open frame ROVs the Cd will be around 2. For a ROV which
has a shape like torpedo, the Cd could be as low as 0.1 but probably more on the order of
0.3.Approximation of drag force of our ROV (considered highest possible value) is calculated in the
following table


Faculty of Engineering, American International University-Bangladesh (AIUB) 18



Frontal area
A(m
2
)


Mass density of
water in (kg/m^3)


Speed
(m/s)

Cd

Drag force F
(Newton)
For horizontal motion :
* r
2
= *0.762
2
= 0.01824

1000

1
0.5
(considered highest
possible value)

9.12
For vertical motion:
L*W=0.762*0.1524
=0.116112

1000

1
2.0
(considered highest
possible value)

116.128

.
The calculated drag force does not include the additional drag component of the umbilical cable.

Buoyancy Estimation 4.3
Buoyancy is the force that exerts on upward direction by any fluid. This force opposes the weight of any
drowning object. Pressure increases as depth increases as a resultant effect of the increasing weight of the
overlying layers of fluid in a column of fluid. For this reason a column of fluid, or body submerged in the
fluid, experiences greater pressure at the bottom of the column than at the top.

The sum of the forces applied to the ROV and the weight forces should be equal to buoyant force applied
by the water. The density of the fluid is a important factor on how the forces will act on the ROV. Also,
another important aspect that will determine the success is the determination of the center of gravity of the
ROV. This cannot be calculated until the components are decided upon. Once the ROV reaches neutral
buoyancy we will be able to manipulate it through thrusters [10].


For neutral buoyancy the following equation must be used.

device
- W
device
F
device
is the downward force due to gravity and W
device
is the upward force due to buoyancy.
In calculation F
ROV
is the gravitational force which depends on the mass of the ROV M and acceleration
due to gravity g. F
W
is the force due to the buoyancy of fluid which varies with different fluids. F
W
is
proportional to the density of the fluid , mass of ROV M and volume of water replaced by the body
of ROV V
WD
.

Faculty of Engineering, American International University-Bangladesh (AIUB) 19


Calculations to find displacement volume that will make ROV neutrally buoyant

F
ROV
= Mg F
ROV
= weight of the ROV
F
ROV
= 10.59.81 M= mass =10.5kg
= 103.005 N g= 9.81 m/s
2


F
w
=gV
wd
Fw = force of water
=10009.81*0.056 = density
=136.31 N g= gravity
V
wd
= volume displaced
= r2l m
3

=3.14160.076220.762 m
3

= 0.056 m
3


Based on the previous calculations the team determined that the ROV will not sink because, ROV is not
neutrally buoyant. To make it neutrally buoyant FROV must be equal to Fw

Mass estimation to make neutrally buoyant
F
ROV
= 136.31 N = M g
M= 13.89 kg.

The mass of the ROV must be at least 13.89 kg to sink in the water. So we need to attach 3.39 kg of
additional weight to the ROV.

Summary 4.4
In this chapter we made a rough calculation about the drag force and buoyancy. To give motion to a ROV
and to sink it under water these are some of the substantial worries. Depending on the result of this section
is helpful to set our work procedure like motor selection, power estimation, body shape of the ROV etc.

Faculty of Engineering, American International University-Bangladesh (AIUB) 20


Chapter 5
Components and Protocols Used in this Project
Introduction 5.1
To be able to control a robot, a variety of electric and mechanical components are needed. In this project
the electronics mainly consist of a Host Module which comprehends a Microcontroller (PIC16F877A),
Relays, Motors, Bc-547 transistors, IRF540 power MOSFET, Fuses, Heat Sink, and a set of sensors.
There is also a Remote Module which also contains a Microcontroller (PIC16F877A), push buttons,
GLCD, control the host module. The most important devices will be described below Since electronics
usually are sensitive to water; a water-proof container is needed inside the underwater vehicle. In this
project, the main electronics are assembled in a plastic structure

Sensors 5.2
Different kinds of sensors were used to measure some physical quantity from the environment. Their
names and respective model no. are listed below

Table 5.1 Sensors model no and physical stimulus.
Physical Stimulus Sensor Model No.
Temperature DS18B20
Sonar GH311
Water Level Sensor
WL

DS18B20 Digital Thermometer Sensor 5.2.1
The DS18B20 digital thermometer provides 9-bitto 12-bit Celsius temperature measurements and has an
alarm function with nonvolatile user-programmable upper and lower trigger points. The DS18B20
communicates over a 1-Wire bus that by definition requires only one data line (and ground) for
communication with a central microprocessor. It has an operating temperature range of -55C to +125C
and is accurate to 0.5C over the range of -10C to +85C. In addition, the DS18B20 can derive power

Faculty of Engineering, American International University-Bangladesh (AIUB) 21


directly from the data line (parasite power), eliminating the need for an external power supply. Each
DS18B20 has a unique 64-bit serial code, which allows multiple DS18B20s to function on the same 1-
Wire bus. Thus, it is simple to use one microprocessor to control many DS18B20s distributed over a large
area. Applications that can benefit from this feature include HVAC environmental controls, temperature
monitoring systems inside buildings, equipment, or machinery, and process monitoring and control
systems [11].

Features
Unique 1 - Wire Interface Requires Only One Port Pin for Communication
Each Device has a Unique 64 - Bit Serial Code Stored in an On-Board ROM
Multi drop Capability Simplifies Distributed Temperature-Sensing Applications
Requires No External Components
Can Be Powered from Data Line; Power Supply Range is 3.3V to 5.5V
Measures Temperatures from - 55 C to + 125 C ( - 67 F to + 257 F)
3.5 C Accuracy from - 13 C to + 85 C
Thermometer Resolution is User Selectable from 9 to 12 Bits
Converts Temperature to 12 - Bit Digital Word in 753ms (Max

GH-311 Ultrasound Motion Sensor 5.2.2
The GH-311 ultrasonic Motion sensor provides precise, non-contact distance Measurements from about 2
cm (0.8 inches) to 3 meters (3.3 yards). It is very easy to connect to microcontrollers such as the BASIC
Stamp, SX or Propeller chip, requiring only one I/O pin. The GH-311 sensor works by transmitting an
ultrasonic (well above human hearing angel) burst and providing an output pulse that corresponds to the
time required for the burst echo to return to the sensor. By measuring the echo pulse width, the distance to
target can easily be calculated [12].

Features
High Sensitivity, Reliability and Stability
Extreme-Temp resistant, moisture proof, shock & vibration-proof, etc.



Faculty of Engineering, American International University-Bangladesh (AIUB) 22


Pin Definitions
GND Ground (Vss)
5 V 5 VDC (Vdd)
SIG Signal (I/O pin)

Figure 5.1 GH-311 Ultrasound motion sensor
Water Level Sensor 5.2.3
Global Water's WL433 Water Level Sensor submersible pressure transducer consists of a solid state
pressure sensor encapsulated in submersible stainless steel 13/16 diameter housing. The water level
gauge uses a marine grade cable to connect the water pressure sensor to the monitoring device. Each of
Global Water's pressure transducers has a two-wire 4-23 mA high level output, five full scales ranges, and
is fully temperature and barometric pressure compensated.

Feature
High accuracy and reliability
Completely submersible sensor and cable
Compact, rugged design for easy installation
Minimal maintenance and care
Sensor compatible with most monitoring equipment
- mA output
Vented cable for automatic barometric compensation
Multiple ranges available from to
Wet-wet sensor eliminates vent tube concerns
Dynamic temperature compensation system
Not affected by foam, wind or rain

Faculty of Engineering, American International University-Bangladesh (AIUB) 23


IMU 5.2.4
IMU is a measurement device that can combine three dierent sensors into one measuring board. It
consists of a gyroscope (measures angular velocities), 3 accelerometers (measures the acceleration in each
direction) and a magnetometer (measures magnetic eld). With this information, it is straight-forward to
use the Kalman lter to estimate the orientation of the device. In this way we can attain knowledge of the
orientation, rotation and linear motion of the ROV. Since the IMU came with a built in congured
Kalman lter.



Figure 5.2 IMU
Linear regulator IC (MC78XX/LM78XX/MC78XXA) 5.3
Description
The MC78XX/LM78XX/MC78XXA series of three terminal positive regulators are available in the TO-
220/D-PAK package and with several fixed output voltages, making them useful in a wide range of
applications. Each type employs internal current limiting, thermal shut down and safe operating area
protection, making it essentially indestructible. If adequate heat sinking is provided, they can deliver over
1A output current. Although designed primarily as fixed voltage regulators, these devices can be used
with external components to obtain adjustable voltages and currents.

Features
Output Current up to 1A
Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V
Thermal Overload Protection
Short Circuit Protection
Output Transistor Safe Operating Area Protection


Faculty of Engineering, American International University-Bangladesh (AIUB) 24



Figure 5.3 IC MC 7805
Pin description
Pin no Function Name
1

Input voltage(5v-18v) input
2

Ground(0v) ground
3 Regulated output (varies with
different models)
output

Crystal Oscillator 5.4
A crystal oscillator is an electronic circuit that uses the mechanical resonance of a vibrating crystal of
piezoelectric material to create an electrical signal with a very precise frequency. This frequency is
commonly used to keep track of time (as in quartz wristwatches), to provide a stable clock for digital
integrated circuits, and to stabilize frequencies for radio transmitter and receivers. The most common type
of piezoelectric resonator used is the quartz crystal, so oscillator circuits designed around them become
known as crystal oscillators

When a crystal of quartz is properly cut and mounted, it can be made to distort in an electric field by
applying a voltage to an electrode near or on the crystal. This property is known as piezoelectricity. When
the field is removed, the quartz will generate an electric field as it remains to its previous shape, and this
can generate voltage. The result is that a quartz crystal behaves like a circuit composed of an inductor,
capacitor and resistor, with a precise resonance frequency. Quartz has the further advantage that its elastic
constants and its size change in such a way that the frequency dependence on temperature can be very
low. The specific characteristics will depend on the mode of vibration and the angle at which the quartz is
cut. For critical applications the quartz oscillator is mounted in a temperature- controlled container, called

Faculty of Engineering, American International University-Bangladesh (AIUB) 25


a crystal oven, and can also be mounted on a shock absorbers to prevent perturbation by external
mechanical vibration [13].

Figure 5.4 Crystal oscillator
Relay 5.5
A relay is a kind of switch which is electrically operated. Mainly relays use an electromagnet to operate a
switching mechanism, but there are some other operating principles also. Where several circuits must be
controlled by one signal or where it is necessary to control a circuit by a low power signal, relay are used.
Relay gives complete electrical isolation between control and controlled circuit.
Contactor is a type of relay that can handle the high power required to drive or control an electric motor or
other loads. Instead of using a semiconductor device to perform switching, solid-state relays are used. The
relay also drives high power rated devices and machineries without damaging the control circuit.

Construction and operation of relay
Relays are amazingly simple device. There mainly 4 parts in every relay.
Electromagnet
Armature(that can be attach by electromagnet)
Spring
Set of electrical contacts.
A relay consists of two separate and completely independent circuits. The first is that the bottom and
drives the electromagnet, in this circuit, a switch is controlling power to the electromagnet. When the
switch is on, the electromagnet is on and it attracts the armature. The armature is acting as a switch in the
second circuit. When the electromagnet is energized, the armature completes the second circuit and turns
it on. When the electromagnet is not energized, the spring pulls the armature away and the circuit is not
complete.

Advanced and disadvantages of relay
The main advantages and disadvantages of relays are listed below:

Faculty of Engineering, American International University-Bangladesh (AIUB) 26


Advantages:
Relays can switch AC and DC, transistor can only switch DC.
Relays can switch higher voltages than standard transistor.
Relays are often a better choice for switching large current.
Relays can switch many contacts at once.
Disadvantages:
Relays are bulkier than transistors for switching small currents.
Relays cannot switch rapidly (except reed relays), transistor can switch many times per second.
Relays use more power due to the current flowing through their coil.
Relays require more current than many ICs can provide, so a low power transistor may be needed
to switch the current for the relays coil.
Work of relay in our project
To drive the high power thruster
Controlling the direction of thruster
Operating the pumps and light.
For relay purchasing we generally have control over several variables
The voltages and current to active the armature.
The maximum voltage and current that can run through the armature contacts.
The number of armatures(generally one or two)
The number of contacts for armature.
Whether the contacts (if only one contact is provided) is normally open (NO) or normally closed
(NC).

Figure 5.5 12V 5 amp relay



Faculty of Engineering, American International University-Bangladesh (AIUB) 27


BC 547 (dc) 5.6
BC547 is a (NPN) transistor. Used together with other electronic components, such as resistors, coils, and
capacitors, it can be used as the active component for switches and amplifiers. Like all other NPN
transistors, this type has an emitter terminal, a base or control terminal, and a collector terminal. In a
typical configuration, the current flowing from the base to the emitter controls the collector current. A
short vertical line, which is the base, can indicate the transistor schematic for an NPN transistor, and the
emitter, which is a diagonal line connecting to the base, is an arrowhead pointing away from the base.
There are various types of transistors, and the BC547 is a bipolar junction transistor (BJT).

Features of BC547
Material of transistor: Si
Polarity: NPN
Maximum collector power dissipation (Pc), W: 0.5
Maximum collector-base voltage |Ucb|, V: 50
Maximum collector-emitter voltage |Uce|, V: 50
Maximum emitter-base voltage |Ueb|, V: 6
Maximum collector current |Ic max|, A: 0.1
Maximum junction temperature (Tj), C: 150
Transition frequency (ft), MHz: 300
Collector capacitance (Cc), pF: 6
Forward current transfer ratio (hFE), min: 110



Figure 5.6 BC547 IC

Faculty of Engineering, American International University-Bangladesh (AIUB) 28


In our project we used bc547 to couple electrical circuit with microcontroller. The output pulse of
microcontroller passes through the BC547 and enables current flow. It also keep the microcontroller safe
by protesting the reverse biased current.

Irf540 Power MOSFET 5.7
IRF-540 is a power MOSFET. Power MOSFET is a specific type of metal oxide semiconductor field-
effect transistor (MOSFET) that can handle significantly high power levels than regular MOSFET, one of
the advantages of power MOSFET is high commutation speed and good efficiency at low voltages
Compared to the other power semiconductor devices. It is easy to use.
The power MOSFET is the most widely used low-voltage (that is, less than 200 V) switch. It can be found
in most power supplies, DC to DC converters, and low voltage motor controllers. To use various
MOSFETs together may occur in switching high currents or high voltage loads that becomes expensive
and impractical in both components and circuit board space.as a solution of this problem Power
MOSFET's were developed [14].
Features of IRF540
Advanced Process Technology
Ultra Low On-Resistance
Dynamic dv/dt Rating
175C Operating Temperature
Fast Switching
Fully Avalanche Rated

In our project we used IRF540 to work along with PWM for speed control motor. Current passes through
the IRF540 as pulse come from microcontroller according to the PWM signal.

Bilge Pump Replacement Motor 5.8
Bilge pumps are specially made water resistant motor that used for removing water from the lowest
compartment inside the hull of a ship. As a safety measurement electric bilge pumps are designed to be
non-sparking. Electric bilge pumps are used with float switches that turn on the pump when the bilge fills
to a set level.
In our project we used the replacement motor of bilge pump to build our thrusters along with propellers.

Faculty of Engineering, American International University-Bangladesh (AIUB) 29


We used 5 such motors. Ratings are given below:
Capacity
GPH
Number of motors

Current rating
A
Voltage rating
V
1000 2 4 12
750 3 3.5 12




Figure 5.7 Bilge pump motor
Fuse 5.9
Fuse is a type of low resistance resistor that provides overcurrent protection of circuit. It is a metal wire or
strip that is placed between a pair of electrical terminals, and enclosed by a non-combustible housing. It
melts when overcurrent flows and thus interrupts the circuit in which it is connected. By melting itself it
protects circuits from fault like Short circuit, overloading, mismatched loads or device failure. The fuse
element is made of zinc, copper, silver, aluminum, or alloys to provide stable and predictable
characteristics. The fuse ideally would carry its rated current indefinitely, and melt quickly on a small
excess. The bilge pump replacement motor used in our project draws high current. There are other
complex and valuable circuitry. So we used 4 amp fuse to protect the overflow in motors.

Faculty of Engineering, American International University-Bangladesh (AIUB) 30



Figure 5.8 Fuse
Battery 5.10
In this project battery is a very significant aspect of consideration. Since the motors draws very high
current to run under water battery should be powerful enough to support with necessary power. It also
give the power to the circuits. In our project the energy source consists of two 10 Ah sealed lead-acid
battery that together provide for the motor, light and other circuit components in host module. We
used a (6V, 4.5Ah) power source to give power to the remote module.

Pump 5.11
Pump is a basically a motor placed in a closed and congested housing with two hole as input and output
path for water or air. In our project we used pump to collect water sample from certain level of water. We
used a jet pump of windshield wiper for this reason. It can exhaust water with high pressure which may be
dangerous for electrical circuit. So as a safety measure we changed the direction of water flow in the
motor and used the jet output path as input path of water.



Figure 5.9 Water pump

Faculty of Engineering, American International University-Bangladesh (AIUB) 31


Camera and Light 5.12
Camera is an optical device that can capture image or video. It either stores or transmit the output as
image of video to another place. In our project we used camera and led light together to observe
underwater environment. The camera directly transmits the video to the TFT LCD monitor. It can easily
be stored if interfaced with a computer.


Figure 5.10 LED light and camera
Propeller and Coupler 5.13
Propeller is the part that couples with motor to build a thruster which provides with proper thrust force to
give motion to the ROV. The number and shape of the blades of the propeller is an important thing to
concern about to build a ROV thruster. To give proper strength propeller are connected with motor head
using adopter or propeller coupler. In our project we used 3 blade propellers.



Figure 5.11(a) Propeller coupler Figure 5.11(b) Propeller


Faculty of Engineering, American International University-Bangladesh (AIUB) 32


Liquid Cristal Display(LCD) 5.14
LCD or liquid-crystal display is a flat panel electronic visual display or a video display that uses the light
modulating properties of liquid crystals. Computer monitors, televisions, watches, calculators,
and telephones, instrument panels etc. are some field of application of LCD. They do not suffer image
burn-in. LCDs are, however, susceptible to image persistence. LCD screen has better energy efficiency
and they are easily disposable. Its low electrical power consumption enables it to be used in battery-
powered electronic equipment.
In our project we used a 16 X 2 LCD to show the temperature of water and the output of obstacle and
pressure sensor.

Figure 5.12 Display 216 LCD
TFT LCD Display 5.15
TFT LCD stands for thin-film-transistor liquid-crystal display. It is a type of liquid-crystal
display (LCD) that uses thin-film transistor (TFT) for better quality of image. The advantage of this type
of display are high contrast, color saturation and luminance. It also offer the opportunity to increase
performance like anti-reflective screens and ultra-wide viewing angles etc.
TFT LCDs are used in appliances including televisions, computer monitors, PDA, navigation
systems and projectors.

UART Protocol 5.16
UART is a integrated feature in PIC16F877a microcontrollers. The remote module takes bytes of data and
transmits the individual bits in a sequence. At the host module, second UART re-assembles the bits into
complete bytes. In our project Communication is full duplex that means both send and receive at the
same time. The sender MCU and receiver MCU must operate on same Baud Rate. In our project both

Faculty of Engineering, American International University-Bangladesh (AIUB) 33


MCU operates at BAUD rate of 1280. It is possible to operate at a high BAUD rate of more than 9000.
But this is not suitable for long distance transmission.
In asynchronous transmission, the sender sends LSB first. When data is fully transmitted, an optional
parity bit is sent to the transmitter. This bit is usually used by receiver to perform simple error checking.
Lastly, Stop bit will be sent to indicate the end of transmission. A common reason for the occurrence of
Framing Error is that the sender and receiver clocks were not running at the same speed, or that the signal
was interrupted. MCU sends data using TX port and receives using RX port. Both MCU have a common
ground. [15]



Figure 5.13 UART communication timing diagram.

Summery 5.17
In our project we used TFT LCD display for showing the video feedback output of the camera from the
underwater environment.
In this chapter we discussed briefly about the important components used in our project. The purpose of
the components in the circuit is discussed too.


Faculty of Engineering, American International University-Bangladesh (AIUB) 34


Chapter 6
Microcontroller
Introduction 6.1
Microcontroller is a small computer on a single integrated circuit that contains a processor core, memory,
and programmable input/output peripherals. It is a small package of simplified CPU, some amount of ram,
some amount of reprogrammable rom, some I/O ports in a single small chip. Program memory in the form
of NOR flash or OTP ROM is also often included on chip. Microcontrollers are designed for embedded
applications, in contrast to the microprocessors used in personal computers or other general purpose
applications.

Microcontrollers are mostly used in automatically controlled devices, such as automobile engine control
systems, implantable medical devices, remote controls, office machines, appliances, power tools, toys and
other embedded systems. By reducing the size and cost compared to a design that uses a separate
microprocessor, memory, and input/output devices, microcontrollers make it economical to digitally
control even more devices and processes. They are simple and at the same time efficient enough to be
used in many DIY (do it yourself) projects. Mixed signal microcontrollers are common, integrating analog
components needed to control non-digital electronic systems.
We used pic16F877A in our project.[14]


Figure 6.1 Internal block diagram of Microcontroller

Faculty of Engineering, American International University-Bangladesh (AIUB) 35


Microchip PIC16F877A : Microcontroller Overview 6.2
The PIC16F887 is an excellent microcontroller which is one of the latest products of Microchip. It
features all the components which modern microcontrollers normally have. It has register based
architecture it comes with low price but wide range of application as well as high quality and easy
availability. It is a suitable option for applications such as: control of different processes in industry,
machine control devices, measurement of different values etc.

Basic Working Units 6.3
Central Processor Unit (CPU) 6.3.1
The CPU is manufactured with RISC technology an important factor when deciding which
microprocessor to use. RISC (Reduced Instruction Set Computer) gives the PIC16F887 some advantages:
The CPU can recognize only 35 simple instructions (In order to program some other microcontrollers it is
necessary to know more than 200 instructions by heart).
Except two and lasts 4 clock cycles (oscillator frequency is stabilized by a quartz crystal) the execution
time is the same for all instructions. The Jump and Branch instructions execution time is 2 clock cycles. It
means that if the microcontrollers operating speed is 20MHz, execution time of each instruction will be
200nS, i.e. the program will be executed at the speed of 5 million instructions per second [15].

Memory 6.3.2
PIC16F877A microcontroller has 3 types of memory- ROM, RAM and EEPROM. All of them are briefly
discussed below separately, since each has specific functions, features and organization.

ROM Memory 6.3.2.1
To permanently save the program being executed, ROM memory is used. This is also called program
memory. The PIC16F887 has 8Kb of ROM (in total of 8192 locations). This ROM is made with FLASH
technology which gives the facility to change its contents by providing a special programming voltage
(13V).




Faculty of Engineering, American International University-Bangladesh (AIUB) 36


EEPROM Memory 6.3.2.2
Alike ROM memory or program memory, the contents of EEPROM is permanently saved. Even if the
power goes off, it saves the data. But the difference with ROM is that the contents of the EEPROM can be
changed during operation of the microcontroller. That is why this memory (256 locations) is a perfect one
for permanently saving results created and used during the operation.

Random Access Memory 6.3.2.3
This is the most complicated part of microcontroller memory. In this case, it consists of two parts:
general-purpose registers and special-function registers (SFR).
Even though both groups of registers are cleared when power goes off and even though they are
manufactured in the same way and act in the similar way, their functions do not have many things in
common.

General-Purpose Registers 6.3.2.4
For storing temporary data and results created during operation, General-Purpose registers are used. For
example, if the program performs a counting, it is necessary to specify the address of some general
purpose register and assign it a new function. The microcontroller can execute that program because it
now knows what and where the sum is and which must be incremented. Each program variable must be
Pre-assigned some of general-purpose register.

Special Function Registers 6.3.2.5
Special-Function registers are also RAM memory locations, but unlike general-purpose registers, their
purpose is predetermined during manufacturing process and cannot be changed. Since their bits are
physically connected to particular circuits on the chip (A/D converter, serial communication module, etc.),
any change of their contents directly affects the operation of the microcontroller or some of its circuits.
For example, by changing the TRISA register, the function of each port A pin can be changed in a way it
acts as input or output. Another feature of these memory locations is that they have their names (registers
and their bits), which considerably facilitates program writing. Since high-level programming language
can use the list of all registers with their exact addresses, it is enough to specify the registers name in
order to read or change its contents.


Faculty of Engineering, American International University-Bangladesh (AIUB) 37


Some of its Main Features are Listed Below 6.4
RISC architecture
Only 35 instructions to learn
All single-cycle instructions except branches
Operating frequency 0-20 MHz
Precision internal oscillator
Factory calibrated and software selectable frequency range of 8MHz to 31 KHz
Power supply voltage 2.0-5.5V
Consumption: 220uA (2.0V, 4MHz), 11uA (2.0 V, 32 KHz) 50nA (stand-by mode)
Power-Saving Sleep Mode
Brown-out Reset (BOR) with software control option
35 input/output pins
High current source/sink for direct LED drive
software and individually programmable pull-up resistor
Interrupt-on-Change pin
8K ROM memory in FLASH technology
Chip can be reprogrammed up to 100.000 times
In-Circuit Serial Programming Option
Chip can be programmed even embedded in the target device
256 bytes EEPROM memory
Data can be written more than 1.000.000 times
368 bytes RAM memory
A/D converter:
14-channels
10-bit resolution
3 independent timers/counters[16]

Special Microcontroller Features 6.5
100,000 erase/write cycle Enhanced Flash program memory typical
Data EEPROM Retention > 40 years
Self-reprogrammable under software control

Faculty of Engineering, American International University-Bangladesh (AIUB) 38


In-Circuit Serial Programming (ICSP) via two pins
Single-supply 5V In-Circuit Serial Programming
Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation
Programmable code protection
Power saving Sleep mode
Selectable oscillator options
In-Circuit Debug (ICD) via two pins [17]
PIC16f877A Pin Diagram 6.6

Figure 6.2 PIC 16f877A pin diagram


Faculty of Engineering, American International University-Bangladesh (AIUB) 39


Block Diagram of PIC16f877A 6.7

Figure 6.3 Architecture of PIC16F877A [18]


Faculty of Engineering, American International University-Bangladesh (AIUB) 40


PIC16f877A Pin Configuration [19] 6.8
Name Number
DIP
Functio
n
Description


RE3/MCLR/V
PP
1 RE3 General purpose input Port E
MCLR Reset pin. Logic level on this pin resets
microcontroller.
V
pp
Programming voltage


RA AN ULPWU/C IN -
RA
General purpose I/O port A
AN A/D Channel input
ULPWU Stand-by mode deactivation input
C IN Comparator C or C negative input
RA AN C IN -
3
RA
Genaral purpose I/O port A
AN A/D channel
C IN
-
Comparator C or C negative input
RA2/AN2/V
ref-
/CV
ref
C in+

RA2 GENERAL PURPOSE I/O PORT
AN2 A/D CHANNEL 1
Vref- A/D NEGATIVE VOLTAGE REF
CVref COMPARATOR VOLTAGE REF. OUTPUT
C2IN+ COMPARATOR C2 POSITIVE INPUT
RA3/AN2/VREF+/CIN+ 5 RA3 GENERAL PURPOSE I/O PORT A
AN3 A/D CHANNEL 3
VREF+ A/D POSITIVE VOLTAGE REFERENCE INPUT
CIN+ COMPARATOR C1 POSITIVE INPUT
TOCKI TIMER TO CLOCK INPUT

Faculty of Engineering, American International University-Bangladesh (AIUB) 41


C1OUT COMPARATOR C1 OUTPUT
RA5/AN4/SS/C2OUT 7 RA5 GENERAL PURPOSE I/O PORT A
AN4 A/D CHANNEL 4
SS SPI MODULE INPUT(SLAVE SELECT)
C2OUT COMPARATOR C2 OUTPUT
RE0/AN5 8 RE0 GENERAL PURPOSE I/O PORT E
AN5 A/D CHANNEL 5
RE1/AN6 9 RE1 GENERAL PURPOSE I/O PORT E
AN6 A/D CHANNEL 5
RE2/AN7 10 RE2 GENERAL PURPOSE I/O PORT
AN7 A/D CHANNEL 5
VDD 11 + POSITIVE SUPPLY
VSS 12 - NEGATIVE SUPPLY
RA7/OSC1/CLKIN 13 RA7 GENERAL PURPOSE I/O PORT E
OSC1 CRYSTAL OSCILLATOR INPUT
CLKIN EXTERNAL CLOCK INPUT
RA6/OSC2/CLKOUT 14 RA6 GENERAL PURPOSE I/O PORT E
OSC2 CRYSTAL OSCILLATOR INPUT
CLKO FOSC /4 OUTPUT
RC0/T1OSO/T1CK1 15 RC0 GENERAL PURPOSE I/O PORT E
T1OSO TIMER T1 OSCILLATOR OUTPUT
T1CK1 TIMER T1 CLOCK INPUT
RC1/T1OSO/TICK1

1

RC1/ GENERAL PURPOSE I/O PORT E
T1OSO TIMER T1 OSCILLATOR OUTPUT
TICK1 TIMER T1 CLOCK INPUT
RC2/P1A/CCP1 17 RC2 GENERAL PURPOSE I/O PORT E

Faculty of Engineering, American International University-Bangladesh (AIUB) 42


P1A PWM MODULE OUTPUT
/CCP1 CCP1 AND PWM MODULE I/P
RC3/SCK/SCL 18 RC3 GENERAL PURPOSE I/O PORT E
SCK MSSP CLOCK I/O IN SPI MODE
SCL MSSP CLOCK I/O IN I2C MODE
RD0 19 GENERAL PURPOSE I/O PORT E
RD1 20 GENERAL PURPOSE I/O PORT E
RD2 21 GENERAL PURPOSE I/O PORT E
RD3 22 GENERAL PURPOSE I/O PORT E
RC4/SDI/SDA 23 RC4 GENERAL PURPOSE I/O PORT E
SDI MSSP DATA INPUT IN SPI MODE
SDA MSSP DATA I/O IN I2C MODE
RC5/SD0 24 RC5 GENERAL PURPOSE I/O PORT E
SD0 MSSP DATA OUTPUT IN SPI MODE
RC6/TX/CK 25 RC6 GENERAL PURPOSE I/O PORT E
TX/ USART ASYNCHRONOUS OUTPUT
CK USART SYNCHRONOUS CLOCK
RC7/RX/DT 26 RC7 GENERAL PURPOSE I/O PORT E
/RX USART ASYNCHRONOUS INPUT
DT USART ASYNCHRONOUS DATA
RD4 27 GENERAL PURPOSE I/O PORT E
RD5/P1B 28 RD5 GENERAL PURPOSE I/O PORT E
P1B PWM OUTPUT
RD6/P1C 29 RD6 GENERAL PURPOSE I/O PORT E
P1C

PWM OUTPUT

Faculty of Engineering, American International University-Bangladesh (AIUB) 43


RD7/P1D 30 RD7 GENERAL PURPOSE I/O PORT E
P1D PWM OUTPUT
VSS 31 GROUND
VDD 32 POSITIVE SUPPLY
RB0/AN12/INT 33 RB0 GENERAL PURPOSE I/O PORT E
AN12 A/D CHANNEL 12
INT EXTERNAL INTERRUPT
RB1/AN10/C12INT3 34 RB1 GENERAL PURPOSE I/O PORT E
AN10 A/D CHANNEL 10
C12INT3 COMPARATPR C1 OR C2 NEGATIVE INPUT
RB2/AN8 35 RB2 GENERAL PURPOSE I/O PORT E
AN8 A/D CHANNEL 10
RB3/AN9/PGM/C121N2 36 RB3 GENERAL PURPOSE I/O PORT E
AN9 A/D CHANNEL 10
PGM PROGRAMMING ENABLE PIN
C121N2 COMPARATPR C1 OR C2 NEGATIVE INPUT
RB4/AN11 37 RB4 GENERAL PURPOSE I/O PORT E
AN11 A/D CHANNEL 10
RB5/AN13/TIG 38 RB5 GENERAL PURPOSE I/O PORT E
AN13 A/D CHANNEL 10
TIG TTIMER T1 EXTERNAL INPUT
RB6/ICSPICLK 39 RB6 GENERAL PURPOSE I/O PORT E
ICSPICLK SERIAL PROGRAMMING CLOCK
RB7/ICSDAT 40 RB7 GENERAL PURPOSE I/O PORT E
ICSDAT PROGRAMMING ENABLE PIN


Faculty of Engineering, American International University-Bangladesh (AIUB) 44


Summary 6.9
The PIC16f877A microcontroller has been discussed in this chapter. This chapter clarifies that a
microcontroller is a miniature version of computer but it is special in the sense that it carries out a specific
function unlike computers. Different features of the microcontroller are described here. The overall
architecture along with the function of its different parts is provided in this chapter.



Faculty of Engineering, American International University-Bangladesh (AIUB) 45


Chapter 7
Programming and Application of the Software
Introduction 7.1
Machines cannot understand human language. It only understands binary 0 and1. But writing a long code
in 0s and 1s is very difficult for humans. So another language that is in between this two language is used.
These languages are called high level language. The codes written in the high level language are t hen
translated into the machine language using software. Then this instruction can be executed by the
computer. This chapter discusses the high-level programming language that has been used to write the
codes, the software that converts it into machine language and finally burn into the microcontroller.

The C Programming 7.2
C is a general purpose computer programming, developed between 1969 and 1973 by Dennis Ritchie at
the bell telephone laboratories for use with the UNIX operating system. Although c was designed for
implementing system software, it is also widely used for developing portable application software.

C is one of the most widely used programming languages of all time and there are very few computer
architecture for which a c compiler does not work. C has greatly influenced many other popular
programming languages, most notably C++, which began as an extension of c.

C is an imperative (procedural) system implementation language. It was designed to be compiled using
relatively straight forward compiler, to provide low level access to memory, to provide language
constructs that map efficiently to machine instructions and to require minimal run-time support. C has
been useful for much application that had for formerly been coded in assembly language. For this reason
this language has become available on a very wide range of platforms, from embedded microcontrollers to
super computer.

In this project, the code is written in c language. The source program is well commenter and easy to
understand. First the resister mane is defined specifically for PIC16f877A and then variables were
declared [20].


Faculty of Engineering, American International University-Bangladesh (AIUB) 46


MikroC Pro Pic C Compiler 7.2.1
C was designed as a programming language not as a compiler target language. Since we know that the
code must be translated into machine language, we need a compiler to do this task. The compiler we are
using is called mikroc_pro_pic_v600 c compiler. This compiler converts the source program into hex
code which is downloaded to the microcontroller.
MikroC pro PIC is a complete set of tools designed for rapid and efficient software development for PIC
microcontroller. Hence for using to compile codes for PIC16F877A this software in best option [20].

Some Features of Mikroc_pro_PIC_v600 7.2.2
MikroC is a full-featured ANSI C compiler that is available for six different microcontroller architectures
(in this case, for PIC 12/16/18). It features an intuitive IDE, a powerful compiler with advanced SSA
optimizations, lots of hardware and software libraries, and additional tools

Single-click Debugging 7.2.2.1
MikroC PRO for PIC has native support for the MikroICD In-Circuit Debugger feature of the fast USB
2.0 MikroProg-PIC programmer (in both on-board and standalone versions). MikroICD is a separate DLL
module which supports Step-over, Step-Into, Step-Out, Run, and Run-to-Cursor debugging operations.
Also, the debugger supports standard and advanced breakpoints.

Faster, Better, More Productive 7.2.2.2
MikroC PRO for PIC comes equipped with fully functional software tools that can boost efficiency.

Design Develop Share 7.2.2.3
The Drag-and-drop development environment of the program ensures that we need to spend less time for
programming, allowing focusing on functionality and design.

Library Manager 7.2.2.4
It offers the mechanism to use any available library in project easily. If it is just clicked on the checkboxes
of the libraries the code will be available instantly. The Library Manager is programmed to allow easy
usage of third-party libraries installed with Package Manager Software.

Faculty of Engineering, American International University-Bangladesh (AIUB) 47



Edit Project 7.2.2.5
Edit Project gives full overview of the configuration bits in each chip. Edit Project includes predefined
schemes of oscillator settings for most widely used microcontrollers.

Code Assistant 7.2.2.6
The Code Assistant feature helps by providing function names and let syntax write itself correctly. Code
Assistant in MikroC PRO for PIC also suggests correct names of constants, URLs, Active Comments, and
variables.

Parameter Assistant 7.2.2.7
It has a listed function parameters which helps to easily identify the desired function.

Object Explorer 7.2.2.8
The Project Explorer window leads to projects and displays all of the included examples by default.
Double-click opens the project and sets it as active. It is possible to quickly switch between the programs
and have stable RAM consumption.

Active Comments 7.2.2.9
Its a unique feature of MikroC PRO for PIC. Any comment can be used as a multimedia event hook and
images, files, URLs etc. can be used as active comment.

Quick Converter 7.2.2.10
Quick Converter can convert binary, float, HEX and Radix 1.15 formats within these as necessary. It also
can displays ASCII values of command bytes.

Code Folding 7.2.2.11
If code outgrows the size of screen, it fold those completed blocks, and work in a clearer surrounding.


Faculty of Engineering, American International University-Bangladesh (AIUB) 48


Software Simulator 7.2.2.12
If allows to go through your code and monitor the values of your variables, searching for bugs and errors
via Software Simulator. Instead of executing the code on real hardware, it simulates code flow on PC.

Programming the Microcontroller 7.3
The codes to program the microcontroller was written using the Micro PRO C software in C programming
language. Then the code was converted to *.hex file. Than the program loader circuit TECH PIC was
connected to the computer. Generated HEX file (*.hex) was loaded using PICKIT 2.6. It was ensured the
simulated code was accurate and loaded to the microcontroller successfully.

Introduction to Burner 7.4
TechPIC trainer kit by www.techshopbd.com is a clone of pickit 2 with some extra function.


Figure 7.1: TechPIC


Faculty of Engineering, American International University-Bangladesh (AIUB) 49


Features:
1) ZIF Socket for PIC IC, with accessible I/O, grouped by PORT.
2) On board Programmer.
3) USB connector, connection with PC.
4) Crystal Oscillator (Default 16MHz). Its replaceable.
5) External Supply Socket (5V).
6) SPI Pinout.
7) ISP Pinout.
8) USART Pinout.
9) I2C Pinout.
10) Seven Segment Display Interfacing.
11) LCD Interfacing Connector.
12) LCD Contrast.
13) ADC Interfacing.
14) Push Button (x2) Interfacing.
15) I/O Expander.
16) RESET Circuitry.
17) 8 LEDs for general use.
18) 5-way Tactile Switch Interfacing.
19) Buzzer Interfacing.
20) PS/2 Interfacing.
21) Infrared Interfacing.
22) 1-Wire Communication Interfacing.
23) Power Switch.
24) Vcc-GND power pin [21].

PICkit 2 Programming Software 7.5
We used the software PICkit 2 to burn the code into the PIC16F877a microcontroller. Steps of burning
a code into the microcontroller are given below.



Faculty of Engineering, American International University-Bangladesh (AIUB) 50



Figure7.2 PICkit 2 Programming Software
Program Loading Steps 7.6
Plugin the PIC kit 2 clone Development Board into Pc
Manu bar > tools > check communication
File > import HEX > select HEX file(*.hex)> click open
Command bar> write
Check if the programming is successful.


Figure 7.3 Manu bar > tools > check communication

Faculty of Engineering, American International University-Bangladesh (AIUB) 51




Figure7.4 HEX file loaded succesfully


Figure 7.5 Program loaded successfully.

Summary 7.7
This chapter introduces the fundamental software and working procedure that has been used in this project
in order to load the program in the microcontroller. We also described the program burning steps with
necessary diagram of the every important steps.








Faculty of Engineering, American International University-Bangladesh (AIUB) 52


Chapter 8
ROV Shell, Thruster, Camera and Light Housing Design and Construction
Introduction 8.1
Design of shell, thruster, camera and light housing and its manufacture is describe through this chapter.
The design and manufacture of skeleton or structure of a ROV, is an important portion of this project. In
this chapter there will be a brief description of factors, process of design and manufacture the whole ROV,
with locally available elements and materials.

Shell Design 8.2
Shell is the body structure and the main housing of the ROV. The design must be efficient and robust.

Shape 8.2.1
ROVs come in all shapes and sizes depending on what they are designed to do but all ROVs have a few
structures in common. ROVs have a rigid frame that must withstand high pressure and extreme
temperatures as deep sea temperatures can range from near freezing to over 400 degrees Celsius. Mounted
to the frame are motors to provide propulsion, floatation and ballast that combine to provide neutral
buoyancy, and a tether or umbilical cord linked to the ship that provides power and is used to control
movement. Other equipment such as lights, cameras, sensors, and collecting devices are often attached as
well. We designed our ROV shape as torpedo. The frontal area of torpedo shape ROV is less so the drag
factor is also less which gives the ROV more speed and maneuverability.

Drawing
First of all, we need to sketch a rough design we want, to scale, on paper. During design we count on
some points
Dimensions
Materials
Buoyancy
Drag
Stability

Faculty of Engineering, American International University-Bangladesh (AIUB) 53


Location of thrusters
Location of required tools
Location of camera and tether attachments
Then we draw it on AUTOCAD design software with perfect scale. We draw it from two perspective
i. Plan view (looking down on the ROV from above)
ii. Side elevation (looking at the ROV from the side),

Figure of ROV (CAD design)



Figure 8.1 Top view and side view


Figure 8.2 Sketch of ROV




Faculty of Engineering, American International University-Bangladesh (AIUB) 54


Making
To build the body of the ROV we used PVC pipe. It is a 2.5ft long PVC pipe of 6 inch diameter and 6mm
thickness. The front side is wide open and the other side is reduced to 2 inch diameter by giving heat. The
head is made with a glass and a PVC casing. This two parts are coupled together to make a waterproof
body. We drilled a few holes to insert the cables and sensors.


Figure 8.3 HULL of ROV
Thrusters 8.3
Thrusters are mainly electrically powered motors connected with propeller. The bilge pump is actually a
ready-made DC motor in a watertight housing. After removing the unnecessary parts of the bilge pump
we attached the propeller with the extension of the armature using the propeller coupler.


Figure 8.4 Bilge motor and propeller unit
Fabricating the Protective Propeller Cowling 8.4
A protective cowling or shroud for the propellers is an essential next step. It is a safety measure for the
deck crew handling the ROV and a method of keeping the propeller from damaging itself or whatever its
hitting and avoiding getting the prop fouled from other materials like tether or lines and competition
structures. To construct the cowling we need:

Faculty of Engineering, American International University-Bangladesh (AIUB) 55


A 3 to 2 PVC pipe and a short length of 2 PVC pipe. Generally we have to cut two sections out
of each of these parts such that the remaining prongs overlap. We cut the reducer coupling by
mounting in on a piece of 2 pipe and then in a moveable vice such as used on a drill press. We
pushed the small end ring (2) of the pipe into the band saw blade. We made sure that the blade
must bisect the small ring (across its diameter) and penetrated into the cone shape until it reaches
the larger ring (3).
Now we rotated the whole pipe about 20 degrees (2.5 cm) in either direction, and position it
exactly as above. We repeated the cut across the diameter of the smaller ring. Now we have four
cut slots into the smaller ring. It leaves two segments of the arc much larger than the other two.
Then we rotated the whole vice 90horizontally, such that the 3 pipe and the pipe coupling are
now perpendicular to the band saw blade. Then went to cut down the plane of the large ring, where
it meets the cone section of the adapter.but only through the larger arc segment. We were very
careful not to cut the smaller arc segments.
Once that was done, the large arc segment was pulled from the reducer. We did the same thing on
the opposite side of the reducer. The piece on the left (above) is what we had left. Were 2/3s
done. Then we took a 20-30cm length of 2 PVC pipe and mounted it was in the drill press vice.
We measure off a 4.5 cm from the end and marked it with a scratch or a white grease pencil and
pointed the end of the pipe at the band saw blade position it such that the blade would cut across
the maximum width (the diameter) of the pipe. Exactly as with the reducer, we made a cut across
the diameter into the end of the pipe, rotated it about 20
0
and then made another cut. The end of
the pipe then had four cuts which defined four segments of the circumference. Two opposite
segments were about 2.0 cm long. Those were the segments which will remain after the next cuts.
Again, like the reducer, rotate the whole vice 90
0
horizontally, such that the 1- ABS is now
perpendicular to the band saw blade. Cut out the two longer arc segments at about 4.5 cm from the
end, being careful not to cut the smaller arc segments. The piece on the right (in the photo above)
is what you have left. Almost done! Now you can join the two parts of the thruster cowling
together. (see photo right) The bilge pump motor cartridge fits tightly into the 1- ABS pipe. The
propeller and brass hub can now be installed on the motors drive shaft and the whole unit can be
glued together with transition cement. (ABS to PVC). The finished design is shown below


Faculty of Engineering, American International University-Bangladesh (AIUB) 56



Figure 8.5 Bilge motor housing
Summary 8.5
This is one of the most important part of the project to make the HULL/ body structure of the ROV. Hull
is the container of the internal circuitry. The motors are attached with the body. It must be ensured that the
body is water proof. In this chapter we discussed about the procedure of building a waterproof HULL for
our ROV.


Faculty of Engineering, American International University-Bangladesh (AIUB) 57


Chapter 9
Software Simulation of the System
Introduction 9.1
In this chapter the model derived in Chapter Modeling will be evaluated by simulations. The dierent
tests that have been used will be described, followed by some results and recommendations. With the
intention of obtain accuracy of the model, trial the system and test the controller a variety of tests are
needed. Here are three types of tests that have been run: Dry tests, static wet tests and dynamic wet tests.

Simulation 9.2
In order to verify the model derived in chapter modeling and estimated the real time working procedure
a model was created in PROTEOUS as a test workbench.
Its main purpose is
Verify that the model behaves reasonable.
Estimate the necessary model upgrades and changes.
To understand solutions and ideas for implementing the circuit.
The system block. This block simulates the systems behavior for a given input signal.
The controllers. With the help of the switch it is possible to understand the behavior of the controller.

Simulating the Circuit of Remote Module 9.2.1
The circuitry for the remote consists of pulse switch, microcontroller, LCD, TFT LCD. The pulse switch
and the LCD has been interfaced with the microcontroller unit. The tasks of the remote are to send
command to the host module and to receive feedback and to process the data too. The LCD shows output
of sensors after receiving and processing through microcontroller.
When a pulse switch is pressed, for every individual switch connected to different pin of the
microcontroller different character is generated. Thats means every generated character has different
ASCII value. It sends the ASCII code to microcontroller of the host module for further action. Total 15
switch are connected to Microcontroller as input pin. 12 of them turns on/off and controls the direction of
movement of the motors. 2 of them controls speed of motor. 1 switch used to completely shut down the
device.

Faculty of Engineering, American International University-Bangladesh (AIUB) 58




Figure 9.1 Simulation diagram of remote module
Simulating the Circuit of Host Module 9.2.2
The main consisting parts of the circuitry of the host module of several relays, microcontroller,
optocoupler, power MOSFET, heat sink BJT, sensor etc. The sensors and motor driver circuits has been
interfaced with the microcontroller unit. The tasks of the host is to receive command from the remote
module and to behave accordingly by switching on different motors, light and pump. It also sends the
retrieved data of the sensors to the remote module to show in the LCD.
When a pulse switch is pressed in the remote module it sends the ASCII value to microcontroller of the
host module. Host module receives the data and execute further action.

RA0/AN0
2
RA1/AN1
3
RA2/AN2/VREF-/CVREF
4
RA4/T0CKI/C1OUT
6
RA5/AN4/SS/C2OUT
7
RE0/AN5/RD
8
RE1/AN6/WR
9
RE2/AN7/CS
10
OSC1/CLKIN
13
OSC2/CLKOUT
14
RC1/T1OSI/CCP2
16
RC2/CCP1
17
RC3/SCK/SCL
18
RD0/PSP0
19
RD1/PSP1
20
RB7/PGD
40
RB6/PGC
39
RB5
38
RB4
37
RB3/PGM
36
RB2
35
RB1
34
RB0/INT
33
RD7/PSP7
30
RD6/PSP6
29
RD5/PSP5
28
RD4/PSP4
27
RD3/PSP3
22
RD2/PSP2
21
RC7/RX/DT
26
RC6/TX/CK
25
RC5/SDO
24
RC4/SDI/SDA
23
RA3/AN3/VREF+
5
RC0/T1OSO/T1CKI
15
MCLR/Vpp/THV
1
U1
PIC16F877A
D
7
1
4
D
6
1
3
D
5
1
2
D
4
1
1
D
3
1
0
D
2
9
D
1
8
D
0
7
E
6
R
W
5
R
S
4
V
S
S
1
V
D
D
2
V
E
E
3
LCD1
LM016L
5
0
%
RV1
5k
+5v
D5
1N4733A
+5v
VI
1
VO
3
G
N
D
2
U2
7805
+12v
R9
1k
+5v
X10
CRYSTAL
C12
22pf C1
22pf
To the Receiver circuit
+5v
R1
1k
R1222
1k
R2
1k
R33
1k
R4
1k
R55
1k
R6
1k
R77
1k
R8
1k
R103
1k
R11
1k
R122
1k
R13
1k
R144
1k
R15
1k
R166
1k
C2
100uf
RXD
RTS
TXD
CTS
9
3
%
RV2
1k
+5v

Faculty of Engineering, American International University-Bangladesh (AIUB) 59


R

Figure 9.2 Simulation diagram of host module

RA0/AN0
2
RA1/AN1
3
RA2/AN2/VREF-/CVREF
4
RA4/T0CKI/C1OUT
6
RA5/AN4/SS/C2OUT
7
RE0/AN5/RD
8
RE1/AN6/WR
9
RE2/AN7/CS
10
OSC1/CLKIN
13
OSC2/CLKOUT
14
RC1/T1OSI/CCP2
16
RC2/CCP1
17
RC3/SCK/SCL
18
RD0/PSP0
19
RD1/PSP1
20
RB7/PGD
40
RB6/PGC
39
RB5
38
RB4
37
RB3/PGM
36
RB2
35
RB1
34
RB0/INT
33
RD7/PSP7
30
RD6/PSP6
29
RD5/PSP5
28
RD4/PSP4
27
RD3/PSP3
22
RD2/PSP2
21
RC7/RX/DT
26
RC6/TX/CK
25
RC5/SDO
24
RC4/SDI/SDA
23
RA3/AN3/VREF+
5
RC0/T1OSO/T1CKI
15
MCLR/Vpp/THV
1
U1
PIC16F877A
RL1
OMIH-SH-105D
RL2
OMIH-SH-105D
D1
1N4007
D2
1N4007
Q1
BC547
Q2
BC547
R1
10k
R3
10k
+12v
RL3
OMIH-SH-105D
RL4
OMIH-SH-105D
D3
1N4007
D4
1N4007
Q3
BC547
Q4
BC547
R2
10k
R4
10k
+12v
RL5
OMIH-SH-105D
RL6
OMIH-SH-105D
D5
1N4007
D6
1N4007
Q5
BC547
Q6
BC547
R5
10k
R6
10k
+12v
RL8
OMIH-SH-105D
D8
1N4007
Q8
BC547
R8
10k
+12v
RL7
OMIH-SH-105D
D7
1N4007
Q7
BC547
R7
10k
+12v
D9
LED-RED
X10
CRYSTAL
C11
22pf C1
22pf
R9
10k
+5v
C2
2200uf
C3
0.1uf
Q9
IRF540
+12v
Q10
IRF540
Q11
IRF540
Q12
IRF540
A
K
C
E
1
2
4
3
U3
PC817
+12v
R10
10k
R11
10k
To Obstacle detecting sensor
To the Remote control circuit
28.0
3
1
VOUT
2
U2
LM35

Faculty of Engineering, American International University-Bangladesh (AIUB) 60


Simulation of Serial Communication by Coupling the Remote and Host 9.2.3



Figure 9.3 UART communication simulation diagram

Summary 9.3
The experiments and test done in this section ensures the ROV is a full functional ROV. Different type of
run time error may occur. In the test period final checking is done to find if there any trouble. If any
problem found which can cause malfunction of the device and can harm the device, immediate steps for
recovery are taken to ensure maximum safety for the ROV.




MCLR/VPP
1
RA0/AN0
2
RA1/AN1
3
RA2/AN2/VREF-
4
RA3/AN3/VREF+
5
RA4/T0CKI
6
RA5/AN4/SS/LVDIN
7
RE0/RD/AN5
8
RE1/WR/AN6
9
RE2/CS/AN7
10
OSC1/CLKI
13
RA6/OSC2/CLKO
14
RC0/T1OSO/T1CKI
15
RC2/CCP1
17
RC3/SCK/SCL
18
RD0/PSP0
19
RD1/PSP1
20
RD2/PSP2
21
RD3/PSP3
22
RD4/PSP4
27
RD5/PSP5
28
RD6/PSP6
29
RD7/PSP7
30
RC4/SDI/SDA
23
RC5/SDO
24
RC6/TX/CK
25
RC7/RX/DT
26
RB0/INT0
33
RB1/INT1
34
RB2/INT2
35
RB3/CCP2B
36
RB4
37
RB5/PGM
38
RB6/PGC
39
RB7/PGD
40
RC1/T1OSI/CCP2A
16
MC1
PIC18F452
MCLR/VPP
1
RA0/AN0
2
RA1/AN1
3
RA2/AN2/VREF-
4
RA3/AN3/VREF+
5
RA4/T0CKI
6
RA5/AN4/SS/LVDIN
7
RE0/RD/AN5
8
RE1/WR/AN6
9
RE2/CS/AN7
10
OSC1/CLKI
13
RA6/OSC2/CLKO
14
RC0/T1OSO/T1CKI
15
RC2/CCP1
17
RC3/SCK/SCL
18
RD0/PSP0
19
RD1/PSP1
20
RD2/PSP2
21
RD3/PSP3
22
RD4/PSP4
27
RD5/PSP5
28
RD6/PSP6
29
RD7/PSP7
30
RC4/SDI/SDA
23
RC5/SDO
24
RC6/TX/CK
25
RC7/RX/DT
26
RB0/INT0
33
RB1/INT1
34
RB2/INT2
35
RB3/CCP2B
36
RB4
37
RB5/PGM
38
RB6/PGC
39
RB7/PGD
40
RC1/T1OSI/CCP2A
16
MC
PIC18F452
VCC
R2
10k
R3
10k
Master
Slave
D
7
1
4
D
6
1
3
D
5
1
2
D
4
1
1
D
3
1
0
D
2
9
D
1
8
D
0
7
E
6
R
W
5
R
S
4
V
S
S
1
V
D
D
2
V
E
E
3
LCD1
LM016L

Faculty of Engineering, American International University-Bangladesh (AIUB) 61


Chapter 10
Circuit Implementation and Operation
Introduction 10.1
In this chapter the process of building the complete circuit and final attachment with the body is
described. At first we have implemented the circuit on bread board at first stage of testing. We checked
for error and troubles. After solving the error found at the primary stage, we finally implemented the
circuit in Vero board and made the connection carefully by soldering. Then we implemented it inside the
hull of ROV. We checked if there any possibility of leaking of water. Setting up the battery inside the
hull, mounting camera and LED light was done at this stage. Finally we tested it in dry, static wet and
dynamic wet environment.

Block Diagram and operational description of Complete Circuit 10.2














Figure 10.1 Block diagram of the complete circuit



REMOTE
MODUDEL
HOST
MODULE
Command
switches
LCD
Display
Monitor
Thrusters
Pump
Light
Movement
Thermal
Sensor
Sonar
Sensor

Faculty of Engineering, American International University-Bangladesh (AIUB) 62


Description of the Block Diagram 10.2.1
This block diagram shows the elementary working procedure, direction of command flow between the
MCUs (microcontroller unit) and relation of MCUs and other parts of circuit. As shown in the block
diagram the remote module consists of a MCU, a GLCD and a TFT LCD display. The MCU is connected
to MCU of host module. The host module consists of MCU, motor, pump, camera and LED lights. The
communication between the remote module and the host module is a bidirectional process. The MCU of
remote module send signal to the host module when switch is turned on. The MCU of host module
receives the signal and either make its different pin high or low to turn on/ off the motor, pump and LED.
On the other hand this also takes the reading of the sensors and sends to the MCU of remote module. The
MCU of remote module receives the data and shows it on the GLCD. The video feed of the camera is sent
from the host module and the TFT LCD display of the remote module shows the image of video.

Test Connection of the Circuits 10.3
There are some major types of circuits that are being controlled by the microcontroller in the host module.
Those are described briefly below with diagram.

Speed control with PWM 10.3.1

Figure 10.2 PWM controlled motor block diagram
From the diagram above we see the motor is connected to ground and source through a MOSFET.
MOSFET has 3 parts gate (G), drain (D) and source(S). The MOSFET allows current to flow from drain
to source if voltage is given to the gate (G). The MOSFET is normally off. When microcontroller give
pulse to the gate of the MOSFET it enables current to flow through the circuit and let the motor rotate.
The MOSFET has very fast switching property. If duty cycle of the PWM (provided from the
microcontroller) is small the MOSFET is ON for less time hence the motor gains less speed. Thus If the
duty cycle increase motor gains more speed due to inertia

Faculty of Engineering, American International University-Bangladesh (AIUB) 63


Use of Optocoupler 10.3.2

Figure 10.3 Optocoupler block diagram
The power MOSFET used in our project need at least 8V to work on full mode. But the output pin of a
microcontroller can provide 5V at most. Practically we get less than 5V output from the microcontroller
pin. To overcome the problem we use optocoupler. Optocoupler has to main part, a light emitting diode
and a photo activated BJT. The gate of the MOSFET is connected with to a 12 V source through the photo
activated BJT. Current flow to the gate of the MOSFET if the base of the BJT is activated by IFR light.
The output pin of the microcontroller is connected to IFR diode. Microcontroller output enables the IFR,
IFR enables the BJT as a sequence current from 12V source activate the MOSFET.

Bidirectional motor driver using relay 10.3.3

Figure 10.4 Bidirectional motor driver.


Faculty of Engineering, American International University-Bangladesh (AIUB) 64


To drive a motor in clockwise and counter clockwise direction we made the circuit of the given diagram
above using two relay which are connected with output pin of microcontroller through BJTs. when pin A
is high it turn on the BJT and adjacent path is activated by current flow from 6V voltage source hence
switch Sa is turned on to rotate in clockwise direction. Similar process activates the Sb when pin B is high
and rotates the motor counterclockwise.

Circuit Implementation on Bread Board 10.3.4



Figure 10.5 Circuit connection on bread board.
Before placing the component on the Vero board and soldering real time functionality of all the circuits
are needed to be tested. We implemented the components on bread board as a step of testing performance.
Depending on the result of test run we conducted troubleshoot and after final correction and necessary
modification we placed.





Faculty of Engineering, American International University-Bangladesh (AIUB) 65


Operation of Circuit 10.4
The circuit get ready to work after giving connection with power source. A 9V DC battery is the power
source of the remote module. It provide with power to the MCU of the remote controller, the switches,
crystal oscillator, the LCD that shows output of the sensors. To continue the serial communication with
the host module necessary power is also provided from the 9V battery to the remote module. The task of
the remote module is to send command data bit to the host module to switch on/off the motors and let
them rotate in clockwise and counterclockwise direction. It also receives output from the sensors attached
with the host module and show in the LCD display.

Two 12V-10Ah batteries are connected in parallel connection. It provides with the necessary power to the
host module to run the motors, LED lights, MCU, video camera, pump, sensors and all other components
of the circuit of the host module. The task of the host module is to receive the command form the remote
module. The MCU is programmed to get the bits and to make different pin high according to the
command received. The camera captures images or video

To execute a full command the device have to work in a few stages in combination. At first both of the
remote and host module are connected with power source. At this stage the MCUs, motors, sensors and
displays are ready to operate. After pressing every switch MCU gets different input. To turn on a motor,
ON switch is pressed on the remote module and the MCU generate a character inside it. Than it send the
character into bits and send it to the host module through TX port using UART communication protocol.
The MCU in host module receives the command bits through the RX port, which is connected to the TX
port of the remote module. After receiving the command bit. it analysis it. The MCU of the host module
is programmed to switch on/off different pin according to the command of the remote module. When it
make a pin high the motor driver circuit start to run the motor. The output pin that drives the motors are
connected through optocoupler, power MOSFET and relay. When output pin is high in enables the
optocoupler. The optocoupler provides the required 8V voltage to the power MOSFET. The MCU cannot
give more than 5V output theoretically, partially it gives less than 5V which are not enough to turn on the
power MOSFET. Using optocoupler this problem is solved. When the power MOSFET is ON it let the
current flow to the motor and the motor starts. Using two single pole single throw relay bi -directional
motor can be made.



Faculty of Engineering, American International University-Bangladesh (AIUB) 66


Implementation on Vero Board 10.5
Vero board is a circuit prototyping board between solder less breadboards and printed PCBs. It allows to
make a more permanent circuit and more reliable connections than with breadboard. It consists of strips of
metal on a side of a board and a grid of holes that allows to solder most types of non-surface mount ICs,
resistors, capacitors etc. on it. Some of the Vero board has copper layer on one side and some has on both
sides. Vero board holes are drilled on 0.1 inch (2.54mm) centers. This spacing allows components having
pins with 0.1 inch spacing to be inserted.

Planning a Vero Board Layout 10.5.1
Converting a circuit diagram to a Vero board layout is not straightforward because the arrangement of
components is quite different. Concentration is most important for the connections between components,
not their positions on the circuit diagram. The layout should be planned with a pencil and paper or suitable
computer software before attempting to solder any part of the circuit.
Steps to follow for planning a layout:

The IC holder should be place near the center of the planning sheet. It is helpful to number the
pins.
Breaks should be marked in each track under the IC holder with cross(X). It prevents connection
of wrong pin together.
The power supply tracks +Vs and 0V should be marked carefully
Then the wire links should be added. The links can be both vertical and horizontal because all the
holes of the Vero board are isolated.
Components should be added which will be mounted on the Vero board such as switch, resistor,
capacitor etc. through wires.
The plan should be checked very carefully. A good way to do this is to work round the IC pin-by-
pin. So all the connections and components connected to Pin 1 and then pin2 and so should check.
Finally, the plan should check again and a neat copy should be made which will be fully labeled
with all the component reference or values.




Faculty of Engineering, American International University-Bangladesh (AIUB) 67


Placing Components on Vero Board 10.5.2
Components are placed on the non-copper side of the board; the Vero board is turned over and the
components leads are soldered to the copper tracks. In our project we used two Vero boards. Both the
Vero boards holes are separated by both horizontally and vertically. On Vero board we placed the
microcontrollers, resistors, capacitors, switches, relays, MOSFETs connecting ports etc.




Figure 10.6 Placing component on Vero board (remote module)



Faculty of Engineering, American International University-Bangladesh (AIUB) 68




Figure 10.7 Placing component on Vero board (host module)

Figure 10.8 Finalized remote module

Faculty of Engineering, American International University-Bangladesh (AIUB) 69




Figure 10.9 Finalized host module


Figure 10.10 Full functional circuit (1)

Faculty of Engineering, American International University-Bangladesh (AIUB) 70



Figure 10.11 Full functional circuit (2)
Dry Test 10.6
The dry tests are executed on land in order to test some basic functionality in a controlled environment.
During dry tests motors cannot be driven for longer than a minute, because motors may be damager due to
overheating caused by high current flow through the armature.
To conduct dry test of the circuits we check for the following measurements:
every motor runs individually accurately
All motors runs perfectly
The remote communicate with the host perfectly.
Lights, sensors, camera and other circuitry operates sound in dry environment.
Check for troubles before final assembly.



Faculty of Engineering, American International University-Bangladesh (AIUB) 71




Figure 10.12 Final appearance of ROV (1)



Figure 10.13 Final appearance of ROV (2)





Faculty of Engineering, American International University-Bangladesh (AIUB) 72



Figure 10.14 Final appearance of ROV (3)
Wet Test 10.7
Wet test are procedure to test the functionality of the circuits inside the hull of the ROV after primary
assembly. To find out the troubles and malfunction within wet environment, when ROV is static, is the
goal of conducting wet test.

Static Wet Test 10.7.1
The static wet tests are implemented in a small pool to check basic functionality and behavior of the
device. The test-environment is displayed in Figure 6.8. These tests are preparation steps for the dynamic
wet tests. To check safety of circuit from leakage using leakage sensor is the most important step of static
wet test. ROV Needs to be thoroughly tested before using it in a larger pool, where if something goes
wrong the entire ROV can be destroyed.
To conduct static wet test we check for following measurements
Checking the controls, to observe that the ROV moves the way it should.
External aect the ROV by rotating it.
Depending on the result from the tests above, changes to the contributions from dierent if
necessary.
Stress testing to gure out possible faulty situations and observe how the system is reacting in
those situations.

Faculty of Engineering, American International University-Bangladesh (AIUB) 73



Figure 10.15 static wet test of ROV
Dynamic Wet Test 10.7.2
The experiment was conducted in a pool where the ROV can make most motion. Its the final step of
checking the functionality of the ROV. To find out how it behaves during full functional mode is the main
goal of the test.
Some situations that are tested are:
Driving motors with full speed for a longer period of time.
Sending as much commands from the remote as possible.
Check the sensors.
Driving a motor and pulling the Ethernet cable to simulate a loss of connection.
The data collected has to be examined to see if the behavior could cause a problem at the DWTs.

Figure 10.16 Dynamic wet test of ROV

Faculty of Engineering, American International University-Bangladesh (AIUB) 74


Test results 10.8
Test types Description Result
Dry test To check all circuit and component function Successful
Static wet test To check for leakage in ROV body Successful
Dynamic wet test To check balance and maneuverability of ROV Successful
Sample collection Collecting water sample at different depth Successful
Video output To check the video feed of camera Successful
sensors Testing the sensors functionality Partially successful

Summary 10.9
The experiments and test done in this section ensures the ROV is a full functional ROV. Different type of
run time error may occur. In the test period final checking is done to find if there any trouble. If any
problem found which can cause malfunction of the device and can harm the device, immediate steps for
recovery are taken to ensure maximum safety for the ROV.





Faculty of Engineering, American International University-Bangladesh (AIUB) 75


Chapter 11
Discussions and Conclusions
Discussions 11.1
The main objective of this chapter is to discuss the result of the project based on completion of the project.
What part was successful, why some things were not successful, the future scope for improvement of
function and what were the limitations will be included in this chapter.

The project is taken to build a remotely operated underwater robot that will be able to move in vertical
and horizontal direction, sense temperature, detect presence of obstacle send video feed to work as an
observation robot. Its not easy undertaking to construct a project with an errant success. So far we have
done most of the parts came out successful. We have built a complete circuitry with two parts (remote and
host) which are full functional in communicating and operating flawlessly. It is able to detect temperature
and obstacle. The operation of motor is successfully controlled by the circuits to move the ROV
underwater and to collect sample from certain level of water.

In this project a lot of time have been used up on hardware executions and nding errors. The shortage of
data and experience of working with the electronics has been a drawback that we have worked hard to
eliminate. The batteries used in the ROV is not for play. If the wrong circuits are short-circuited, the ROV
circuits could burnt. The quality of the design of the electronics should be investigated by future projects.
In spite of some limitation the prototype ROV is functional.

Due to the decision to use a structural shell, the necessity for an internal framework is less. It is capable
to tow a large amount of tether from the ROV. As the primary thrust has been upgraded and the
hydrodynamics optimized

Limitations 11.2
Due to limitation of time and resource we couldnt designed and built the body structure of the
ROV perfectly.
All the motors are functional as expected but when working underwater environment the ROV
but, due to imperfect balance of the hull the ROV cant move perfectly.

Faculty of Engineering, American International University-Bangladesh (AIUB) 76


The tether used is not very suitable for real life application of the ROV. Strong yet flexible tether
should be used for the ROV to operate underwater.
Power consumption is a major issue in this project. As the motors and light, camera need large
amount of power the ROV cant be operated for a long time.
Radio frequency dont work well in underwater environment specially when its necessary to
communicate from two different medium. We had to use tethered communication instead of using
radio signal.
It has a very high risk of damage due to water leakage.
Sometimes the sensors may give wrong result.
Most of the necessary equipment are not available in the local market. Thats why we bought
components from abroad. For this reason we couldnt use many necessary and suitable sensors and
components that could be used to make a versatile, more functional and efficient ROV.
Project requires very costly equipment that have been a major impediment for completion of the
project.
The project was designed as a miniature prototype for limited purpose due to limitation of
resource.

Suggestion for Future Work 11.3
As it is a basic experimental project there are possibility of various modifications and enhancement of
new sensors to make improvement in this project.

With full implementation of the software USART, calibration commands could be sent from the
PC to the sensor via the PIC to remove the need for access to the sensor/camera box. This would
greatly ease on location calibration of the ROV. In that case the ROV could be controlled from the
PC and the video feed could be seen in the PC monitor.
When its controlled by PC MATLAB simulation could be used to auto detection of objects by
image analysis. Hence with the help of other sensors it could be an automated device.
To simplify communications, only orientation data is read from the sensor. The sensor also
outputs error information and this could be transmitted via the PIC to the PC for the users
information.
Lots of other useful sensors could be used in this ROV to enhanced performance. Like gyroscope
would help it to maintain its balance while moving underwater.

Faculty of Engineering, American International University-Bangladesh (AIUB) 77


Robotic arm could be attached to perform underwater operation like repairing parts in submarine
cable, oilrig or hull of ship. X-ray could be used to detect fracture and imperfection on HULL of
ship or underwater oil/gas pipe or submarine cable.
High powered motor could be used to do underwater heavy excavation with the help of high
powered AC supply.
If viewing an object in the water is impractically slow sideways then perhaps extra cameras could
be placed on the beam of the ROV, or a retracting camera, which could be extended outside the
hull and rotated after transit to the required destination. These are just a few considerations for
further work.

Conclusions 11.4
This project was intended to design and implement a simple and low cost Remotely Operated Underwater
Vehicle (ROV). To implement this project, we used microcontroller as platform and local raw materials
for low cost. Our challenge was to design a ROV in such a way that its components will be able to collect
data from sensors and operate in underwater environment. We succeeded in building a small and low cost
ROV. The price is compared with similar observation ROVs and, bearing in mind this is a prototype, the
chance for reduced costs in bulk production is considerable. In spite of some limitation our designed ROV
may be helpful to work as an underwater observation robot. Our project has much more scope for future
research and development. After further modification and enrichment of available technology it can be
used for commercial purpose.




Faculty of Engineering, American International University-Bangladesh (AIUB) 78


REFERENCES
[1] Patrik Johansson and Jacob Bernhard, Advanced Control of a Remotely Operated Underwater Vehicle,
ISRN : LiTH-ISY-EX--12/4599SE
[2] (2013) EXPLORATORIUM website [Online] Available
http://www.exploratorium.org/snacks/descartes_diver.htm
[3] HG Greene, DS Stakes, DL Orange, JP Barry and BH Robison. (1993). "Application of a remotely
operated vehicle in geologic mapping of Monterey Bay, California, USA.". In: Heine and Crane (eds).
Diving for Science...1993. Proceedings of the American Academy of Underwater Sciences (13th
annual Scientific Diving Symposium). Retrieved 2008-07-11.
[4] C Harrold, K Light and S Lisin. (1993). "Distribution, Abundance, and Utilization of Drift
Macrophytes in a Nearshore Submarine Canyon System. In: Heine and Crane (eds). Diving for
Science...1993. Proceedings of the American Academy of Underwater Sciences (13th annual
Scientific Diving Symposium). Retrieved 2008-07-11.
[5] Reed JK, Koenig CC, Shepard AN, and Gilmore Jr RG (2007). "Long Term Monitoring of a Deep-
water Coral Reef: Effects of Bottom Trawling.".In: NW Pollock, JM Godfrey (Eds.) the Diving for
Science2007. Proceedings of the American Academy of Underwater Sciences (Twentysixth annual
Scientific Diving Symposium). Retrieved 2008-07-11.
[6] TM Shank, DJ Fornari, M Edwards, R Haymon, M Lilley, K Von Damm, and RA Lutz. (1994).
"Rapid Development of Biological Community Structure and Associated Geological Features at
Hydrothermal Vents at 9-10 North, East Pacific Rise". In: M DeLuca (ed). Diving for Science...1994.
Proceedings of the American Academy of Underwater Sciences (14th annual Scientific Diving
Symposium). Retrieved 2008-07-11.
[7] (2013) SeaPerch website. [Online]. Available https://seaperch.org
[8] (2010) MATE's ROV Competitions website [Online]. Available:
http://www.marinetech.org/rov_competition/
[9] MC78XX/LM78XX/MC78XXA Data sheet [Online] Available :
http://www.engineersgarage.com/electronic-components/7806-ic
[10] (2010) National Underwater Robotics Challenge website. [Online]. Available:
https://sites.google.com/site/nationalunderwaterrobotics/
[11] (2011) ALLTRANSISTORS website[Online] Available :
http://alltransistors.com/transistor.php?transistor=2340

Faculty of Engineering, American International University-Bangladesh (AIUB) 79


[12] (2013) ELECTRONICS-TUTORIALS website [Online] Available http://www.electronics-
tutorials.ws/transistor/tran_7.html
[13] (2010) ROV Program Team Manual Under Water Robotics website [Online] Available:
http://www.marinetech.org/files/marine/files/MIROV2MANUAL.pdf
[14] (2008) Remotely Operated Vehicle Operations and Procedures Manual [Online] Available:
http://www.uncw.edu/nurc/
[15] (2010) M.A.T.E ROV competition [Online] Available: http://substack.net/doc/rov-2010-tech-
report.pdf
[16] (2011) Implementation of Underwater ROV as Coastal Surveillance Modules [Online] Available:
http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2178084
[17] http://www.marinetech.org/nine_degrees/expedition.html?phase=log&date=942912000&base=expo94
2864462&picnum=0
[18] Douglas J, Gasiorek J, Swaffield J, Fluid Mechanics3rdEdition Longman Group Limited, Reprinted
1996
[19] Given, D. ROV Review(5thEdition) 1993-1994 ISBN 0-9623145-3-6
[20] Peter P, Chris L, Dainis N, Dalhousie University ROV Project Liquid Death [Online] May 21,
2005. [Cited: December 1, 2008.]
www.optics.rochester.edu/workgroups/agrawal/publications/papers/paper_2005_05.pdf.
[21] David Small Wood A new Remotely Operated Underwater Vehicle for Dynamics and Control
Research [Online] [Cited: September 19,1999 ]11
th
international symposium on Unmanned
Untethered Submersible Technology , Durhum NH , September 19 1999


Faculty of Engineering, American International University-Bangladesh (AIUB) 80



APPENDIX

Code to Run the Remote Module
char uart_rd;
char message1[] = "Temp.:-";
char message2[] = "Obstacle ";
char message3[] = "No Obstacle";
char *tempC = "000.0"; // Variables to store temperature values
unsigned long tempinC;
unsigned long temp_value;
void Display_Temperature() {
temp_value = ADC_Read(0);
temp_value = temp_value*244;
tempinC = temp_value/10; // convert Temp to characters
if (tempinC/10000)
tempC[0] = tempinC/10000 + 48;
else tempC[0] = ' ';
tempC[1] = (tempinC/1000)%10 + 48; // Extract tens digit
tempC[2] = (tempinC/100)%10 + 48; // convert temp_fraction to characters
tempC[4] = (tempinC/10)%10 + 48; // Extract tens digit
Lcd_Out(1, 8, tempC);
Delay_ms(500); // print temperature on LCD
}
void main() { // Disable analog comparators
ADCON0=0b10000101;
ADCON1=0b01000001;
CMCON = 7; // Turn off comparators
INTCON = 0;
TRISA = 0b111111; // RA4/T0CKI input, RA5 is I/P only
PORTA = 0b000000;

Faculty of Engineering, American International University-Bangladesh (AIUB) 81


TRISE = 0b111;
PORTE = 0b000;
TRISB = 0b00000011;
PORTB = 0b00000000;
TRISC = 0b10011111;
PORTC = 0b00000000;
TRISD = 0b11111111;
PORTD = 0b00000000;
UART1_Init(1200); // Initialize UART module at 9600 bps
Delay_ms(1000); // Wait for UART module to stabilize
//UART1_Write_Text("Start");
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Delay_ms(1000); // Wait for UART module to stabilize
Lcd_Out(1,1,message1); // Write message1 in 1st row
Lcd_Chr(1,15,223); // Print degree character
// different LCD displays have different char code for degree
// if you see greek alpha letter try typing 178 instead of 223
Lcd_Chr(1,16,'C');
while (1) { // Endless loop
Display_Temperature();
delay_ms(100);
if (UART1_Data_Ready()) { // If data is received,
uart_rd = UART1_Read(); // read the received data,
}
if(RB0_bit)
{
UART1_Write_Text("G");
}
if(RB1_bit)
{
UART1_Write_Text("D");

Faculty of Engineering, American International University-Bangladesh (AIUB) 82


}
if(RD7_bit)
{
UART1_Write_Text("F");
}
if(RD6_bit==1)
{
UART1_Write_Text("E");
}
if(RD5_bit==1)
{
UART1_Write_Text("J");
}
if(RD4_bit==1)
{
UART1_Write_Text("I");
}
if(RD3_bit==1)
{
UART1_Write_Text("B");
}
if(RD2_bit==1)
{
UART1_Write_Text("A");
}
if(RD1_bit==1)
{
UART1_Write_Text("N");
}
if(RD0_bit==1)
{
UART1_Write_Text("O");
}

Faculty of Engineering, American International University-Bangladesh (AIUB) 83


if(RC0_bit==1)
{
UART1_Write_Text("H");
}
if(RC1_bit==1)
{
UART1_Write_Text("M");
}
if(RC2_bit==1)
{
UART1_Write_Text("L");
}
if(RC3_bit==1)
{
UART1_Write_Text("K");
}
if(RC4_bit==1)
{
UART1_Write_Text("C");
}
if(uart_rd==65){
Lcd_Out(2,1,message2);
//delay_ms(500);
}
if(uart_rd==66){
Lcd_Out(2,1,message3);
//delay_ms(500);
}
// Delay_ms(100); // Wait for UART module to stabilize
}
}



Faculty of Engineering, American International University-Bangladesh (AIUB) 84


Code to Run Host Module

unsigned short current_duty;
char uart_rd;
m1on()
{
rb7_bit=1;
delay_ms(8000);
rb7_bit=0;
}
lighton()
{
rb6_bit=1;
//Delay_ms(100);
}
lightoff()
{
rb6_bit=0;
//Delay_ms(100);
}
m2up()
{
rb4_bit=0;
rb5_bit=0;
delay_ms(40);
rb4_bit=1;
rb5_bit=0;
}
m2off()
{
rb4_bit=0;
rb5_bit=0;

Faculty of Engineering, American International University-Bangladesh (AIUB) 85


//Delay_ms(100);
}
m2down()
{
rb4_bit=0;
rb5_bit=0;
delay_ms(40);
rb4_bit=0;
rb5_bit=1;
}
m3up()
{
rb3_bit=0;
rb2_bit=0;
delay_ms(40);
rb3_bit=1;
rb2_bit=0;
}
m3off()
{
rb3_bit=0;
rb2_bit=0;
//Delay_ms(100);
}
m3down()
{
rb3_bit=0;
rb2_bit=0;
delay_ms(40);
rb3_bit=0;
rb2_bit=1;
}
m4up()

Faculty of Engineering, American International University-Bangladesh (AIUB) 86


{
rb0_bit=0;
rb1_bit=0;
delay_ms(40);
rb0_bit=1;
rb1_bit=0;
}
m4off()
{
rb0_bit=0;
rb1_bit=0;
//Delay_ms(100);
}
m4down()
{
rb0_bit=0;
rb1_bit=0;
delay_ms(40);
rb0_bit=0;
rb1_bit=1;
}
moff()
{
PORTB = 0b00000000;
//Delay_ms(100);
}
void m5up()
{
current_duty = current_duty + 15;
PWM1_Set_Duty(current_duty);
Delay_ms(40);
}
void m5down()

Faculty of Engineering, American International University-Bangladesh (AIUB) 87


{
current_duty = current_duty - 15;
PWM1_Set_Duty(current_duty);

Delay_ms(40);
}
void main() {
ADCON1 = 7; // all ADC pins to digital I/O
CMCON = 7; // Turn off comparators
TRISA = 0b000001; // RA4/T0CKI input, RA5 is I/P only
PORTA = 0b000000;
TRISE = 0b000;
PORTE = 0b000;
TRISB = 0b00000000;
PORTB = 0b00000000;
TRISC = 0b10000000;
PORTC = 0b00000000;
TRISD = 0b00000000;
PORTD = 0b00000000;
UART1_Init(1200); // Initialize UART module at 9600 bps
Delay_ms(1000); // Wait for UART module to stabilize
PWM1_Init(1000); // Initialize PWM1 module at 5KHz
Delay_ms(1000);
current_duty = 0;
PWM1_Start();
PWM1_Set_Duty(current_duty);
while(1)
{
if (UART1_Data_Ready()) { // If data is received,
uart_rd = UART1_Read(); // read the received data,
}
if(uart_rd==66){
m1on();

Faculty of Engineering, American International University-Bangladesh (AIUB) 88


}
if(uart_rd==68){
lighton();
}
if(uart_rd==67){
lightoff();
}
if(uart_rd==71){
m2up();
}
if(uart_rd==70){
m2off();
}
if(uart_rd==69){
m2down();
}
if(uart_rd==74){
m3up();
}
if(uart_rd==73){
m3off();
}
if(uart_rd==72){
m3down();
}
if(uart_rd==77){
m4up();
}
if(uart_rd==76){
m4off();
}
if(uart_rd==75){
m4down();

Faculty of Engineering, American International University-Bangladesh (AIUB) 89


}
if(uart_rd==79 && current_duty <255){
m5up();
}
if(uart_rd==78 && current_duty > 0){
m5down();
}
if(uart_rd==65){
moff();
}
if(RA0_bit)
{
UART1_Write_Text("A");
delay_ms(40);
}
if(RA0_bit == 0)
{
UART1_Write_Text("B");
delay_ms(40);
uart_rd = 0;
} } }

Вам также может понравиться