Source: https://mokxi.com/teachers/plans/build-boat-autopilot
Updated: 2026-11-19

Lesson plan

# 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.

3 chapters, 6 lessons, about 7 hours, on the Arduino Uno R3. Every lesson runs in the browser, with nothing to install.

Start a class from this course

The unit

## 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.

Chapter 1. About 2 h 20 min

## 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 compass An 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

- A pilot for the simulator
- Two axes and atan2
- Keep it in 0 to 360
- Magnetic is not true
- Somewhere else

Tilt compensation A 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

- Heel it
- Gravity says which way is down
- Rotate the field back
- Without it

### 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".

Chapter 2. About 2 h 35 min

## Steer

A rudder with limits, and a PID heading loop that wraps, recovers and does not hunt.

Lesson | Time | What students do

A rudder servo The 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

- Hand steering
- The stop
- The boat turns
- A slower rudder

A PID heading loop Close 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

- AUTO
- A new course
- The 359 to 1 trap
- A knock
- Hunting in waves
- A deadband

### 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".

Chapter 3. About 2 h

## Navigate

Great-circle distance and bearing to waypoints, then the whole route.

Lesson | Time | What students do

GPS waypoints From 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

- A fix
- Distance and bearing
- Arrive
- A bigger circle

Project: hold a course Sail the whole route, add a leg of your own, steer it from the knob, and write up the pilot with its limits. | 60 min

- The whole route
- A leg of your own
- The knob
- Write it up

### 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".

Your class

## 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.

Start a class from this course See the demo class

More units

## Other lesson plans

Electronics basics 20 lessons, about 10 h. Embedded on the Arduino Uno 16 lessons, about 12 h. Embedded on the ESP32-C3 13 lessons, about 11 h. Embedded on the Raspberry Pi Pico 7 lessons, about 6 h. Build your own fight stick 5 lessons, about 4 h. Embedded on the STM32F411 6 lessons, about 6 h. C++ on a board 13 lessons, about 10 h. Digital logic and memory 4 lessons, about 4 h. Interactive devices on the Uno 9 lessons, about 8 h. From gates to a computer 23 lessons, about 16 h. Build a claw machine 8 lessons, about 6 h. Every unit All the courses as ready-made units, on the teachers page.
