Build a boat autopilot lesson plan
A tiller pilot for the simulator: a tilt-compensated compass with declination, a limited rudder, a PID heading loop that knows 359 from 1 and ignores waves, and great-circle navigation to GPS waypoints. Never for real navigation.
Objectives and materials
By the end, students can
- Heading from a three-axis compass, declination, and tilt compensation for a heeling boat.
- A rudder with limits, and a PID heading loop that wraps, recovers and does not hunt.
- Great-circle distance and bearing to waypoints, then the whole route.
Materials for the whole unit
- Accelerometer and compass, LSM303AGR
- Arduino Uno R3
- GPS module, NEO-6M
- Hobby servo
- Rotary encoder, KY-040
Every part is already on the simulator’s bench, so there is nothing to buy or hand out. The counts are the most any one lesson uses, if you build it on real breadboards too.
Which way is north
Heading from a three-axis compass, declination, and tilt compensation for a heeling boat.
| Lesson | Time | What students do |
|---|---|---|
| Heading from a compassAn LSM303AGR measures the Earth’s field in three axes. Turn two of them into a heading with atan2, keep it in 0 to 360, and correct magnetic north to true north with the declination. | 80 min |
|
| Tilt compensationA sailboat heels. Tip a flat compass and the vertical field leaks into its reading. Heel 20 degrees and watch north read 329, then see how the accelerometer puts it back. | 60 min |
|
Materials
- Accelerometer and compass, LSM303AGR
- Arduino Uno R3
- GPS module, NEO-6M
- Hobby servo
- Rotary encoder, KY-040
Check for understanding
Each student finishes "Tilt compensation" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Without it".
Steer
A rudder with limits, and a PID heading loop that wraps, recovers and does not hunt.
| Lesson | Time | What students do |
|---|---|---|
| A rudder servoThe rudder is a servo with limits: 30 degrees each way and 40 degrees a second. Steer by hand in standby, hit the stop, watch the modeled boat turn, and slow the rudder to a real ram’s speed. | 60 min |
|
| A PID heading loopClose the loop: AUTO holds a course with a PID on the heading error. Turn to a new course, fall into the 359 to 1 trap and out of it, ride out a knock, and stop the rudder hunting in waves. | 95 min |
|
Materials
- Accelerometer and compass, LSM303AGR
- Arduino Uno R3
- GPS module, NEO-6M
- Hobby servo
- Rotary encoder, KY-040
Check for understanding
Each student finishes "A PID heading loop" on their own, without opening the hints. The simulator checks 6 of its 6 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "A deadband".
Navigate
Great-circle distance and bearing to waypoints, then the whole route.
| Lesson | Time | What students do |
|---|---|---|
| GPS waypointsFrom holding a heading to going somewhere. Get a fix, work out great-circle distance and bearing to a waypoint, steer to it, and switch to the next one inside an arrival radius. | 60 min |
|
| Project: hold a courseSail the whole route, add a leg of your own, steer it from the knob, and write up the pilot with its limits. | 60 min |
|
Materials
- Accelerometer and compass, LSM303AGR
- Arduino Uno R3
- GPS module, NEO-6M
- Hobby servo
- Rotary encoder, KY-040
Check for understanding
Each student finishes "Project: hold a course" on their own, without opening the hints. The simulator checks 4 of its 4 steps as they go.
Then ask each one to explain, in a sentence or two, the last thing it asked of them: "Write it up".
Teach this unit as a class
Start a class from this course and its 6 lessons are assigned in one go, in order. Students join with a six-character code or printed login cards, and each one’s work comes back to you.
The class tools are free for 30 days for one class of up to 20 students, with no card. The lessons themselves are free either way.