Sailboat Support

Here’s a summary of the approach I used to tune the wing sail controller for a land yacht sim using a combination of g-force limiting and the new wing sail controller. I’ve found it to work over a wind range 1 - 10 m/s on various points of sailing:

Wing sail elevator PID tune

  1. Set SAIL_HEEL_MAX = 5 deg (0.087266 rad). The land yacht steering controller struggles to hold the vehicle straight in high winds with higher heel angles as there is a large lateral load on the front wheel.
  2. Set ATC_SAIL_FF = 1 / ((1 + 0.5) * radians(SAIL_HEEL_MAX)) = 7.64, other PIDs zero. Setting ATC_SAIL_FF = 1 / radians(SAIL_HEEL_MAX) would set the elevator to its limit, however the problem then is that at higher winds, a high P gain is required to reduce the heel, and this leads to instabilities. Instead we use FF to account for half full power elevator deflection and use the P gain to drive the rest.
  3. At low wind speed (2 - 3 m/s), increase the ATC_SAIL_P gain until the elevator limits are reached (i.e. in Mission Planner ch4out = 1000 or 2000). For the land yacht ATC_SAIL_P = 4.0 is enough to hit elevator limits in low winds and reduce heel as the wind increases.
  4. Increase the wind speed until the land yacht is heeling (around 6 - 7 m/s). Increase the derivative term until the oscillations in the heel subside. ATC_SAIL_D = 0.5 seems sufficient.
  5. Increase the integral gains to pull the PID achieved back towards PID desired.
1 Like

Awsome solution. This should be featured on https://ardupilot.org/rover/docs/wind-vane-analogue.html

I forgot to say, your vid is now on the Sailboat landing page,

https://ardupilot.org/rover/docs/sailboat-home.html

Thanks!

Did not have too much to do at work today so I started to build my wind vane. It consists of a AS5040 contactless absolute angle position sensor.
I tried to keep it as small and light as possible and soldered the components directly to the IC. At the moment there is only wind direction detected. I’m waiting for an IR reflective sensor I ordered for wind speed detection .I also ordered ceramic bearings since they have much lower friction and does not corrode.
I use the PWM signal from AS5040 with a RC filter to get an analog signal.


The wind speed cups will be mounted in the lower body part.


I used a hot glue gun to hold the electronics in place. I probably add more glue for water protection later.

Testing the analog output. The magnet needs to be rotated to match the housing so 0 and 360 will facing straight ahead.

3 Likes

I noticed that the angle sensor I have used is on sale for $21.95 if anyone is thinking about it:

https://www.mpja.com/Precision-Angle-Sensor-0-360Deg-Analog-Output/productinfo/36215+MI/

This is much cheaper than Amazon.

Hej Jesper! This is the best solution I have seen so far! Have you tested it with the controller yet? Would you care to provide schematics and a BOM?

Tjena :slight_smile: Robert! Thanks for the nice words. No, I have not tried it on my controller yet. I started a new design with the AS5600 instead. It’s pwm output don’t need the RC-filter.
At the moment I’m trying to collect the sensor data in to an arduino that convert it into NMEA0183 sentences ($WIMWV). That way I can add wind speed to the same sentence. I will also use this set up for my full scale sail vessel but with the open source SignalK-protocol.

1 Like

Hejsan!

Nice design! I have also made a 3d printed wind vane. It’s built around the AS5601-SO_EK_AB evaluation board and uses an Arduino Micro to convert I2C to serial NMEA 0183.

![5|375x500, 100%]

Nice! We should probably start adding native support for these sensors, I2C all the way up the mast is probably not going to end well tho… maybe AP Periph…

I use a DF95 sailboat and the cable length between the sensor and the arduino is around 130cm, up to now it worked without any problem. However it’s probably better to place the Arduino in the mast top together with the sensor.

Risky cable length is one of the reasons why I went using the analog output of my AS5600. I use a Arduino Every to convert to nmea and I will add windspeed sensor to it later. The arduino will be placed in the hull. The worst place to add weight is in top of the mast.

I’m thrilled to see renewed interest in wind vanes!

I want to draw your attention to a previous string of posts regarding the implementation of an I2C digital wind vane. A while back, I created a minimal wind wane based on the AS5045/AS5058 I2C chip, and I found that a 2-meter run of cable was able to reliably carry I2C signal if supplemental pull-down (IIRC) resistors were installed. I wrote an I2C driver based on the device datasheet and on example drivers in the Ardupilot source.

I am personally a proponent of writing one-off drivers for each digital rotary encoder rather than using a separate microcontroller to convert to NMEA, because this strategy does not require a separate microcontroller and it does not require the flight controller to have an available ADC. I believe that, in cases where the long cable does not lead to an unreliable signal, I2C is the way to go because it allows the full 12 or 14 bit (0.02 degree) resolution to be read without requiring analog signal conditioning, but it could be that analog is sufficient in most cases.

Happy hacking, and I hope I’ll have time to join in the fun soon!

@ByggaSaker Nice! Funny that we both used the same filament color :slightly_smiling_face:
Witch nmea sentens did you use? $WIMWV or $WIVWR?

1 Like

There is arduino code for $SDMWV on my project: https://www.holdentechnology.com/2021/01/06/electronic-windvane/#htoc-nmea-output

I also used a version of this code for boatspeed in a different project, there is a pulse-counter with low-pass filter in that code that could work for windspeed, if someone needs a starting point.

Sounds like some good development work on vanes is ongoing, it gives me motivation to work on my boat!

1 Like

I use $WIMWV

I agree with playertr about skipping a separate microcontroller. I will give his I2C driver a try when I learned to build the code.

Hi there!

My name is Huldar and I’m working on the list of everything I need for an autonomous sailboat and I have everything except for the wind direction sensor. I notice that you used this one: AS5040-SS_EK_AB ams | Development Boards, Kits, Programmers | DigiKey the AS5040 sensor for wind direction and I’m wondering if it will still run with a lower voltage than specified on digikey or if 9V is the required voltage (seems high). But here I found a datasheet, Microsoft Word - Manual_AS5040_Demoboard_1.0.doc (ams.com), where it says it will operate fine at either 3.3 or 5 volts. So I’m wondering what’s what. Could you help me out? Currently the maximum required voltage in my system is 6V. Thanks!

Oh nevermind, I figured it out, found a different thing: AS5040-ASST ams | Sensors, Transducers | DigiKey
The other stuff was some PCB as well, this is better. Thanks!

I have taken my sailboat out twice now, it is improving each time, but I have a question for the experienced in the group.

My boat was getting stuck head-to-wind in the light wind sometimes, which is fine, but I had the rudder servo PWM on mission planner and noticed that sometimes the rudder would go from holding hard over at 1100 then jump the opposite way, 1900 for a second or less, then back to 1100. This usually kept it stuck in irons longer than needed.

I assumed it was due to the GPS velocity showing the boat going in reverse and it reversing the rudder as I’ve seen that in the code. But on analyzing the data I don’t see the GPS heading change in most of these cases.

It might just be that the telemetry log misses a short term change (my dataflash did not work on this test) but I thought I would see what other causes could be and what else to check in the data.

Here’s a plot with some markups of what I see, and a link to video

Thank you!

You have it tracked down, the boat thinks its going backwards.

Were not navigating directly based on the GPS data, we fuse it into the EKF. So I guess if you were to plot the EKF north and east velocity you would see the reversal there.

I think I have a branch somewhere that gives you the option to just turn off reversing the rudder when going backwards, of course that is very bad if you are actually going backwards but constant reversing of the rudder is quite bad if your just trying to drift it round a tack.

Maybe we could add some hysteresis on the reversal and get the best of both.