SlideShare a Scribd company logo
1 of 103
Download to read offline
i
FINAL YEAR PROJECT REPORT
AUTO-HELM CONTROL OF
SAILING BOAT USING FUZZY
LOGIC
B.S Electronic Engineering, Batch 2006
Internal Advisor External Advisor
Mr. Chandan Lal Mr. Danish Karim Iqbal
Assistant Professor Design Engineer
Electronic Engineering Deptt. R&D
SSUET, KARACHI Saltec Powerlink
Submitted by:
Sajid Mahmood 2006-EE-075
Ahsan Qamar Hashmi 2006-EE-086
Daniyal Siddiqui 2006-EE-098
Abid Muhammad Jawaid 2006-EE-105
Zohaib Jamil 2006-EE-115
Syed Muneeb Raza Bukhari 2006-EE-609
DEPARTMENT OF ELECTRONIC ENGINEERING
Sir Syed University of Engineering and Technology
University Road, Karachi–75300
January, 2010
ii
SIR SYED UNIVERSITY OF ENGINEERING & TECHNOLOGY
University Road, Karachi -75300, Pakistan.
Tel: - 4988000-2, 4982393, 474583, Fax: (92-21) 4982393
http://www.ssuet.edu.pk
The Faculty of Electronic Engineering
Project Approval
Project Title AUTO-HELM CONTROL OF SAILING BOAT USING FUZZY LOGIC
Internal Advisor Mr. Chandan Lal (Assistant Professor )
External Advisor Engr. Mr. Danish Karim
Academic Year 2006
Group Members:
Sajid Mahmood 2006-EE-075
Ahsan Qamar Hashmi 2006-EE-086
Daniyal Siddiqui 2006-EE-098
Abid Muhammad Jawaid 2006-EE-105
Zohaib Jamil 2006-EE-115
Syed Muneeb Raza Bukhari 2006-EE-609
____
The Department of Electronics Engineering Sir Syed University of Engineering &
Technology has approved this Final Year Project. The Project is submitted in partial
fulfillment of the requirements for the degree of Bachelor of Science in Electronic
Engineering.
Approval Committee:
(Asst. Prof. Mr. Chandan Lal ) (Engr. Mr. Danish Karim Iqbal)
Internal Advisor External Advisor
(Muhammad Sharif ) (Dr. Bilal Ahmed Alvi)
FYP Committee Incharge Chairman EE Department
January/ 2010
iii
ACKNOWLWDGEMENT
We are thankful to Almighty Allah, most beneficial and most merciful, for giving us
the courage and devotion to work on the assigned project successfully within due
course of time in the field of Electronic Engineering.
To acknowledge the efforts and devotion of those people, who have helped us during
our project, is perhaps, the most important part of this report. Although we can’t pay
proper homage to their devotion and dedication to ourselves and to our project, but we
consider their right that their names and efforts should go in history with our project.
First we would like to sincerely mention all the efforts of Assistant professor Mr.
Chandan Lal has made on us for us to accomplish this major task which probably the
biggest project of our lives yet. He has helped us during the entire course of this
project. It would not be improper to say that the project could not see its final shape
without his help and assistance. We have found him humble and cooperative in every
aspect. He has not only helped us in our project but also acted as a source for
character building.
We also wish to express our gratitude to all the staff in the University and our
development and trial areas, Baharia Foundation, National Sailing Centre and PAF
Yacht Club for facilitating us in all possible manners. And last but not the least we
acknowledge the efforts of our external advisor Engr. Mr. Danish Karim Iqbal, our
batch mates Mr. Syed Kamran Ahmed and Mr. Muhammad Fahad Wallam who have
helped us throughout the project and have shared their knowledge and skills with us.
iv
SYNOPSIS
This project demonstrates an Automated Sailboat Control based on Fuzzy Controls.
While it also provides the Manual Controlling feature that may increase the
Scalability of the System. Implementations of various Controls are done using Fuzzy
controls. Other parameters should be controlled using ordinary control techniques.
Advanced sensing techniques must be practiced in order to automate the Sail boat.
Navigation and Path Determination of the boat should be done using Global
Positioning System (GPS). Use of Servo Motors to perform functions like Sail and
Rudder Trim should be done. Radio Frequency transmission using RF Transceivers
should be done in order to Monitor the Boat Parameters and also provide Path
feedback Experiments with a scale prototype show the ability of a fuzzy controller to
govern the rudder and trim the sails on a sailboat. Helm is the term used to describe
the Steering Mechanism of the boat.
A significant advantage of this project is the use of Wind Energy for the propulsion of
the boat. This might be the initial step for the awareness of sailing at the grass route
level in Pakistan and as well as in the other neighboring countries. Participation in
International Events held across the Globe could be made possible. Heuristics
involved in this Sport can easily be understood using the prototype. Participation of
Under-Developed Countries in this expensive Sport can be made possible.
v
TABLE OF CONTENTS
ACKNOWLWDGEMENT iii
SYNOPSIS iv
TABLE OF CONTENTS v
LIST OF FIGURES ix
Chapter 1 INTRODUCTION 1
1.1 GOALS AND OBJECTIVE 2
1.2 SYSTEM STATEMENT OF SCOPE 2
1.3 LIST OF COMPONENTS 3
Chapter 2 INTRODUCTION TO SAILING 5
2.1 INTRODUCTION 6
2.2 THEORITICAL BACKGROUND 6
2.3 SAILING BOAT 6
2.4 HOW TO SAIL A BOAT? 7
2.5 RULES FOR SAILING 10
2.6 CARE FOR SAILING EQUIPMENT 14
2.7 SAILING TERMS AND IT’S MEANING 16
Chapter 3 AUTOMATION OF SAILING BOAT 18
3.1 INTRODUCTION 19
3.2 HISTORY 19
3.3 OVERVIEW 19
3.4 OBJECTIVE 19
3.5 BACKGROUNDS OF PROJECT 19
3.6 ALGORITHM BEHIND AUTOMATION 20
3.7 DEFINITION OF NO-GO AREA 21
3.8 FUZZY LOGIC WITH RESPECT TO OUR PROJECT 21
3.8.1 FUZZY SETS 21
vi
3.8.2 FUZZIFICATION 21
3.8.3 RULE EVALUATION 22
3.8.4 DEFUZZIFICATION 22
3.9 KEY FEATURES 22
Chapter 4 SYSTEM DESCRIPTION 23
4.1 INTRODUCTION 24
4.2 SYSTEM ARCHITECTURE 24
4.3 SYSTEM ARCHITECTURE FOR END USER 25
4.4 SYSTEM ARCHITECTURE OFF SHORE 29
4.5 SUBSYSTEM OVERVIEW 30
4.5.1 OFF SHORE STATION 30
4.5.1.1) MAIN CIRCUIT DIAGRAM 30
4.5.1.2) GPS INTERFACING 31
4.5.1.3) DC MOTOR INTERFACING 32
4.5.1.4) ANEMOMETER INTERFACING 32
Chapter 5 FUZZY CONTROLLING LOGIC 34
5.1 INTRODUCTION 35
5.2 FUZZY CONTROLLING LOGIC 35
5.3 DEGREES OF TRUTH 35
5.4) OVERALL STRUCTURE 35
5.5) FUZZIFICATION 36
5.6) RULE EVALUATION 37
5.7) DEFUZZIFICATION 38
Chapter 6 DESCRIPTION OF ELECTRONIC COMPONENTS 39
6.1 INTRODUCTION 40
6.2 ATMEGA-16 8-bit MICROCONTROLLER 40
6.2.1) OVERVIEW 40
6.2.2) FEATURES 40
6.2.3) PIN CONFIGURATION 42
6.2.4) BLOCK DIAGRAM 43
vii
6.2.5) PIN DESCRIPTION 43
6.3) DC GEAR MOTOR 45
6.4) SERVO MOTOR 45
6.5) MAX-232 DUAL RECIEVER 47
6.5.1) INTRODUCTON 47
6.5.2) PIN CONFIGURATION 48
6.5.3) FUNCTION TABLES 48
6.5.4) LOGIC DIAGRAMS (POSITIVE LOGIC) 49
6.5.5) APPLICATION INFORMATION 49
Chapter 7 NAVIGATIONAL MODULE 50
7.1 INTRODUCTION 51
7.2 HOLUX M-89 GPS MODULE 51
7.2.1) HISTORY 51
7.2.2) KEY FEATURES 51
7.2.3) APPLICATIONS 52
7.2.4) BLOCK DIAGRAM 52
7.2.5) PIN DEFINATION 53
7.3 NMEA Data Protocol 54
7.3.1) THE PROTOCOL 54
7.3.2) HARDWARE CONNECTION 55
7.3.3) NMEA SENTENCES 56
7.3.4) NMEA INPUT 59
7.3.5) DECODE OF SELECTED POSITION SENTENCES 60
7.3.6) DECODE OF SOME NAVIGATION SENTENCES 63
7.3.7) OTHER SENTENCES THAT MAY BE USEFUL 66
Chapter 8 TRANSMISSION MODULE 68
8.1 INTRODUCTION 69
8.2 WIRELESS RF TRANCIEVER 69
8.2.1 HISTORY 69
8.2.2 PIN DEFINATION 69
viii
8.2.3 INTERFACING DIAGRAM 70
8.2.4 DATA RECPETION 71
8.2.5 DATA TRANSMISSION 71
8.2.6 FREQUENCY SETTING 71
Chapter 9 SOFTWARE TOOLS 73
9.1 HOW TO COMPILE SOURCE CODE 74
9.2 BURNING .HEX FILE INTO THE MICROCONTROLLER
USING PONYPROG 82
APPENDICES
Appendix A: TIME AND COST ANALYSIS
Appendix B: DATASHEETS
Appendix C: REFERENCES
ix
LIST OF FIGURES
Figure 2-1 Sailing Boat 6
Figure 2-2 Sailing Restriction Map 7
Figure 2-3 Stern 10
Figure 2-4 Tacks 11
Figure 2-5 Rule No.1 11
Figure 2-6 Rule No.2 12
Figure 2-7 Rule No.3 13
Figure 2-8 Rule No.4 13
Figure 2-9 Rule No.5 14
Figure 3-1 Automation Algorithm 20
Figure 4-1 System Architecture 24
Figure 4-2 System Architecture for End User 25
Figure 4-3 Graphical user Interface 27
Figure 4-4 Microsoft Access Data Base 28
Figure 4-5 System Architecture Off Shore 29
Figure 4-6 Main Circuit Diagram 30
Figure 4-7 GPS Interfacing 31
Figure 4-8 DC Motor Interfacing 32
Figure 4-9 BMS 33
Figure 5-1 Software Fuzzy Interface Unit 36
Figure 5-2 Two Input Member Function 37
Figure 6-1 Microcontroller 40
Figure 6-2 Pin Configuration 42
Figure 6-3 Block Diagram 43
Figure 6-4 DC Gear Motor 45
Figure 6-5 Servo Motor 46
Figure 6-6 Servo motor 46
x
Figure 6-7 Function of Servo motor 47
Figure 6-8 MAX-232 48
Figure 6-9 Logic Diagrams 49
Figure 6-10 Application Information 49
Figure 7-1 HOLUX M-89 GPS Module 51
Figure 7-2 Block Diagram 52
Figure 7-3 Pin Definition 53
Figure 8-1 Wireless RF Transceiver 69
Figure 8-2 Interfacing Diagrams 70
Figure 9-1 AVR Studio 4 (Step 1) 74
Figure 9-2 AVR Studio 4 (Step 2) 75
Figure 9-3 AVR Studio 4 (Step 3) 76
Figure 9-4 AVR Studio 4 (Step 4) 77
Figure 9-5 AVR Studio 4 (Step 4) 78
Figure 9-6 AVR Studio 4 (Step 4) 79
Figure 9-7 AVR Studio 4 (Step 5) 80
Figure 9-8 AVR Studio 4 (Step 5) 81
Figure 9-9 Parallel Port Interfacing 82
Figure 9-10 PonyProg (Step 1) 83
Figure 9-11 PonyProg (Step 2) 84
Figure 9-12 PonyProg (Step 3) 85
Figure 9-13 PonyProg (Step 4) 86
Figure 9-14 PonyProg (Step 5) 87
Chapter 1
INTRODUCTION
2
1.1) GOALS AND OBJECTIVE:
Significant goals and objective of this project is the use of Wind Energy for the
propulsion of the boat. This might be the initial step for the awareness of sailing at the
grass route level in Pakistan and as well as in the other neighboring countries.
Participation in International Events held across the Globe could be made possible.
Heuristics involved in this Sport can easily be understood using the prototype.
Participation of Under-Developed Countries in this expensive Sport can be made
possible.
1.2) SYSTEM STATEMENT OF SCOPE:
Control the dissolution apparatus using microcontroller. The apparatus technician
controls the apparatus using microcontroller. Manual Input from the user is
transmitted through RF transmitter, where it is received at RF receiver, identified and
relayed to the controller then controlling done. While automation inputs are from
rudder and sail trim then controlling is done as describe above
The input to the system is from the user and input automation parameter of
boat (i.e. Rudder, GPS and Anemometer).
The output of the system is the processed signal to the controller.
This module can be motors for sail and rudder.
Major Inputs and Outputs:
Rudder
In basic form, a rudder is a flat plane or sheet of material attached
with hinges to the craft's stern, tail or after end. Often rudders are shaped so as
to minimize hydrodynamic or aerodynamic drag. Here rudder is a both input
and output part.
GPS
Global Positioning System is used to navigate the boat along the
ocean; GPS provide accurate longitude and latitude information using NMEA
Protocol Format.
3
Anemometer
It is a custom made anemometer based on Potentiometer that provide
voltages from 0-5v that can be decoded using Analog to digital Converter and
can be used to detect the direction of the air as the air strikes it and make it
rotate.
Sail Trim
Sail trim is term used to describe the control of sail; while in case of
sail we are using a geared dc motor that can produce high torque when there is
enormous applied of air pressure on the sail.
BMS
Battery Management System also provides Indication for low battery
and would also help us for the efficient use of Battery Power.
1.3) List of Components
SAILING BOAT ASSEMBLY
• HULL (FIBER GLASS)
• RUDDER
• CENTER BOARD
• MAST
• SAIL
• MECHANICAL COIL
Electronic Components
• AVR MICROCONTROLLER (ATMEGA-16)
• TTL-RS 232 Level Converter (MAX 232)
• ROTARY ENCODER (Slotted Disc and Opto-coupler, U-type)
• GPS (M-89)
4
• RF TRANSCIEVER (CY2196R)
• DC GEAR MOTOR
• RC SERVO MOTOR (FUTABA S3003)
• RELAYS (12V DC)
• ANEMOMETER(Free-End Potentiometer)
• OPTOISOLATER (2N35)
5
Chapter 2
INTRODUCTION TO
SAILING
6
2.1) INTRODUCTION:
In this chapter we discuss about sailing boat. What is Sailing Boat, How to sail a boat,
What are the rules that are to be followed during sailing of a boat, care methods
during sailing boat, different terms of sailing and terms of sailing boat.
2.2) THEORITICAL BACKGROUND:
Sailing has been for long times the only means of ship propulsion at sea. Although
the performance of a sailing vessel is well below the present power driven ships,
either in terms of navigation speed and predictability, wind energy is absolutely
reusable, clean and free. Sailing boats may exhibit a virtually unlimited autonomy
and be able to perform unassisted missions at sea for long periods of time. Promising
applications include oceanographic and weather data collecting, surveillance and even
military applications.
2.3) SAILING BOAT:
Figure 2.1
7
A sailboat or sailing boat is a boat propelled partly or entirely by sails. The term
covers a variety of boats, larger than small vessels such as sailboards and smaller
than sailing ships, but distinctions in size are not strictly defined and what constitutes
a sailing ship, sailboat, or a smaller vessel (such as a sailboard) varies by region and
culture.
2.4) How to Sail a Boat
Figure 2-2
The wind has four different effects on a sailboat, which must be understood by the
amateur sailor before he can begin to see why his boat performs differently under
different conditions of wind and sailing course.
8
The wind drives the boat ahead-most important of all; it also drives it laterally or, to
speak in a nautical term, causes it to "make leeway"; it heels the boat over, and lastly,
turns it around, according to the balance of her sails, distribution of weight, and what
is known as the "center of lateral resistance." The proper handling of sails and rudder
is what enables the sailor to so utilize these effects of the wind that he may sail his
boat in any direction.
The propelling effect is the one most utilized, and it is for this reason that every boat
is constructed to offer the least resistance to its forward movement with as little
friction as possible.
Leeway is one effect to be avoided, and for this purpose boats are given either deep,
stationary keels or centerboards, or some other device for providing an extensive
lateral surface below the water.
Heeling and the stability of a boat go hand in hand. The boat must be prevented from
capsizing, and this is done either by putting lead or iron on the keel, or carrying
ballast in the hull in order to lower the center of gravity, or by building a broad and
shallow boat such as the cat boat, which is very stiff in a breeze and does not heel
readily, but when a certain point has been reached, is apt to capsize quickly in the
hands of an unskillful sailor.
The fourth effect is that of turning the boat around. This is done when the center of
effort on the sails does not come on a line with the center of lateral resistance. This is
always the case in a poorly balanced boat. A well-balanced boat requires very little
movement of the rudder to hold to a course.
Any novice can understand how a sailing boat can travel with the wind, but why it
should go forward when the sails are close hauled is a question of dynamics which we
will not try to explain in this short article. An easily understood explanation of why
boats go ahead instead of sideways can be made by taking a V-shaped block of wood
and pressing it between the thumb and forefinger. If sufficient force is used it shoots
forward quickly. The thumb may be likened to the wind and the forefinger to the
water on the opposite side of the boat. The pressure caused by the wind pushing the
boat against the water on the opposite side causes the boat to go forward.
The center of effort and center of lateral resistance must be understood in the handling
of a sailboat. The center of effort is the center of the total sail area. If, for example,
this comes forward of the center of lateral resistance when the boat is sailing with the
wind abeam, then the side pressure on the sails will turn the boat's bow in the
direction toward which the wind is blowing, or away from the wind, and a boat doing
this is said to carry a "lee helm."
On the other hand, if the center of lateral resistance is farther forward than the center
of effort, the wind will swing the boat in the direction in which it is blowing, thus
throwing the bow up into the wind. A boat doing this is said to carry a weather helm.
Every sailing boat should be so rigged as to carry a little weather helm, as, if struck by
a squall under those conditions, it will luff quickly up into the wind and so be in
safety, while if the lee helm is carried, the boat will fall off before the wind,
presenting a broadside to wind and wave which is very apt to cause it to capsize.
9
Too much weather helm is also to be avoided, as it makes it necessary to keep the
rudder over at a sharp angle and retards the progress of the boat.
To reduce weather helm, move the ballast aft or shorten the after canvas, or increase
the forward canvas by setting a larger jib. If a boat carries a lee helm, shift the ballast
forward or reduce the area of the head canvas.
In considering the action of the rudder, the amateur sailor should bear in mind that as
the boat is turned by the rudder, it swings as on a pivot. The water, pressing against
one side of the rudder, pushes the stern of the boat away from that side.
The pivot or turning point is always well forward of the center. This is a fact that
should be remembered when steering close to a boat or other object. Don't delay
turning out of the way too long, or the very act of turning your boat will throw the
stern over sufficiently to cause the collision you are trying to avoid.
Running before the wind may look like the ideal course to the amateur sailor, but a
little experience cures him of that belief. Steering is difficult when running with the
wind aft, especially in rough water, and there is danger of the sail gybing over when
least expected. Except on smooth water it is better to haul the boat up so as to have
the wind on the quarter, and after following that course for some distance, to "take the
other track", gybe over so as to bring the wind on the other quarter. The proper
location or direction of the boom, or, in a nautical term, how the sail should be
trimmed is of supreme importance. The wind on the quarter, the wind abaft the beam,
the wind abeam or directly at right angles with the boat, and the wind forward of the
beam. are what are known as favorable winds, the sheet being hauled in such
proportion as to give the best results. These positions all refer to a boat when it is
what is termed "sailing free."
To sail "close hauled" means to bring the boat up as close into the wind as possible
and still keep it on its course, with the wind filling the sail so as to drive it forward. A
properly built boat will lie within four or four and a half points of the wind, while
some, especially those built on racing models, will do even better than this. Figure 6
shows about the proper location of the boom when sailing close hauled. The wind
striking the sail at this angle will drive the boat forward and maintain a reasonable
degree of speed, while to haul it closer would increase the leeway until, if the sail
were hauled parallel with the keel, the only progress made would be to leeward. Most
boats will sail closer to the wind in smooth water than in a rough sea.
When sailing close hauled, it is necessary to hold the boat on a course that will just
nicely keep the sail filled with wind. This point can be ascertained by putting the helm
slowly to the leeward. As soon as the sail begins to shake near the head, you have
reached a point where it is not drawing as much as it should, and, if the helm is kept
down, the sail will begin to flap in the wind and the boat will lose headway. A little
practice will enable an amateur skipper to see the beginning of this "tremble" in the
sail, and at the first symptoms he must reverse the helm until the wind fills the sails
fairl
10
2.5) RULES FOR SAILING
There are five basic rules of the road for small sailing boats to decide who has the
"Right-of-Way" so that each boat's skipper (driver) will know what to do to avoid a
collision. When sailing the words "left" and "right" in reference are replaced with
"port" and "starboard". It is important to remember which is which since the rules of
the road for sailings rely on using these words to assign right-of-way.
You might be able to remember this by noticing that the letter "R" appears twice in
the word "starboard", and only once in "port". Then since "right" begins with "R", you
will know that the right hand side of the boat when facing forward is the starboard
side.
Figure 2.3
The next item to remember is the word "tack" and how it is used to describe which
side of the boat the wind is blowing from. As seen in the illustration below, if the
wind is coming from the right hand side of the boat, and the sail is on the left side, the
boat is on a starboard tack. When the wind and sail are reversed, the boat is on a port
tack.
11
Figure 2.4
Rule Number 1:
When two sailboats are approaching each other and are on different tacks, the boat on
the starboard tack has the right-of-way over the boat which is in the port tack. In the
illustration below, boat “A” on the port tack, must turn to avoid boat “B” on the
starboard tack.
Figure 2.5
Rule Number 2:
When two sailboats are approaching each other and are on the same tack, the leeward
boat has the right-of-way over the windward boat. Another way to say this is to say
that the boat closer to the wind source must keep clear. The boat further from the
12
wind source has the right-of-way. In the illustration below, boat “B” is the windward
boat and must turn to avoid boat “A” which is leeward.
Figure 2.6
Rule Number 3:
A sailboat that is staying on a tack has the right-of-way over a sailboat that is tacking
or jibing. A simpler way to say this is to say "make sure you have room to complete a
tack or a jibe without interfering with any other boats before doing so". Make sure
that you can see clearly in all directions to ensure you have room.
In the illustration below, boat "A" must ensure that it leaves plenty of room to avoid
boat "B", who has the right-of-way, since boat "B" is continuing on its tack. However,
in the event that boat "A" was unable to tack due to the proximity of "B", remember
that "A" is the leeward boat so therefore could tell boat "B" to give room to tack, but
would lose this right of way as soon as they actually began to tack.
13
Figure 2.7
Rule Number 4:
Any sailboat that is overtaking a slower boat from behind must steer clear of the
slower boat and give right-of-way. The slower boat should hold its course and allow
the faster boat to pass. In the illustration below, boat "A" is a faster boat, and must
steer around the slower boat "B", who should remain on the same course.
Figure 2.8
14
Rule Number 5:
Most of the time sailboats have the right-of-way over power boats. Since most
powerboats are more easily maneuverable than sailboats, they must steer clear. This is
not always the case however. Larger power boats are sometimes steering in the deep
channel of the area, and cannot leave the channel. In this case the sailboat does not
have right-of-way, and must avoid impeding the progress of the larger vessel. Many
larger power boats cannot simply stop quickly or easily turn to avoid a small sailboat,
so it is in the sailor's best interest to steer well clear of these larger boats. In the
illustration below, the powerboat "A" must turn to avoid the sailboat "B", who has the
right-of-way.
Figure 2.9
2.6) Care For Sailing equipment:
• Drain and dry the boat:
The first thing you should do when your boat is back on shore is to open the portholes
and drain bungs. Always leave the boat with the drain bungs open and the portholes
open, so the flotation tanks can dry out completely. Prop the boat up if needed to
ensure the drain holes are the lowest point. You can place a piece of carpet on the
ground under the transom, and raise the bow of the boat onto a sawhorse or support.
Remember to close all drain holes before putting the boat back in the water.
• Organize your gear:
Keep the hatches, drain bungs and other loose gear in one place, so you know they
will always be there. After sailing, and after rinsing out or washing, and drying your
sailing gear, put it back in a gear bag. It is frustrating to show up at the lake on a
gorgeous day, only to discover that you left your sailing boots or some other piece of
important gear, at home.
15
• Sail care:
You can leave the mainsail on the boom, if you will be sailing the boat again soon.
Roll up the main from the head, perpendicular to the luff, so that it ends up in a roll
parallel to the boom. Also roll the jib up, put it inside the jib bag, and leave that in the
boat. All sails should be removed from the boat if it is to be trailed or stored out of the
water for any length of time. All sails should be dried and folded or rolled and placed
in sail bags ready for the next launch.
• Centerboard care:
Leaving the board resting on the trolley or trailer may damage the leading edge, and
you want your slot gaskets left flat (in the normal closed position), so they do not take
on a permanent bend. If the centerboard up control does not have a shock cord take
up, you can put the line into a cleat, so the board is held all the way up, in the
centerboard trunk. Remove the dagger board completely from it's slot.
• Rudder care:
Lay the rudder in the boat, or buy or make a rudder bag and put the rudder blade in
the bag as one of the first steps in derigging the boat. Also check your rudder fittings.
There should be no play in them.
• Rig:
If leaving the boat with the mast rigged leave the boat with a little rig tension to
support the mast, but not so much as to load up the boat.
• Cover:
The boat should be covered with a good top cover that shields the boat from UV
radiation. If the cover has holes in it, fix it or replace it. Figure out how to support the
cover so that water does not collect in it.
• Salt:
Rinse salt water off the boat, rinsing out blocks, lines and once in awhile, inside the
tanks. If the tanks ever leak, you get salt in the tanks, and you will want to rinse that
out from time to time.
• Turnbuckle grease:
If you have adjustable angle spreaders, lubricate the adjusters. Use turnbuckle grease.
If you don't lubricate these the stainless steel threaded part will permanently bond to
the aluminum, and you will not be able to adjust them ever again.
• Inspections:
From time to time complete a visual inspection of your boat. There are lots of highly
loaded areas on a small sailboat. The chain plates are among them. Check where your
shrouds and forestay or jib halyard attach to the hull. Watch for cracks that could let
water into wooden reinforcements. Heavily loaded fasteners should be epoxied into
the boat. From time to time take your centerboard out of the boat and check both
centerboard and rudder for dings, cracks etc. Pay particular attention to the
centerboard bolt hole. If the bolt hole has been damaged such that water can get in,
16
wooden cored boards will soak up water, start to rot and will be weakened. Seal all
bare wood with epoxy. Anytime you run aground you should check the centerboard.
Inspect all lines from time to time, replace worn lines.
2.7) SAILING TERMS AND IT’S MEANING:
Abeam
90° (perpendicular) to the side of the boat.
Aft
Towards the Stern or rear of the boat.
Ahead
Towards the front of the boat.
Aloft
Towards the top of the mast.
Astern
Actually behind the boat. (Aft can mean on the boat but at the rear)
Bailer
A bucket or scoop used to remove water from the cockpit.
Block
Nautical word for pulley.
Centerline
An imaginary line from the bow of the boat, to the center of the stern.
Draft
The depth of water required to float your boat. On a small sailboat, draft can
vary from the length of the centre board (or daggerboard) to a few inches if the boat
outfitted with a movable centre board (or removable daggerboard) and a kick-up
rudder.
Ease
To let out the sails.
Give-Way Vessel
The boat which changes course because it does not have the right of way.
Heel
The degree of sideways tilt caused by wind on the sails or balance of weight in
the boat.
17
Leeward
Away from the wind (downwind).
Luffing
The flapping of the sail when not properly trimmed or when the boat is in
irons.
Stand-On-Vessel
The boat which does not change course because it has the right of way.
Trim
To pull the sails in towards the wind.
Windward
Towards the wind (upwind).
18
Chapter 3
AUTOMATION OF SAILING
BOAT
19
3.1) INTRODUCTION:
In this chapter we will discuss about the basic concept of our Project then we will
discuss about automation of Sailing Boat and project‟s key features.
3.2) HISTORY:
Sailing has been for long times the only means of ship propulsion at sea. Although
the performance of a sailing vessel is well below the present power driven ships,
either in terms of navigation speed and predictability, wind energy is absolutely
reusable, clean and free. Sailing boats may exhibit a virtually unlimited autonomy
and be able to perform unassisted missions at sea for long periods of time. Promising
applications include oceanographic and weather data collecting, surveillance and even
military applications.
3.3) OVERVIEW:
Automation of sailboat is a very nonlinear and time-variant problem, and modeling
ship dynamics considering all real phenomena is a very complex task. Besides, it has
to compensate for stochastic disturbances acting upon it, such as wind, waves and
currents. Heuristics in sailing plays an important role: sailing rules obtained from
skippers can be included in a knowledge base to govern the boat correctly in different
conditions. Besides that Sailing is an Olympic class Sport played around the world.
Automation of such a kind would develop interest in the people of our Country to
actively participate in this Sport.
3.4) OBJECTIVE:
A significant advantage and objective of this project is the use of Wind Energy for the
propulsion of the boat. This might be the initial step for the awareness of sailing at the
grass route level in Pakistan and as well as in the other neighboring countries.
Participation in International Events held across the Globe could be made possible.
Heuristics involved in this Sport can easily be understood using the prototype.
Participation of Under-Developed Countries in this expensive Sport can be made
possible.
3.5) BACKGROUNDS OF PROJECT:
Sailing is the art of controlling a boat with large pieces of canvas cloth called sails. By
changing the rigging, rudder, and dagger or centre board, a sailor manages the force
of the wind on the sails in order to change the direction and speed of a boat. Mastery
of the skill requires experience in varying wind and sea conditions, as well as
knowledge concerning sailboats. The subjection of Automation of Sailing boats will
provide an innovative solution to this Sport. The popularity of Sailing will certainly
be increased with the help of these types of Projects. Involvement of Control
Electronics will certainly produce amazing results and highly sophisticated Control
Systems.
20
3.6) ALGORITHM BEHIND AUTOMATION
Since Global Positioning System is used for navigation. It provides information like
Longitude, Latitude, heading and speed etc. These values are the main inputs to the
navigational system of our project.
The basic algorithm behind the automation is the use of these longitude and latitudes
to produce a straight between destination and current location. Then from this
equation of line we can determine the coordinates of the actual path and then compare
it to the values from GPS. By differentiating both the vales we can determine the
bearing in which the boat has to move in order to follow the given path.
Figure 3-1
21
3.7) Definition of No-Go Area
In automation of a sailing boat the first thing that is supposed to make the boat
understand is the wind direction. A sailing boat cannot work into the wind. There are
certain limitations for a sailing boat to properly steer along the water. These
limitations can be manipulated using values from the Anemometer (in our case).
No-Go Area Zone (Refer to figure 2.2)
3.8) FUZZY LOGIC WITH RESPECT TO OUR PROJECT
Fuzzy logic is a form of multi-valued logic to deal with reasoning that is approximate
rather than precise. Similarly our system works in the same procedure that it does not
have precise conditions to operate the system. Therefore we require approximate
functions to deal with our system. These functions requires fuzzification and
Defuzzification as we have gone through system and have produced following
functions on the basis of rules, determined from the system behavior. Thus creating a
knowledge base.
3.8.1) FUZZY SETS
Our system has three crucial inputs and two crucial outputs.
Input Membership Function
Anemometer= MFA
MFA = {MFA1, MFA2, MFA3, ……….., MFA26}
Rudder = MFIR
MFIR = {MFIR1, MFIR2, MFIR3, MFIR4, MFIR5}
Sail = MFIS
MFIS = {MFIS1, MFIS2, MFIS3, MFIS4, MFIS5}
Output Membership Functions
Rudder = MFOR
MFOR = {MFOR1, MFOR2, MFOR3, MFOR4, MFOR5}
Sail = MFOS
MFOS = {MFOS1, MFOS2, MFOS3, MFOS4, MFOS5}
3.8.2) FUZZIFICATION
The fuzzification comprises the process of transforming crisp values into grades of
membership for linguistic terms of fuzzy sets. The membership function is used to
associate a grade to each linguistic term.
22
3.8.3) RULE EVALUATION
The rule evaluation process uses a list of linguistic rules from the knowledge base to
perform inference in the fuzzy domain. The inputs to this process are the fuzzy inputs
from the fuzzification process.
3.8.4) DEFUZZIFICATION
Defuzzification is the process of producing a quantifiable result in fuzzy logic.
Typically, a fuzzy system will have a number of rules that transform a number of
variables into a "fuzzy" result, that is, the result is described in terms of membership
in fuzzy sets.
3.9) KEY FEATURES:
This project provides robust features from the Automation till its Monitoring. State of
the Art Control Techniques, Complex manipulation of Time variant Analog Values
and Optimized Sensing are included in the basic features of this boat.
Implementation of Fuzzy Logic on the control system
Auto Piloting and Manual Navigation
Real Time Tracking and Monitoring
Path Logging which will provide a record of past surveyed Longitudes and
Latitudes
Battery Management System
Efficient use of Wind Energy
Replacement of Human Sailor
23
Chapter 4
SYSTEM DESCRIPTION
24
4.1) INTRODUCTION:
This section will provide an overview of the system model, its constituent‟s parts and
major data objects and their relationship that flows in the system. Data object is any
data that is being transformed by our system.
4.2) SYSTEM ARCHITECTURE:
Figure 4-1
25
4.3) SYSTEM ARCHITECTURE FOR END USER:
Figure 4-2
26
End User is subjected to the following components that are provided either to monitor
or to control the sailing boat.
These components include:
Base Station circuitry
RF-Module
MAX-232
Power Supply
Personal Computer
Visual Basic
o Monitoring
 Rudder Position
 Sail Position
 Wind Direction
 Battery Level
 Longitude
 Latitude
 Speed
 Heading
o Controlling
 Rudder
 Sail
27
GRAPHICAL USER INTERFACE
The following is the Human Machine Interface which is being used in our system
which provides visual display from all the sensors and feedback values and it all
enables us to manually control the Boat. The Data Base is also connected with this
GUI/HMI.
Figure 4-3
28
MICROSOFT ACCESS DATA BASE
A constant stream of data from microcontroller in the form of command byte is sent
to the base station in the following format:
$ Rudde
r
Anemomete
r
Sail
Positio
n
Tim
e
Latitud
e
Longitud
e
Headin
g
Speed *
The above defined format is received and saved in the data base in the Microsoft
Access Data Base in their respective fields.
Figure 4-4
29
4.4) SYSTEM ARCHITECTURE OFF SHORE:
Figure 4-5
For further details review the base station and off shore station section
30
4.5) SUBSYSTEM OVERVIEW:
4.5.1) OFF SHORE STATION
4.5.1.1) MAIN CIRCUIT DIAGRAM
Figure 4-6
31
4.5.1.2) GPS INTERFACING:
Figure 4-7
32
4.5.1.3) DC MOTOR INTERFACING:
Figure 4-8
4.5.1.4) ANEMOMETER INTERFACING:
A free end potentiometer is used with a wooden assembly. The output of the
potentiometer is connected to the ADC of the microcontroller. It gives a particular
value at different angles which is used to calculate the wind direction.
33
RUDDER FEEDBACK:
The position of rudder is decoded from the potentiometer installed in a servo package
i.e. built in. The analog voltage across this potentiometer is then feedback to the 8-bit
ADC of the microcontroller.
SAIL TRIM FEEDBACK:
Feedback of sail is coming from the opto-coupler which is connected with the DC
motor. It is counting the count that how much the sail is loosed or tight. The
programming is interrupt based.
BMS FEEDBACK:
An Operational Amplifier is used to measure the voltage level of the system battery.
The configuration used in Op-Amp is Differential Amplifier with a gain of Unity.
Figure 4-9
34
Chapter 5
FUZZY CONTROLLING
LOGIC
35
5.1) INTRODUCTION:
In this chapter we will discuss about fuzzy controlling logic. It contains what is
fuzzy what are it‟s degree of operation, structure, fuzzification rule to
evaluation fuzzification and defuzzification with rules to evaluate.
5.2) FUZZY CONTROLLING LOGIC:
Because of its association with neural networks and artificial intelligence, many
people expect fuzzy logic to require complex algorithms and lots of processing
horsepower. Surprisingly, even a small 8-bit microcontroller can be programmed to
perform fuzzy logic inference. This can perform tasks in milliseconds. This speed is
appropriate for many common control applications, and the small program size can
easily fit within the budget of a small MCU system. This paper discusses the
requirements of fuzzy logic and describes the structure of a general purpose fuzzy
inference program that is suitable for use in small 8-bit microcontroller systems.
5.3) DEGREES OF TRUTH:
Fuzzy logic derives its power from the concept of partial degrees of truth. Unlike
Boolean logic where a given input level either is or is not a member of a selected set,
fuzzy logic allows an input value to be a partial member of a set. In fact the same
input value can be a partial member of an overlapping set at the same time. For
example, the temperature 50°F can be both COLD and COOL at the same time. In
Boolean logic, truth can be represented by a single bit with one representing true and
zero representing false. In fuzzy logic, truth can be represented by an 8-bit value in
the range $00 (0 or completely false) to $FF (0.996 or completely true).
The second powerful concept in fuzzy logic is that of linguistic variables. Linguistic
variables allow rules to be stated in a language that closely resembles natural
language. This allows an application expert to describe a system in familiar terms
without requiring knowledge of computer programming. These two important
concepts are tied together by membership functions. An input membership function
describes the meaning of a linguistic label by providing a mapping of truth values
for all possible values of the input. Typically trapezoids are used for input
membership functions because they satisfy the need for a gradual change from
false to true without requiring much memory space. A trapezoid can be defined by
two 8-bit points and two 8-bit slopes. Output membership functions typically use
simpler singletons to relate a linguistic label to a specific output value. The
corresponding fuzzy output determines the height (weight) of the singleton.
5.4) OVERALL STRUCTURE:
As shown in Figure #, a software fuzzy inference unit (nu) consists of three main
parts. Each of these subprograms has an associated data structure in a
36
knowledge base. All application specific information is contained in the knowledge
base which is developed independently from the fuzzy inference program.
Figure 5-1
(Software Fuzzy Interface Unit)
The fuzzification process uses membership functions from the knowledge base to
transform system input values, such as a binary value from a temperature sensor, into
fuzzy input values. The fuzzy input values are stored in RAM for use in the following
rule evaluation subprogram. The rule evaluation process uses linguistic rules from the
knowledge base to produce fuzzy outputs based on the current values of fuzzy inputs.
The fuzzy outputs are stored in RAM for use by the last process in the fuzzy inference
program. The final defuzzification process uses output membership functions from
the knowledge base to resolve the fuzzy outputs into a single system output. The
system output is a weighted average of the fuzzy outputs.
5.5) FUZZIFICATION:
The first process in a fuzzy inference unit takes us out of the domain of crisp
input values like 50°F and into the fuzzy domain where fuzzy inputs (RAM
variables) describe the degree to which linguistic expressions are true. The key to
this translation is the input membership function which provides a numerical meaning
to a linguistic label such as COOL. A trapezoid is used because it provides a
37
reasonable compromise between shape flexibility and memory space required to
define the membership function. Four bytes can describe any trapezoidal membership
function. Figure # shows two membership functions (labeled COLD and COOL) for
the system input named TEMPERATURE. The vertical dashed line shows that
when temperature is 50°F, the label COLD has a degree of membership of
about $40 or about 25% true. At 50°F, the label COOL has a degree of membership
of $BF or about 75% true.
Two Input Member Function
Figure 5-2
Notice that as the system input value changes from $40 to $70, the label COLD
changes gradually from completely true to completely false. At the same time,
COOL changes from completely false to completely true. In a medium sized system
like an inverted pendulum, there may be two system inputs with seven linguistic
labels per input, or fourteen membership functions. Using trapezoids, this system
would need only 56 bytes to define the input membership functions. The freeware
program mentioned earlier uses a 43 byte routine to calculate a fuzzy input value for a
given system input value. This routine is placed in a simple loop, and is executed once
for each label of each system input. The inputs to the fuzzification process are the
current values of system inputs such as temperature and pressure. The outputs are 8-
bit fuzzy input values stored in RAM variable locations. One byte of RAM is required
for each label of each system input.
5.6) RULE EVALUATION:
The rule evaluation process uses a list of linguistic rules from the knowledge base
to perform inference in the fuzzy domain. The inputs to this process are the fuzzy
inputs from the fuzzification process. The outputs of this process are fuzzy outputs (8-
bit values in RAM variable locations). The rule "If temperature is warm and pressure
is medium then fan is medium-high has two antecedents (inputs) and one consequent
(output). Each antecedent is of the form "input-name is label", where input-name is
the name assigned to a system input and label is the name of a label of that input.
Each consequent is of the form "output-name is label", where output-name is the
name of a system output and label is the name of a label of that output. To evaluate a
38
rule you would replace each antecedent phrase with the associated fuzzy input
value, determine the overall truth value of the rule, and update the fuzzy output
corresponding to the rule consequent. This is done by storing the rules as a list of
addresses or pointers to fuzzy inputs and fuzzy outputs.
In microcontroller based fuzzy inference units, only two operators are needed. The
AND operator connects rule antecedents and an implied OR operator connects
separate rules. The AND operator corresponds to the mathematical minimum
operation and OR corresponds to the maximum operation. The overall truth of a
rule is found by taking the minimum of all fuzzy inputs to the rule. Before any
rules are processed, all fuzzy outputs are cleared to zero. As rules are evaluated, the
truth value for the rule is stored to the fuzzy output corresponding to the rule
consequent unless the fuzzy output is already larger. In this way the fuzzy output ends
up with the maximum truth value of any rule related to that fuzzy output. This is
called min-max rule evaluation.
5.7) DEFUZZIFICATION:
The fuzzy outputs generated by the rule evaluation process collectively define the
desired system output. The defuzzification process takes a weighted average to
translate the fuzzy outputs into a single crisp system output value.
Singleton type output membership functions are used for a microcontroller based FIU.
A singleton is defined by an 8-bit value that represents the output value
corresponding to a linguistic label of a system output. The corresponding fuzzy
output value in RAM provides the height (weight) of the singleton. The following
formula is used to calculate the weighted average which is used as the system output
value.
The operations required to implement fuzzy logic inference are simple enough for a
small 8-bit MCU. Memory requirements are small and execution time for a software
fuzzy inference unit is fast enough for typical real-time control applications.As fuzzy
logic becomes familiar to more engineers, applications once thought too difficult for
small microcontrollers will routinely be solved using fuzzy logic techniques.
Good general purpose fuzzy inference programs will allow non-programmers to
access the power of microcontrollers to solve a wide range of design problems.
39
Chapter 6
DESCRIPTION OF
ELECTRONIC
COMPONENTS
40
6.1) INTRODUCTION
In this chapter we will discuss controller that used in our project the features,
significant and other parameter of the controller it‟s block diagram pin configuration
and description of pins.
6.2) ATMEGA-16 8-bit Microcontroller with 16K Bytes In-
System Programmable Flash
Figure 6-1
6.2.1) OVERVIEW:
The ATmega16 is a low-power CMOS 8-bit microcontroller based on the AVR
enhanced RISC architecture. By executing powerful instructions in a single clock
cycle, the ATmega16 achieves throughputs approaching 1 MIPS per MHz allowing
the system designed to optimize power consumption versus processing speed.
6.2.2) FEATURES:
High-performance, Low-power AVR® 8-bit Microcontroller
Advanced RISC Architecture
 131 Powerful Instructions – Most Single-clock Cycle Execution
 32 x 8 General Purpose Working Registers
 Fully Static Operation
 Up to 16 MIPS Throughput at 16 MHz
 On-chip 2-cycle Multiplier
High Endurance Non-volatile Memory segments
 16K Bytes of In-System Self-programmable Flash program memory
 512 Bytes EEPROM
 1K Byte Internal SRAM
 Write/Erase Cycles: 10,000 Flash/100,000 EEPROM
 Data retention: 20 years at 85°C/100 years at 25°C(1)
 Optional Boot Code Section with Independent Lock Bits
41
 In-System Programming by On-chip Boot Program
 True Read-While-Write Operation
 Programming Lock for Software Security
JTAG (IEEE std. 1149.1 Compliant) Interface
 Boundary-scan Capabilities According to the JTAG Standard
 Extensive On-chip Debug Support
 Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG
Interface
Peripheral Features
 Two 8-bit Timer/Counters with Separate Pre scalars and Compare Modes
 One 16-bit Timer/Counter with Separate Pre scalar, Compare Mode, and
Capture
 Mode
 Real Time Counter with Separate Oscillator
 Four PWM Channels
 8-channel, 10-bit ADC
 8 Single-ended Channels
 7 Differential Channels in TQFP Package Only
 2 Differential Channels with Programmable Gain at 1x, 10x, or 200x
 Byte-oriented Two-wire Serial Interface
 Programmable Serial USART
 Master/Slave SPI Serial Interface
 Programmable Watchdog Timer with Separate On-chip Oscillator
 On-chip Analog Comparator
Special Microcontroller Features
 Power-on Reset and Programmable Brown-out Detection
 Internal Calibrated RC Oscillator
 External and Internal Interrupt Sources
 Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down,
Standby and Extended Standby
I/O and Packages
 32 Programmable I/O Lines
 40-pin PDIP, 44-lead TQFP, and 44-pad QFN/MLF
Operating Voltages
 4.5 - 5.5V for ATmega16
Speed Grades
 0 - 16 MHz for ATmega16
Power Consumption @ 1 MHz, 3V, and 25ーC for ATmega16L
 Active: 1.1 mA
 Idle Mode: 0.35 mA
 Power-down Mode: < 1 μA
42
6.2.3) PIN CONFIGURATION:
Figure 6-2
43
6.2.4) BLOCK DIAGRAM:
Figure 6-3
6.2.5) PIN DESCRIPTION:
VCC
Digital supply voltage.
GND
Ground.
Port A (PA0-PA7)
Port A serves as the analog inputs to the A/D Converter. Port A also serves as
an 8-bit bi-directional I/O port, if the A/D Converter is not used. Port pins can provide
internal pull-up resistors (selected for each bit). The Port A output buffers have sym-
metrical drive characteristics with both high sink and source capability. When pins
PA0 to PA7 are used as inputs and are externally pulled low, they will source current
if the internal pull-up resistors are activated. The Port A pins are tri-stated when a
reset condition becomes active, even if the clock is not running.
44
Port B (PB0-PB7)
Port B is an 8-bit bi-directional I/O port with internal pull-up resistors
(selected for each bit). The Port B output buffers have symmetrical drive
characteristics with both high sink and source capability. As inputs, Port B pins that
are externally pulled low will source current if the pull-up resistors are activated. The
Port B pins are tri-stated when a reset condition becomes active, even if the clock is
not running. Port B also serves the functions of various special features of the
ATmega16 as listed on page 58.
Port C (PC0-PC7)
Port C is an 8-bit bi-directional I/O port with internal pull-up resistors
(selected for each bit). The Port C output buffers have symmetrical drive
characteristics with both high sink and source capability. As inputs, Port C pins that
are externally pulled low will source current if the pull-up resistors are activated. The
Port C pins are tri-stated when a reset condition becomes active, even if the clock is
not running. If the JTAG interface is enabled, the pull-up resistors on pins PC5 (TDI),
PC3 (TMS) and PC2 (TCK) will be activated even if a reset occurs. Port C also serves
the functions of the JTAG interface and other special features of the ATmega16 as
listed on page 61.
Port D (PD0-PD7)
Port D is an 8-bit bi-directional I/O port with internal pull-up resistors
(selected for each bit). The Port D output buffers have symmetrical drive
characteristics with both high sink and source capability. As inputs, Port D pins that
are externally pulled low will source current if the pull-up resistors are activated. The
Port D pins are tri-stated when a reset condition becomes active, even if the clock is
not running. Port D also serves the functions of various special features of the
ATmega16 as listed on page 63.
RESET
Reset Input. A low level on this pin for longer than the minimum pulse length
will generate a reset, even if the clock is not running. The minimum pulse length is
given in Table 15 on page 38. Shorter pulses are not guaranteed to generate a reset.
XTAL1
Input to the inverting Oscillator amplifier and input to the internal clock
operating circuit.
XTAL2
Output from the inverting Oscillator amplifier.
AVCC
AVCC is the supply voltage pin for Port A and the A/D Converter. It should
be externally connected to VCC, even if the ADC is not used. If the ADC is used, it
should be connected to VCC through a low-pass filter.
AREF
AREF is the analog reference pin for the A/D Converter.
45
6.3) DC GEAR MOTOR:
We are using 3 DC Motors to rotate the shafts in the vessels these all 3 motors are 24v
dc Many projects require the use of a cheap dc motor to create rotational movement.
There are a number of ways motors can be interfaced to the microcontroller. This
circuit uses a darling ton transistor to switch the motor on and off. This circuit will
work with „solar‟ motors, but may not function correctly with cheap dc motors. This
is because this type of motor introduces a lot of electrical „noise‟ on to the power
rails. This noise can affect the microcontroller, and in some cases can completely stop
the control program functioning. These comparators are designed for use in level
detection, low-level sensing and memory applications in consumer, automotive, and
industrial electronic applications.
Figure 6-4
6.4) SERVO MOTOR:
Servo is an automatic device that uses error-sensing feedback to correct the
performance of a mechanism. The term correctly applies only to systems where the
feedback or error-correction signals help control mechanical position or other
parameters. For example, an automotive power window control is not a
servomechanism, as there is no automatic feedback that controls position the operator
does this by observation. By contrast the car's cruise control uses closed loop
feedback, which classifies it as a servomechanism.
46
A servomechanism is unique among control systems in that it controls a parameter by
commanding the time-based derivative of that parameter. For example, a
servomechanism controlling position must be capable of changing the velocity of the
system because the time-based derivative (rate change) of position is velocity. A
hydraulic actuator controlled by a spool valve and a position sensor is a good example
because the velocity of the actuator is proportional to the error signal of the position
sensor.
Figure 6-5
Servo motors are devices which provide precise position through feedback. RC
Servos can rotate only 180 degree and have wide applications in robotics. These
servos are used for application like robotic arms and humanoid.
RC servos consist of a DC motor, gearbox, control circuit and feedback devices. The
feedback device (mostly potentiometer) is mechanically coupled to the output shaft.
The control signal (PWM signal) proportional to the required shaft position is given to
the servo.
Figure 6-6
47
The PWM signal is converted into a voltage corresponding to the desired position.
The output voltage also changes in proportion to the actual shaft position. These two
will have same value if the position of the shaft is at the desired position. If the
position of the shaft is not the same as desired position then an error voltage is
generated which will move the motor until the desired position is obtained.
Figure 6-7
The RC Servo motors require a PWM having time period of around 20ms is required
and the pulse width of 1-2ms. 1ms pulse width corresponds to 0 degree and 2ms pulse
width corresponds to 180 degree. For any other angle between 0 degree and 180
degree corresponding pulse width is required. The RC servo has three wires, one for
control signal and others for power supply (Vcc and Gnd). Operating voltage or
supply voltage is in the range of 4.8v to 6v. Refer to the programming section for the
program of RC Servo motor.
6.5) MAX-232 DUAL RECIEVER
6.5.1) INTRODUCTON:
The MAX232 is a dual driver/receiver that includes a capacitive voltage generator to
supply TIA/EIA-232-F voltage levels from a single 5-V supply. Each receiver
converts TIA/EIA-232-F inputs to 5-V TTL/CMOS levels. These receivers have a
typical threshold of 1.3 V, a typical hysteresis of 0.5 V, and can accept ±30-V inputs.
Each driver converts TTL/CMOS input levels into TIA/EIA-232-F levels. It has two
drivers and two receivers.
48
6.5.2) PIN CONFIGURATION:
Figure 6-8
6.5.3) FUNCTION TABLES:
EACH DRIVER
INPUT
TIN
OUTPUT
TOUT
H L
L H
EACH RECIEVER
INPUT
RIN
OUTPUT
ROUT
L H
H L
49
6.5.4) LOGIC DIAGRAMS (POSITIVE LOGIC):
Figure 6-9
6.5.5) APPLICATION INFORMATION:
Figure 6-10
50
Chapter 7
NAVIGATIONAL MODULE
51
7.1) INTRODUCTION:
In this chapter we discuss about the navigational component used. There is interfacing
and description of GPS navigation module. There is also description of NMEA
protocol to extract and differ in data get from GPS
7.2) HOLUX M-89 GPS MODULE
Figure 7-1
7.2.1) HISTORY:
M-89 is an ultra miniature 25.4 * 25.4 * 3 mm GPS engine board designed by low
Power consumption MTK GPS solution. It provides superior sensitivity up to -
159dBm and fast Time-To-First-Fix in navigation application. The stable performance
of M-89 is your best choice to be embedded in your portable device design, like PDA,
PND, mobile phone, Digital Camera for GPS service.
7.2.2) KEY FEATURES:
Small form factor: 25.4 * 25.4 * 3 mm
RoHS/WEEE compliant
High sensitivity -159dBm
Searching up to 32 Channel of satellites
Fast Position Fix
Low power consumption
RTCM-in ready.
52
Built-in WAAS/EGNOS/MSAS Demodulator.
Support NMEA0183 V 3.01 data protocol.
Real time navigation for location based services.
For Car Navigation, Marine Navigation, Fleet Management, AVL and
Location-Based Services, Auto Pilot, Personal Navigation or touring devices,
Tracking devices/systems and Mapping devices application
7.2.3) APPLICATIONS:
Automotive and Marine Navigation
Automotive Navigator Tracking
Emergency Locator
Geographic Surveying
Personal Positioning
Sporting and Recreation
Embedded applications:
Smart phone, UMPC, PND, MP4
7.2.4) BLOCK DIAGRAM:
Figure 7-2
53
7.2.5) PIN DEFINATION:
Figure 7-3
Pin No. Pin Name Type Function Description
1 VCC_IN I/p 3.3 - 5 V Supply Input
2 GND Gnd Ground
3 NC I/p NC
4 RXDA I/p Serial Data Input A
5 TXDA O/p Serial Data Output A
6 TXDB O/p Serial Data Output
7 RXDB I/p Serial Data Input B
8 GPIO0 I/O General purpose I/O. Flash at 1Hz when position is fixed
9 INT1 I/O General purpose I/O
10 GND Gnd Ground
11 GND Gnd Ground
12 GND Gnd Ground
13 GND Gnd Ground
14 GND Gnd Ground
15 GND Gnd Ground
16 GND Gnd Ground
17 RF_IN I/p GPA Signal Input
18 GND I/p Ground
19 V_ANT_IN I/p Antenna Power Supply Input, 3V
20 VCC_RF_O O/p Antenna Power Supply, 2.8V
21 V_BAT I/p RTC and backup SRAM power, 2.6 - 3.6 VDC
22 HRST I/p Reset, Active low
54
7.3) NMEA Data Protocol:
7.3.1) THE PROTOCOL:
The National Marine Electronics Association (NMEA) has developed a specification
that defines the interface between various pieces of marine electronic equipment. The
standard permits marine electronics to send information to computers and to other
marine equipment. A full copy of this standard is available for purchase at their web
site. None of the information on this site comes from this standard and I do not have a
copy. Anyone attempting to design anything to this standard should obtain an official
copy.
GPS receiver communication is defined within this specification. Most computer
programs that provide real time position information understand and expect data to be
in NMEA format. This data includes the complete PVT (position, velocity, time)
solution computed by the GPS receiver. The idea of NMEA is to send a line of data
called a sentence that is totally self contained and independent from other sentences.
There are standard sentences for each device category and there is also the ability to
define proprietary sentences for use by the individual company. All of the standard
sentences have a two letter prefix that defines the device that uses that sentence type.
(For gps receivers the prefix is GP.) which is followed by a three letter sequence that
defines the sentence contents. In addition NMEA permits hardware manufactures to
define their own proprietary sentences for whatever purpose they see fit. All
proprietary sentences begin with the letter P and are followed with 3 letters that
identifies the manufacturer controlling that sentence. For example a Garmin sentence
would start with PGRM and Magellan would begin with PMGN.
Each sentence begins with a '$' and ends with a carriage return/line feed sequence and
can be no longer than 80 characters of visible text (plus the line terminators). The data
is contained within this single line with data items separated by commas. The data
itself is just ascii text and may extend over multiple sentences in certain specialized
instances but is normally fully contained in one variable length sentence. The data
may vary in the amount of precision contained in the message. For example time
might be indicated to decimal parts of a second or location may be show with 3 or
even 4 digits after the decimal point. Programs that read the data should only use the
commas to determine the field boundaries and not depend on column positions. There
is a provision for a checksum at the end of each sentence which may or may not be
checked by the unit that reads the data. The checksum field consists of a '*' and two
23 GPIO1 I/O General purpose I/O
24 GPIO2 I/O General purpose I/O
25 GPIO3 I/O General purpose I/O
26 GPIO4 I/O General purpose I/O
27 GPIO5 I/O General purpose I/O
28 GPIO6 I/O General purpose I/O
29 PPS O/p 1 PPS output, synchronized with GPS time. TIME_MARK
1PPS output, 1us/s
30 GND Gnd Ground
55
hex digits representing an 8 bit exclusive OR of all characters between, but not
including, the '$' and '*'. A checksum is required on some sentences.
There have been several changes to the standard but for gps use the only ones that are
likely to be encountered are 1.5 and 2.0 through 2.3. These just specify some different
sentence configurations which may be peculiar to the needs of a particular device thus
the gps may need to be changed to match the devices being interfaced to. Some gps's
provide the ability configure a custom set the sentences while other may offer a set of
fixed choices. Many gps receivers simply output a fixed set of sentences that cannot
be changed by the user. The current version of the standard is 3.01. I have no specific
information on this version, but I am not aware of any GPS products that require
conformance to this version.
7.3.2) HARDWARE CONNECTION:
The hardware interface for GPS units is designed to meet the NMEA requirements.
They are also compatible with most computer serial ports using RS232 protocols,
however strictly speaking the NMEA standard is not RS232. They recommend
conformance to EIA-422. The interface speed can be adjusted on some models but the
NMEA standard is 4800 b/s (bit per second rate) with 8 bits of data, no parity, and
one stop bit. All units that support NMEA should support this speed. Note that, at a
b/s rate of 4800, you can easily send enough data to more than fill a full second of
time. For this reason some units only send updates every two seconds or may send
some data every second while reserving other data to be sent less often. In addition
some units may send data a couple of seconds old while other units may send data that
is collected within the second it is sent. Generally time is sent in some field within
each second so it is pretty easy to figure out what a particular gps is doing. Some
sentences may be sent only during a particular action of the receiver such as while
following a route while other receivers may always send the sentence and just null out
the values. Other difference will be noted in the specific data descriptions defined
later in the text.
At 4800 b/s you can only send 480 characters in one second. Since an NMEA
sentence can be as long as 82 characters you can be limited to less than 6 different
sentences. The actual limit is determined by the specific sentences used, but this
shows that it is easy to overrun the capabilities if you want rapid sentence response.
NMEA is designed to run as a process in the background spitting out sentences which
are then captured as needed by the using program. Some programs cannot do this and
these programs will sample the data stream, then use the data for screen display, and
then sample the data again. Depending on the time needed to use the data there can
easily be a lag of 4 seconds in the responsiveness to changed data. This may be fine in
some applications but totally unacceptable in others. For example a car traveling at 60
mph will travel 88 feet in one second. Several second delays could make the entire
system seem unresponsive and could cause you to miss your turn.
The NMEA standard has been around for many years (1983) and has undergone
several revisions. The protocol has changed and the number and types of sentences
may be different depending on the revision. Most GPS receivers understand the
standard which is called: 0183 version 2. This standard dictates a transfer rate of 4800
b/s. Some receivers also understand older standards. The oldest standard was 0180
followed by 0182 which transferred data at 1200 b/s. An earlier version of 0183 called
56
version 1.5 is also understood by some receivers. Some Garmin units and other brands
can be set to 9600 for NMEA output or even higher but this is only recommended if
you have determined that 4800 works ok and then you can try to set it faster. Setting it
to run as fast as you can may improve the responsiveness of the program.
In order to use the hardware interface you will need a cable. Generally the cable is
unique to the hardware model so you will need an cable made specifically for the
brand and model of the unit you own. Some of the latest computers no longer include
a serial port but only a USB port. Most gps receivers will work with Serial to USB
adapters and serial ports attached via the pcmcia (pc card) adapter. For general
NMEA use with a gps receiver you will only need two wires in the cable, data out
from the gps and ground. A third wire, Data in, will be needed if you expect the
receiver to accept data on this cable such as to upload waypoints or send DGPS data
to the receiver.
GPS receivers may be used to interface with other NMEA devices such as autopilots,
fish finders, or even another gps receivers. They can also listen to Differential Beacon
Receivers that can send data using the RTCM SC-104 standard. This data is consistent
with the hardware requirements for NMEA input data. There are no handshake lines
defined for NMEA.
7.3.3) NMEA SENTENCES:
NMEA consists of sentences, the first word of which, called a data type, defines the
interpretation of the rest of the sentence. Each Data type would have its own unique
interpretation and is defined in the NMEA standard. The GGA sentence (shown
below) shows an example that provides essential fix data. Other sentences may repeat
some of the same information but will also supply new data. Whatever device or
program that reads the data can watch for the data sentence that it is interested in and
simply ignore other sentences that is doesn't care about. In the NMEA standard there
are no commands to indicate that the gps should do something different. Instead each
receiver just sends all of the data and expects much of it to be ignored. Some receivers
have commands inside the unit that can select a subset of all the sentences or, in some
cases, even the individual sentences to send. There is no way to indicate anything
back to the unit as to whether the sentence is being read correctly or to request a re-
send of some data you didn't get. Instead the receiving unit just checks the checksum
and ignores the data if the checksum is bad figuring the data will be sent again
sometime later.
There are many sentences in the NMEA standard for all kinds of devices that may be
used in a Marine environment. Some of the ones that have applicability to gps
receivers are listed below: (all message start with GP.)
AAM - Waypoint Arrival Alarm
ALM - Almanac data
APA - Auto Pilot A sentence
APB - Auto Pilot B sentence
BOD - Bearing Origin to Destination
BWC - Bearing using Great Circle route
DTM - Datum being used.
57
GGA - Fix information
GLL - Lat/Lon data
GRS - GPS Range Residuals
GSA - Overall Satellite data
GST - GPS Pseudorange Noise Statistics
GSV - Detailed Satellite data
MSK - send control for a beacon receiver
MSS - Beacon receiver status information.
RMA - recommended Loran data
RMB - recommended navigation data for gps
RMC - recommended minimum data for gps
RTE - route message
TRF - Transit Fix Data
STN - Multiple Data ID
VBW - dual Ground / Water Spped
VTG - Vector track an Speed over the Ground
WCV - Waypoint closure velocity (Velocity Made Good)
WPL - Waypoint Location information
XTC - cross track error
XTE - measured cross track error
ZTG - Zulu (UTC) time and time to go (to destination)
ZDA - Date and Time
Some gps receivers with special capabilities output these special messages.
HCHDG - Compass output
PSLIB - Remote Control for a DGPS receiver
In addition some GPS receivers can mimic Loran-C receivers by outputing the LC
prefix in some of their messages so that they can be used to interface to equipment
that is expecting this prefix instead of the GP one.
The last version 2 iteration of the NMEA standard was 2.3. It added a mode indicator
to several sentences which is used to indicate the kind of fix the receiver currently
has. This indication is part of the signal integrity information needed by the FAA. The
value can be A=autonomous, D=differential, E=Estimated, N=not valid, S=Simulator.
Sometimes there can be a null value as well. Only the A and D values will correspond
to an Active and reliable Sentence. This mode character has been added to the RMC,
RMB, VTG, and GLL, sentences and optionally some others including the BWC and
XTE sentences.
If you are interfacing a GPS unit to another device, including a computer program,
you need to ensure that the receiving unit is given all of the sentences that it needs. If
it needs a sentence that your GPS does not send then the interface to that unit is likely
to fail. Here is a Link for the needs of some typical programs. The sentences sent by
some typical receivers include:
58
NMEA 2.0
Name Garmin Magellan Lowrance SiRF Notes:
GPAPB N Y Y N Auto Pilot B
GPBOD Y N N N
bearing, origin to destination - earlier G-
12's do not transmit this
GPGGA Y Y Y Y fix data
GPGLL Y Y Y Y
Lat/Lon data - earlier G-12's do not
transmit this
GPGSA Y Y Y Y
overall satellite reception data, missing
on some Garmin models
GPGSV Y Y Y Y
detailed satellite data, missing on some
Garmin models
GPRMB Y Y Y N
minimum recommended data when
following a route
GPRMC Y Y Y Y minimum recommended data
GPRTE Y U U N
route data, only when there is an active
route. (this is sometimes bidirectional)
GPWPL Y Y U N
waypoint data, only when there is an
active route (this is sometimes
bidirectional)
NMEA 1.5 - some units do not support version 1.5. Lowrance units provide the ability
to customize the NMEA output by sentences so that you can develop your own
custom sentence structure.
Name Garmin Magellan Notes:
GPAPA N Y Automatic Pilot A
GPBOD Y N
bearing origin to destination - earlier G-12's do not send
this
GPBWC Y Y bearing to waypoint using great circle route.
GPGLL Y Y lat/lon - earlier G-12's do not send this
GPRMC Y N minimum recommend data
GPRMB Y N minimum recommended data when following a route
GPVTG Y Y vector track and speed over ground
GPWPL Y N waypoint data (only when active goto)
GPXTE Y Y cross track error
The NMEA 2.3 output from the Garmin Legend, Vista, and perhaps some others
include the BWC, VTG, and XTE sentences.
59
The Trimble Scoutmaster outputs: APA, APB, BWC, GGA, GLL, GSA, GSV, RMB,
RMC, VTG, WCV, XTE, ZTG.
The Motorola Encore outputs: GGA, GLL, GSV, RMC, VTG, ZDA and a proprietary
sentence PMOTG.
Units based on the SiRF chipset can output: GGA, GLL, GSA, GSV, RMC, and VTG.
What is actually output is based on which sentences are selected by the user or
application program. See below for more details. Some implementations have
enhanced the SiRF capabilities with other sentences as well by changing the
firmware. For example, the u-blox receivers add ZDA and some proprietary sentences
to the above list of sentences. Check your documentation for more details.
Garmin receivers send the following Proprietary Sentences:
PGRME (estimated error) - not sent if set to 0183 1.5
PGRMM (map datum)
PGRMZ (altitude)
PSLIB (beacon receiver control)
Note that Garmin converts lat/lon coordinates to the datum chosen by the user when
sending this data. This is indicated in the proprietary sentence PGRMM. This can help
programs that use maps with other datums but is not an NMEA standard. Be sure and
set your datum to WGS84 on Garmin units when communicating to other NMEA
devices.
Magellan also converts lat/lon coordinates to the datum chosen on the receiver but do
not indicate this in a message. Magellan units use proprietary sentences for waypoint
maintenance and other tasks. They use a prefix of PMGN for this data.
Most other units always output NMEA messages in the WGS84 datum. Be sure and
check the user documentation to be sure.
It is possible to just view the information presented on the NMEA interface using a
simple terminal program. If the terminal program can log the session then you can
build a history of the entire session into a file. More sophisticated logging programs
can filter the messages to only certain sentences or only collect sentences at
prescribed intervals. Some computer programs that provide real time display and
logging actually save the log in an ascii format that can be viewed with a text editor or
used independently from the program that generated it.
7.3.4) NMEA INPUT:
Some units also support an NMEA input mode. While not too many programs support
this mode it does provide a standardized way to update or add waypoint and route
data. Note that there is no handshaking or commands in NMEA mode so you just send
the data in the correct sentence and the unit will accept the data and add or overwrite
the information in memory. If the data is not in the correct format it will simply be
ignored. A carriage return/line feed sequence is required. If the waypoint name is the
same you will overwrite existing data but no warning will be issued. The sentence
60
construction is identical to what the unit downloads so you can, for example, capture a
WPL sentence from one unit and then send that same sentence to another unit but be
careful if the two units support waypoint names of different lengths since the
receiving unit might truncate the name and overwrite a waypoint accidently. If you
create a sentence from scratch you should create a correct checksum. Be sure you
know and have set you unit to the correct datum. Many units support the input of
WPL sentences and a few support RTE as well.
On NMEA input the receiver stores information based on interpreting the sentence
itself. While some receivers accept standard NMEA input this can only be used to
update a waypoint or similar task and not to send a command to the unit. Proprietary
input sentences could be used to send commands. Since the Magellan upload and
download maintenance protocol is based on NMEA sentences they support a modified
WPL message that adds comments, altitude, and icon data.
Some marine units may accept input for alarms such as deep or shallow water based
on the DPT sentence or MTW to read the water temperature. For example the Garmin
Map76 supports DPT, MTW (temperature), and VHW (speed) input sentences. Other
units may use NMEA input to provide initialization data via proprietary sentences, or
to select which NMEA sentences to output.
7.3.5)Decode of Selected Position Sentences:
The most important NMEA sentences include the GGA which provides the current
Fix data, the RMC which provides the minimum gps sentences information, and the
GSA which provides the Satellite status data.
GGA - essential fix data which provide 3D location and accuracy data.
$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47
Where:
GGA Global Positioning System Fix Data
123519 Fix taken at 12:35:19 UTC
4807.038,N Latitude 48 deg 07.038' N
01131.000,E Longitude 11 deg 31.000' E
1 Fix quality: 0 = invalid
1 = GPS fix (SPS)
2 = DGPS fix
3 = PPS fix
4 = Real Time Kinematic
5 = Float RTK
6 = estimated (dead reckoning) (2.3 feature)
7 = Manual input mode
8 = Simulation mode
08 Number of satellites being tracked
0.9 Horizontal dilution of position
545.4,M Altitude, Meters, above mean sea level
46.9,M Height of geoid (mean sea level) above WGS84
61
ellipsoid
(empty field) time in seconds since last DGPS update
(empty field) DGPS station ID number
*47 the checksum data, always begins with *
If the height of geoid is missing then the altitude should be suspect. Some non-
standard implementations report altitude with respect to the ellipsoid rather than geoid
altitude. Some units do not report negative altitudes at all. This is the only sentence
that reports altitude.
GSA - GPS DOP and active satellites. This sentence provides details on the nature of
the fix. It includes the numbers of the satellites being used in the current solution and
the DOP. DOP (dilution of precision) is an indication of the effect of satellite
geometry on the accuracy of the fix. It is a unitless number where smaller is better.
For 3D fixes using 4 satellites a 1.0 would be considered to be a perfect number,
however for overdetermined solutions it is possible to see numbers below 1.0.
There are differences in the way the PRN's are presented which can effect the ability
of some programs to display this data. For example, in the example shown below
there are 5 satellites in the solution and the null fields are scattered indicating that the
almanac would show satellites in the null positions that are not being used as part of
this solution. Other receivers might output all of the satellites used at the beginning of
the sentence with the null field all stacked up at the end. This difference accounts for
some satellite display programs not always being able to display the satellites being
tracked. Some units may show all satellites that have ephemeris data without regard to
their use as part of the solution but this is non-standard.
$GPGSA,A,3,04,05,,09,12,,,24,,,,,2.5,1.3,2.1*39
Where:
GSA Satellite status
A Auto selection of 2D or 3D fix (M = manual)
3 3D fix - values include: 1 = no fix
2 = 2D fix
3 = 3D fix
04,05... PRNs of satellites used for fix (space for 12)
2.5 PDOP (dilution of precision)
1.3 Horizontal dilution of precision (HDOP)
2.1 Vertical dilution of precision (VDOP)
*39 the checksum data, always begins with *
GSV - Satellites in View shows data about the satellites that the unit might be able to
find based on its viewing mask and almanac data. It also shows current ability to track
this data. Note that one GSV sentence only can provide data for up to 4 satellites and
thus there may need to be 3 sentences for the full information. It is reasonable for the
GSV sentence to contain more satellites than GGA might indicate since GSV may
include satellites that are not used as part of the solution. It is not a requirment that the
GSV sentences all appear in sequence. To avoid overloading the data bandwidth some
receivers may place the various sentences in totally different samples since each
sentence identifies which one it is.
62
The field called SNR (Signal to Noise Ratio) in the NMEA standard is often referred
to as signal strength. SNR is an indirect but more useful value that raw signal
strength. It can range from 0 to 99 and has units of dB according to the NMEA
standard, but the various manufacturers send different ranges of numbers with
different starting numbers so the values themselves cannot necessarily be used to
evaluate different units. The range of working values in a given gps will usually show
a difference of about 25 to 35 between the lowest and highest values, however 0 is a
special case and may be shown on satellites that are in view but not being tracked.
$GPGSV,2,1,08,01,40,083,46,02,17,308,41,12,07,344,39,14,22,228,45*75
Where:
GSV Satellites in view
2 Number of sentences for full data
1 sentence 1 of 2
08 Number of satellites in view
01 Satellite PRN number
40 Elevation, degrees
083 Azimuth, degrees
46 SNR - higher is better
for up to 4 satellites per sentence
*75 the checksum data, always begins with *
RMC - NMEA has its own version of essential gps pvt (position, velocity, time) data.
It is called RMC, The Recommended Minimum, which will look similar to:
$GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A
Where:
RMC Recommended Minimum sentence C
123519 Fix taken at 12:35:19 UTC
A Status A=active or V=Void.
4807.038,N Latitude 48 deg 07.038' N
01131.000,E Longitude 11 deg 31.000' E
022.4 Speed over the ground in knots
084.4 Track angle in degrees True
230394 Date - 23rd of March 1994
003.1,W Magnetic Variation
*6A The checksum data, always begins with *
Note that, as of the 2.3 release of NMEA, there is a new field in the RMC sentence at
the end just prior to the checksum. For more information on this field see here.
GLL - Geographic Latitude and Longitude is a holdover from Loran data and some
old units may not send the time and data active information if they are emulating
Loran data. If a gps is emulating Loran data they may use the LC Loran prefix instead
of GP.
63
$GPGLL,4916.45,N,12311.12,W,225444,A,*1D
Where:
GLL Geographic position, Latitude and Longitude
4916.46,N Latitude 49 deg. 16.45 min. North
12311.12,W Longitude 123 deg. 11.12 min. West
225444 Fix taken at 22:54:44 UTC
A Data Active or V (void)
*iD checksum data
Note that, as of the 2.3 release of NMEA, there is a new field in the GLL sentence at
the end just prior to the checksum. For more information on this field see here.
VTG - Velocity made good. The gps receiver may use the LC prefix instead of GP if
it is emulating Loran output.
$GPVTG,054.7,T,034.4,M,005.5,N,010.2,K*48
where:
VTG Track made good and ground speed
054.7,T True track made good (degrees)
034.4,M Magnetic track made good
005.5,N Ground speed, knots
010.2,K Ground speed, Kilometers per hour
*48 Checksum
Note that, as of the 2.3 release of NMEA, there is a new field in the VTG sentence at
the end just prior to the checksum. For more information on this field see here.
Receivers that don't have a magnetic deviation (variation) table built in will null out
the Magnetic track made good.
7.3.6) Decode of Some Navigation Sentences:
WPL - Waypoint Location data provides essential waypoint data. It is output when
navigating to indicate data about the destination and is sometimes supported on input
to redefine a waypoint location. Note that waypoint data as defined in the standard
does not define altitude, comments, or icon data. When a route is active, this sentence
is sent once for each waypoint in the route, in sequence. When all waypoints have
been reported, the RTE sentence is sent in the next data set. In any group of sentences,
only one WPL sentence, or an RTE sentence, will be sent.
$GPWPL,4807.038,N,01131.000,E,WPTNME*5C
With an interpretation of:
WPL Waypoint Location
4807.038,N Latitude
01131.000,E Longitude
WPTNME Waypoint Name
64
*5C The checksum data, always begins with *
AAM - Waypoint Arrival Alarm is generated by some units to indicate the Status of
arrival (entering the arrival circle, or passing the perpendicular of the course line) at
the destination waypoint.
$GPAAM,A,A,0.10,N,WPTNME*32
Where:
AAM Arrival Alarm
A Arrival circle entered
A Perpendicular passed
0.10 Circle radius
N Nautical miles
WPTNME Waypoint name
*32 Checksum data
APB - Autopilot format B is sent by some gps receivers to allow them to be used to
control an autopilot unit. This sentence is commonly used by autopilots and contains
navigation receiver warning flag status, cross-track-error, waypoint arrival status,
initial bearing from origin waypoint to the destination, continuous bearing from
present position to destination and recommended heading-to-steer to destination
waypoint for the active navigation leg of the journey.
Note: some autopilots, Robertson in particular, misinterpret "bearing from origin to
destination" as "bearing from present position to destination". This is likely due to the
difference between the APB sentence and the APA sentence. for the APA sentence
this would be the correct thing to do for the data in the same field. APA only differs
from APB in this one field and APA leaves off the last two fields where this
distinction is clearly spelled out. This will result in poor performance if the boat is
sufficiently off-course that the two bearings are different.
$GPAPB,A,A,0.10,R,N,V,V,011,M,DEST,011,M,011,M*3C
where:
APB Autopilot format B
A Loran-C blink/SNR warning, general warning
A Loran-C cycle warning
0.10 cross-track error distance
R steer Right to correct (or L for Left)
N cross-track error units - nautical miles (K for kilometers)
V arrival alarm - circle
V arrival alarm - perpendicular
011,M magnetic bearing, origin to destination
DEST destination waypoint ID
011,M magnetic bearing, present position to destination
011,M magnetic heading to steer (bearings could True as 033,T)
65
BOD - Bearing - Origin to Destination shows the bearing angle of the line, calculated
at the origin waypoint, extending to the destination waypoint from the origin
waypoint for the active navigation leg of the journey.
$GPBOD,045.,T,023.,M,DEST,START*01
where:
BOD Bearing - origin to destination waypoint
045.,T bearing 045 True from "START" to "DEST"
023.,M bearing 023 Magnetic from "START" to "DEST"
DEST destination waypoint ID
START origin waypoint ID
*01 checksum
BWC - Bearing & Distance to Waypoint using a Great Circle route. Time (UTC) and
distance & bearing to, and location of, a specified waypoint from present position
along the great circle path.
$GPBWC,225444,4917.24,N,12309.57,W,051.9,T,031.6,M,001.3,N,004*29
where:
BWC Bearing and distance to waypoint - great circle
225444 UTC time of fix 22:54:44
4917.24,N Latitude of waypoint
12309.57,W Longitude of waypoint
051.9,T Bearing to waypoint, degrees true
031.6,M Bearing to waypoint, degrees magnetic
001.3,N Distance to waypoint, Nautical miles
004 Waypoint ID
*29 checksum
RMB - The recommended minimum navigation sentence is sent whenever a route or
a goto is active. On some systems it is sent all of the time with null data. The Arrival
alarm flag is similar to the arrival alarm inside the unit and can be decoded to drive an
external alarm. Note the use of leading zeros in this message to preserve the character
spacing. This is done, I believe, because some autopilots may depend on exact
character spacing.
$GPRMB,A,0.66,L,003,004,4917.24,N,12309.57,W,001.3,052.5,000.5,V*20
where:
RMB Recommended minimum navigation information
A Data status A = OK, V = Void (warning)
0.66,L Cross-track error (nautical miles, 9.99 max),
steer Left to correct (or R = right)
003 Origin waypoint ID
004 Destination waypoint ID
4917.24,N Destination waypoint latitude 49 deg. 17.24 min. N
12309.57,W Destination waypoint longitude 123 deg. 09.57 min. W
66
001.3 Range to destination, nautical miles (999.9 max)
052.5 True bearing to destination
000.5 Velocity towards destination, knots
V Arrival alarm A = arrived, V = not arrived
*20 checksum
RTE - RTE is sent to indicate the names of the waypoints used in an active route.
There are two types of RTE sentences. This route sentence can list all of the
waypoints in the entire route or it can list only those still ahead. Because an NMEA
sentence is limited to 80 characters there may need to be multiple sentences to
identify all of the waypoints. The data about the waypoints themselves will be sent in
subsequent WPL sentences which will be sent in future cycles of the NMEA data.
$GPRTE,2,1,c,0,W3IWI,DRIVWY,32CEDR,32-29,32BKLD,32-I95,32-US1,BW-
32,BW-198*69
Where:
RTE Waypoints in active route
2 total number of sentences needed for full data
1 this is sentence 1 of 2
c Type c = complete list of waypoints in this route
w = first listed waypoint is start of current leg
0 Route identifier
W3IWI,... Waypoint identifiers (names)
*69 checksum
XTE - Measured cross track error is a small subset of the RMB message for
compatibility with some older equipment designed to work with Loran. Note that the
same limitations apply to this message as the ones in the RMB since it is expected to
be decoded by an autopilot.
$GPXTE,A,A,0.67,L,N*6F
Where:
XTE Cross track error, measured
A General warning flag V = warning
(Loran-C Blink or SNR warning)
A Not used for GPS (Loran-C cycle lock flag)
0.67 cross track error distance
L Steer left to correct error (or R for right)
N Distance units - Nautical miles
*6F checksum
7.3.7) Other Sentences That may be Useful:
ALM - GPS Almanac Data contains GPS week number, satellite health and the
complete almanac data for one satellite. Multiple messages may be transmitted, one
for each satellite in the GPS constellation, up to maximum of 32 messages. Note that
these sentences can take a long time to send so they are not generally sent
automatically by the gps receiver. (Sorry I don't have an exact example of the
sentence.) Note that this sentence breaks the 80 character rule. Also note that this
67
sentence is often accepted as input so that you can preload a new almanac in a
receiver.
$GPALM,A.B,C.D,E,F,hh,hhhh,...
Where:
ALM Almanac Data being sent
A Total number of messages
B Message number
C Satellite PRN number
D GPS week number (0-1023)
E Satellite health (bits 17-24 of message)
F eccentricity
hh t index OA, almanac reference time
hhhh sigma index 1, inclination angle
... OMEGADOT rate of right ascension
SQRA(A) root of semi-major axis
Omega, argument of perigee
Omega index 0, longitude of ascension node
M index 0, mean anomaly
a index f0, clock parameter
a index f1, clock parameter
HCHDG - Compass output is used on Garmin etrex summit, vista , and 76S receivers
to output the value of the internal flux-gate compass. Only the magnetic heading and
magnetic variation is shown in the message.
$HCHDG,101.1,,,7.1,W*3C
where:
HCHDG Magnetic heading, deviation, variation
101.1 heading
,, deviation (no data)
7.1,W variation
ZDA - Data and Time
$GPZDA,hhmmss.ss,dd,mm,yyyy,xx,yy*CC
$GPZDA,201530.00,04,07,2002,00,00*60
where:
hhmmss HrMinSec(UTC)
dd,mm,yyy Day,Month,Year
xx local zone hours -13..13
yy local zone minutes 0..59
*CC checksum
68
Chapter 8
TRANSMISSION MODULE
69
8.1) INTRODUCTION:
In this chapter we discuss about the RF transceiver that is used. We describe all its pin
definition, data reception and transmission and frequency setting how set it for
transmission.
8.2) WIRELESS RF TRANCIEVER 433MHz FSK TRANSFER
MODULE
Figure 8-1
8.2.1) HISTORY:
433MHz is an integrative module for transmitting and receiving wireless data based on
FSK Zero-IF digital infrastructure. The products conform to related laws and standards
about micro-power wireless telecommunication devices in PRC, USA, Canada, EU,
Australia, New Zealand, etc. This module is sorted as version A and B based on the
firmware program employed. The difference of these two versions lies on the
conditions of activation for data transmission and the way that transmitting and
receiving status are switched while the radio frequency performance and functions of
both versions remain consistent. You may refer to the following for details.
8.2.2) PIN DEFINATION:
The pin started from the left side (viewed from the side that IC components are visible)
is pin 1. Please pay close attention that the pins on module PCB have been marked
with pin 1 and pin 8.
PIN1: VCC. +2.4V~+4.2v, requires at least 100mA stable current supply, the ripple
shall be reduced to the amount of less than 20mv while the interface of power supply
shall be equipped with appropriate decoupling components.
PIN2: GND
70
PIN3: RXD. Serial input, baud rate 19200 (customizable), 8-bit data bits, 1-bit start
bit, 1-bit stop bit. This IO is input.
PIN4: TXD. Serial output, baud rate 19200 (customizable), 8-bit data bits, 1-bit start
bit, 1-bit stop bit. This IO is input.
PIN5: Enable. This is “Enable” port of module, active low. This IO is input.
PIN6: Busy. It output “busy” signal during transmission and receiving, active low.
This IO is output.
PIN 7: for module of 433MHz type, this pin is reserved. This IO is input.
PIN 8: Frequency Setting Enable Port, active low. This IO is input.
8.2.3) INTERFACING DIAGRAM:
Figure 8-2
71
8.2.4) DATA RECPETION:
When valid data has been received by the module, demodulated data will be
transmitted serially from TXD automatically. Busy port maintains low level during
data frame transmission, and turns into high when data frame transmission has been
finished or no valid data has been received.
8.2.5) DATA TRANSMISSION:
Module of 915MHz type:
When the level of “Busy” indicates high, data could be directly feed into RXD
terminal in standard serial communication format in series. The module will
automatically switch into transmission status if the data input stops for approximately
10 ms long. In programming application, please stop for at least 15 ms.
During data transmission, “Busy” output remains low level, so please don‟t use serial
port for data transmission. Otherwise, it will be processed as invalid. When “Busy”
indicator is not in use, appropriate delay might be added prior to the transmission of
the next frame data after the transmission of the previous frame data is finished.
This module supports both transmission and reception of any hex data including ASCII
characters, Chinese character, etc. The data amount of single frame for this module is
limited into a threshold of 1byte~64 bytes. Any data that beyond this range will be
ignored.
“Busy” output is “strong pull-down” type which could bear a maximum current of up
to 20mA. It is allowed to insert LED and current-limiting resistor as indicator for data
transmission and reception between “Busy” port and VCC.
8.2.6) FREQUENCY SETTING:
PIN 8 shall remain low level during frequency settings. The frequency settings of
module can proceed during either data transmission or reception. It accepts 64
frequencies on this module and numbered from channel 0~63. The setting parameter is
“not so easily lost on power down”. Over 100,000 operations shall be settings of last
time. Set PIN8 to low level when the working frequency is to be set, then, feed hex
command “0xaf” and channel number continuously from serial port, the channel
number ranges from 0-63 in decimal (corresponding to 0x00-0x3f in hex). Numbers
input that exceed 63 will automatically be modified as 63. The results of frequency
setting will be returned from serial port which serves as the basis of valid operation.
After the frequency setting parameters are feed into serial port of module, PIN 6
(Busy) will indicate as low level and will resume to high level after setting is finished.
Setting PIN8 to high level after the frequency settings been finished (you may monitor
Busy indication) will lead you to the new status of data transmission and reception on
newly-selected frequency.
Frequency settings on each channel are shown as follows:
433M: 430.26M-439.71M
868M: 860.50M-869.95M
72
915M: 915.18M-924.63M
The difference between channels is 150 kHz, detailed channel frequency calculation
(take 915M channel as an example, other frequency settings have the same calculation
method but different initial frequency): f=915.18+channel number x 0.15 in MHz. The
above-mentioned frequency settings have dodged internal CDMA and GSM frequency
band, for export products, more frequencies can be provided for selection in
accordance with related standard of countries in which products with this module are
going to be sold.
73
Chapter 9
SOFTWARE TOOLS
74
Following applications are sued in our project in terms of programming the AVR
ATMega-16 Microcontroller.
AVR Studio 4
PonyProg 2000 version 2.06f
WinAvr
AVR libc
9.1) HOW TO COMPILE SOURCE CODE
Step#01
Open AVR Studio4 and create new project as defined in the diagram below.
Figure 9-1
75
Step#02
In Step 2 you need to select the appropriate platform. For programming of ATMega-
16 from an ISP, you need to select the AVR Simulator.
Select your device given in the AVR Studio4.
Note: You must select at least one platform to do the programming.
Figure 9-2
76
Step#03
Write your code in the following window.
Figure 9-3
Step#04
After writing the source code in AVR Studio4, you need to include directories and
libraries to the project which are been used in our source. In our case WinAVR and
AVR libc are two main libraries used.
77
Figure 9-4
78
Figure 9-5
79
Figure 9-6
80
Step#05
The Last step to this procedure is to build the project. In this if you have any errors in
the source code you have the bottom window to view these errors and warnings.
Figure 9-7
81
Figure 9-8
82
9.2) BURNING .HEX FILE INTO THE MICROCONTROLLER USING
PONYPROG
After the successful completion of HEX file generation, now you can use PonyProg
software to burn this .hex file into the microcontroller.
For doing so you need an ISP Cable, the circuit diagram of ISP Cable is given below.
Figure 9-9
Connect the ISP cable to the microcontroller development board, and open the hex
file using PonyProg, as mentioned in the diagram below:
83
Figure 9-10
Select the .hex file and press open, by doing you can see the FFFFF and 000000 sort
of coding on the screen which is yours .hex file.
Press write device button to write the hex file into the microcontroller board. You
must check that the controller you are programming must be selected before any read
write operation.
84
Figure 9-11
Press yes…..
85
Figure 9-12
86
Figure 9-13
After writing the code into the target controller, you can even read the controller by
using Read Device button.
87
Figure 9-14
88
APPENDICES
89
Appendix A
TIME AND COST
ANALYSIS
90
TIME AND COST ANALYSIS
Contents Time Cost
Sailing Boat(Designing
& Testing)
20 days Rs 5000
Controller Programmer 10 days Rs 2000
Servo Motor(
Understanding servo
mechanism & motor
purchasing)
30 days Rs 6000
Power supply(±5V &
75-80V)
15 days Rs 1000
Development board
(Designing & testing)
30 days Rs 500
Sensors 20 days Rs 8000
Hardware Assembly 40 days Rs 6000
GPS Module 15 days Rs. 4000
RF Module 10 days Rs. 2000
Miscellaneous 30 days Rs 4000
Total 250 days (working) Rs 38,500
91
Appendix B
DATASHEETS
92
Appendix C
REFERENCES
Capstone Project

More Related Content

Similar to Capstone Project

System%20 modelling%20and%20simulation
System%20 modelling%20and%20simulationSystem%20 modelling%20and%20simulation
System%20 modelling%20and%20simulationVivek Maurya
 
AIR BAG CRASH USING MEMS
AIR BAG CRASH USING MEMS AIR BAG CRASH USING MEMS
AIR BAG CRASH USING MEMS Ganesh Gani
 
design of FPGA based traffic light controller system
design of FPGA based traffic light controller systemdesign of FPGA based traffic light controller system
design of FPGA based traffic light controller systemVinny Chweety
 
DEVELOPMENT OF FIXED WING VTOL UAV.
DEVELOPMENT OF FIXED WING VTOL UAV.DEVELOPMENT OF FIXED WING VTOL UAV.
DEVELOPMENT OF FIXED WING VTOL UAV.IRJET Journal
 
IOT BASED NAUTICAL TRACKING SYSTEM
IOT BASED NAUTICAL TRACKING SYSTEMIOT BASED NAUTICAL TRACKING SYSTEM
IOT BASED NAUTICAL TRACKING SYSTEMIRJET Journal
 
Aircraft design trends and their impact on air cargo oriented aircrafts
Aircraft design trends and their impact on air cargo oriented aircraftsAircraft design trends and their impact on air cargo oriented aircrafts
Aircraft design trends and their impact on air cargo oriented aircraftsArjun Arayakandy
 
Voice over LTE report
Voice over LTE reportVoice over LTE report
Voice over LTE reportAnirudh Yadav
 
Design and Development of a Quadrotor – A Didactic Approach
Design and Development of a Quadrotor – A Didactic ApproachDesign and Development of a Quadrotor – A Didactic Approach
Design and Development of a Quadrotor – A Didactic ApproachIRJET Journal
 
Final Year Project report on quadcopter
Final Year Project report on quadcopter Final Year Project report on quadcopter
Final Year Project report on quadcopter Er. Ashutosh Mishra
 
Main project report on GSM BASED WIRELESS NOTICE BOARD
Main project report on GSM BASED WIRELESS NOTICE BOARD Main project report on GSM BASED WIRELESS NOTICE BOARD
Main project report on GSM BASED WIRELESS NOTICE BOARD Ganesh Gani
 
Report - Automated Sprayer Using Gantry Robot
Report - Automated Sprayer Using Gantry RobotReport - Automated Sprayer Using Gantry Robot
Report - Automated Sprayer Using Gantry RobotNaushir Miraz
 

Similar to Capstone Project (20)

MAJOR PROJECT
MAJOR PROJECTMAJOR PROJECT
MAJOR PROJECT
 
System%20 modelling%20and%20simulation
System%20 modelling%20and%20simulationSystem%20 modelling%20and%20simulation
System%20 modelling%20and%20simulation
 
AIR BAG CRASH USING MEMS
AIR BAG CRASH USING MEMS AIR BAG CRASH USING MEMS
AIR BAG CRASH USING MEMS
 
design of FPGA based traffic light controller system
design of FPGA based traffic light controller systemdesign of FPGA based traffic light controller system
design of FPGA based traffic light controller system
 
DEVELOPMENT OF FIXED WING VTOL UAV.
DEVELOPMENT OF FIXED WING VTOL UAV.DEVELOPMENT OF FIXED WING VTOL UAV.
DEVELOPMENT OF FIXED WING VTOL UAV.
 
Making of Drone
Making of  DroneMaking of  Drone
Making of Drone
 
IOT BASED NAUTICAL TRACKING SYSTEM
IOT BASED NAUTICAL TRACKING SYSTEMIOT BASED NAUTICAL TRACKING SYSTEM
IOT BASED NAUTICAL TRACKING SYSTEM
 
full report
full reportfull report
full report
 
final report
final reportfinal report
final report
 
Aircraft design trends and their impact on air cargo oriented aircrafts
Aircraft design trends and their impact on air cargo oriented aircraftsAircraft design trends and their impact on air cargo oriented aircrafts
Aircraft design trends and their impact on air cargo oriented aircrafts
 
Front
FrontFront
Front
 
Front Pages_pdf_format
Front Pages_pdf_formatFront Pages_pdf_format
Front Pages_pdf_format
 
Voice over LTE report
Voice over LTE reportVoice over LTE report
Voice over LTE report
 
Project report
Project reportProject report
Project report
 
Design and Development of a Quadrotor – A Didactic Approach
Design and Development of a Quadrotor – A Didactic ApproachDesign and Development of a Quadrotor – A Didactic Approach
Design and Development of a Quadrotor – A Didactic Approach
 
Final Year Project report on quadcopter
Final Year Project report on quadcopter Final Year Project report on quadcopter
Final Year Project report on quadcopter
 
Drone
DroneDrone
Drone
 
Main project report on GSM BASED WIRELESS NOTICE BOARD
Main project report on GSM BASED WIRELESS NOTICE BOARD Main project report on GSM BASED WIRELESS NOTICE BOARD
Main project report on GSM BASED WIRELESS NOTICE BOARD
 
Main cerificate
Main cerificateMain cerificate
Main cerificate
 
Report - Automated Sprayer Using Gantry Robot
Report - Automated Sprayer Using Gantry RobotReport - Automated Sprayer Using Gantry Robot
Report - Automated Sprayer Using Gantry Robot
 

Capstone Project

  • 1. i FINAL YEAR PROJECT REPORT AUTO-HELM CONTROL OF SAILING BOAT USING FUZZY LOGIC B.S Electronic Engineering, Batch 2006 Internal Advisor External Advisor Mr. Chandan Lal Mr. Danish Karim Iqbal Assistant Professor Design Engineer Electronic Engineering Deptt. R&D SSUET, KARACHI Saltec Powerlink Submitted by: Sajid Mahmood 2006-EE-075 Ahsan Qamar Hashmi 2006-EE-086 Daniyal Siddiqui 2006-EE-098 Abid Muhammad Jawaid 2006-EE-105 Zohaib Jamil 2006-EE-115 Syed Muneeb Raza Bukhari 2006-EE-609 DEPARTMENT OF ELECTRONIC ENGINEERING Sir Syed University of Engineering and Technology University Road, Karachi–75300 January, 2010
  • 2. ii SIR SYED UNIVERSITY OF ENGINEERING & TECHNOLOGY University Road, Karachi -75300, Pakistan. Tel: - 4988000-2, 4982393, 474583, Fax: (92-21) 4982393 http://www.ssuet.edu.pk The Faculty of Electronic Engineering Project Approval Project Title AUTO-HELM CONTROL OF SAILING BOAT USING FUZZY LOGIC Internal Advisor Mr. Chandan Lal (Assistant Professor ) External Advisor Engr. Mr. Danish Karim Academic Year 2006 Group Members: Sajid Mahmood 2006-EE-075 Ahsan Qamar Hashmi 2006-EE-086 Daniyal Siddiqui 2006-EE-098 Abid Muhammad Jawaid 2006-EE-105 Zohaib Jamil 2006-EE-115 Syed Muneeb Raza Bukhari 2006-EE-609 ____ The Department of Electronics Engineering Sir Syed University of Engineering & Technology has approved this Final Year Project. The Project is submitted in partial fulfillment of the requirements for the degree of Bachelor of Science in Electronic Engineering. Approval Committee: (Asst. Prof. Mr. Chandan Lal ) (Engr. Mr. Danish Karim Iqbal) Internal Advisor External Advisor (Muhammad Sharif ) (Dr. Bilal Ahmed Alvi) FYP Committee Incharge Chairman EE Department January/ 2010
  • 3. iii ACKNOWLWDGEMENT We are thankful to Almighty Allah, most beneficial and most merciful, for giving us the courage and devotion to work on the assigned project successfully within due course of time in the field of Electronic Engineering. To acknowledge the efforts and devotion of those people, who have helped us during our project, is perhaps, the most important part of this report. Although we can’t pay proper homage to their devotion and dedication to ourselves and to our project, but we consider their right that their names and efforts should go in history with our project. First we would like to sincerely mention all the efforts of Assistant professor Mr. Chandan Lal has made on us for us to accomplish this major task which probably the biggest project of our lives yet. He has helped us during the entire course of this project. It would not be improper to say that the project could not see its final shape without his help and assistance. We have found him humble and cooperative in every aspect. He has not only helped us in our project but also acted as a source for character building. We also wish to express our gratitude to all the staff in the University and our development and trial areas, Baharia Foundation, National Sailing Centre and PAF Yacht Club for facilitating us in all possible manners. And last but not the least we acknowledge the efforts of our external advisor Engr. Mr. Danish Karim Iqbal, our batch mates Mr. Syed Kamran Ahmed and Mr. Muhammad Fahad Wallam who have helped us throughout the project and have shared their knowledge and skills with us.
  • 4. iv SYNOPSIS This project demonstrates an Automated Sailboat Control based on Fuzzy Controls. While it also provides the Manual Controlling feature that may increase the Scalability of the System. Implementations of various Controls are done using Fuzzy controls. Other parameters should be controlled using ordinary control techniques. Advanced sensing techniques must be practiced in order to automate the Sail boat. Navigation and Path Determination of the boat should be done using Global Positioning System (GPS). Use of Servo Motors to perform functions like Sail and Rudder Trim should be done. Radio Frequency transmission using RF Transceivers should be done in order to Monitor the Boat Parameters and also provide Path feedback Experiments with a scale prototype show the ability of a fuzzy controller to govern the rudder and trim the sails on a sailboat. Helm is the term used to describe the Steering Mechanism of the boat. A significant advantage of this project is the use of Wind Energy for the propulsion of the boat. This might be the initial step for the awareness of sailing at the grass route level in Pakistan and as well as in the other neighboring countries. Participation in International Events held across the Globe could be made possible. Heuristics involved in this Sport can easily be understood using the prototype. Participation of Under-Developed Countries in this expensive Sport can be made possible.
  • 5. v TABLE OF CONTENTS ACKNOWLWDGEMENT iii SYNOPSIS iv TABLE OF CONTENTS v LIST OF FIGURES ix Chapter 1 INTRODUCTION 1 1.1 GOALS AND OBJECTIVE 2 1.2 SYSTEM STATEMENT OF SCOPE 2 1.3 LIST OF COMPONENTS 3 Chapter 2 INTRODUCTION TO SAILING 5 2.1 INTRODUCTION 6 2.2 THEORITICAL BACKGROUND 6 2.3 SAILING BOAT 6 2.4 HOW TO SAIL A BOAT? 7 2.5 RULES FOR SAILING 10 2.6 CARE FOR SAILING EQUIPMENT 14 2.7 SAILING TERMS AND IT’S MEANING 16 Chapter 3 AUTOMATION OF SAILING BOAT 18 3.1 INTRODUCTION 19 3.2 HISTORY 19 3.3 OVERVIEW 19 3.4 OBJECTIVE 19 3.5 BACKGROUNDS OF PROJECT 19 3.6 ALGORITHM BEHIND AUTOMATION 20 3.7 DEFINITION OF NO-GO AREA 21 3.8 FUZZY LOGIC WITH RESPECT TO OUR PROJECT 21 3.8.1 FUZZY SETS 21
  • 6. vi 3.8.2 FUZZIFICATION 21 3.8.3 RULE EVALUATION 22 3.8.4 DEFUZZIFICATION 22 3.9 KEY FEATURES 22 Chapter 4 SYSTEM DESCRIPTION 23 4.1 INTRODUCTION 24 4.2 SYSTEM ARCHITECTURE 24 4.3 SYSTEM ARCHITECTURE FOR END USER 25 4.4 SYSTEM ARCHITECTURE OFF SHORE 29 4.5 SUBSYSTEM OVERVIEW 30 4.5.1 OFF SHORE STATION 30 4.5.1.1) MAIN CIRCUIT DIAGRAM 30 4.5.1.2) GPS INTERFACING 31 4.5.1.3) DC MOTOR INTERFACING 32 4.5.1.4) ANEMOMETER INTERFACING 32 Chapter 5 FUZZY CONTROLLING LOGIC 34 5.1 INTRODUCTION 35 5.2 FUZZY CONTROLLING LOGIC 35 5.3 DEGREES OF TRUTH 35 5.4) OVERALL STRUCTURE 35 5.5) FUZZIFICATION 36 5.6) RULE EVALUATION 37 5.7) DEFUZZIFICATION 38 Chapter 6 DESCRIPTION OF ELECTRONIC COMPONENTS 39 6.1 INTRODUCTION 40 6.2 ATMEGA-16 8-bit MICROCONTROLLER 40 6.2.1) OVERVIEW 40 6.2.2) FEATURES 40 6.2.3) PIN CONFIGURATION 42 6.2.4) BLOCK DIAGRAM 43
  • 7. vii 6.2.5) PIN DESCRIPTION 43 6.3) DC GEAR MOTOR 45 6.4) SERVO MOTOR 45 6.5) MAX-232 DUAL RECIEVER 47 6.5.1) INTRODUCTON 47 6.5.2) PIN CONFIGURATION 48 6.5.3) FUNCTION TABLES 48 6.5.4) LOGIC DIAGRAMS (POSITIVE LOGIC) 49 6.5.5) APPLICATION INFORMATION 49 Chapter 7 NAVIGATIONAL MODULE 50 7.1 INTRODUCTION 51 7.2 HOLUX M-89 GPS MODULE 51 7.2.1) HISTORY 51 7.2.2) KEY FEATURES 51 7.2.3) APPLICATIONS 52 7.2.4) BLOCK DIAGRAM 52 7.2.5) PIN DEFINATION 53 7.3 NMEA Data Protocol 54 7.3.1) THE PROTOCOL 54 7.3.2) HARDWARE CONNECTION 55 7.3.3) NMEA SENTENCES 56 7.3.4) NMEA INPUT 59 7.3.5) DECODE OF SELECTED POSITION SENTENCES 60 7.3.6) DECODE OF SOME NAVIGATION SENTENCES 63 7.3.7) OTHER SENTENCES THAT MAY BE USEFUL 66 Chapter 8 TRANSMISSION MODULE 68 8.1 INTRODUCTION 69 8.2 WIRELESS RF TRANCIEVER 69 8.2.1 HISTORY 69 8.2.2 PIN DEFINATION 69
  • 8. viii 8.2.3 INTERFACING DIAGRAM 70 8.2.4 DATA RECPETION 71 8.2.5 DATA TRANSMISSION 71 8.2.6 FREQUENCY SETTING 71 Chapter 9 SOFTWARE TOOLS 73 9.1 HOW TO COMPILE SOURCE CODE 74 9.2 BURNING .HEX FILE INTO THE MICROCONTROLLER USING PONYPROG 82 APPENDICES Appendix A: TIME AND COST ANALYSIS Appendix B: DATASHEETS Appendix C: REFERENCES
  • 9. ix LIST OF FIGURES Figure 2-1 Sailing Boat 6 Figure 2-2 Sailing Restriction Map 7 Figure 2-3 Stern 10 Figure 2-4 Tacks 11 Figure 2-5 Rule No.1 11 Figure 2-6 Rule No.2 12 Figure 2-7 Rule No.3 13 Figure 2-8 Rule No.4 13 Figure 2-9 Rule No.5 14 Figure 3-1 Automation Algorithm 20 Figure 4-1 System Architecture 24 Figure 4-2 System Architecture for End User 25 Figure 4-3 Graphical user Interface 27 Figure 4-4 Microsoft Access Data Base 28 Figure 4-5 System Architecture Off Shore 29 Figure 4-6 Main Circuit Diagram 30 Figure 4-7 GPS Interfacing 31 Figure 4-8 DC Motor Interfacing 32 Figure 4-9 BMS 33 Figure 5-1 Software Fuzzy Interface Unit 36 Figure 5-2 Two Input Member Function 37 Figure 6-1 Microcontroller 40 Figure 6-2 Pin Configuration 42 Figure 6-3 Block Diagram 43 Figure 6-4 DC Gear Motor 45 Figure 6-5 Servo Motor 46 Figure 6-6 Servo motor 46
  • 10. x Figure 6-7 Function of Servo motor 47 Figure 6-8 MAX-232 48 Figure 6-9 Logic Diagrams 49 Figure 6-10 Application Information 49 Figure 7-1 HOLUX M-89 GPS Module 51 Figure 7-2 Block Diagram 52 Figure 7-3 Pin Definition 53 Figure 8-1 Wireless RF Transceiver 69 Figure 8-2 Interfacing Diagrams 70 Figure 9-1 AVR Studio 4 (Step 1) 74 Figure 9-2 AVR Studio 4 (Step 2) 75 Figure 9-3 AVR Studio 4 (Step 3) 76 Figure 9-4 AVR Studio 4 (Step 4) 77 Figure 9-5 AVR Studio 4 (Step 4) 78 Figure 9-6 AVR Studio 4 (Step 4) 79 Figure 9-7 AVR Studio 4 (Step 5) 80 Figure 9-8 AVR Studio 4 (Step 5) 81 Figure 9-9 Parallel Port Interfacing 82 Figure 9-10 PonyProg (Step 1) 83 Figure 9-11 PonyProg (Step 2) 84 Figure 9-12 PonyProg (Step 3) 85 Figure 9-13 PonyProg (Step 4) 86 Figure 9-14 PonyProg (Step 5) 87
  • 12. 2 1.1) GOALS AND OBJECTIVE: Significant goals and objective of this project is the use of Wind Energy for the propulsion of the boat. This might be the initial step for the awareness of sailing at the grass route level in Pakistan and as well as in the other neighboring countries. Participation in International Events held across the Globe could be made possible. Heuristics involved in this Sport can easily be understood using the prototype. Participation of Under-Developed Countries in this expensive Sport can be made possible. 1.2) SYSTEM STATEMENT OF SCOPE: Control the dissolution apparatus using microcontroller. The apparatus technician controls the apparatus using microcontroller. Manual Input from the user is transmitted through RF transmitter, where it is received at RF receiver, identified and relayed to the controller then controlling done. While automation inputs are from rudder and sail trim then controlling is done as describe above The input to the system is from the user and input automation parameter of boat (i.e. Rudder, GPS and Anemometer). The output of the system is the processed signal to the controller. This module can be motors for sail and rudder. Major Inputs and Outputs: Rudder In basic form, a rudder is a flat plane or sheet of material attached with hinges to the craft's stern, tail or after end. Often rudders are shaped so as to minimize hydrodynamic or aerodynamic drag. Here rudder is a both input and output part. GPS Global Positioning System is used to navigate the boat along the ocean; GPS provide accurate longitude and latitude information using NMEA Protocol Format.
  • 13. 3 Anemometer It is a custom made anemometer based on Potentiometer that provide voltages from 0-5v that can be decoded using Analog to digital Converter and can be used to detect the direction of the air as the air strikes it and make it rotate. Sail Trim Sail trim is term used to describe the control of sail; while in case of sail we are using a geared dc motor that can produce high torque when there is enormous applied of air pressure on the sail. BMS Battery Management System also provides Indication for low battery and would also help us for the efficient use of Battery Power. 1.3) List of Components SAILING BOAT ASSEMBLY • HULL (FIBER GLASS) • RUDDER • CENTER BOARD • MAST • SAIL • MECHANICAL COIL Electronic Components • AVR MICROCONTROLLER (ATMEGA-16) • TTL-RS 232 Level Converter (MAX 232) • ROTARY ENCODER (Slotted Disc and Opto-coupler, U-type) • GPS (M-89)
  • 14. 4 • RF TRANSCIEVER (CY2196R) • DC GEAR MOTOR • RC SERVO MOTOR (FUTABA S3003) • RELAYS (12V DC) • ANEMOMETER(Free-End Potentiometer) • OPTOISOLATER (2N35)
  • 16. 6 2.1) INTRODUCTION: In this chapter we discuss about sailing boat. What is Sailing Boat, How to sail a boat, What are the rules that are to be followed during sailing of a boat, care methods during sailing boat, different terms of sailing and terms of sailing boat. 2.2) THEORITICAL BACKGROUND: Sailing has been for long times the only means of ship propulsion at sea. Although the performance of a sailing vessel is well below the present power driven ships, either in terms of navigation speed and predictability, wind energy is absolutely reusable, clean and free. Sailing boats may exhibit a virtually unlimited autonomy and be able to perform unassisted missions at sea for long periods of time. Promising applications include oceanographic and weather data collecting, surveillance and even military applications. 2.3) SAILING BOAT: Figure 2.1
  • 17. 7 A sailboat or sailing boat is a boat propelled partly or entirely by sails. The term covers a variety of boats, larger than small vessels such as sailboards and smaller than sailing ships, but distinctions in size are not strictly defined and what constitutes a sailing ship, sailboat, or a smaller vessel (such as a sailboard) varies by region and culture. 2.4) How to Sail a Boat Figure 2-2 The wind has four different effects on a sailboat, which must be understood by the amateur sailor before he can begin to see why his boat performs differently under different conditions of wind and sailing course.
  • 18. 8 The wind drives the boat ahead-most important of all; it also drives it laterally or, to speak in a nautical term, causes it to "make leeway"; it heels the boat over, and lastly, turns it around, according to the balance of her sails, distribution of weight, and what is known as the "center of lateral resistance." The proper handling of sails and rudder is what enables the sailor to so utilize these effects of the wind that he may sail his boat in any direction. The propelling effect is the one most utilized, and it is for this reason that every boat is constructed to offer the least resistance to its forward movement with as little friction as possible. Leeway is one effect to be avoided, and for this purpose boats are given either deep, stationary keels or centerboards, or some other device for providing an extensive lateral surface below the water. Heeling and the stability of a boat go hand in hand. The boat must be prevented from capsizing, and this is done either by putting lead or iron on the keel, or carrying ballast in the hull in order to lower the center of gravity, or by building a broad and shallow boat such as the cat boat, which is very stiff in a breeze and does not heel readily, but when a certain point has been reached, is apt to capsize quickly in the hands of an unskillful sailor. The fourth effect is that of turning the boat around. This is done when the center of effort on the sails does not come on a line with the center of lateral resistance. This is always the case in a poorly balanced boat. A well-balanced boat requires very little movement of the rudder to hold to a course. Any novice can understand how a sailing boat can travel with the wind, but why it should go forward when the sails are close hauled is a question of dynamics which we will not try to explain in this short article. An easily understood explanation of why boats go ahead instead of sideways can be made by taking a V-shaped block of wood and pressing it between the thumb and forefinger. If sufficient force is used it shoots forward quickly. The thumb may be likened to the wind and the forefinger to the water on the opposite side of the boat. The pressure caused by the wind pushing the boat against the water on the opposite side causes the boat to go forward. The center of effort and center of lateral resistance must be understood in the handling of a sailboat. The center of effort is the center of the total sail area. If, for example, this comes forward of the center of lateral resistance when the boat is sailing with the wind abeam, then the side pressure on the sails will turn the boat's bow in the direction toward which the wind is blowing, or away from the wind, and a boat doing this is said to carry a "lee helm." On the other hand, if the center of lateral resistance is farther forward than the center of effort, the wind will swing the boat in the direction in which it is blowing, thus throwing the bow up into the wind. A boat doing this is said to carry a weather helm. Every sailing boat should be so rigged as to carry a little weather helm, as, if struck by a squall under those conditions, it will luff quickly up into the wind and so be in safety, while if the lee helm is carried, the boat will fall off before the wind, presenting a broadside to wind and wave which is very apt to cause it to capsize.
  • 19. 9 Too much weather helm is also to be avoided, as it makes it necessary to keep the rudder over at a sharp angle and retards the progress of the boat. To reduce weather helm, move the ballast aft or shorten the after canvas, or increase the forward canvas by setting a larger jib. If a boat carries a lee helm, shift the ballast forward or reduce the area of the head canvas. In considering the action of the rudder, the amateur sailor should bear in mind that as the boat is turned by the rudder, it swings as on a pivot. The water, pressing against one side of the rudder, pushes the stern of the boat away from that side. The pivot or turning point is always well forward of the center. This is a fact that should be remembered when steering close to a boat or other object. Don't delay turning out of the way too long, or the very act of turning your boat will throw the stern over sufficiently to cause the collision you are trying to avoid. Running before the wind may look like the ideal course to the amateur sailor, but a little experience cures him of that belief. Steering is difficult when running with the wind aft, especially in rough water, and there is danger of the sail gybing over when least expected. Except on smooth water it is better to haul the boat up so as to have the wind on the quarter, and after following that course for some distance, to "take the other track", gybe over so as to bring the wind on the other quarter. The proper location or direction of the boom, or, in a nautical term, how the sail should be trimmed is of supreme importance. The wind on the quarter, the wind abaft the beam, the wind abeam or directly at right angles with the boat, and the wind forward of the beam. are what are known as favorable winds, the sheet being hauled in such proportion as to give the best results. These positions all refer to a boat when it is what is termed "sailing free." To sail "close hauled" means to bring the boat up as close into the wind as possible and still keep it on its course, with the wind filling the sail so as to drive it forward. A properly built boat will lie within four or four and a half points of the wind, while some, especially those built on racing models, will do even better than this. Figure 6 shows about the proper location of the boom when sailing close hauled. The wind striking the sail at this angle will drive the boat forward and maintain a reasonable degree of speed, while to haul it closer would increase the leeway until, if the sail were hauled parallel with the keel, the only progress made would be to leeward. Most boats will sail closer to the wind in smooth water than in a rough sea. When sailing close hauled, it is necessary to hold the boat on a course that will just nicely keep the sail filled with wind. This point can be ascertained by putting the helm slowly to the leeward. As soon as the sail begins to shake near the head, you have reached a point where it is not drawing as much as it should, and, if the helm is kept down, the sail will begin to flap in the wind and the boat will lose headway. A little practice will enable an amateur skipper to see the beginning of this "tremble" in the sail, and at the first symptoms he must reverse the helm until the wind fills the sails fairl
  • 20. 10 2.5) RULES FOR SAILING There are five basic rules of the road for small sailing boats to decide who has the "Right-of-Way" so that each boat's skipper (driver) will know what to do to avoid a collision. When sailing the words "left" and "right" in reference are replaced with "port" and "starboard". It is important to remember which is which since the rules of the road for sailings rely on using these words to assign right-of-way. You might be able to remember this by noticing that the letter "R" appears twice in the word "starboard", and only once in "port". Then since "right" begins with "R", you will know that the right hand side of the boat when facing forward is the starboard side. Figure 2.3 The next item to remember is the word "tack" and how it is used to describe which side of the boat the wind is blowing from. As seen in the illustration below, if the wind is coming from the right hand side of the boat, and the sail is on the left side, the boat is on a starboard tack. When the wind and sail are reversed, the boat is on a port tack.
  • 21. 11 Figure 2.4 Rule Number 1: When two sailboats are approaching each other and are on different tacks, the boat on the starboard tack has the right-of-way over the boat which is in the port tack. In the illustration below, boat “A” on the port tack, must turn to avoid boat “B” on the starboard tack. Figure 2.5 Rule Number 2: When two sailboats are approaching each other and are on the same tack, the leeward boat has the right-of-way over the windward boat. Another way to say this is to say that the boat closer to the wind source must keep clear. The boat further from the
  • 22. 12 wind source has the right-of-way. In the illustration below, boat “B” is the windward boat and must turn to avoid boat “A” which is leeward. Figure 2.6 Rule Number 3: A sailboat that is staying on a tack has the right-of-way over a sailboat that is tacking or jibing. A simpler way to say this is to say "make sure you have room to complete a tack or a jibe without interfering with any other boats before doing so". Make sure that you can see clearly in all directions to ensure you have room. In the illustration below, boat "A" must ensure that it leaves plenty of room to avoid boat "B", who has the right-of-way, since boat "B" is continuing on its tack. However, in the event that boat "A" was unable to tack due to the proximity of "B", remember that "A" is the leeward boat so therefore could tell boat "B" to give room to tack, but would lose this right of way as soon as they actually began to tack.
  • 23. 13 Figure 2.7 Rule Number 4: Any sailboat that is overtaking a slower boat from behind must steer clear of the slower boat and give right-of-way. The slower boat should hold its course and allow the faster boat to pass. In the illustration below, boat "A" is a faster boat, and must steer around the slower boat "B", who should remain on the same course. Figure 2.8
  • 24. 14 Rule Number 5: Most of the time sailboats have the right-of-way over power boats. Since most powerboats are more easily maneuverable than sailboats, they must steer clear. This is not always the case however. Larger power boats are sometimes steering in the deep channel of the area, and cannot leave the channel. In this case the sailboat does not have right-of-way, and must avoid impeding the progress of the larger vessel. Many larger power boats cannot simply stop quickly or easily turn to avoid a small sailboat, so it is in the sailor's best interest to steer well clear of these larger boats. In the illustration below, the powerboat "A" must turn to avoid the sailboat "B", who has the right-of-way. Figure 2.9 2.6) Care For Sailing equipment: • Drain and dry the boat: The first thing you should do when your boat is back on shore is to open the portholes and drain bungs. Always leave the boat with the drain bungs open and the portholes open, so the flotation tanks can dry out completely. Prop the boat up if needed to ensure the drain holes are the lowest point. You can place a piece of carpet on the ground under the transom, and raise the bow of the boat onto a sawhorse or support. Remember to close all drain holes before putting the boat back in the water. • Organize your gear: Keep the hatches, drain bungs and other loose gear in one place, so you know they will always be there. After sailing, and after rinsing out or washing, and drying your sailing gear, put it back in a gear bag. It is frustrating to show up at the lake on a gorgeous day, only to discover that you left your sailing boots or some other piece of important gear, at home.
  • 25. 15 • Sail care: You can leave the mainsail on the boom, if you will be sailing the boat again soon. Roll up the main from the head, perpendicular to the luff, so that it ends up in a roll parallel to the boom. Also roll the jib up, put it inside the jib bag, and leave that in the boat. All sails should be removed from the boat if it is to be trailed or stored out of the water for any length of time. All sails should be dried and folded or rolled and placed in sail bags ready for the next launch. • Centerboard care: Leaving the board resting on the trolley or trailer may damage the leading edge, and you want your slot gaskets left flat (in the normal closed position), so they do not take on a permanent bend. If the centerboard up control does not have a shock cord take up, you can put the line into a cleat, so the board is held all the way up, in the centerboard trunk. Remove the dagger board completely from it's slot. • Rudder care: Lay the rudder in the boat, or buy or make a rudder bag and put the rudder blade in the bag as one of the first steps in derigging the boat. Also check your rudder fittings. There should be no play in them. • Rig: If leaving the boat with the mast rigged leave the boat with a little rig tension to support the mast, but not so much as to load up the boat. • Cover: The boat should be covered with a good top cover that shields the boat from UV radiation. If the cover has holes in it, fix it or replace it. Figure out how to support the cover so that water does not collect in it. • Salt: Rinse salt water off the boat, rinsing out blocks, lines and once in awhile, inside the tanks. If the tanks ever leak, you get salt in the tanks, and you will want to rinse that out from time to time. • Turnbuckle grease: If you have adjustable angle spreaders, lubricate the adjusters. Use turnbuckle grease. If you don't lubricate these the stainless steel threaded part will permanently bond to the aluminum, and you will not be able to adjust them ever again. • Inspections: From time to time complete a visual inspection of your boat. There are lots of highly loaded areas on a small sailboat. The chain plates are among them. Check where your shrouds and forestay or jib halyard attach to the hull. Watch for cracks that could let water into wooden reinforcements. Heavily loaded fasteners should be epoxied into the boat. From time to time take your centerboard out of the boat and check both centerboard and rudder for dings, cracks etc. Pay particular attention to the centerboard bolt hole. If the bolt hole has been damaged such that water can get in,
  • 26. 16 wooden cored boards will soak up water, start to rot and will be weakened. Seal all bare wood with epoxy. Anytime you run aground you should check the centerboard. Inspect all lines from time to time, replace worn lines. 2.7) SAILING TERMS AND IT’S MEANING: Abeam 90° (perpendicular) to the side of the boat. Aft Towards the Stern or rear of the boat. Ahead Towards the front of the boat. Aloft Towards the top of the mast. Astern Actually behind the boat. (Aft can mean on the boat but at the rear) Bailer A bucket or scoop used to remove water from the cockpit. Block Nautical word for pulley. Centerline An imaginary line from the bow of the boat, to the center of the stern. Draft The depth of water required to float your boat. On a small sailboat, draft can vary from the length of the centre board (or daggerboard) to a few inches if the boat outfitted with a movable centre board (or removable daggerboard) and a kick-up rudder. Ease To let out the sails. Give-Way Vessel The boat which changes course because it does not have the right of way. Heel The degree of sideways tilt caused by wind on the sails or balance of weight in the boat.
  • 27. 17 Leeward Away from the wind (downwind). Luffing The flapping of the sail when not properly trimmed or when the boat is in irons. Stand-On-Vessel The boat which does not change course because it has the right of way. Trim To pull the sails in towards the wind. Windward Towards the wind (upwind).
  • 29. 19 3.1) INTRODUCTION: In this chapter we will discuss about the basic concept of our Project then we will discuss about automation of Sailing Boat and project‟s key features. 3.2) HISTORY: Sailing has been for long times the only means of ship propulsion at sea. Although the performance of a sailing vessel is well below the present power driven ships, either in terms of navigation speed and predictability, wind energy is absolutely reusable, clean and free. Sailing boats may exhibit a virtually unlimited autonomy and be able to perform unassisted missions at sea for long periods of time. Promising applications include oceanographic and weather data collecting, surveillance and even military applications. 3.3) OVERVIEW: Automation of sailboat is a very nonlinear and time-variant problem, and modeling ship dynamics considering all real phenomena is a very complex task. Besides, it has to compensate for stochastic disturbances acting upon it, such as wind, waves and currents. Heuristics in sailing plays an important role: sailing rules obtained from skippers can be included in a knowledge base to govern the boat correctly in different conditions. Besides that Sailing is an Olympic class Sport played around the world. Automation of such a kind would develop interest in the people of our Country to actively participate in this Sport. 3.4) OBJECTIVE: A significant advantage and objective of this project is the use of Wind Energy for the propulsion of the boat. This might be the initial step for the awareness of sailing at the grass route level in Pakistan and as well as in the other neighboring countries. Participation in International Events held across the Globe could be made possible. Heuristics involved in this Sport can easily be understood using the prototype. Participation of Under-Developed Countries in this expensive Sport can be made possible. 3.5) BACKGROUNDS OF PROJECT: Sailing is the art of controlling a boat with large pieces of canvas cloth called sails. By changing the rigging, rudder, and dagger or centre board, a sailor manages the force of the wind on the sails in order to change the direction and speed of a boat. Mastery of the skill requires experience in varying wind and sea conditions, as well as knowledge concerning sailboats. The subjection of Automation of Sailing boats will provide an innovative solution to this Sport. The popularity of Sailing will certainly be increased with the help of these types of Projects. Involvement of Control Electronics will certainly produce amazing results and highly sophisticated Control Systems.
  • 30. 20 3.6) ALGORITHM BEHIND AUTOMATION Since Global Positioning System is used for navigation. It provides information like Longitude, Latitude, heading and speed etc. These values are the main inputs to the navigational system of our project. The basic algorithm behind the automation is the use of these longitude and latitudes to produce a straight between destination and current location. Then from this equation of line we can determine the coordinates of the actual path and then compare it to the values from GPS. By differentiating both the vales we can determine the bearing in which the boat has to move in order to follow the given path. Figure 3-1
  • 31. 21 3.7) Definition of No-Go Area In automation of a sailing boat the first thing that is supposed to make the boat understand is the wind direction. A sailing boat cannot work into the wind. There are certain limitations for a sailing boat to properly steer along the water. These limitations can be manipulated using values from the Anemometer (in our case). No-Go Area Zone (Refer to figure 2.2) 3.8) FUZZY LOGIC WITH RESPECT TO OUR PROJECT Fuzzy logic is a form of multi-valued logic to deal with reasoning that is approximate rather than precise. Similarly our system works in the same procedure that it does not have precise conditions to operate the system. Therefore we require approximate functions to deal with our system. These functions requires fuzzification and Defuzzification as we have gone through system and have produced following functions on the basis of rules, determined from the system behavior. Thus creating a knowledge base. 3.8.1) FUZZY SETS Our system has three crucial inputs and two crucial outputs. Input Membership Function Anemometer= MFA MFA = {MFA1, MFA2, MFA3, ……….., MFA26} Rudder = MFIR MFIR = {MFIR1, MFIR2, MFIR3, MFIR4, MFIR5} Sail = MFIS MFIS = {MFIS1, MFIS2, MFIS3, MFIS4, MFIS5} Output Membership Functions Rudder = MFOR MFOR = {MFOR1, MFOR2, MFOR3, MFOR4, MFOR5} Sail = MFOS MFOS = {MFOS1, MFOS2, MFOS3, MFOS4, MFOS5} 3.8.2) FUZZIFICATION The fuzzification comprises the process of transforming crisp values into grades of membership for linguistic terms of fuzzy sets. The membership function is used to associate a grade to each linguistic term.
  • 32. 22 3.8.3) RULE EVALUATION The rule evaluation process uses a list of linguistic rules from the knowledge base to perform inference in the fuzzy domain. The inputs to this process are the fuzzy inputs from the fuzzification process. 3.8.4) DEFUZZIFICATION Defuzzification is the process of producing a quantifiable result in fuzzy logic. Typically, a fuzzy system will have a number of rules that transform a number of variables into a "fuzzy" result, that is, the result is described in terms of membership in fuzzy sets. 3.9) KEY FEATURES: This project provides robust features from the Automation till its Monitoring. State of the Art Control Techniques, Complex manipulation of Time variant Analog Values and Optimized Sensing are included in the basic features of this boat. Implementation of Fuzzy Logic on the control system Auto Piloting and Manual Navigation Real Time Tracking and Monitoring Path Logging which will provide a record of past surveyed Longitudes and Latitudes Battery Management System Efficient use of Wind Energy Replacement of Human Sailor
  • 34. 24 4.1) INTRODUCTION: This section will provide an overview of the system model, its constituent‟s parts and major data objects and their relationship that flows in the system. Data object is any data that is being transformed by our system. 4.2) SYSTEM ARCHITECTURE: Figure 4-1
  • 35. 25 4.3) SYSTEM ARCHITECTURE FOR END USER: Figure 4-2
  • 36. 26 End User is subjected to the following components that are provided either to monitor or to control the sailing boat. These components include: Base Station circuitry RF-Module MAX-232 Power Supply Personal Computer Visual Basic o Monitoring  Rudder Position  Sail Position  Wind Direction  Battery Level  Longitude  Latitude  Speed  Heading o Controlling  Rudder  Sail
  • 37. 27 GRAPHICAL USER INTERFACE The following is the Human Machine Interface which is being used in our system which provides visual display from all the sensors and feedback values and it all enables us to manually control the Boat. The Data Base is also connected with this GUI/HMI. Figure 4-3
  • 38. 28 MICROSOFT ACCESS DATA BASE A constant stream of data from microcontroller in the form of command byte is sent to the base station in the following format: $ Rudde r Anemomete r Sail Positio n Tim e Latitud e Longitud e Headin g Speed * The above defined format is received and saved in the data base in the Microsoft Access Data Base in their respective fields. Figure 4-4
  • 39. 29 4.4) SYSTEM ARCHITECTURE OFF SHORE: Figure 4-5 For further details review the base station and off shore station section
  • 40. 30 4.5) SUBSYSTEM OVERVIEW: 4.5.1) OFF SHORE STATION 4.5.1.1) MAIN CIRCUIT DIAGRAM Figure 4-6
  • 42. 32 4.5.1.3) DC MOTOR INTERFACING: Figure 4-8 4.5.1.4) ANEMOMETER INTERFACING: A free end potentiometer is used with a wooden assembly. The output of the potentiometer is connected to the ADC of the microcontroller. It gives a particular value at different angles which is used to calculate the wind direction.
  • 43. 33 RUDDER FEEDBACK: The position of rudder is decoded from the potentiometer installed in a servo package i.e. built in. The analog voltage across this potentiometer is then feedback to the 8-bit ADC of the microcontroller. SAIL TRIM FEEDBACK: Feedback of sail is coming from the opto-coupler which is connected with the DC motor. It is counting the count that how much the sail is loosed or tight. The programming is interrupt based. BMS FEEDBACK: An Operational Amplifier is used to measure the voltage level of the system battery. The configuration used in Op-Amp is Differential Amplifier with a gain of Unity. Figure 4-9
  • 45. 35 5.1) INTRODUCTION: In this chapter we will discuss about fuzzy controlling logic. It contains what is fuzzy what are it‟s degree of operation, structure, fuzzification rule to evaluation fuzzification and defuzzification with rules to evaluate. 5.2) FUZZY CONTROLLING LOGIC: Because of its association with neural networks and artificial intelligence, many people expect fuzzy logic to require complex algorithms and lots of processing horsepower. Surprisingly, even a small 8-bit microcontroller can be programmed to perform fuzzy logic inference. This can perform tasks in milliseconds. This speed is appropriate for many common control applications, and the small program size can easily fit within the budget of a small MCU system. This paper discusses the requirements of fuzzy logic and describes the structure of a general purpose fuzzy inference program that is suitable for use in small 8-bit microcontroller systems. 5.3) DEGREES OF TRUTH: Fuzzy logic derives its power from the concept of partial degrees of truth. Unlike Boolean logic where a given input level either is or is not a member of a selected set, fuzzy logic allows an input value to be a partial member of a set. In fact the same input value can be a partial member of an overlapping set at the same time. For example, the temperature 50°F can be both COLD and COOL at the same time. In Boolean logic, truth can be represented by a single bit with one representing true and zero representing false. In fuzzy logic, truth can be represented by an 8-bit value in the range $00 (0 or completely false) to $FF (0.996 or completely true). The second powerful concept in fuzzy logic is that of linguistic variables. Linguistic variables allow rules to be stated in a language that closely resembles natural language. This allows an application expert to describe a system in familiar terms without requiring knowledge of computer programming. These two important concepts are tied together by membership functions. An input membership function describes the meaning of a linguistic label by providing a mapping of truth values for all possible values of the input. Typically trapezoids are used for input membership functions because they satisfy the need for a gradual change from false to true without requiring much memory space. A trapezoid can be defined by two 8-bit points and two 8-bit slopes. Output membership functions typically use simpler singletons to relate a linguistic label to a specific output value. The corresponding fuzzy output determines the height (weight) of the singleton. 5.4) OVERALL STRUCTURE: As shown in Figure #, a software fuzzy inference unit (nu) consists of three main parts. Each of these subprograms has an associated data structure in a
  • 46. 36 knowledge base. All application specific information is contained in the knowledge base which is developed independently from the fuzzy inference program. Figure 5-1 (Software Fuzzy Interface Unit) The fuzzification process uses membership functions from the knowledge base to transform system input values, such as a binary value from a temperature sensor, into fuzzy input values. The fuzzy input values are stored in RAM for use in the following rule evaluation subprogram. The rule evaluation process uses linguistic rules from the knowledge base to produce fuzzy outputs based on the current values of fuzzy inputs. The fuzzy outputs are stored in RAM for use by the last process in the fuzzy inference program. The final defuzzification process uses output membership functions from the knowledge base to resolve the fuzzy outputs into a single system output. The system output is a weighted average of the fuzzy outputs. 5.5) FUZZIFICATION: The first process in a fuzzy inference unit takes us out of the domain of crisp input values like 50°F and into the fuzzy domain where fuzzy inputs (RAM variables) describe the degree to which linguistic expressions are true. The key to this translation is the input membership function which provides a numerical meaning to a linguistic label such as COOL. A trapezoid is used because it provides a
  • 47. 37 reasonable compromise between shape flexibility and memory space required to define the membership function. Four bytes can describe any trapezoidal membership function. Figure # shows two membership functions (labeled COLD and COOL) for the system input named TEMPERATURE. The vertical dashed line shows that when temperature is 50°F, the label COLD has a degree of membership of about $40 or about 25% true. At 50°F, the label COOL has a degree of membership of $BF or about 75% true. Two Input Member Function Figure 5-2 Notice that as the system input value changes from $40 to $70, the label COLD changes gradually from completely true to completely false. At the same time, COOL changes from completely false to completely true. In a medium sized system like an inverted pendulum, there may be two system inputs with seven linguistic labels per input, or fourteen membership functions. Using trapezoids, this system would need only 56 bytes to define the input membership functions. The freeware program mentioned earlier uses a 43 byte routine to calculate a fuzzy input value for a given system input value. This routine is placed in a simple loop, and is executed once for each label of each system input. The inputs to the fuzzification process are the current values of system inputs such as temperature and pressure. The outputs are 8- bit fuzzy input values stored in RAM variable locations. One byte of RAM is required for each label of each system input. 5.6) RULE EVALUATION: The rule evaluation process uses a list of linguistic rules from the knowledge base to perform inference in the fuzzy domain. The inputs to this process are the fuzzy inputs from the fuzzification process. The outputs of this process are fuzzy outputs (8- bit values in RAM variable locations). The rule "If temperature is warm and pressure is medium then fan is medium-high has two antecedents (inputs) and one consequent (output). Each antecedent is of the form "input-name is label", where input-name is the name assigned to a system input and label is the name of a label of that input. Each consequent is of the form "output-name is label", where output-name is the name of a system output and label is the name of a label of that output. To evaluate a
  • 48. 38 rule you would replace each antecedent phrase with the associated fuzzy input value, determine the overall truth value of the rule, and update the fuzzy output corresponding to the rule consequent. This is done by storing the rules as a list of addresses or pointers to fuzzy inputs and fuzzy outputs. In microcontroller based fuzzy inference units, only two operators are needed. The AND operator connects rule antecedents and an implied OR operator connects separate rules. The AND operator corresponds to the mathematical minimum operation and OR corresponds to the maximum operation. The overall truth of a rule is found by taking the minimum of all fuzzy inputs to the rule. Before any rules are processed, all fuzzy outputs are cleared to zero. As rules are evaluated, the truth value for the rule is stored to the fuzzy output corresponding to the rule consequent unless the fuzzy output is already larger. In this way the fuzzy output ends up with the maximum truth value of any rule related to that fuzzy output. This is called min-max rule evaluation. 5.7) DEFUZZIFICATION: The fuzzy outputs generated by the rule evaluation process collectively define the desired system output. The defuzzification process takes a weighted average to translate the fuzzy outputs into a single crisp system output value. Singleton type output membership functions are used for a microcontroller based FIU. A singleton is defined by an 8-bit value that represents the output value corresponding to a linguistic label of a system output. The corresponding fuzzy output value in RAM provides the height (weight) of the singleton. The following formula is used to calculate the weighted average which is used as the system output value. The operations required to implement fuzzy logic inference are simple enough for a small 8-bit MCU. Memory requirements are small and execution time for a software fuzzy inference unit is fast enough for typical real-time control applications.As fuzzy logic becomes familiar to more engineers, applications once thought too difficult for small microcontrollers will routinely be solved using fuzzy logic techniques. Good general purpose fuzzy inference programs will allow non-programmers to access the power of microcontrollers to solve a wide range of design problems.
  • 50. 40 6.1) INTRODUCTION In this chapter we will discuss controller that used in our project the features, significant and other parameter of the controller it‟s block diagram pin configuration and description of pins. 6.2) ATMEGA-16 8-bit Microcontroller with 16K Bytes In- System Programmable Flash Figure 6-1 6.2.1) OVERVIEW: The ATmega16 is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture. By executing powerful instructions in a single clock cycle, the ATmega16 achieves throughputs approaching 1 MIPS per MHz allowing the system designed to optimize power consumption versus processing speed. 6.2.2) FEATURES: High-performance, Low-power AVR® 8-bit Microcontroller Advanced RISC Architecture  131 Powerful Instructions – Most Single-clock Cycle Execution  32 x 8 General Purpose Working Registers  Fully Static Operation  Up to 16 MIPS Throughput at 16 MHz  On-chip 2-cycle Multiplier High Endurance Non-volatile Memory segments  16K Bytes of In-System Self-programmable Flash program memory  512 Bytes EEPROM  1K Byte Internal SRAM  Write/Erase Cycles: 10,000 Flash/100,000 EEPROM  Data retention: 20 years at 85°C/100 years at 25°C(1)  Optional Boot Code Section with Independent Lock Bits
  • 51. 41  In-System Programming by On-chip Boot Program  True Read-While-Write Operation  Programming Lock for Software Security JTAG (IEEE std. 1149.1 Compliant) Interface  Boundary-scan Capabilities According to the JTAG Standard  Extensive On-chip Debug Support  Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG Interface Peripheral Features  Two 8-bit Timer/Counters with Separate Pre scalars and Compare Modes  One 16-bit Timer/Counter with Separate Pre scalar, Compare Mode, and Capture  Mode  Real Time Counter with Separate Oscillator  Four PWM Channels  8-channel, 10-bit ADC  8 Single-ended Channels  7 Differential Channels in TQFP Package Only  2 Differential Channels with Programmable Gain at 1x, 10x, or 200x  Byte-oriented Two-wire Serial Interface  Programmable Serial USART  Master/Slave SPI Serial Interface  Programmable Watchdog Timer with Separate On-chip Oscillator  On-chip Analog Comparator Special Microcontroller Features  Power-on Reset and Programmable Brown-out Detection  Internal Calibrated RC Oscillator  External and Internal Interrupt Sources  Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby and Extended Standby I/O and Packages  32 Programmable I/O Lines  40-pin PDIP, 44-lead TQFP, and 44-pad QFN/MLF Operating Voltages  4.5 - 5.5V for ATmega16 Speed Grades  0 - 16 MHz for ATmega16 Power Consumption @ 1 MHz, 3V, and 25ーC for ATmega16L  Active: 1.1 mA  Idle Mode: 0.35 mA  Power-down Mode: < 1 μA
  • 53. 43 6.2.4) BLOCK DIAGRAM: Figure 6-3 6.2.5) PIN DESCRIPTION: VCC Digital supply voltage. GND Ground. Port A (PA0-PA7) Port A serves as the analog inputs to the A/D Converter. Port A also serves as an 8-bit bi-directional I/O port, if the A/D Converter is not used. Port pins can provide internal pull-up resistors (selected for each bit). The Port A output buffers have sym- metrical drive characteristics with both high sink and source capability. When pins PA0 to PA7 are used as inputs and are externally pulled low, they will source current if the internal pull-up resistors are activated. The Port A pins are tri-stated when a reset condition becomes active, even if the clock is not running.
  • 54. 44 Port B (PB0-PB7) Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port B output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port B pins that are externally pulled low will source current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset condition becomes active, even if the clock is not running. Port B also serves the functions of various special features of the ATmega16 as listed on page 58. Port C (PC0-PC7) Port C is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port C output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port C pins that are externally pulled low will source current if the pull-up resistors are activated. The Port C pins are tri-stated when a reset condition becomes active, even if the clock is not running. If the JTAG interface is enabled, the pull-up resistors on pins PC5 (TDI), PC3 (TMS) and PC2 (TCK) will be activated even if a reset occurs. Port C also serves the functions of the JTAG interface and other special features of the ATmega16 as listed on page 61. Port D (PD0-PD7) Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port D output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port D pins that are externally pulled low will source current if the pull-up resistors are activated. The Port D pins are tri-stated when a reset condition becomes active, even if the clock is not running. Port D also serves the functions of various special features of the ATmega16 as listed on page 63. RESET Reset Input. A low level on this pin for longer than the minimum pulse length will generate a reset, even if the clock is not running. The minimum pulse length is given in Table 15 on page 38. Shorter pulses are not guaranteed to generate a reset. XTAL1 Input to the inverting Oscillator amplifier and input to the internal clock operating circuit. XTAL2 Output from the inverting Oscillator amplifier. AVCC AVCC is the supply voltage pin for Port A and the A/D Converter. It should be externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be connected to VCC through a low-pass filter. AREF AREF is the analog reference pin for the A/D Converter.
  • 55. 45 6.3) DC GEAR MOTOR: We are using 3 DC Motors to rotate the shafts in the vessels these all 3 motors are 24v dc Many projects require the use of a cheap dc motor to create rotational movement. There are a number of ways motors can be interfaced to the microcontroller. This circuit uses a darling ton transistor to switch the motor on and off. This circuit will work with „solar‟ motors, but may not function correctly with cheap dc motors. This is because this type of motor introduces a lot of electrical „noise‟ on to the power rails. This noise can affect the microcontroller, and in some cases can completely stop the control program functioning. These comparators are designed for use in level detection, low-level sensing and memory applications in consumer, automotive, and industrial electronic applications. Figure 6-4 6.4) SERVO MOTOR: Servo is an automatic device that uses error-sensing feedback to correct the performance of a mechanism. The term correctly applies only to systems where the feedback or error-correction signals help control mechanical position or other parameters. For example, an automotive power window control is not a servomechanism, as there is no automatic feedback that controls position the operator does this by observation. By contrast the car's cruise control uses closed loop feedback, which classifies it as a servomechanism.
  • 56. 46 A servomechanism is unique among control systems in that it controls a parameter by commanding the time-based derivative of that parameter. For example, a servomechanism controlling position must be capable of changing the velocity of the system because the time-based derivative (rate change) of position is velocity. A hydraulic actuator controlled by a spool valve and a position sensor is a good example because the velocity of the actuator is proportional to the error signal of the position sensor. Figure 6-5 Servo motors are devices which provide precise position through feedback. RC Servos can rotate only 180 degree and have wide applications in robotics. These servos are used for application like robotic arms and humanoid. RC servos consist of a DC motor, gearbox, control circuit and feedback devices. The feedback device (mostly potentiometer) is mechanically coupled to the output shaft. The control signal (PWM signal) proportional to the required shaft position is given to the servo. Figure 6-6
  • 57. 47 The PWM signal is converted into a voltage corresponding to the desired position. The output voltage also changes in proportion to the actual shaft position. These two will have same value if the position of the shaft is at the desired position. If the position of the shaft is not the same as desired position then an error voltage is generated which will move the motor until the desired position is obtained. Figure 6-7 The RC Servo motors require a PWM having time period of around 20ms is required and the pulse width of 1-2ms. 1ms pulse width corresponds to 0 degree and 2ms pulse width corresponds to 180 degree. For any other angle between 0 degree and 180 degree corresponding pulse width is required. The RC servo has three wires, one for control signal and others for power supply (Vcc and Gnd). Operating voltage or supply voltage is in the range of 4.8v to 6v. Refer to the programming section for the program of RC Servo motor. 6.5) MAX-232 DUAL RECIEVER 6.5.1) INTRODUCTON: The MAX232 is a dual driver/receiver that includes a capacitive voltage generator to supply TIA/EIA-232-F voltage levels from a single 5-V supply. Each receiver converts TIA/EIA-232-F inputs to 5-V TTL/CMOS levels. These receivers have a typical threshold of 1.3 V, a typical hysteresis of 0.5 V, and can accept ±30-V inputs. Each driver converts TTL/CMOS input levels into TIA/EIA-232-F levels. It has two drivers and two receivers.
  • 58. 48 6.5.2) PIN CONFIGURATION: Figure 6-8 6.5.3) FUNCTION TABLES: EACH DRIVER INPUT TIN OUTPUT TOUT H L L H EACH RECIEVER INPUT RIN OUTPUT ROUT L H H L
  • 59. 49 6.5.4) LOGIC DIAGRAMS (POSITIVE LOGIC): Figure 6-9 6.5.5) APPLICATION INFORMATION: Figure 6-10
  • 61. 51 7.1) INTRODUCTION: In this chapter we discuss about the navigational component used. There is interfacing and description of GPS navigation module. There is also description of NMEA protocol to extract and differ in data get from GPS 7.2) HOLUX M-89 GPS MODULE Figure 7-1 7.2.1) HISTORY: M-89 is an ultra miniature 25.4 * 25.4 * 3 mm GPS engine board designed by low Power consumption MTK GPS solution. It provides superior sensitivity up to - 159dBm and fast Time-To-First-Fix in navigation application. The stable performance of M-89 is your best choice to be embedded in your portable device design, like PDA, PND, mobile phone, Digital Camera for GPS service. 7.2.2) KEY FEATURES: Small form factor: 25.4 * 25.4 * 3 mm RoHS/WEEE compliant High sensitivity -159dBm Searching up to 32 Channel of satellites Fast Position Fix Low power consumption RTCM-in ready.
  • 62. 52 Built-in WAAS/EGNOS/MSAS Demodulator. Support NMEA0183 V 3.01 data protocol. Real time navigation for location based services. For Car Navigation, Marine Navigation, Fleet Management, AVL and Location-Based Services, Auto Pilot, Personal Navigation or touring devices, Tracking devices/systems and Mapping devices application 7.2.3) APPLICATIONS: Automotive and Marine Navigation Automotive Navigator Tracking Emergency Locator Geographic Surveying Personal Positioning Sporting and Recreation Embedded applications: Smart phone, UMPC, PND, MP4 7.2.4) BLOCK DIAGRAM: Figure 7-2
  • 63. 53 7.2.5) PIN DEFINATION: Figure 7-3 Pin No. Pin Name Type Function Description 1 VCC_IN I/p 3.3 - 5 V Supply Input 2 GND Gnd Ground 3 NC I/p NC 4 RXDA I/p Serial Data Input A 5 TXDA O/p Serial Data Output A 6 TXDB O/p Serial Data Output 7 RXDB I/p Serial Data Input B 8 GPIO0 I/O General purpose I/O. Flash at 1Hz when position is fixed 9 INT1 I/O General purpose I/O 10 GND Gnd Ground 11 GND Gnd Ground 12 GND Gnd Ground 13 GND Gnd Ground 14 GND Gnd Ground 15 GND Gnd Ground 16 GND Gnd Ground 17 RF_IN I/p GPA Signal Input 18 GND I/p Ground 19 V_ANT_IN I/p Antenna Power Supply Input, 3V 20 VCC_RF_O O/p Antenna Power Supply, 2.8V 21 V_BAT I/p RTC and backup SRAM power, 2.6 - 3.6 VDC 22 HRST I/p Reset, Active low
  • 64. 54 7.3) NMEA Data Protocol: 7.3.1) THE PROTOCOL: The National Marine Electronics Association (NMEA) has developed a specification that defines the interface between various pieces of marine electronic equipment. The standard permits marine electronics to send information to computers and to other marine equipment. A full copy of this standard is available for purchase at their web site. None of the information on this site comes from this standard and I do not have a copy. Anyone attempting to design anything to this standard should obtain an official copy. GPS receiver communication is defined within this specification. Most computer programs that provide real time position information understand and expect data to be in NMEA format. This data includes the complete PVT (position, velocity, time) solution computed by the GPS receiver. The idea of NMEA is to send a line of data called a sentence that is totally self contained and independent from other sentences. There are standard sentences for each device category and there is also the ability to define proprietary sentences for use by the individual company. All of the standard sentences have a two letter prefix that defines the device that uses that sentence type. (For gps receivers the prefix is GP.) which is followed by a three letter sequence that defines the sentence contents. In addition NMEA permits hardware manufactures to define their own proprietary sentences for whatever purpose they see fit. All proprietary sentences begin with the letter P and are followed with 3 letters that identifies the manufacturer controlling that sentence. For example a Garmin sentence would start with PGRM and Magellan would begin with PMGN. Each sentence begins with a '$' and ends with a carriage return/line feed sequence and can be no longer than 80 characters of visible text (plus the line terminators). The data is contained within this single line with data items separated by commas. The data itself is just ascii text and may extend over multiple sentences in certain specialized instances but is normally fully contained in one variable length sentence. The data may vary in the amount of precision contained in the message. For example time might be indicated to decimal parts of a second or location may be show with 3 or even 4 digits after the decimal point. Programs that read the data should only use the commas to determine the field boundaries and not depend on column positions. There is a provision for a checksum at the end of each sentence which may or may not be checked by the unit that reads the data. The checksum field consists of a '*' and two 23 GPIO1 I/O General purpose I/O 24 GPIO2 I/O General purpose I/O 25 GPIO3 I/O General purpose I/O 26 GPIO4 I/O General purpose I/O 27 GPIO5 I/O General purpose I/O 28 GPIO6 I/O General purpose I/O 29 PPS O/p 1 PPS output, synchronized with GPS time. TIME_MARK 1PPS output, 1us/s 30 GND Gnd Ground
  • 65. 55 hex digits representing an 8 bit exclusive OR of all characters between, but not including, the '$' and '*'. A checksum is required on some sentences. There have been several changes to the standard but for gps use the only ones that are likely to be encountered are 1.5 and 2.0 through 2.3. These just specify some different sentence configurations which may be peculiar to the needs of a particular device thus the gps may need to be changed to match the devices being interfaced to. Some gps's provide the ability configure a custom set the sentences while other may offer a set of fixed choices. Many gps receivers simply output a fixed set of sentences that cannot be changed by the user. The current version of the standard is 3.01. I have no specific information on this version, but I am not aware of any GPS products that require conformance to this version. 7.3.2) HARDWARE CONNECTION: The hardware interface for GPS units is designed to meet the NMEA requirements. They are also compatible with most computer serial ports using RS232 protocols, however strictly speaking the NMEA standard is not RS232. They recommend conformance to EIA-422. The interface speed can be adjusted on some models but the NMEA standard is 4800 b/s (bit per second rate) with 8 bits of data, no parity, and one stop bit. All units that support NMEA should support this speed. Note that, at a b/s rate of 4800, you can easily send enough data to more than fill a full second of time. For this reason some units only send updates every two seconds or may send some data every second while reserving other data to be sent less often. In addition some units may send data a couple of seconds old while other units may send data that is collected within the second it is sent. Generally time is sent in some field within each second so it is pretty easy to figure out what a particular gps is doing. Some sentences may be sent only during a particular action of the receiver such as while following a route while other receivers may always send the sentence and just null out the values. Other difference will be noted in the specific data descriptions defined later in the text. At 4800 b/s you can only send 480 characters in one second. Since an NMEA sentence can be as long as 82 characters you can be limited to less than 6 different sentences. The actual limit is determined by the specific sentences used, but this shows that it is easy to overrun the capabilities if you want rapid sentence response. NMEA is designed to run as a process in the background spitting out sentences which are then captured as needed by the using program. Some programs cannot do this and these programs will sample the data stream, then use the data for screen display, and then sample the data again. Depending on the time needed to use the data there can easily be a lag of 4 seconds in the responsiveness to changed data. This may be fine in some applications but totally unacceptable in others. For example a car traveling at 60 mph will travel 88 feet in one second. Several second delays could make the entire system seem unresponsive and could cause you to miss your turn. The NMEA standard has been around for many years (1983) and has undergone several revisions. The protocol has changed and the number and types of sentences may be different depending on the revision. Most GPS receivers understand the standard which is called: 0183 version 2. This standard dictates a transfer rate of 4800 b/s. Some receivers also understand older standards. The oldest standard was 0180 followed by 0182 which transferred data at 1200 b/s. An earlier version of 0183 called
  • 66. 56 version 1.5 is also understood by some receivers. Some Garmin units and other brands can be set to 9600 for NMEA output or even higher but this is only recommended if you have determined that 4800 works ok and then you can try to set it faster. Setting it to run as fast as you can may improve the responsiveness of the program. In order to use the hardware interface you will need a cable. Generally the cable is unique to the hardware model so you will need an cable made specifically for the brand and model of the unit you own. Some of the latest computers no longer include a serial port but only a USB port. Most gps receivers will work with Serial to USB adapters and serial ports attached via the pcmcia (pc card) adapter. For general NMEA use with a gps receiver you will only need two wires in the cable, data out from the gps and ground. A third wire, Data in, will be needed if you expect the receiver to accept data on this cable such as to upload waypoints or send DGPS data to the receiver. GPS receivers may be used to interface with other NMEA devices such as autopilots, fish finders, or even another gps receivers. They can also listen to Differential Beacon Receivers that can send data using the RTCM SC-104 standard. This data is consistent with the hardware requirements for NMEA input data. There are no handshake lines defined for NMEA. 7.3.3) NMEA SENTENCES: NMEA consists of sentences, the first word of which, called a data type, defines the interpretation of the rest of the sentence. Each Data type would have its own unique interpretation and is defined in the NMEA standard. The GGA sentence (shown below) shows an example that provides essential fix data. Other sentences may repeat some of the same information but will also supply new data. Whatever device or program that reads the data can watch for the data sentence that it is interested in and simply ignore other sentences that is doesn't care about. In the NMEA standard there are no commands to indicate that the gps should do something different. Instead each receiver just sends all of the data and expects much of it to be ignored. Some receivers have commands inside the unit that can select a subset of all the sentences or, in some cases, even the individual sentences to send. There is no way to indicate anything back to the unit as to whether the sentence is being read correctly or to request a re- send of some data you didn't get. Instead the receiving unit just checks the checksum and ignores the data if the checksum is bad figuring the data will be sent again sometime later. There are many sentences in the NMEA standard for all kinds of devices that may be used in a Marine environment. Some of the ones that have applicability to gps receivers are listed below: (all message start with GP.) AAM - Waypoint Arrival Alarm ALM - Almanac data APA - Auto Pilot A sentence APB - Auto Pilot B sentence BOD - Bearing Origin to Destination BWC - Bearing using Great Circle route DTM - Datum being used.
  • 67. 57 GGA - Fix information GLL - Lat/Lon data GRS - GPS Range Residuals GSA - Overall Satellite data GST - GPS Pseudorange Noise Statistics GSV - Detailed Satellite data MSK - send control for a beacon receiver MSS - Beacon receiver status information. RMA - recommended Loran data RMB - recommended navigation data for gps RMC - recommended minimum data for gps RTE - route message TRF - Transit Fix Data STN - Multiple Data ID VBW - dual Ground / Water Spped VTG - Vector track an Speed over the Ground WCV - Waypoint closure velocity (Velocity Made Good) WPL - Waypoint Location information XTC - cross track error XTE - measured cross track error ZTG - Zulu (UTC) time and time to go (to destination) ZDA - Date and Time Some gps receivers with special capabilities output these special messages. HCHDG - Compass output PSLIB - Remote Control for a DGPS receiver In addition some GPS receivers can mimic Loran-C receivers by outputing the LC prefix in some of their messages so that they can be used to interface to equipment that is expecting this prefix instead of the GP one. The last version 2 iteration of the NMEA standard was 2.3. It added a mode indicator to several sentences which is used to indicate the kind of fix the receiver currently has. This indication is part of the signal integrity information needed by the FAA. The value can be A=autonomous, D=differential, E=Estimated, N=not valid, S=Simulator. Sometimes there can be a null value as well. Only the A and D values will correspond to an Active and reliable Sentence. This mode character has been added to the RMC, RMB, VTG, and GLL, sentences and optionally some others including the BWC and XTE sentences. If you are interfacing a GPS unit to another device, including a computer program, you need to ensure that the receiving unit is given all of the sentences that it needs. If it needs a sentence that your GPS does not send then the interface to that unit is likely to fail. Here is a Link for the needs of some typical programs. The sentences sent by some typical receivers include:
  • 68. 58 NMEA 2.0 Name Garmin Magellan Lowrance SiRF Notes: GPAPB N Y Y N Auto Pilot B GPBOD Y N N N bearing, origin to destination - earlier G- 12's do not transmit this GPGGA Y Y Y Y fix data GPGLL Y Y Y Y Lat/Lon data - earlier G-12's do not transmit this GPGSA Y Y Y Y overall satellite reception data, missing on some Garmin models GPGSV Y Y Y Y detailed satellite data, missing on some Garmin models GPRMB Y Y Y N minimum recommended data when following a route GPRMC Y Y Y Y minimum recommended data GPRTE Y U U N route data, only when there is an active route. (this is sometimes bidirectional) GPWPL Y Y U N waypoint data, only when there is an active route (this is sometimes bidirectional) NMEA 1.5 - some units do not support version 1.5. Lowrance units provide the ability to customize the NMEA output by sentences so that you can develop your own custom sentence structure. Name Garmin Magellan Notes: GPAPA N Y Automatic Pilot A GPBOD Y N bearing origin to destination - earlier G-12's do not send this GPBWC Y Y bearing to waypoint using great circle route. GPGLL Y Y lat/lon - earlier G-12's do not send this GPRMC Y N minimum recommend data GPRMB Y N minimum recommended data when following a route GPVTG Y Y vector track and speed over ground GPWPL Y N waypoint data (only when active goto) GPXTE Y Y cross track error The NMEA 2.3 output from the Garmin Legend, Vista, and perhaps some others include the BWC, VTG, and XTE sentences.
  • 69. 59 The Trimble Scoutmaster outputs: APA, APB, BWC, GGA, GLL, GSA, GSV, RMB, RMC, VTG, WCV, XTE, ZTG. The Motorola Encore outputs: GGA, GLL, GSV, RMC, VTG, ZDA and a proprietary sentence PMOTG. Units based on the SiRF chipset can output: GGA, GLL, GSA, GSV, RMC, and VTG. What is actually output is based on which sentences are selected by the user or application program. See below for more details. Some implementations have enhanced the SiRF capabilities with other sentences as well by changing the firmware. For example, the u-blox receivers add ZDA and some proprietary sentences to the above list of sentences. Check your documentation for more details. Garmin receivers send the following Proprietary Sentences: PGRME (estimated error) - not sent if set to 0183 1.5 PGRMM (map datum) PGRMZ (altitude) PSLIB (beacon receiver control) Note that Garmin converts lat/lon coordinates to the datum chosen by the user when sending this data. This is indicated in the proprietary sentence PGRMM. This can help programs that use maps with other datums but is not an NMEA standard. Be sure and set your datum to WGS84 on Garmin units when communicating to other NMEA devices. Magellan also converts lat/lon coordinates to the datum chosen on the receiver but do not indicate this in a message. Magellan units use proprietary sentences for waypoint maintenance and other tasks. They use a prefix of PMGN for this data. Most other units always output NMEA messages in the WGS84 datum. Be sure and check the user documentation to be sure. It is possible to just view the information presented on the NMEA interface using a simple terminal program. If the terminal program can log the session then you can build a history of the entire session into a file. More sophisticated logging programs can filter the messages to only certain sentences or only collect sentences at prescribed intervals. Some computer programs that provide real time display and logging actually save the log in an ascii format that can be viewed with a text editor or used independently from the program that generated it. 7.3.4) NMEA INPUT: Some units also support an NMEA input mode. While not too many programs support this mode it does provide a standardized way to update or add waypoint and route data. Note that there is no handshaking or commands in NMEA mode so you just send the data in the correct sentence and the unit will accept the data and add or overwrite the information in memory. If the data is not in the correct format it will simply be ignored. A carriage return/line feed sequence is required. If the waypoint name is the same you will overwrite existing data but no warning will be issued. The sentence
  • 70. 60 construction is identical to what the unit downloads so you can, for example, capture a WPL sentence from one unit and then send that same sentence to another unit but be careful if the two units support waypoint names of different lengths since the receiving unit might truncate the name and overwrite a waypoint accidently. If you create a sentence from scratch you should create a correct checksum. Be sure you know and have set you unit to the correct datum. Many units support the input of WPL sentences and a few support RTE as well. On NMEA input the receiver stores information based on interpreting the sentence itself. While some receivers accept standard NMEA input this can only be used to update a waypoint or similar task and not to send a command to the unit. Proprietary input sentences could be used to send commands. Since the Magellan upload and download maintenance protocol is based on NMEA sentences they support a modified WPL message that adds comments, altitude, and icon data. Some marine units may accept input for alarms such as deep or shallow water based on the DPT sentence or MTW to read the water temperature. For example the Garmin Map76 supports DPT, MTW (temperature), and VHW (speed) input sentences. Other units may use NMEA input to provide initialization data via proprietary sentences, or to select which NMEA sentences to output. 7.3.5)Decode of Selected Position Sentences: The most important NMEA sentences include the GGA which provides the current Fix data, the RMC which provides the minimum gps sentences information, and the GSA which provides the Satellite status data. GGA - essential fix data which provide 3D location and accuracy data. $GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47 Where: GGA Global Positioning System Fix Data 123519 Fix taken at 12:35:19 UTC 4807.038,N Latitude 48 deg 07.038' N 01131.000,E Longitude 11 deg 31.000' E 1 Fix quality: 0 = invalid 1 = GPS fix (SPS) 2 = DGPS fix 3 = PPS fix 4 = Real Time Kinematic 5 = Float RTK 6 = estimated (dead reckoning) (2.3 feature) 7 = Manual input mode 8 = Simulation mode 08 Number of satellites being tracked 0.9 Horizontal dilution of position 545.4,M Altitude, Meters, above mean sea level 46.9,M Height of geoid (mean sea level) above WGS84
  • 71. 61 ellipsoid (empty field) time in seconds since last DGPS update (empty field) DGPS station ID number *47 the checksum data, always begins with * If the height of geoid is missing then the altitude should be suspect. Some non- standard implementations report altitude with respect to the ellipsoid rather than geoid altitude. Some units do not report negative altitudes at all. This is the only sentence that reports altitude. GSA - GPS DOP and active satellites. This sentence provides details on the nature of the fix. It includes the numbers of the satellites being used in the current solution and the DOP. DOP (dilution of precision) is an indication of the effect of satellite geometry on the accuracy of the fix. It is a unitless number where smaller is better. For 3D fixes using 4 satellites a 1.0 would be considered to be a perfect number, however for overdetermined solutions it is possible to see numbers below 1.0. There are differences in the way the PRN's are presented which can effect the ability of some programs to display this data. For example, in the example shown below there are 5 satellites in the solution and the null fields are scattered indicating that the almanac would show satellites in the null positions that are not being used as part of this solution. Other receivers might output all of the satellites used at the beginning of the sentence with the null field all stacked up at the end. This difference accounts for some satellite display programs not always being able to display the satellites being tracked. Some units may show all satellites that have ephemeris data without regard to their use as part of the solution but this is non-standard. $GPGSA,A,3,04,05,,09,12,,,24,,,,,2.5,1.3,2.1*39 Where: GSA Satellite status A Auto selection of 2D or 3D fix (M = manual) 3 3D fix - values include: 1 = no fix 2 = 2D fix 3 = 3D fix 04,05... PRNs of satellites used for fix (space for 12) 2.5 PDOP (dilution of precision) 1.3 Horizontal dilution of precision (HDOP) 2.1 Vertical dilution of precision (VDOP) *39 the checksum data, always begins with * GSV - Satellites in View shows data about the satellites that the unit might be able to find based on its viewing mask and almanac data. It also shows current ability to track this data. Note that one GSV sentence only can provide data for up to 4 satellites and thus there may need to be 3 sentences for the full information. It is reasonable for the GSV sentence to contain more satellites than GGA might indicate since GSV may include satellites that are not used as part of the solution. It is not a requirment that the GSV sentences all appear in sequence. To avoid overloading the data bandwidth some receivers may place the various sentences in totally different samples since each sentence identifies which one it is.
  • 72. 62 The field called SNR (Signal to Noise Ratio) in the NMEA standard is often referred to as signal strength. SNR is an indirect but more useful value that raw signal strength. It can range from 0 to 99 and has units of dB according to the NMEA standard, but the various manufacturers send different ranges of numbers with different starting numbers so the values themselves cannot necessarily be used to evaluate different units. The range of working values in a given gps will usually show a difference of about 25 to 35 between the lowest and highest values, however 0 is a special case and may be shown on satellites that are in view but not being tracked. $GPGSV,2,1,08,01,40,083,46,02,17,308,41,12,07,344,39,14,22,228,45*75 Where: GSV Satellites in view 2 Number of sentences for full data 1 sentence 1 of 2 08 Number of satellites in view 01 Satellite PRN number 40 Elevation, degrees 083 Azimuth, degrees 46 SNR - higher is better for up to 4 satellites per sentence *75 the checksum data, always begins with * RMC - NMEA has its own version of essential gps pvt (position, velocity, time) data. It is called RMC, The Recommended Minimum, which will look similar to: $GPRMC,123519,A,4807.038,N,01131.000,E,022.4,084.4,230394,003.1,W*6A Where: RMC Recommended Minimum sentence C 123519 Fix taken at 12:35:19 UTC A Status A=active or V=Void. 4807.038,N Latitude 48 deg 07.038' N 01131.000,E Longitude 11 deg 31.000' E 022.4 Speed over the ground in knots 084.4 Track angle in degrees True 230394 Date - 23rd of March 1994 003.1,W Magnetic Variation *6A The checksum data, always begins with * Note that, as of the 2.3 release of NMEA, there is a new field in the RMC sentence at the end just prior to the checksum. For more information on this field see here. GLL - Geographic Latitude and Longitude is a holdover from Loran data and some old units may not send the time and data active information if they are emulating Loran data. If a gps is emulating Loran data they may use the LC Loran prefix instead of GP.
  • 73. 63 $GPGLL,4916.45,N,12311.12,W,225444,A,*1D Where: GLL Geographic position, Latitude and Longitude 4916.46,N Latitude 49 deg. 16.45 min. North 12311.12,W Longitude 123 deg. 11.12 min. West 225444 Fix taken at 22:54:44 UTC A Data Active or V (void) *iD checksum data Note that, as of the 2.3 release of NMEA, there is a new field in the GLL sentence at the end just prior to the checksum. For more information on this field see here. VTG - Velocity made good. The gps receiver may use the LC prefix instead of GP if it is emulating Loran output. $GPVTG,054.7,T,034.4,M,005.5,N,010.2,K*48 where: VTG Track made good and ground speed 054.7,T True track made good (degrees) 034.4,M Magnetic track made good 005.5,N Ground speed, knots 010.2,K Ground speed, Kilometers per hour *48 Checksum Note that, as of the 2.3 release of NMEA, there is a new field in the VTG sentence at the end just prior to the checksum. For more information on this field see here. Receivers that don't have a magnetic deviation (variation) table built in will null out the Magnetic track made good. 7.3.6) Decode of Some Navigation Sentences: WPL - Waypoint Location data provides essential waypoint data. It is output when navigating to indicate data about the destination and is sometimes supported on input to redefine a waypoint location. Note that waypoint data as defined in the standard does not define altitude, comments, or icon data. When a route is active, this sentence is sent once for each waypoint in the route, in sequence. When all waypoints have been reported, the RTE sentence is sent in the next data set. In any group of sentences, only one WPL sentence, or an RTE sentence, will be sent. $GPWPL,4807.038,N,01131.000,E,WPTNME*5C With an interpretation of: WPL Waypoint Location 4807.038,N Latitude 01131.000,E Longitude WPTNME Waypoint Name
  • 74. 64 *5C The checksum data, always begins with * AAM - Waypoint Arrival Alarm is generated by some units to indicate the Status of arrival (entering the arrival circle, or passing the perpendicular of the course line) at the destination waypoint. $GPAAM,A,A,0.10,N,WPTNME*32 Where: AAM Arrival Alarm A Arrival circle entered A Perpendicular passed 0.10 Circle radius N Nautical miles WPTNME Waypoint name *32 Checksum data APB - Autopilot format B is sent by some gps receivers to allow them to be used to control an autopilot unit. This sentence is commonly used by autopilots and contains navigation receiver warning flag status, cross-track-error, waypoint arrival status, initial bearing from origin waypoint to the destination, continuous bearing from present position to destination and recommended heading-to-steer to destination waypoint for the active navigation leg of the journey. Note: some autopilots, Robertson in particular, misinterpret "bearing from origin to destination" as "bearing from present position to destination". This is likely due to the difference between the APB sentence and the APA sentence. for the APA sentence this would be the correct thing to do for the data in the same field. APA only differs from APB in this one field and APA leaves off the last two fields where this distinction is clearly spelled out. This will result in poor performance if the boat is sufficiently off-course that the two bearings are different. $GPAPB,A,A,0.10,R,N,V,V,011,M,DEST,011,M,011,M*3C where: APB Autopilot format B A Loran-C blink/SNR warning, general warning A Loran-C cycle warning 0.10 cross-track error distance R steer Right to correct (or L for Left) N cross-track error units - nautical miles (K for kilometers) V arrival alarm - circle V arrival alarm - perpendicular 011,M magnetic bearing, origin to destination DEST destination waypoint ID 011,M magnetic bearing, present position to destination 011,M magnetic heading to steer (bearings could True as 033,T)
  • 75. 65 BOD - Bearing - Origin to Destination shows the bearing angle of the line, calculated at the origin waypoint, extending to the destination waypoint from the origin waypoint for the active navigation leg of the journey. $GPBOD,045.,T,023.,M,DEST,START*01 where: BOD Bearing - origin to destination waypoint 045.,T bearing 045 True from "START" to "DEST" 023.,M bearing 023 Magnetic from "START" to "DEST" DEST destination waypoint ID START origin waypoint ID *01 checksum BWC - Bearing & Distance to Waypoint using a Great Circle route. Time (UTC) and distance & bearing to, and location of, a specified waypoint from present position along the great circle path. $GPBWC,225444,4917.24,N,12309.57,W,051.9,T,031.6,M,001.3,N,004*29 where: BWC Bearing and distance to waypoint - great circle 225444 UTC time of fix 22:54:44 4917.24,N Latitude of waypoint 12309.57,W Longitude of waypoint 051.9,T Bearing to waypoint, degrees true 031.6,M Bearing to waypoint, degrees magnetic 001.3,N Distance to waypoint, Nautical miles 004 Waypoint ID *29 checksum RMB - The recommended minimum navigation sentence is sent whenever a route or a goto is active. On some systems it is sent all of the time with null data. The Arrival alarm flag is similar to the arrival alarm inside the unit and can be decoded to drive an external alarm. Note the use of leading zeros in this message to preserve the character spacing. This is done, I believe, because some autopilots may depend on exact character spacing. $GPRMB,A,0.66,L,003,004,4917.24,N,12309.57,W,001.3,052.5,000.5,V*20 where: RMB Recommended minimum navigation information A Data status A = OK, V = Void (warning) 0.66,L Cross-track error (nautical miles, 9.99 max), steer Left to correct (or R = right) 003 Origin waypoint ID 004 Destination waypoint ID 4917.24,N Destination waypoint latitude 49 deg. 17.24 min. N 12309.57,W Destination waypoint longitude 123 deg. 09.57 min. W
  • 76. 66 001.3 Range to destination, nautical miles (999.9 max) 052.5 True bearing to destination 000.5 Velocity towards destination, knots V Arrival alarm A = arrived, V = not arrived *20 checksum RTE - RTE is sent to indicate the names of the waypoints used in an active route. There are two types of RTE sentences. This route sentence can list all of the waypoints in the entire route or it can list only those still ahead. Because an NMEA sentence is limited to 80 characters there may need to be multiple sentences to identify all of the waypoints. The data about the waypoints themselves will be sent in subsequent WPL sentences which will be sent in future cycles of the NMEA data. $GPRTE,2,1,c,0,W3IWI,DRIVWY,32CEDR,32-29,32BKLD,32-I95,32-US1,BW- 32,BW-198*69 Where: RTE Waypoints in active route 2 total number of sentences needed for full data 1 this is sentence 1 of 2 c Type c = complete list of waypoints in this route w = first listed waypoint is start of current leg 0 Route identifier W3IWI,... Waypoint identifiers (names) *69 checksum XTE - Measured cross track error is a small subset of the RMB message for compatibility with some older equipment designed to work with Loran. Note that the same limitations apply to this message as the ones in the RMB since it is expected to be decoded by an autopilot. $GPXTE,A,A,0.67,L,N*6F Where: XTE Cross track error, measured A General warning flag V = warning (Loran-C Blink or SNR warning) A Not used for GPS (Loran-C cycle lock flag) 0.67 cross track error distance L Steer left to correct error (or R for right) N Distance units - Nautical miles *6F checksum 7.3.7) Other Sentences That may be Useful: ALM - GPS Almanac Data contains GPS week number, satellite health and the complete almanac data for one satellite. Multiple messages may be transmitted, one for each satellite in the GPS constellation, up to maximum of 32 messages. Note that these sentences can take a long time to send so they are not generally sent automatically by the gps receiver. (Sorry I don't have an exact example of the sentence.) Note that this sentence breaks the 80 character rule. Also note that this
  • 77. 67 sentence is often accepted as input so that you can preload a new almanac in a receiver. $GPALM,A.B,C.D,E,F,hh,hhhh,... Where: ALM Almanac Data being sent A Total number of messages B Message number C Satellite PRN number D GPS week number (0-1023) E Satellite health (bits 17-24 of message) F eccentricity hh t index OA, almanac reference time hhhh sigma index 1, inclination angle ... OMEGADOT rate of right ascension SQRA(A) root of semi-major axis Omega, argument of perigee Omega index 0, longitude of ascension node M index 0, mean anomaly a index f0, clock parameter a index f1, clock parameter HCHDG - Compass output is used on Garmin etrex summit, vista , and 76S receivers to output the value of the internal flux-gate compass. Only the magnetic heading and magnetic variation is shown in the message. $HCHDG,101.1,,,7.1,W*3C where: HCHDG Magnetic heading, deviation, variation 101.1 heading ,, deviation (no data) 7.1,W variation ZDA - Data and Time $GPZDA,hhmmss.ss,dd,mm,yyyy,xx,yy*CC $GPZDA,201530.00,04,07,2002,00,00*60 where: hhmmss HrMinSec(UTC) dd,mm,yyy Day,Month,Year xx local zone hours -13..13 yy local zone minutes 0..59 *CC checksum
  • 79. 69 8.1) INTRODUCTION: In this chapter we discuss about the RF transceiver that is used. We describe all its pin definition, data reception and transmission and frequency setting how set it for transmission. 8.2) WIRELESS RF TRANCIEVER 433MHz FSK TRANSFER MODULE Figure 8-1 8.2.1) HISTORY: 433MHz is an integrative module for transmitting and receiving wireless data based on FSK Zero-IF digital infrastructure. The products conform to related laws and standards about micro-power wireless telecommunication devices in PRC, USA, Canada, EU, Australia, New Zealand, etc. This module is sorted as version A and B based on the firmware program employed. The difference of these two versions lies on the conditions of activation for data transmission and the way that transmitting and receiving status are switched while the radio frequency performance and functions of both versions remain consistent. You may refer to the following for details. 8.2.2) PIN DEFINATION: The pin started from the left side (viewed from the side that IC components are visible) is pin 1. Please pay close attention that the pins on module PCB have been marked with pin 1 and pin 8. PIN1: VCC. +2.4V~+4.2v, requires at least 100mA stable current supply, the ripple shall be reduced to the amount of less than 20mv while the interface of power supply shall be equipped with appropriate decoupling components. PIN2: GND
  • 80. 70 PIN3: RXD. Serial input, baud rate 19200 (customizable), 8-bit data bits, 1-bit start bit, 1-bit stop bit. This IO is input. PIN4: TXD. Serial output, baud rate 19200 (customizable), 8-bit data bits, 1-bit start bit, 1-bit stop bit. This IO is input. PIN5: Enable. This is “Enable” port of module, active low. This IO is input. PIN6: Busy. It output “busy” signal during transmission and receiving, active low. This IO is output. PIN 7: for module of 433MHz type, this pin is reserved. This IO is input. PIN 8: Frequency Setting Enable Port, active low. This IO is input. 8.2.3) INTERFACING DIAGRAM: Figure 8-2
  • 81. 71 8.2.4) DATA RECPETION: When valid data has been received by the module, demodulated data will be transmitted serially from TXD automatically. Busy port maintains low level during data frame transmission, and turns into high when data frame transmission has been finished or no valid data has been received. 8.2.5) DATA TRANSMISSION: Module of 915MHz type: When the level of “Busy” indicates high, data could be directly feed into RXD terminal in standard serial communication format in series. The module will automatically switch into transmission status if the data input stops for approximately 10 ms long. In programming application, please stop for at least 15 ms. During data transmission, “Busy” output remains low level, so please don‟t use serial port for data transmission. Otherwise, it will be processed as invalid. When “Busy” indicator is not in use, appropriate delay might be added prior to the transmission of the next frame data after the transmission of the previous frame data is finished. This module supports both transmission and reception of any hex data including ASCII characters, Chinese character, etc. The data amount of single frame for this module is limited into a threshold of 1byte~64 bytes. Any data that beyond this range will be ignored. “Busy” output is “strong pull-down” type which could bear a maximum current of up to 20mA. It is allowed to insert LED and current-limiting resistor as indicator for data transmission and reception between “Busy” port and VCC. 8.2.6) FREQUENCY SETTING: PIN 8 shall remain low level during frequency settings. The frequency settings of module can proceed during either data transmission or reception. It accepts 64 frequencies on this module and numbered from channel 0~63. The setting parameter is “not so easily lost on power down”. Over 100,000 operations shall be settings of last time. Set PIN8 to low level when the working frequency is to be set, then, feed hex command “0xaf” and channel number continuously from serial port, the channel number ranges from 0-63 in decimal (corresponding to 0x00-0x3f in hex). Numbers input that exceed 63 will automatically be modified as 63. The results of frequency setting will be returned from serial port which serves as the basis of valid operation. After the frequency setting parameters are feed into serial port of module, PIN 6 (Busy) will indicate as low level and will resume to high level after setting is finished. Setting PIN8 to high level after the frequency settings been finished (you may monitor Busy indication) will lead you to the new status of data transmission and reception on newly-selected frequency. Frequency settings on each channel are shown as follows: 433M: 430.26M-439.71M 868M: 860.50M-869.95M
  • 82. 72 915M: 915.18M-924.63M The difference between channels is 150 kHz, detailed channel frequency calculation (take 915M channel as an example, other frequency settings have the same calculation method but different initial frequency): f=915.18+channel number x 0.15 in MHz. The above-mentioned frequency settings have dodged internal CDMA and GSM frequency band, for export products, more frequencies can be provided for selection in accordance with related standard of countries in which products with this module are going to be sold.
  • 84. 74 Following applications are sued in our project in terms of programming the AVR ATMega-16 Microcontroller. AVR Studio 4 PonyProg 2000 version 2.06f WinAvr AVR libc 9.1) HOW TO COMPILE SOURCE CODE Step#01 Open AVR Studio4 and create new project as defined in the diagram below. Figure 9-1
  • 85. 75 Step#02 In Step 2 you need to select the appropriate platform. For programming of ATMega- 16 from an ISP, you need to select the AVR Simulator. Select your device given in the AVR Studio4. Note: You must select at least one platform to do the programming. Figure 9-2
  • 86. 76 Step#03 Write your code in the following window. Figure 9-3 Step#04 After writing the source code in AVR Studio4, you need to include directories and libraries to the project which are been used in our source. In our case WinAVR and AVR libc are two main libraries used.
  • 90. 80 Step#05 The Last step to this procedure is to build the project. In this if you have any errors in the source code you have the bottom window to view these errors and warnings. Figure 9-7
  • 92. 82 9.2) BURNING .HEX FILE INTO THE MICROCONTROLLER USING PONYPROG After the successful completion of HEX file generation, now you can use PonyProg software to burn this .hex file into the microcontroller. For doing so you need an ISP Cable, the circuit diagram of ISP Cable is given below. Figure 9-9 Connect the ISP cable to the microcontroller development board, and open the hex file using PonyProg, as mentioned in the diagram below:
  • 93. 83 Figure 9-10 Select the .hex file and press open, by doing you can see the FFFFF and 000000 sort of coding on the screen which is yours .hex file. Press write device button to write the hex file into the microcontroller board. You must check that the controller you are programming must be selected before any read write operation.
  • 96. 86 Figure 9-13 After writing the code into the target controller, you can even read the controller by using Read Device button.
  • 99. 89 Appendix A TIME AND COST ANALYSIS
  • 100. 90 TIME AND COST ANALYSIS Contents Time Cost Sailing Boat(Designing & Testing) 20 days Rs 5000 Controller Programmer 10 days Rs 2000 Servo Motor( Understanding servo mechanism & motor purchasing) 30 days Rs 6000 Power supply(±5V & 75-80V) 15 days Rs 1000 Development board (Designing & testing) 30 days Rs 500 Sensors 20 days Rs 8000 Hardware Assembly 40 days Rs 6000 GPS Module 15 days Rs. 4000 RF Module 10 days Rs. 2000 Miscellaneous 30 days Rs 4000 Total 250 days (working) Rs 38,500