GPS Based mast tracking

The concept

Tracking the position of vessel needs expensive sensors, such as accelerometers and gyros, and also complex algorithms in order to provide an accurate output. More over tracking moving parts on the vessel is an additional challenge. In this post we will describe an alternative method not only for real-time tracking of a sailing boat, but also for tracking the position – bend – of the mast.

No matter the weather conditions, the correct sail trimming is important not only for achieving the best speed but most important for sailing in a safe manner. Pitch indication – or inclinometer – needs to be constantly monitoring and main sail must be constantly trimmed in order to sail fast and safe. Roll is difficult to be monitored and is affected by the center of gravity – or the crew positions. Mast bend is important for giving the correct shape on the sails. In our design we will use the NEO-M8P high precision GPS modules from u-blox – providing centimeter level positioning in order to monitor the vessel and also the mast bend in real-time. Thanks to NEO-M8P modules the total component count is extremely low, without any analog component.  The following diagram provides an overview of the complete system design:

The implementation

The design has been based on four NEO-M8P modules. The three modules are placed on the vessel (Port – Starboard and bow sides) and are enough to provide as with the pitch – roll and GPS positioning information of the boat. The forth module is placed on the top side of the mast and will be used to track the position of the upper mast side – and so the bend of the mast. Information from the GPS modules is monitored by the CPU unit (an orange pi  one embedded unit) and stored in a local database. GPS information – in NMEA-0183 format – is also forwarded to VHF for supporting DSC/Distress functionality, to AIS transporter for reporting the vessel position and finally to our navigation unit (a second orange pi win running OpenCPN maps). Our CPU is also driving a paper-like display module which is used for displaying the vessel and mast information – essential for correct trimming. Database stores all the information about the boat conditions and performance. The information will be used in order to feed our Artificial Intelligent algorithm that will provide us with suggestions about the optimal position and trimming for the specific vessel at the specific conditions.

NEO-M8P modules arrived

The application is based on Real Time Kinematics (RTK) features that the NEO-M8P u-blox modules support. Since all modules are mounted on the vessel, we will configure the module in a “moving baseline RTK configuration”. Using the u-center control software we enable the following RTCM messages to UART port for our reference module (module placed on bow):

  • 1077: GPS MSM7
  • 1087: GLONASS MSM7
  • 1230: GLONASS code-phase biases
  • 4072: Reference station PVT (u-blox proprietary RTCM Message)

The above configuration will provide us with all the necessary information from the reference module for a moving base-point application in the transmit UART port. Detailed information about the configuration steps and options can be found in the C94-M8P board application note. The output from the reference board will be forwarded the rest GPS modules in the UART receive port. This will automatically enable the high-precision functionality as long as RTK messages received and each module will report the relative position to reference unit.

Interconnection diagram

A small board has been developed in order to accommodate the GPS module. The board contains a power supply module, an optional LNA amplifier for the GPS signals, the GPS patch antenna, two RS-485 transceivers for the UART communication (since the cable length from the module will be more than 20m) and of course the NEO-M8P module.

The GPS board

The GPS antenna is a low cost 25x25mm ceramic patch antenna. Exta caution must be given in the ground plane design for the patch anntenna. U-blox provides an excellent guide for achiving the best performance (see GPS Antennas: RF Design Considerations for u-blox GPS Receivers). The power supply provides 3,3V for all electronic components.

An enclosure has been designed and printed from ABS for placing the module on the vessel.




Printing the housing

From the CPU side the Orange Pi One unit has been loaded with an Armbian distribution providing one click build environment for deploying our drivers. Some of the major components that are needed for bringing up out prototype are:

UART controllers – UART is the main interface for both GPS modules and marine equipments using NMEA0138 protocol (4 GPS modules, NMEA masthead wind unit, VHF, Navigation and more).  Although, Orange Pi provides up to four UART channels, we have to multiplex the data in order to cover the deferent needs for each device.

Display driver – the e-paper display that we are using for the prototyping communicates through an SPI-based protocol. The display selected is the GDEW042Z15 three color display, equipped with the IL0398 driver. The main disadvantage of e-paper displays is the extremely slow refresh rate. In order to overcome this issue, the driver will be based on region based update mechanism in order to be able to sequential update the necessary regions. Also the controller LUT configuration will be modified in order to based on more dynamic context allocation that static image (e-paper usually used as static image displays due to the advantage of keeping the displayed image even without power supply, so without any power consumption).

Elaborating on the e-paper display

Finally, it was not able to achieve the required refresh rate of 10Hz using e-paper like displays. The refresh was extremely slow, even using custom LUT and partial update used. So, we return to traditional solutions using a high brightness TFT module. Using a TFT module give us the ability to extent the graphics by taking advantage of OpenGL library and make a front panel including rich information and also with extremely fast response.

NMEA message handler – NMEA0183 mesages from the GNSS including the position and the heading information (GGA, GSA and VTG) and the weather condition messages from the masthead unit (XDM and MWV) must be processed and forward the information to applications.

RTCM message handler – the relative position beetween the NEO-M8P GNSS modules is needed in order to calculate the 3D position of the vessel and the position of the mast.

Database – information will be also stored in a small footprint DB (SQLite) in order to be accesible for post -processing algorithms.

Data Processing Unit – will feed our classifier with data from the database and use the model for predicting and propossing actions. The unit will be based on OpenCV platform.

The masthead wind sensor

In order to be able to correlate the vessel conditions – such as pitch or speed – with the outside environment we need an accurate measurement of the weather conditions and basically the wind speed and direction. For our application we have used the tactical NMEA masthead wind unit from NASA Instruments which is an affordable option. The specific unit is able to provide us with a realtime NMEA information about the wind speed and direction with a rate up to 10Hz in 4800bps NMEA transfer rate.

Communicating with the masthead unit in our lab

Unfortunately, the module provides a single end output for NMEA information, so the signal running on 20m cable received in a strange shape. So, the first attempt to communicate was unsuccessful. After taping the signal with the oscilloscope we have decode the outpup and fix the issue by placing a 1,5K termination resistor. Then we were able to receive the information using a PL2303 RS232 to USB adapter.

Decoding wind sensor NMEA output

The information that the module provides is having the following format:



$WIMWV:Wind direction and speed NMEA message code
248:   Wind direction 
R:     The messurement is relative
8.9:   Wind speed
N:     Wind speed unit (Knots)
A:     Measurement is valid
32:    The hex CRC value of the message
The GPS boards

Preparing the M8P GPS boards – we have to ensure that the latest firmware is installed in the GPS modules. This is essential in order to be able to have access to all required messages (such as UBX message 4072 which is needed for moving base applications ). So,  reference and rover modules updated with the latest firmware (at this time HPG1.40) and now we are ready to configure the modules for our application.

First of all we have increase the UART communication speed to 230Kbps in order to be able to accommodate the required traffic from reference station to rovers. For the base we have enabled messages 1077, 1087, 1230, 4072 and also disabled the TMOD3. For rovers we have only added the UBX-NAV-RELPOSNED message to UART1 output. UBX-NAV-RELPOSNED message from the rover modules will provide us with the relative to reference station position information (Nort-East-Down vectors).

The last step is to verify that everything works as expected. Using the u-center and the “sky view” we have ensure that the GNSS signal reception is ok (sky view map is green at almost all directions) and rover can receive decode messages from base (GNSS mode switched to FLOAT/FIXED after feeding module with RTK messages from base). Finally, we decided to used external active GPS antenna for the rovers that mounted in the vessel in order to protect the hardware from the UV and heavy weather conditions. Now, we are ready for the most difficult part of the project – mounting the modules on the vessel.

Ready for the field
The application
Working on the display driver