Bearing and Distance finder V.2
A module to navigate between waypoints. It has a display which shows the bearing, distance, waypoint number and actual coordinates.It has also a servo that can be used to drive a rudder to steer a boat or a plane
This project is an enhancement of a former identical one. But, it has some additional features and components, like a new LCD display which has a I2C interface, a new GPS breakout board from Adafruit , a compass and a servo.
Its purpose is to follow a predetermined course with the support of several waypoints and calculate the bearing and distance between them. The heading between two waypoints is calculated from the course obtained from the GPS receiver and the compass bearing. The error between the two is handled by a PID controller and its output drives a servo which can be used to control a rudder from a boat or an aircraft, for instance.
The compass from Robot Electronics has an internal Kalman filter to compensate for unlevel readings. These must be divided by ten because they are internally multiplied by this factor to avoid floating point arithmetic.
The code needs two libraries: one for the LCD display and the other for the PID controller. Both are provided as downloadable files.
The schema is self-explanatory, but is necessary to remark that the I2C bus for the CMPS11 compass and the LCD05 display need two pull-up resistors inserted between SDA,SCL pins and Vcc. The GPS receiver uses the TinyGPS++ library and the hardware serial1 port from the MEGA 2650.