If you cannot afford expensive gyros then there is one very nice way of combining the sensors found on a mobile phone or some HAT board.
See the clip at http://x-io.co.uk/open-source-imu-and-ahrs-algorithms/
and the initial paper published by Madgwick. At the end of the paper there is a very small C-code program that implements a MARG (Magnetic Angular Rate and Gravitational sensor) Fusion Filter. Luckily the modern chips found on a HAT will provide all the required sensor values for MARG.
There is also some scientific papers with simple source codes in C of how to make a reliable position and direction out of the sensors.
The problematic part in a gyro is the drift. When you accelerate or turn you may actually get the direction to drift. Once the vessel is steady you can check the magnetic direction. If it is consistent with the gyro calculation you are happy. Otherwise you may adjust it.
Acceleration has a little similar dilemma. Once you are turning and changing speed you really don't know your exact orientation. But once you run steady then the earths gravity pulls you down.
These automatic adjustments are part of the Fusion Filter algorithm presented here.
So by taking many sensors like magnetic north and earth gravity in the algorithm you can create a cheap, accurate system that is better than the sensors alone.
At the same time you have a wonderful chance to get introduced to quaternion math that is used all over the place from computer games to drones today.
The math and the code is not so cryptic. By reading through the research papers you get a very nice understanding of components required by resilient PNT navigation for autonomous vessels. (Both real ones and small model boats.)
Perhaps you could even expand the fusion filter by finding out what the time is and where the sun is. Or some image recognition algorithms that could see if the lighthouses are where they are supposed to be? Then the algorithm would also care for terrestrial navigation and not just use satellites.