Robotized sailing boat
Hi all ! What I want to achieve is a boat that can sail alone following some waypoints with the gps. I'm new to arduino, but I already have a rc boat and coding knowledge.
Inputs I need are: -GPS coordinates -Compass direction (0-360° N-S) -Wind direction (weathercock) (this could be optional if wind is regular) -A GSM connection to communicate (It this I/O in fact, this is also optional, at least in the beginning)
Outputs are: -two actuators to deal with the sails and rudder
So my question is what should I buy, what arduino and what additional gears ? The idea is to avoid as possible welding. I prefer the ready to use, plug and play, components. For instance I like the idea of TinkerKit http://www.tinkerkit.com/ , but they don't have the modules I need.
Thank you very much.
if wind is regular
You sailed much? 8)
Presumably since you have the boat, you know how to sail it? Seems to me the programming task is going to more than trivial- you can't just sail from point a to point b, as you'll know from the rc sailing. The decision of (eg) how high to point to windward and when to tack, and trimming the sail to keep it nice and tight is not likely to be that easy to code.
That said, you say you need actuators for the sails and rudder: aren't those already part of the rc boat's configuration? If not, Google sail servos.
You should read this thread Arduino - maximum run time and fault tolerance - Project Guidance - Arduino Forum .
You should assume that the wind WON'T be regular - even if it is the boat won't be and it's the apparent wind that matters.
Ensure that you are very competent at sailing the course using simple radio control before you try to automate anything. Only then will you understand what the software will have to be able to do.
Thank you for you answers.
First of all, the regularity of the wind is just a supposition to simplify the design. I sailed enough to know that if you want the optimal speed you need to constantly adapt the sail position, but your boat will still go forward if you set them and do something else for a while. However, my goal is to have a device to measure the wind direction and only if it is too complicated in the beginning I will renounce to it.
Jimbo, I fully understand how complex the coding part will be, however, it does not seem an impossible task and I would at least try it. But, as I'm new to arduino, I don't really understand how compatible modules are. If someone could give me a possible "shopping list" for what I want to achieve, I would be extremely grateful. I'm also interested in any suggestion of webpage or hints on the subject of compatibility between modules, actuators etc... This is why I was asking about actuators, sure I already have some but I'm not sure how compatible with arduino they are.
The usual approach to a project like yours is to break it down into its various parts and work on those individually until they work. You may want to look at the various UAV projects like below as they might be adapted to your boat project.
In the spirit of breakking the project down into bite-sized chinks I think I would first start by automating the rudder with the sails fixed (perhaps the sails could continue to be under R/C manual control to simplify recovery if/when things go wrong). Think about how the rudder must be managed to make the boat stay on a constant course or at a constant angle to the wind.
Thanks zoomkat for the link, it is interesting, but I think I do not need all these gyros...
Doing the project step by step is definitely a good practice, I will stick to it.
I'm still unsure about my hardware question. For example, do you think that, if I buy: -an Arduino Uno R3 -an Arduino Motor Shield too plug two actuators on it -This card for GPS (and GSM, which might be an evolution of the boat later on): SIM908 Arduino GPS/GPRS/GSM Shield - DFRobot -This chip for the compass : Tilt Compensated Compass Breakout - LSM303DLMTR - SEN-10888 - SparkFun Electronics
I will be able to start with the think or will I be stuck because of hardware incompatibility ?
First get the mechanical part, the sailboat and the actuators to work. No amount of effort with the compass, GPS and software will help if the mechanical parts don't work.
I assume you'll have some sort of autopilot that knows where it is and which direction it wants to travel. Then you need to know which way the boat is pointing and which way the average wind is moving. They both seem straight forward. Then you need to have a steering algorithm which decides which direction the boat should be sailing in to achieve the required course. This is where you would deal with currents, tacking, turning into the wind when the weather was too violent, and so on. To me, this is the hardest part. Then you need some rudder control to make the boat point in the direction you chose, and to position the sails to suit the boat orientation and speed and wind direction and speed. That might be non-trivial, but presumably if you know how to sail the boat you know how to do that.
You can control several servos from an Uno without any "shield". The Uno can directly produce a servo control signal on one of pins. The servos should have there own power supply (as the Arduino boards can't supply enough power) and there must be a common ground between the Arduino and the servo power supply.
I haven't used any GPS module with an Arduino. My inclination would be to buy the cheapest one that seems to have the facilities you need.
Be prepared to discover something doesn't do what you want and there is a need to change track.
Robin, thank you very much, very good to know a bit more about the servos. It might be obvious, but then I don't understand why they are selling board for plugging the servos ? You are right to point this out about the gps. I need to put the gps (as well as all the electronic) in a waterproof place. But then I'm not sure how the satellite reception will be. I guess I will not know about this before trying.
Does by any chance anyone have an idea how to build (or where to buy) a very light weathercock ?
The direction of sailing boats (full size and models) can be controlled with wind vanes. It may be more practical to use one rather than trying to make a very sensitive weathercock which would also have to be connected to some form of sensor. A rotary encoder would be an obvious choice but I don't know if they would be small enough to mount at the top of a mast. The wind vane, on the other hand, is mounted at deck level and can be big enough to exert a reasonable force on a sensor.
In a full sized boat the wind vane usually steers a small slave rudder which in turn steers the main rudder, making use of the greater force generated by the water.
Thanks Robin for this idea. Wind vane gears are very interesting. Usually, the wind vane gears are used to keep a constant angle between the boat and the wind. (see for example The servo pendulum principle for self-steering on a sailboat - YouTube ). If I understood well, you propose to connect the wind vane gear to a sensor rather than to the rudder. This is interesting, but would work only if the direction of the boat is supposed to be a straight line.
If I decide to make the boat turn at some point, then I will need to set the wind vane gear to a new neutral position and to adjust the sails to the new wind angle. These are two problems: I need an additional servo to accomplish the first task and another wind vane to measure the direction of the wind to determine this neutral position as well as the optimal sail position.
To me, the wind vane gear seems an option only if the boat keeps a constant angle with the wind during the whole sailing time.
However, your proposition led me to consider a wind direction sensor closer to the hull of the boat rather than at the top of the mast.
I think it should be possible to use your Arduino to reposition the wind vane for changes in direction or changes of boat direction.
Any wind direction sensor that is below the top of the highest mast will give incorrect readings due to the influence of the sails.
Perhaps you could have a simple weather cock at the mast head that just gives a rough indication of wind direction (maybe +/- 10 or 20 degrees) and use the wind vane for fine control.
I mentioned a rotary encoder previously, but now I'm not sure if it would be sufficient. They rely on never getting lost because they have no means to determine absolute position. That can be overcome with a constantly rotating shaft, but there is no guarantee a weathercock would return to a "home" position for hours or days. So I think there would need to be a sensor that detects the absolute direction of the weathercock without imposing any friction on it. One idea might be a ring of photodiodes and a disc attached to the weathercock with a tab that shrouds just one of the photodiodes at any one time. Maybe someone else has a better suggestion.
What size is your boat so we can have an idea of what size of equipment can be attached to it?
Related Topics
Topic | Replies | Views | Activity | |
---|---|---|---|---|
Project Guidance | 3 | 887 | May 5, 2021 | |
Project Guidance | 9 | 1194 | May 5, 2021 | |
Project Guidance | 6 | 5260 | May 5, 2021 | |
Project Guidance | 3 | 744 | May 5, 2021 | |
Project Guidance | 6 | 1554 | May 5, 2021 |
Boat Autopilot - Based on the Arduino
Introduction: Boat Autopilot - Based on the Arduino
Here's how to build an autopilot which can steer an RC boat to waypoints! It's easy to build, based on the popular Arduino platform, and great for hobbyists who want some soldering practice! With this autopilot, an RC boat can go long distances without any human intervention, like an autonomous drone. The original idea was to mimic robotic boats like the UBC Sailbot , and the Scout (which almost successfully completed its trans-atlantic voyage!)
This project has been in the making for over a year now, and has taught me a lot about autopilot theory and circuit design. Hopefully, one day, I'll be able to take the skills used to make this autopilot, and apply them to make an autopilot for my dad's 38 foot catamaran !
To get to the final version of this autopilot, I went through three main prototypes. Each prototype got increasingly more complex in terms of circuitry and code. After those three prototypes, I built the final circuit, which was able to steer an RC boat around a pond multiple times. Very detailed schematics and pictures are available if you want to build your own.
The final version is bug-free, but still has room for improvement. In terms of code, I still need to get the boat to follow a path, and not simply go to a waypoint (this counteracts sideways drift). In terms of electronics, I'm hoping to add an accelerometer in order to add tilt-compensation to my compass.
Step 1: Video Overview and Autopilot Explaination
Here's a short video that goes over the project, the prototypes, some theory, and more!
Step 2: Prototype #1
The first prototype of the autopilot was very basic. The goal was to build a device that could:
- Read the location from a GPS
- Read the bearing from a compass
- Steer a rudder servo
- Test formulas which are necessary for making a real autopilot
- Use the rudder to keep a bearing
For this early prototype I decided on using an Arduino Uno for the brains; I would switch over to a barebones Arduino design (AtMega328) in the final version.
Reading a GPS
For the first prototype, I wanted the cheapest possible GPS I could get my hands on, so I went with the $8 UBlox PCI-5s. To connect the GPS to the Arduino, all I had to do was solder four wires to the back of the card, connect them to Arduino, then attach an antenna. I used the TinyGPS++ library to parse incoming serial data, which allowed me to get the current location, speed, direction, and more! Here's my other Instructable on how to implement this chip. I used this GPS up until the third prototype, where I replaced it with another one.
Reading a Compass
The compass I used is the HMC5883L , which connects to the Arduino through I2C. Bildr has a very nice tutorial on how to connect this compass to the Arduino. To read the bearing I used this Arduino library .
Steering a Servo
Steering a servo with an Arduino is incredibly easy , but not when the SoftwareSerial library (necessary for TinyGPS++) interferes with one of the Arduino's timers! When SoftwareSerial is running, it will interfere with any servos using the standard servo library. A simple solution is to use the PWM Servo library instead.
Implimenting Autopilot Formulas
In this prototype, I implemented several functions that would become critical later on. These functions use the haversin formula to calculate things like the: distance between two waypoints, direction from one waypoint to the next, and real bearing from a magnetic bearing. Here's a build-log post I made on these formulas.
Putting it All Together
I decided to make a wooden case to hold everything together (see images above). So now that I knew what the bearing of the autopilot was, I was able to compare it to a preset heading and turn the rudder to keep that certain heading. This would become necessary later on in order to travel to a GPS coordinate.
Step 3: Prototype #2
I was satisfied with the success of the first prototype, so I decided to make a secound one with the intention of putting it on a boat. Most of the changes to this autopilot were software based. The goals for this prototype were to:
- Travel to a set of GPS coordinates
- Run the autopilot on a battery
- Test and record autopilot data
I made a few changes to the physical structure of the autopilot. I added a ProtoSheild, which connects to the Arduino and has a little breadboard on it. I moved the compass there. I also attached all autopilot components to a new plywood base, and put that plywood base inside a sandwich container.
I also tried adding an RC receiver to this autopilot, but I was not successful due to the space limitation inside that container.
Traveling to GPS Coordinates
I programmed the Arduino with a sketch that turns the rudder in order to travel to the next waypoint. The sketch used the GPS to calculate the bearing to each waypoint, then compared it to the compass, and the difference between the two was the error. If the error was to the right, 90 degrees, then the rudder would turn to 60 degrees. If the error was to the left, 270 degrees, then the rudder would turn to 120 degrees. If the error was between 330 and 30 degrees (straight ahead), then the rudder would turn exponentially in order to keep going straight.
All of this would happen in a loop similar to this one (this code is exaggerated):
Here's an "english" explanation of the code above: if the distance between you and the waypoint is more than five meters, then calculate the bearing of the compass, the bearing to the waypoint, get the real bearing of the compass, then send the two bearings to the RudderTurn function, which calculates the error and turns the rudder accordingly.
Adding a Battery
Adding a battery to power the Arduino was simple. There is a Vin pin on the Arduino Uno. It accepts up to 20 volts DC. I had a 12.6v, 3 cell, lithium battery laying around, so I simply made a connector that went from the battery to the Vin pin.
Step 4: Testing Prototype #2
In order to assist with the testing of the autopilot, I added two LEDs. One LED would turn on when there is a GPS lock, the other would turn on when I have arrived at a waypoint.
Testing the Prototype
I used a local field for the testing of my autopilot. I would bring my laptop, connect it to the autopilot, run the serial monitor (part of the Arduino software), and have it record the GPS coordinates, all while walking to pre-programmed waypoints. I used the rudder to guide me to each waypoint, and I responded to the rudder by turning like a boat would.
The images you see above are just some of the paths I recorded. When I would get within five meters of a waypoint, the autopilot would switch, and begin navigating to the next one. I made lots of minor changes to the code during the tests.
In order to convert serial text into a Google Earth track, I imported the text into Excel using the text import, then saved the file, then followed the instructions at Earthpoint to convert the file to KML format.
Step 5: First Boat
The first boat I made for this project was more of an experiment than a real prototype. I wanted to see if I could make a functioning airboat instead of having to go and buy one.
Most pieces were cut out from foam, including the deck, which is a marine grade foam. I originally used a brushed motor, but then I switched over to a brushless motor and a 5x3 prop for thrust. That 9 gram hobby servo was mounted on the back, and the sandwich container had some holes drilled into it for wires to pass through. In the end, this boat never really sailed. The ESC I was going to use burnt out in a tragic electric longboarding accident , and the GPS absolutely refused to work on the surface of a pond.
Step 6: Modifying the Boat
Okay, so back to the drawing board with the boat. I picked up this new boat from eBay for $20.01; free shipping too! It came with a 7.4v NI-MH battery, a charger, a transmitter, and a receiving circuit. I had some trouble finding the appropriate number of AA batteries to fit the transmitter (12 to be precise), and I was left disappointed when the boat didn't work. Oh well, I can still make this work.
I salvaged two N-Channel MOSFETs from the receiving circuit; those came in handy later on. After that, I proceeded to clip all of the remaining wires, and hot-glue every opening, crevice, and crack I could find in the boat.
The two motors had an intricate cooling system: a very noisy propeller which blew air through the motors. There were also decoupling capacitors on the motors as well. Both of these things worked to my advantage. There was also a little switch on the top of the boat. I haven't found a good use for it quite yet.
Next order of business was to secure the prototype. I got a scrap piece of wood, hot-glued a horizontal support (a bamboo skewer) near the motors, and velcroed the piece of wood to the boat and support. The velcro had enough holding force to keep the autopilot secured, even when upside down.
Step 7: Prototype #3
One problem that plagued the previous prototypes was the slow update speed. The rudder simply didn't react fast enough to a changing bearing, so I included that in my list of goals:
- Increase the update speed of the autopilot
- Add motor controllers
- Program a motor mixer
- Adding a receiver
Increasing the update speed
The only problem with the TinyGPS++ library is that it is slow. The problem was, the Arduino Uno cannot run two things at the same time (well it can, but not really). A simple solution would be to have another Arduino use the TinyGPS++ library to parse GPS data, then send the position to the other autopilot. Problem was, I didn't have another Arduino.
An Arduino Uno is essentially an AtMega328 chip and some extra components. It's easy to build your own "Arduino" on a breadboard, so that's exactly what I did. Here 's a really good guide on how to do that. After I built my breadboard Arduino, I hooked up a brand new Ublox NEO-6M GPS module in the same way that I hooked up my previous GPS. I programmed this new Arduino to use Bill Porter's Easy Transfer library , and I used single wire to form a one-way serial connection between the main Arduino and the breadboard one. With this new breadboard Arduino, I was able to increase the update speed from 4Hz, to up to 50Hz!
Adding Motor Controllers
I really liked the ProtoSheild for the Arduino Uno that I was using, but I found that it didn't have enough space to hold two motor controllers. So I ripped off the old, mini breadboard, and put in a much larger one.
The circuit for the motor controller is simple, a MOSFET, with the help of PWM, controls the average voltage going to the motor. A 1k resistor limits gate current so that the Arduino doesn't burn out, and a 10k resistor keeps the MOSFET off when there is no input.
Programming a Motor Mixer: Going from a Rudder to Motors
This boat does not have a rudder, but instead, it uses two motors to steer. I wanted to take advantage of the two motors instead of gluing a servo the the boat. I already built the motor controllers, now all that was left to do is program the Arduino to control these motors controllers.
I started out by programming a mock-up program in Visual Studio. I used breakpoints to debug my code, and eventually I had a motor mixer. Now all that was left to do was transfer the code from VS to the Arduino, which wasn't very hard, considering they were very similar languages (C# and C++).
Adding a RC Receiver
I added an RC receiver to this prototype for manual override. It was easy to measure the incoming values with the pulseIn function, and have the autopilot react to those values.
I placed this prototype in the boat, connected the motors to the MOSFETs, and pre-programmed a path in the local pond. The boat was able to complete the triangle path once , then it stopped working and died. I had to rescue it with an inflatable boat. Turns out, the high voltage from the battery (12v), fried the 5v voltage regulators.
Step 8: Soldering the Circuit-board(s)
The final circuit was virtually a duplicate of the third prototype, except that I used another AtMega328 chip instead of the Arduino Uno. Just above you can find the full circuit diagram. Since there were two AtMegas, I decided to split them amongst two 5x7cm perfboards I had laying around. The schematic is split along the middle, everything on either side belongs to its respective board. This means there are two voltage regulators for each board which disperses the heat over a larger surface area. Instead of soldering all of the parts to the perfboard, I soldered pin headers for replaceable parts like the GPS, compass, motors, FT232, AtMegas. I also put two pin headers along each AtMega just in case I wanted to add something else in the future.
These two AtMegas are simple to program, as all they need is a FT232 and a computer. There's two pin headers for the FT232 to connect, so all you do is plug them into there, plug the FT232 chip to your computer through a USB cable, and program with the Arduino software like you would with a regular Arduino.
There are several connections between the two AtMega chips. One of them is for transferring the GPS location to the other one. There's a wire going from the 13th pin from one AtMega to the TX pin on the other AtMega. These circuits need to be powered by the same battery. In order to connect them together I soldered female JST RCY connectors to each chip for power, then make a Y splitter to connect them to the battery. I liked the power connector of the battery, so I decided to make an adapter for it instead of chopping it off.
Here's a full parts list that I came up with after I built the autopilot. I was actually shocked at the total cost of this project; but then again, most of the cost comes from the GPS, RC boat, and RC transmitter and receiver.
- 4x 10k resistors ($0.05)
- 2x 1k resistors ($0.02)
- 4x 220 ohm resistors ($0.06)
Power Regulators:
- 2x LM7805 regulators ($0.32)
- 2x L78L33ACZ regulators ($0.32)
Arduino Parts:
- 2x AtMega328 chips ($3.52)
- 4x 5mm LEDs ($0.20)
- 2x 16MHz clock crystal ($0.16)
- 2x Momentary pushbutton: normally off ($0.81)
- 4x 30pf Ceramic capacitors ($0.08)
- 2x 0.1uf Ceramic capacitors ($0.04)
- 2x 47uf Electrolytic capacitors ($0.16)
- 2x N-Channel Logic Level MOSFETs ($0.43)
- 3x Female JST RCY connectors ($0.34)
- 1x Male JST RCY connectors ($0.14)
- 2x 1N5408 diodes ($0.02)
- Lots of female and male pin headers ($0.50)
- At least one FT232 Breakout Board ($1.56)
Large Parts:
- 1x NEO-6M GPS Module ($12.00)
- 2x 5x7cm Perfboard ($0.95)
- 1x HK-GT2B Transmitter and receiver ($24.00)
- 1x HMC5883L 3-Axis compass ($1.00)
- 1x RC Boat ($20.01)
Grand Total: $66.69
Most of these parts I either had laying around, or are available in bulk from eBay.
Step 9: Combining the Autopilot With the RC Boat
I used a scrap piece of wood I had from the third prototype to hold the autopilot together. I used little screws to attach the perfboards to the board. I also drilled four holes and used zip-ties to hold the battery. Once again, I used Velcro to attach the autopilot to the boat.
The GPS antenna was also Velcro'd to the board, and the GPS receiver was simply held by the pin header on the perfboard. In order to attach the RC receiver to the circuit, I used some pre-crimped female jumpers, to which I soldered some male header pins and secured with hot glue. The wires for the motors were also soldered to a male connector, insulated with hot glue, and connected to the board according to the schematic.
Step 10: Programming the AtMegas
In order to program the AtMegas I used a FT232 chip, and all I had to do was plug it into each circuit and upload the appropriate sketch using the Arduino software (see image above) just like I would with an Arduino Uno. The only difference is that you need to select "Arduino Nano w/ ATmega328" instead of "Arduino Uno" in Tools > Board. The code was very similar to the code used in the third prototype.
The first sketch parsed GPS data and sent it to the second GPS through a serial connection. The sketch would flash the LED on pin 13 when data was being sent, and the LED would glow when there is no GPS lock.
The second sketch has far more responsibility. It takes the current GPS location, calculates the distance from that location to the next waypoint, compares the heading to the next waypoint with the compass bearing, and controls the motors to go there. There's also the override function, which pauses the autopilot while there is a signal from the RC receiver. That signal is then used to calculate the speed of each motor. The waypoints that the autopilot goes to are programmed directly into this sketch.
The second AtMega also needs to calibrate the compass before using it. This is where I switched over to helscream's compass library which does the calibration for me. When calibration is finished, a green LED lights up!
The sketch that I uploaded to each chip was essentially a combination of all my previous sketches.
You can download all source code at the very last step of this Instructable!
Step 11: Separating the Compass
With the third prototype, whenever I turned on the motors, the compass would shift up to ten degrees to the left. Clearly there was some interference. I noticed that this interference got exponentially smaller as I moved the autopilot up the boat, so I decided to simply move the compass forward.
Since the compass is really sensitive to tilt, I decided to build a support for the compass out of foamcore. I used double sided tape to stick this support to the front of the boat, then I placed the compass inside the support. I also created a four wire extension cord for the compass out of scrap speaker wire and some pin-headers. One end of this extension cord went to the compass, while the other plugged into the autopilot. Once again, I used hot glue to insulate these connections.
Step 12: Testing the Autopilot
After extensive bathtub testing, it was finally time for a proper real-world test! Once again, I brought the boat to the pond, programmed three waypoints that were in a triangle, used the manual override to steer the boat away from land, and let it rip! The autopilot was able to go to each waypoint in order, and when it was done will all three waypoints it would loop and go to the very first waypoint again! Success!
The autopilot was able to travel to these waypoints at about 30% throttle, which is about walking speed. I set the speed this low because I didn't want the MOSFETs to overheat, and I generally wanted to play it safe.
After the first fully successful triangle test, I spent the next week testing one new path a day. I tried everything from triangles, to circles, to squiggles, to zig-zags, and the autopilot was able to travel the paths just like it was supposed to!
On two occasions, the wire that served as the one-way serial connection between the two AtMegas came loose. Thankfully, I was able to use the manual override to bring the boat to shore, connect the wire again, and send the boat on its way. The GPS signal never got lost during testing, and the battery lasted roughly ten minutes each charge.
Step 13: Next Steps, Final Thoughts and Downloads
Improvements:
This boat is essentially finished, but there is always room for improvement. While doing the last few tests, I noticed that the boat would sometimes begin oscillate after a turn. Turns out, since the compass is not tilt-compensated, there's enough deviation after a turn to start this oscillation. In order to make a compass tilt-compensated you need add an accelerometer, but I thought an easier way to implement one is to buy the GY-511, which is a compass and an accelerometer, and it uses the same I2C protocol as my current compass! When the new chip gets here, all I will have to do it switch some pins around and that's it!
There's also the issue of paths. The program I wrote for this autopilot is very simple, so it doesn't follow a path, or compensate for drift. A PID controller is specifically made to compensate for this, so I'm going to try to implement one in my software.
Also, I have an SD card reader available. I was thinking of implementing it in order to record GPS data, but it seems to run at a lower voltage level.
Just below you can find the source code for my autopilot. The Autopilot_GPS file is for the AtMega chip that is connected to the GPS, and the Autopilot_Main is for that main AtMega. Other files contains previous versions of the autopilot (the first two prototypes). Again, just extract the archives somewhere, and inside are the files that are directly compatible with Arduino software !
Final Thoughts:
I am really happy with not only how this project turned out, but I'm also happy that I learned a lot of really important skills; everything from programming to designing circuits. I think that when I grow up I'll be doing things like this, writing programs, making drones, projects, but obviously on a bigger level.
Also, there's a lot I haven't mentioned in this Instructable. On my blog there's more info about this project, and you'll be able to find my other projects like my weather station , electric longboard , and flying machines !
Attachments
Ride, Captain, Ride Aboard Your Arduino-Controlled Autopiloted Sailboat
He’s using two Arduino Megas. One is solely for the GPS, and the other controls everything else. [Jack]’s autopilot has three modes. In the one he calls knob steering, a potentiometer drives the existing hydraulic pump, which he controls with a Polulu Qik serial DC motor controller . In compass steering mode, a Pololu IMU locks in the heading to steer (HTS). GPS mode uses a predetermined waypoint, and sets the course to steer (CTS) to the same bearing as the waypoint.
[Jack]’s system also uses cross track error (XTE) correction to calculate a new HTS when necessary. He has fantastic documentation and several Fritzing and Arduino files available on Dropbox .
Autopilot sailboat rigs must be all the rage right now. We just saw a different one back in November.
http://www.youtube.com/watch?v=-nA6wo9PXls
[Thanks Jeremy]
22 thoughts on “ Ride, Captain, Ride Aboard Your Arduino-Controlled Autopiloted Sailboat ”
why would a mechanical engineer seemingly use a cardboard box as an enclosure?
I had a lead programmer once tell me after a week of beating my head against GUI issues I was having with Drupal, “make it work, make it work better, THEN make it pretty.”
I love the “Although functioning, parts of it are still packaged in a prototypical way. ” way to go!
Exactly what I envision a terrorist’s one-time-use device would look like. :)
This is great for drug smugglers ;)
I like the title, but now the song will be haunting the rest of the day… B^)
Why would a PC based solution be ‘out of reach’? I don’t think it’s a monetary problem, old PCs are so common someone might actually pay you to take it! Maybe the interface? Get one with a parallel port and it can’t be that much different than the GPIOs of an Arduino. The language? Arduino is basically C++, PCs use any language you prefer, including C++.
I think the Arduino is a better choice but I am curious why a PC solution was “out of reach”.
Power consumption?
Raspberry pi uses less power than the Mega board.
not sure about using TWO megas but good job.
I built a similar system for controlling a trolling motor (very similar to Minnkota auto pilot). I had to use two arduinos because the serial interrupt while reading GPS data disruptive to the entire system.
Chris is right about the two Megas. The GPS cycle time is 1 Hz whereas the IMU is operating at 50Hz. Once a second the Main mega recieves the GPS update in a few milli seconds. I am working to add a third Mega to provide a remote control over a single cable with serial data transfer.
In the spirit of open software which is at the heart hacking is the idea of using and crediting the source. I would like to see that Bill Bishop whose blog The Marine Installers Rant, http://themarineinstallersrant.blogspot.com/ be credited as the original author for the material in this Hack A Day blog.
Such a waste of hardware
Want to expand on that a little? In what way is it a waste?
If you can afford a Nordic 40, you can afford a proper Raymarine autopilot IMHO. This would be great for those of us with smaller boats that don’t have 100G to blow through on a 40 footer though.
Just because you could afford something once doesn’t mean you can continue to. Perhaps circumstances changed, perhaps he could barely afford it, or perhaps he has other financial obligations. I wouldn’t leap to conclusions
or he just wanted to…
The boat is 31 years old. Pretty sure it never cost 100G.
Never owned a pit you throw money down (boat), eh?
Here is the same model one year newer for $109,500 http://m.yachtworld.com/mobile/boats/1984/Nordic-40-2396149/Georgetown/ME/United-States
Some people will mortgage a larger boat to “live aboard” if their respective marina will allow it.
Someone needs to filk Sloop John B. into Sloop Wile E., and throw in some stuff about arduino, GPS and autopilot. http://songmeanings.com/songs/view/4885/
Jack has done a great job. I am not sure whether I would have the inclination to embark on such a project. However, I am currently re-writing the AutoPilot code to obviate the mega which handles the GPS.. I have a finite finite state machine handling the incoming GPS, and the GPS code no longer blocks the auto pilot code. In addition, the overhead to do the data transfer is now gone. The have re-used the majority of the current GPS code, In addition I am implementing alternative IMU components & optionsto work with the 9 DOF IMU that I have, so I have some work to do there still. I will attempt to keep the Polulu code.
Leave a Reply Cancel reply
Please be kind and respectful to help make the comments section excellent. ( Comment Policy )
This site uses Akismet to reduce spam. Learn how your comment data is processed .
Never miss a hack
If you missed it, haiku os’s beta 5 release brings us into a new beos era.
Boss Byproducts: Fulgurites Are Fossilized Lightning
FreeBSD At 30: The History And Future Of The Most Popular BSD-Based OS
Ham Radio In The Internet Age
Hacker Tactic: Building Blocks
Our columns.
Supercon 2024 Flower SAO Badge Redrawing In KiCad
FLOSS Weekly Episode 807: Bitten By The Penguin
Supercon 2023: Cuddly Companion Bots
Hackaday Links: October 27, 2024
Retrotechtacular: Making Enough Merlins To Win A War
By using our website and services, you expressly agree to the placement of our performance, functionality and advertising cookies. Learn more
DIY autopilot for sailboat – Part one
Instead of buying a complete autopilot our plan is to do a DIY autopilot for our sailboat. The reason is to save money and also because it is a bit fun. Both of us has pretty good knowledge about the general theory for autopilots, control theory which we both has read a course in university about. Thomas has also studied, and currently works with electronics design and Petra is a software developer. So, we both have some background knowledge about this stuff. But if you are interested in learning about this stuff and to spend time on it, it should be possible even without education, the internet is full of information!
The idea of a DIY autopilot for our sailboat started when we were looking at finding a good second-hand one. We realized that it would be expensive since all the affordable second hand autopilots were tiller pilots and we need something that is compatible with our wheel steering system. Autopilots made for fix installation, e.g. not tiller mounted where you disconnect the actuator when not in use, tend to be very expensive because some kind of release mechanism or clutch needs to be in the system.
As we realized that the actuator, or drive unit, were going to be the most expensive component in our DIY autopilot we started to design the system from the actuator. Today we have a wire steering with a quadrant on the rudder shaft. The autopilot actuators, or drive units, that we can use in our system are:
- Linear electric actuator
- Rotar electric actuator
- Linear electro-hydraulic actuator
- Hydraulic actuator (if changing to hydraulic steering).
The idea of building our own actuator came up but independent of the actuator design it always got stuck on how to solve the problem with a reliable and low power consuming clutch. Luckily a second hand electro-hydraulic actuator pop up and we bought it.
General idea for our DIY Autopilot
Our autopilot will not be completely DIY, since we will use an open source code for the actual code. This will save a lot of time and we will be able to more easily get extra fancy features, such as waypoints. We may however write a basic back-up code which will simply just maintain a certain course, to have if the other one should fail.
The autopilot will consist of the following hardware and software components:
- Electro-hydraulic actuator
- Rudder angle sensor
- Arduino and H-bridge motor controller
- Raspberry Pi running Pypilot
- Inertial measurement unit and magnetometer.
The arduino will do the following:
- Control a H-brigde that will drive the actuator
- Engage the clutch soleniod of the actuator
- Read the rudder angle sensor
- Read the temperature of the H-bridge
The Raspberry Pi, who will communicate with the arduino over an opto isolated UART, will run Pypilot which is an open source autopilot software. It will also act as our back up navigation system running the chartplotter openCPN and do some other stuff. All of this software is included in OpenPlotter which is like a software package for navigational aid and boat automation.
To be continued….
UPDATE May 2020: It has been some months since we shared this first posts and hope will do a Part 2 soon. We have a lot of other things to prepare on the boat as well but we have made some progress with the DIY autopilot as well. One thing we have done is to take the drive unit apart for some service and also tried to run our setup. Soon we will start to install the autopilot onto the boat and then we will be able to try it out for real.
NEWS UPDATE: We have bought a new boat, a Wasa 530. Read more about it on this page: The Boat – Anne-Mon II .
Our new sailboat is in need of some upgrades and renovations as it has been standing for 10+ years. We will post all the boatwork we do on Anne-Mon II on our YouTube channel: youtube.com/c/SailingAnneMon .
Miikka Savolainen
Looking good! Im in the middle of a similar project but im planning on using a wheel drive. What H-bridge did you use on your controller?
Sailing Anne-Mon
Thank you! We used this one: https://www.robot-electronics.co.uk/htm/md03tech.htm . Good luck with your project 🙂
Sailing Windjammer
Dear, I am currently looking into a similar system. My current problem is finding a drive unit. What brand and type did you use? With kind regards Samuel D.
Leave a Reply Cancel reply
Your email address will not be published. Required fields are marked *
IMAGES
VIDEO
COMMENTS
Autopilot for Sailing Boats (Automatic Steering System) Let's take a break during navigation while Autopilot follows the route, control it with remote control! Apr 7, 2020
Let's take a break during navigation while Autopilot follows the route, control it with remote control. Project contains many improvements!
Autopilot for sailing boats (NEW! - Version 2) Let's take a break during navigation while Autopilot follows the route, control it with remote control. Project contains many improvements!
What I want to achieve is a boat that can sail alone following some waypoints with the gps. I'm new to arduino, but I already have a rc boat and coding knowledge. Inputs I need are: -GPS coordinates -Compas…
It's easy to build, based on the popular Arduino platform, and great for hobbyists who want some soldering practice! With this autopilot, an RC boat can go long distances without any human intervention, like an autonomous drone.
Ride, Captain, Ride Aboard Your Arduino-Controlled Autopiloted Sailboat. [Jack], a mechanical engineer, loom builder, and avid sailor wanted an autopilot system for his 1983 Robert Perry...
The Raspberry Pi, who will communicate with the arduino over an opto isolated UART, will run Pypilot which is an open source autopilot software. It will also act as our back up navigation system running the chartplotter …