## 4 Electrical System
### Real-Time Controller  
In this section, first, a choice of low-power sensors is justified; then, the embedded processor software architecture is described; finally, the navigation algorithm is detailed. In order to navigate, autonomous sailboats require a number of sensors, specifically a Global Positioning System (GPS) sensor to provide real-time position, a compass that provides vessel heading, and a wind vane that returns the wind direction. The physical sensors for the SeaLeon were the same models as for the Breizh Tigresse, since they were chosen very carefully to minimize power consumption, as is reported in Section 4.2. Specifically, the GPS was a breakout board distributed by Adafruit; it includes an on-board patch antenna, consumes extremely low power, and provides high sensitivity. It  
Figure 2: Mechanical fabrication. (**a**) Control drive assembly with clutch in two positions; (**b**) picture of the hull enclosure with electronics. includes the GSM MTK3339 chipset and is interfaced to the controller using a USART (Universal Synchronous and Asynchronous Receiver and Transmitter). The compass was the HMC6343 by Honeywell, and provides a three-axis magneto-resistive sensor. It is interfaced to the controller using an I2C interface. Both the GPS and compass were strategically mounted inside the hull of the SeaLeon. A CV7 windvane manufactured by LCF uses ultra-sonic measurement to provide a reliable estimate of the wind direction. It was mounted on a short mast at the back of the hull, and was connected to the controller through a USART interface. Additionally to the three sensors, the SeaLeon used an XBee Series 1 radio module for testing purposes, as well as the XEOS Onyx Iridium Asset Tracker to track and transmit the location of the sailboat. Note that during the mission, the XBee radio was disabled, and the XEOS was powered independently. The rules for the Microtransat indicate that the sailboat must navigate autonomously. As such, to define a mission, waypoints are uploaded to the sailboat before the competition begins through the radio interface. Therefore, the SeaLeon had a waypoint loading mode, where the waypoints could be input to an electrically erasable programmable read-only memory (EEPROM) interfaced to the sailboat microcontroller. When a waypoint is reached, the next waypoint index is updated in an external EEPROM, in case there is a power failure during the mission. Due to the metallic structures on the sailboat, especially the XEOS ONYX trackers, there was large magnetic interference with the compass. Prior to the final voyage, calibration was carried out for the Breizh Tigresse to correct for the compass considering the magnetic interference. During the calibration, angle readings were taken with the compass while the compass was turned in each 30 degree increment. The average angle was taken from three trials and compared to the actual angle, and the output served to populate a lookup table. From this information, the magnetic deviation could be calculated and was included in the code to obtain the heading with respect to true north. The final correction also included a correction that accounts for the magnetic declination between the true north and the measured north from the compass \(\phi_{c}\), which is a function of the longitude L in degrees and can be estimated to be equal to \(\phi_{c}=0.3\)L \(-1.3\) in the North Atlantic Ocean. The SeaLeon used one microcontroller to receive sensor data, control the motors for navigation, and communicate its location. In comparison, the previous version of the sailboat, the Breizh Tigresse, used two Microchip PIC18F2550 microcontrollers to implement the sailboat controller. The main PIC was responsible for receiving data from its peripherals, applying an algorithm, and then sending that data to the second chip. The secondary chip was only responsible for converting the motor position to a pulse width modulation (PWM) signal applied to the servo motors.