The Unmanned Autonomous Vehicle (UAV) Project

Table of Contents

  1. Objective
  2. Operational Concepts
  3. Requirements
  4. Design Decisions
  5. Navigation
  6. Speed Control
  7. Simulation
  8. System Breakdown Structure
  9. Functions
  10. Interfaces
  11. Investigation
  12. Completed Development
  13. Current Development
  14. Further Development
  15. Prototype Specifications
  16. Interconnection Diagram
  17. Detailed Schematic Diagram
  18. Interface Design
  19. Software Design
  20. Coding Examples
  21. Verification and Validation
  22. Documentation
  23. Links


The objective of this UAV Project is to bring interested people together and to promote the exchange of ideas.

"Something magical happens when you bring together a group of people from different disciplines with a common purpose." - Mark Stefik

"A shared vision is not an idea. It is, rather, a force in people's hearts. At its simplest level, a shared vision is the answer to the question: What do we want to create?" - Peter Senge

Back to Table of Contents

Operational Concepts

  1. The UAV mission shall be to autonomously navigate and survey an area of ground along a pre-defined route.

  2. The UAV shall locate any objects* along its path.

  3. The UAV shall provide the user with the location of any any objects found. 

  4. The UAV shall be activated and launched by the user before the mission.

  5. The UAV shall be recovered and deactivated by the user after the mission.

(*) Note: The specific type of object is yet to be determined. The purpose of the objects is merely to verify the success of the mission. For example: The objects could be coins scattered randomly throughout the search area. The mission would be successful if the UAV found all the coins.

Back to Table of Contents


  1. The system shall comprise a fixed and a mobile segment.
  2. The fixed segment shall provide a user interface.
  3. The user interface shall enable the user to control and monitor the operation of the mobile segment.
  4. The mobile segment shall comprise an UAV capable of autonomous navigation, movement and surveillance.
  5. The mobile segment shall operate without the need for user intervention.

Back to Table of Contents

Design Decisions

Analysis of the operational concepts and further investigation lead to the following design decisions and derived requirements:

The vehicle would operate within the search area and the user would operate the vehicle from outside of the search area. To maintain both safe and secure operation, the vehicle must be visible to the user at all times.

The system shall comprise a fixed segment and a mobile segment.

The fixed segment shall be deployed within line-of-sight of the mobile segment.

The mobile segment shall be deployed within the search area.

A fixed or rotary winged airborne vehicle would have better coverage of rough terrain, but a ground vehicle would simplify the design, construction and testing. A wheeled vehicle would be preferred over a tracked vehicle, which would be slower, more complex and may also damage the environment. The vehicle's movement should not be impeded by any towed cables.

The mobile segment shall be ground-based.

The mobile segment shall be wheeled.

The mobile segment shall operate under its own power.

The mobile segment shall have a wireless connection to the fixed segment.

The vehicle would have to move in a defined search pattern to find all the objects within the search area. The search pattern must take account of the size and shape of the search area, the turn radius of the vehicle and the detection radius of the object detector. To move in such a defined way the vehicle must be able to navigate by real-time determination of is own position, speed, direction and knowledge of its required destination. Navigation like this implies a navigation reference system and a vehicle control system. Navigation reference systems include, in order of preference, the Global Positioning System (GPS), an Inertial Navigation System (INS), dead-reckoning using a magnetic compass and odometer or, finally, triangulation of static beacons located outside of the search area. The GPS would be the most cost-effective sensor. The vehicle control system should be on-board the vehicle to prove operation without human intervention from the fixed segment. 

The mobile segment shall autonomously navigate a pre-defined search pattern.

Regarding terrain and ground clearance, the vehicle could have a wheel in a -2cm rut while the vehicle chassis could experience a +2cm hump.

The mobile segment shall have a ground clearance of at least 4cm.

For safety reasons the vehicle must be controllable by the user at all times.

The mobile segment shall permit remote control override of its speed and direction by the fixed segment.

For test and evaluation purposes the mission of the vehicle must be controlled by the user; to navigate to a waypoint or to execute a defined search pattern. This capability would be provided by a wireless command link.

The mobile segment shall permit control of its mission by the fixed segment.

Evaluation of the system performance would be greatly simplified if on-board vehicle data was made available to the user in real-time. A wireless telemetry link would provide feedback of the vehicle's position, speed and direction as well as the location of any objects.

The mobile segment shall provide its position, speed, direction and the location of objects to the fixed segment.

A wireless video surveillance system would provide provide independent feedback of object location.

The mobile segment shall provide independent video surveillance of the object location to the fixed segment.

The user will be able to remotely control the vehicle's speed and direction, have control of the vehicle's mission and monitor the vehicle's telemetry data and its surveillance video.

The fixed segment shall provide the user remote control of the mobile segment.

The fixed segment shall provide the user mission control of the mobile segment.

The fixed segment shall provide the user telemetry data from the mobile segment.

The fixed segment shall provide the user surveillance video from the mobile segment.

The vehicle should actively discourage people within the search area from interfering with the vehicle and possibly endangering their own safety. This type of protection should be non-invasive, but effective.

The mobile segment shall discourage unauthorised human interference in its operation.

Back to Table of Contents


The derived requirement for UAV navigation is stated as follows:

The UAV shall navigate along a track between two arbitrary waypoints, starting with an arbitrary heading and at an arbitrary distance from the track.

The optimum navigation solution should be for the UAV to execute the minimum number of turns at its maximum rate of turn in order to intercept the track as quickly as possible. The UAV should execute an intercept course perpendicular to the track when not turning or travelling along the track.

The optimum navigation solution is illustrated below (there are sixteen cases shown in the diagram). The UAV starting position is indicated by an X. Its initial heading is shown with an arrow. The horizontal line is the track between the first waypoint at left and the next waypoint at right. For each starting angle there are two navigation solutions shown: One starting on the track and the other starting at a perpendicular distance "d" from the track. The thick lines indicate the optimum path of the UAV. Each curve is an arc with a radius equal to the maximum turn rate of the UAV. The blue line indicates a right turn. The red line indicates a left turn. The black line indicates a perpendicular intercept course.

Optimum Navigation Solution

The navigation solution is illustrated in the following diagram:

Navigation Diagram

The navigation solution uses the following terms:

Term Abbrev Definition Calculation Range Resolution Units
Position (X3,Y3) The Cartesian coordinates of the UAV as derived from its GPS Position (GLAT0, GLON0). Note: Only the fractional minutes of arc are used. No correction is made for latitude. (GLON0, GLAT0) 0-9999 0.0001 min of arc
Heading HDG The heading of the UAV as derived from its GPS Ground Track (GHDG0) GHDG0 0-36000 0.01 Degrees
Speed SPD The speed of the UAV as derived from the GPS Ground Speed GSPD0 0-50000 0.01 Knots
Waypoint1 (X1,Y1) The starting point of the track (X1,Y1) 0-9999 0.0001 min of arc
Waypoint2 (X2,Y2) The ending point of the track (X2,Y2) 0-9999 0.0001 min of arc
Leg LEG The distance between Waypoint1 and Waypoint2 SQRT(SQR(Y2-Y1)+SQR(X2-X1)) 0-14140 0.0001 min of arc
Area AREA The area of the navigation triangle, as defined by vertices at (X1,Y1), (X2,Y2) and (X3,Y3). Found by the determinant method, which returns both positive and negative results - useful in calculating the CTE. 0.5(X1Y2-X1Y3+X2Y3-X2Y1+X3Y1-X3Y2) 0-50000000 0.0001 sq min of arc
Track TRK The track angle between Waypoint1 and Waypoint2. Track also refers to the ground track between these two points. ATAN2PI(X2-X1,Y2-Y1)*18000/Pi -18000 to +18000 0.01 Degrees
Cross Track Error CTE The magnitude of CTE indicates the perpendicular distance from the UAV to the Track. The sign of CTE is positive if the UAV is on the left side of the track and negative if the UAV is on the right side of the track (i.e. when facing along the direction of the track). 2*AREA/LEG 0-9999 0.0001 min of arc
Cross Track Gain CTG A constant multiplier applied to CTE in order to control the dynamics of the intercept course. Larger values speed the intercept, but increase overshoot at the track. The optimum value is discovered by simulation. The simulation uses the value:  TRL/SPD TRL/SPD 0-65535    
Cross Track Angle CTA The relative angle required to cross (or intercept) the track from the current UAV position. Positive means to cross to the right of the track, negative means to cross to the left of the track. CTE*CTG -9000 to +9000 0.01 Degrees
Course CRS The required direction to steer to. TRK+CTA 0-36000 0.01 Degrees
Turn Angle TRN The required turn angle in degrees. Right is positive. Left is negative. CRS-HDG -18000 to +18000 0.01 Degrees
Steering Gear Ratio SGR A constant divisor applied to the turn angle to adjust for the steering gear. The optimum value is discovered by simulation. 4 0-65535    
Steering Angle STR The steering angle in servomotor PWM microsecond units. Centre value is 1500uS. Right is greater than 1500uS. Left is less than 1500uS. The positive and negative excursions are strictly limited to the range indicated. TRN/SGR+1500 1000 to 2000 1 uS
Turn Rate Limit TRL A constant used only in the simulation. It represents the maximum turn rate in degrees per second. Assume 20 degrees per second = 18 second turn. 2000 0-65535 0.01 Degrees per second

Back to Table of Contents

Speed Control

The derived requirements for UAV speed control are stated as follows:

The UAV shall shall start moving when commanded to do so.

The UAV shall shall stop moving when commanded to do so.

The UAV shall shall stop moving at a pre-configured waypoint.

The UAV shall shall accelerate at a pre-configured rate.

The UAV shall shall decelerate at a pre-configured rate.

The UAV shall shall maintain a pre-configured manoeuvring speed while turning.

The UAV shall shall accelerate to a pre-configured cruising speed while not turning or breaking.

The UAV shall shall decelerate prior to turning.

The UAV shall shall decelerate prior to stopping.

Consider the UAV navigating from an arbitrary position and heading along a track between waypoint 1 and waypoint 2 on the following map. The UAV turns onto an intercept course with the track, then turns onto the track.

The UAV speed profile together with the Cross Track Error and Closest Point of Approach (to Waypoint 2) is shown in the following diagram.

Back to Table of Contents


Numerical simulation of the navigation solution was performed using an Excel spreadsheet (here). Extensive simulation shows that the UAV approximates the optimum navigation solution over a range of speeds. 

Simulation Control
Constants Inputs Outputs Calculations Output
X1 -60 1 10.0 0 -60.0 60.0 7200 240 9000 18000 18000 2000
X2 60 2 10.0 2000 -60.0 70.0 7800 130 9000 18000 16000 2000
Y1 -60 3 10.0 4000 -56.6 79.4 8363 139 9000 18000 14000 2000
Y2 -60 4 10.0 6000 -50.2 87.1 8823 147 9000 18000 12000 2000
TRK 9000 5 10.0 8000 -41.5 92.1 9123 152 9000 18000 10000 2000
LEG 120 6 10.0 10000 -31.6 93.8 9227 153 9000 18000 8000 2000
HDG 0 7 10.0 12000 -21.8 92.1 9123 152 9000 18000 6000 2000
SPD 10 8 10.0 14000 -13.1 87.1 8823 147 9000 18000 4000 2000
SGR 4 9 10.0 16000 -6.7 79.4 8363 139 9000 18000 2000 2000
CTG 200 10 10.0 18000 -3.3 70.0 7800 130 9000 18000 0 1500
TRL 2000 11 10.0 18000 -3.3 60.0 7200 120 9000 18000 0 1500
    12 10.0 18000 -3.3 50.0 6600 110 9000 18000 0 1500
    13 10.0 18000 -3.3 40.0 6000 100 9000 18000 0 1500
    14 10.0 18000 -3.3 30.0 5400 90 9000 18000 0 1500
    15 10.0 18000 -3.3 20.0 4800 80 9000 18000 0 1500
    16 10.0 18000 -3.3 10.0 4200 70 9000 18000 0 1500
    17 10.0 18000 -3.3 0.0 3600 60 9000 18000 0 1500
    18 10.0 18000 -3.3 -10.0 3000 50 9000 18000 0 1500
    19 10.0 18000 -3.3 -20.0 2400 40 8000 17000 -1000 1250
    20 10.0 17000 -3.3 -30.0 1800 30 6000 15000 -2000 1000
    21 10.0 15000 -1.6 -39.8 1209 20 4000 13000 -2000 1000
    22 10.0 13000 3.4 -48.5 689 11 2200 11200 -1800 1050
    23 10.0 11200 11.1 -54.9 303 5 1000 10000 -1200 1200
    24 10.0 10000 20.4 -58.7 79 1 200 9200 -800 1300
    25 10.0 9200 30.2 -60.4 -26 -1 -200 8800 -400 1400
    26 10.0 8800 40.2 -60.8 -47 -1 -200 8800 0 1500
    27 10.0 8800 50.2 -60.4 -26 -1 -200 8800 0 1500
    28 10.0 8800 60.2 -60.1 -5 -1 -200 8800 0 1500
    29 10.0 8800 70.2 -59.7 16 0 0 9000 200 1550
    30 10.0 9000 80.2 -59.4 37 0 0 9000 0 1500

Navigation Simulation

Back to Table of Contents

System Breakdown Structure

The UAV System is broken down into the segments and subsystems shown in the following diagram.

System Breakdown Structure

Back to Table of Contents


System functionality is allocated to subsystems in accordance with the following table.

Subsystem Allocated Functions
Vehicle Subsystem Forward and reverse motion, steering, ground traction and stability over defined terrains. Towing and load bearing. Equipment mounting and environmental protection.
Vehicle Control Subsystem Real-time position, heading and speed determination. Vehicle speed, acceleration, breaking and direction control. Search pattern navigation.
TeleCommand Subsystem Real-time wireless telemetry of  position, heading, speed and object location. Real-time wireless command of vehicle operation.
Object Detection Subsystem Real-time surface detection of selected objects.
Video Surveillance Subsystem Real-time, independent, wireless, confirmation of object location and surveillance.
Collision Avoidance Subsystem Detection of obstacles.
Self Protection Subsystem Non-violent protection against theft and vandalism.
Power Supply Subsystem Power supply, conversion, regulation and distribution.
Mission Control Subsystem User interface. Command and Control. Data reduction, display and recording.
Vehicle Support Subsystem Battery charging, programming and debugging.
Remote Control Subsystem Remote control of vehicle speed and direction.

System Functions

Back to Table of Contents


The UAV system context diagram indicating external interfaces is shown below:

Context Diagram

Back to Table of Contents


What is the detection radius of a object detector ? Assume 25cm.
What is the turning radius of the vehicle? Assume 5m.
What is the endurance of the vehicle with the present battery? Assume 15 minutes.
What is the best search pattern for a square area as a function of turn radius and detection radius?
What is the total distance covered in the search pattern?
What is the maximum speed required to complete the search pattern in one hour?
What is the maximum speed permitted by the object detector?
What are the vehicle power requirements to execute the search pattern?

Back to Table of Contents

Completed Development

Vehicle Subsystem - Vehicle Chassis/Equipment Tray.
Radio Control Subsystem - RC Transmitter/Receiver.
Vehicle Control Subsystem - Battery, Motor, Electronic Speed Controller, Steering Servo.
Vehicle Control Subsystem - Microcontroller, GPS Receiver, Yaw Rate Gyro.
Power Supply Subsystem - DC Power Supply, Battery Charger.
TeleCommand Subsystem - TeleCommand Transceiver.

Current Development

Vehicle Control Subsystem - Navigation software.
Vehicle Control Subsystem - Telemetry and Command software.
Mission Control Subsystem - Telemetry and Command software.

Back to Table of Contents

Further Development

Object Detection Subsystem
Video Surveillance Subsystem
Collision Avoidance Subsystem
Environmental Sensor Subsystem
Self Protection Subsystem

Back to Table of Contents

Prototype Specifications

  • Style: 4WD Monster Truck
  • Scale: 1/8
  • Chassis Type: Countersunk Alloy
  • Side Splash Guards
  • Top Mounted Equipment Tray
  • Height: 250mm
  • Ground Clearance: 48mm
  • Overall Length: 510mm
  • Overall Width: 380mm
  • Wheelbase: 325mm
  • Equip. Tray Ext: 460x360x47mm
  • Equip. Tray Int: 400x300x40mm
  • Unidirectional MT-X4 Tires
  • Tire Width/Diameter: 150x90mm
  • Removable Equipment Tray
  • Velcro Pad Equipment Mounting
  • Adjustable Height
  • Suspension: Full 4 Wheel A-Arm 100% independent adjustable
  • Front and Rear Differentials
  • Battery: 7.2volt 1800mAh NiCd
  • Steering Servo: Hi Torque 9kg 
  • Steering Trim
  • Adjustable Camber
  • Adjustable Toe In, Toe Out
  • Alloy Cap Coil Spring Adjustable Shock Absorbers
  • Centre Differential
  • Motor: Fan Cooled Novatech Brushless 3000KV 420Watt
  • Gear Ratio: 1:12.95
  • Electronic Speed Controller: Fan Cooled Novatech 70AMP with Forward / Reverse / Brake

  • RC Transmitter
  • Hitech Flash 5 System X
  • FM Digital Proportional
  • Channels: 4
  • Stick Modes: I/II
  • Throttle, Elevator, Aileron, Rudder
  • Telescopic Antenna: 1m
  • Frequency: 36.450MHz
  • Low Battery Warning
  • End-Point Adjustment
  • Dual Rate Switches
  • Trim Memory
  • Channel 5 Retract Switch
  • TeleCommand Console
  • Model: Dell Laptop Computer
  • MSP430 USB Debug Interface
  • Model: TI MSP-FET430UIF
  • Interfaces: USB, JTAG
  • Voltage: 1.8V to 3.6V
  • Compiler/Assembler/IDE
  • Model: IAR Embedded Workbench
  • Breakpoint Debugger
  • Automatic Flash Download
  • Symbolic Memory display
  • Microcontroller
  • TI MSP430F149 CPU
  • Olimex Header Board
  • Ultra-Low Power
  • 8MIPS 16-Bit RISC Processor
  • 2 USARTS
  • 10 12BIT ADC
  • 2 16-Bit Timers
  • Voltage: 4.8V to 6.0V
  • Current:
  • Size: 48x48x30mm
  • Weight: 50g

  • GPS Receiver (Old)
  • Model: Polstar PMB-248
  • Type: Built-In Patch Antenna
  • Chipset: Sony CXD2951GA-4
  • Channels: 12
  • Fix Update Rate: 1Hz
  • Sensitivity: -152 dBm Tracking
  • Interfaces: TTL and RS-232
  • Data Rate: 4800 bps
  • Voltage: 3.3V to 5.0V
  • Current: 80mA
  • Size: 32x32x8mm
  • Weight: 17g
  • GPS Receiver (New)
  • Type: Built-In Patch Antenna
  • Chipset: MediaTek MT3329
  • Channels: 66
  • Fix Update Rate: 10Hz
  • Sensitivity: -165dBm Tracking
  • Interfaces: TTL and USB
  • Data Rate: 4800-115200 bps
  • Voltage: 3.3V to 5.0V
  • Current: 37mA
  • Size: 16x16x6mm
  • Weight: 7g
  • GPS Backup Battery
  • Model: Panasonic CR2032
  • Type: Lithium
  • Voltage: 3.0V
  • Capacity: 220mAh
  • Size: 20x3.2mm
  • Weight: 3.1g
  • Yaw Rate Gyro
  • Model: Futaba GY401
  • Type: Silicon Micro Machine
  • Modes: Rate, Integrating Rate
  • Switch 1: Digital/Analog Servo
  • Switch 2: Nor/Rev Servo
  • Control 1: Delay
  • Control 2: Limit
  • Voltage: 4 to 6V
  • Current:
  • Size: 27x27x20mm
  • Weight: 27g

  • RC Receiver
  • Ultra Narrow Band
  • Dual Conversion
  • FM Digital Proportional
  • Channels: 8
  • Frequency: 36.450MHz
  • Voltage: 4.8V to 6.0V
  • Current:
  • Size:
  • Weight: 36g
  • RC Servo (Typical)
  • Model: Hitec HS-422
  • Type: PWM 1000us-2000us
  • Speed: 60 in 0.21s (No Load)
  • Torque:
  • Voltage: 4.8V To 6.0V
  • Current: 150mA
  • Size: 40.6x19.8x36.6mm
  • Weight: 46g
  • Battery Charger
  • Cells: 1-6 LiPo, LiFe
  • Cells: 1-16 NiCd, NiMH
  • Cells: 1-12 Pb
  • Interfaces: PC, Temp, Balancer
  • Voltage: 11-28V
  • Current 1-10A
  • Power: 250W
  • TeleCommand Transceiver
  • Model: XBee Pro 900
  • Shown fitted to Serial Adapter
  • Range: 3km LOS
  • TX Power: +17dBm (50mW)
  • Antenna Gain: 2dBi
  • RX Sensitivity: -100dBm
  • Frequency: 902-928MHz (ISM)
  • ECCM: FH Spread Spectrum
  • Data Rate: 8700bps max
  • Encryption: 128 bit AES
  • Voltage: 3.3V - 3.6V
  • Current: 210mA TX, 80mA  RX
  • Size: 25x35x15mm
  • Weight: 18g
  • USB-Serial Adapter
  • Model: ATEN UC-232A
  • Interfaces: USB, RS-232
  • DC Power Supply
  • Model: Powertech
  • Voltage: 13.8V
  • Current: 12A
  • AC Inverter
  • Continuous: 150W Output
  • Surge: 450W Output
  • Standby Current: < 300mA
  • Input Voltage: 10 - 15VDC
  • Output: Modified Sine Wave
  • Efficiency: > 90%
  • Size: 141x79x45mm
  • Weight: 0.4kg


Back to Table of Contents

Interconnection Diagram

Back to Table of Contents

Detailed Schematic Diagram

Detailed Schematic Diagram

Back to Table of Contents

Interface Design

Device Interface Specification
GPS Receiver Power 3.3VDC
  Serial Port 9600bps,n,8,1,3.0V
TeleCommand Transceiver Power 3.3VDC
  Serial Port 9600bps,n,8,1,3.0V
  Data Link

10 byte message format:

Lat LSB, Lat MSB, Lon LSB, Lon MSB, Spd LSB, Spd MSB, Hdg LSB, Hdg MSB, Sync1,Sync2

Lat and Lon are minutes of arc/10000. Range 0000-9999

Spd is knots/100. Range 0.00-500.00

Hdg is degrees/100. Range 0.00-360.00

Message Rate: 1Hz

Sync1 = 8-bit checksum of Lat, Lon, Spd and Trk

Sync2 = Bitwise inverse of Sync1

Microcontroller Power 3.3VDC
  PWM 3.3VDC, 1000-2000uS, 40-50Hz
Vehicle Control System Power 4.8VDC

Software Design

The software design is shown below. The system enters the reset Interrupt Service Routine (ISR) after power up. It initializes its modules and memory, enables interrupts and then powers down the CPU. External PWM interrupts from the radio control subsystem run at 50Hz. In their absence an internal 45Hz interrupt occurs. The PWM inputs are read. Internal PWM deltas are added to the PWM inputs and the result is output to the steering servomotor and electronic speed controller. Data is read from the GPS port and the TeleCommand ports at 9600bps. When a complete message is received a task flag is set to process the message after the interrupt is serviced. The CPU is woken up to complete the task. The waypoint task computes the track angle and length of each leg between waypoints. The GPS task uses these to compute the new course, the Cross Track Error (CTE) and the turn required. It then steers the UAV onto the track. The UAV's position, heading and speed telemetry is updated when available from the GPS. Library functions include telemetry encoders to send data and sync frames to the mission control subsystem. Maths functions including a 16bit integer square-root, a  32bit signed integer divide and a 16bit CORDIC arc-tangent. The software is written in MSP430 macro assembler.

Software Design Flow Chart

Back to Table of Contents

Coding Examples

The following example shows the state machine used to parse the NMEA Sentences from the GPS receiver.

Flowchart MSP430 Assembler Code

//USART 0 Receive ISR


//USART0 GPS Interface System Design

//The GPS receiver is the Globaltop FGPMMOPA6B with MediaTek MT3329 chipset

//The GPS provides these NMEA sentences on startup:

//The GPS provides these NMEA sentences before satellite acquisition:

//The GPS provides these NMEA sentences after satellite acquisition:

//Only the GPRMC NMEA sentence need to be decoded as follows:
//RMC Recommended Minimum Navigation Information
//hh=hours, mm=minutes, ss=seconds, ddd=milliseconds
//A=Status (A=Valid,V=Not Valid)
//ddmm.mmmm=degrees, minutes and decimal minutes of arc
//dddmm.mmmm=degrees, minutes and decimal minutes of arc
//N=North/South Hemisphere (N=North, S=South)
//E=East-West of the Meridian (E=East, W=West)
//Spd=Speed knots
//Hdg=Heading Degrees
//DDMMYY=Day, Month, Year
//HH=Checksum in hexadecimal

//The following routine parses GPS NMEA sentences using a state machine
//It works with both fixed and variable length fields of multiple NMEA sentences
//It extracts GPS validity, latitude, longitude, speed and track in ASCII format
//It stores the GPS latitude and longitude in memory as 16 bit integers
//It negates the GPS latitude and longitude for south and west coordinates
//A state vector is used to define how the GPS NMEA sentences are parsed
//A state variable is used to indicate the current position in the state vector
//Where parsing GPS NMEA headers a GPS header pointer GPSHPTR is also used
//The state machine parses one GPS input character at a time
//The only state saved between each GPS input character is GPSSTAT and GPSHPTR

//The GPS state variable GPSSTAT is initialised to zero on startup
//It points to the current position in the state vector
//The GPS state vector GPSVECT contains pointers to individual parsing routines
//The GPS state variable is changed under the control of the parsing routines
//It is incremented to point to the next routine
//It is reset to point to the first routine
//The first parsing routine is the GPS NMEA header routine. E.g GETRMC
//The GPS header pointer GPSHPTR is initialised to zero on startup
//It points to the current position in the GPS header string. E.g. GPSRMC
//It is incremented to point to the next position

	dint			//Disable interrupts during this ISR
	nop			//Required for dint
	push.w	R12		//Save the scratch registers
	push.w	R14
	mov.b	&U0RXBUF,R12	//Get the GPS input variable
#if EchoGPS=1			
	call	#TX1BYTE		//Patch GPS to USART 1 for debugging
	mov.b	&GPSSTAT,R14	//Get the GPS state variable
	call	GPSVECT(R14)	//Call the GPS state routine
	pop.w	R14		//Restore the scratch registers
	pop.w	R12
	eint			//enable interrupts
	reti			//Return form interrupt

//Each state routine should process delimiters by calling GETLIM
//WARNING: GETLIM exits the calling routine if a delimiter is found
//It only returns to the calling routine if no delimiter is found
//Process delimiters: ',' and '.'
GETLIM	cmp.b	#',',R12		//Delimiter received?
	jne	GETLIMa		//No
	jmp	GETLIMb		//Yes Increment state and Exit
GETLIMa	cmp.b	#'.',R12		//Delimiter received?
	jne	GETLIMc		//No
GETLIMb	incd.b	&GPSSTAT		//Yes: Increment state
	pop.w	R12		//Pop the SP from the stack
GETLIMc	ret			//Exit

//Process delimiters: ',' but ignore '.'
GETLIM1	cmp.b	#',',R12		//Delimiter received?
	jne	GETLIM1a		//No
	jmp	GETLIM1b		//Yes Increment state and Exit
GETLIM1a	cmp.b	#'.',R12		//Delimiter received?
	jne	GETLIM1d		//No
	jmp	GETLIM1c		//Yes: ignore
GETLIM1b	incd.b	&GPSSTAT		
GETLIM1c	pop.w	R12		//Pop the SP from the stack
GETLIM1d	ret			//Exit

//Wait for GPRMC header
GETRMC	mov.b	&GPSHPTR,R14	//Get the GPS Header Pointer
	cmp.b	GPSRMC(R14),R12	//Compare GPS input to GPSRMC header
	jne	GETRMCa		//No Match: Exit
	inc.b	&GPSHPTR		//Match found: Increment GPS Header Pointer
	cmp.b	#',',R12		//End of header?
	jne	GETRMCb		//No: Exit
	incd.b	&GPSSTAT		//Yes: Increment GPS State
GETRMCa	clr.b	&GPSHPTR		//Reset GPS Header Pointer
GETRMCb	ret	

//Skip each character until the next delimiter is found then increment the state

//Process the GPS Valid flag
	cmp.b	#'A',R12		//Valid flag received?
	jne	GETVa		//No
	bic.b	#1,&P4OUT		//Yes: Turn off Sync LED
GETVa	cmp.b	#'V',R12		//Invalid flag received?
	jne	GETVb		//No
	xor.b	#1,&P4OUT		//Yes: Toggle the Sync LED
	clr.b	&GPSSTAT
GETVb	ret
//Process the GPS Latitude
	asciimac	R12,&GLAT0	//No: GLAT0=GLAT0*10+Input

//Process the GPS North/South flag
	cmp.b	#'S',R12		//South flag received?
	jne	GETNa		//No
	inv.w	&GLAT0		//Yes: Negate GLAT0
	inc.w	&GLAT0
GETNa	ret

//Process the GPS Longitude
	asciimac	R12,&GLON0	//No: GLON0=GLON0*10+Input

//Process the GPS East/West flag
	cmp.b	#'W',R12		//West flag received?
	jne	GETEa		//No
	inv.w	&GLON0		//Yes: Negate GLON0
	inc.w	&GLON0
GETEa	ret

//Process the GPS Speed
GETS	call	#GETLIM1		//Yes: Ignore
	asciimac	R12,&GSPD0	//No: GSPD0=GSPD0*10+Input

//Process the GPS Heading
GETH	call	#GETLIM1		//Yes: Ignore
	asciimac	R12,&GHDG0	//No: GHDG0=GHDG0*10+Input

	clr.b	&GPSSTAT
	bis.b	#GPSTSK,&TSKFLG	//Yes: Setup to run the GPS task
	bic.b	#CPUOFF,6(SP)	//Wake up the CPU: SR is at SP+6
	//SP+8	PC
	//SP+4	R12
	//SP+2	R14

Back to Table of Contents

Verification and Validation

UAV Test #1 Conducted on 13/12/2009. This test demonstrates the initial prototype UAV under direct radio control (RPV Mode). The test demonstrates low speed manoeuvring, high speed linear motion, including acceleration, gyro stabilisation and breaking followed by high speed manoeuvring. The microcontroller was programmed to simply regenerate the PWM control signals from the RC transmitter. Only throttle, steering and gyro control channels were used. The yaw rate gyro was remotely set for maximum integration during the high speed runs. The platform was stable under all conditions, over vegetation, bumps, dips and sandy terrain. See the full video on youtube here.


UAV Test #2 Conducted on 27/02/2010. The UAV was driven under direct radio control (RPV Mode) around the neighbourhood. The TeleCommand Subsystem provided a real-time downlink of the GPS position from the UAV to the prototype Mission Control Subsystem shown in the picture below. The display was manually scaled to fit a Google EarthTM map.


DIY UAV Mission Control Subsystem

Back to Table of Contents


MSP430 Users Guide

MSP430 Datasheet

X-Bee Serial Explorer

900MHz SMARP Antenna

Olimex MSP430 H149 Header Board


Futaba GY401 Gyro

HiTec HS-422 Servomotor

HiTec Servomotor Manual

ZLDO330 3.3V Ultra Low Dropout Voltage Regulator

4WD Electric Monster Truck - Video

DIY UAV NavSim.xls - Navigation Simulator

DIY UAV Project - Mk I

Back to Table of Contents





Back to Table of Contents