homemade autopilot

Discussion in 'OnBoard Electronics & Controls' started by bertho, Nov 8, 2009.

  1. Dave911
    Joined: Aug 2011
    Posts: 70
    Likes: 2, Points: 0, Legacy Rep: 16
    Location: Indiana

    Dave911 Junior Member

    QUOTE=brianb00;583154 Hi, Please see answers below:

    >> The gyro signals predict heading, that is they modify the much slower compass and keep a running DR heading estimate.
    <<

    So you are doing something like integrating your gyro output over time to get an estimated position change and then updating everything periodically by the compass input?

    >> It works very well downwind. I sailed 2100 miles, much of it very close to DDW. THat is the nature of the course to Hawaii. I sailed night and day, sometimes in winds to 25 kts, and often asleep. You notice very quickly when the wind shifts a bit and make the appropriate course corrections with a few button pushes. I was racing, so the spinnaker was up for 9 days, 24/7. The only exception was to do changes to size for conditions.<<

    Excellent!

    >>
    The AP has 3 buttons and an IR remote. Also two LED's are on the front panel. I kept it all very simple to avoid water intrusion. One button engages/disengages the AP. Basic operation, point boat at target course and engage, then go do something else while boat steers you home. The other two buttons command course changes, Green for Star, Red for Port. There are other modes for adjusting loop parameters and engaging compass following versus wind following. I use the LED's to determine what mode I happen to be in. The IR remote allows me to stick my head into the companion way and command course changes without having to put on foulies.
    <<

    That sounds more than sufficient. I have something similar less the LEDs on a wired pendant and I use that all of the time on my current setup. I have a small LCD display that doubles as a compass in the cockpit but it can also be used for tuning. The one I am currently using is watertight.

    >> THis version was specifically set up to use my existing instrument set, a B&G network pack. Wind data was taken from the mast head unit via NMEA serial data stream. This mode was really great and was one of the last things I got debugged prior to the race to Hawaii. I was impressed with how well it worked given I had little time to tune it in. I could sleep comfortably knowing the boat would maintain a constant relative wind angle.
    <<

    After quite a bit of testing I have realized that sailing to a wind angle is important, much more than I previously thought.

    >>Choice of hydraulics ?

    I had five drive units aboard, two RM Tiller pilots just in case, the hydraulic unit I made, a homemade electric drive that drives a cable, and an RM Linear tiller drive unit (electric screw drive). There is a reason all the mini transat boats employee hydraulics in heavy conditions, it is powerful and resistant to ocean conditions. The Hydraulics drove about 3000 miles of my round trip, and always in the roughest conditions. The electric screw drive drove about 2000 miles before the gears in the unit died (this happened about 300 miles from SF). The Hydraulics show no signs of wear, the motor still seems to have full power. Other than the need to add a bit of hydraulic fluid I had no other issues. As far as leaks, there were none and I assembled the unit carefully to avoid same. Hydraulics have the advantage that the only thing exposed to the elements are stainless steel, o ring seals, and hydraulic fluid. Motors/electronics exposed to salt have a bad habit of failing. Yes, hydraulics are less efficient, but the power one can achieve with standard components is impressive, and the power translates to tiller reaction time, which is key in rough seas with a dynamic boat (and so is the AP response and algorithms). If using the screw drives keep then covered and put some silicon grease or teflon lube on the tiller to keep water out and off the units. There are other electric drive choices. I would reference the around the world racers to see what they are using. Take a look at Jefa and Alpha AP s for non hydraulic choices that are supposedly very rugged.
    <<

    Obviously you were concerned about always having an autopilot available. Smart move.

    From a robustness standpoint, I really like hydraulics. I work with them frequently in my day job. But power friendly they are not. How often did you need to run your engine to recharge your batteries? Or do you have a wind turbine on your boat or other charging method/s?

    >>
    BTW Dave, do you sail a 911 or drive a 911, or both ?
    <<

    I have driven a 911, but the ID was made on a whim. I think I was in a hurry. :)

    Thanks for the info!

    Dave
     
  2. jonr
    Joined: Sep 2008
    Posts: 721
    Likes: 11, Points: 0, Legacy Rep: 57
    Location: Great Lakes

    jonr Senior Member

    If you need a compass, GPS and a user interface, it is probably hard to beat an android phone in a mounted waterproof case (the ones where you can use the touch screen while in the case). It can talk bluetooth to an arduino for the actual control.
     
  3. Joakim
    Joined: Apr 2004
    Posts: 892
    Likes: 53, Points: 28, Legacy Rep: 422
    Location: Finland

    Joakim Senior Member

    It's not difficult at all to change something and reprogram the AVR-chip. Takes no longer than doing the same in NSLU2 and I did that several times during our holiday sailing until I was happy with it. You edit and compile the program in a PC and the transfer it to AVR using an USB-interface. It is just a bit different type of C-programming, since there is no operating system. But I think you need to go quite low level even with RPI in order to handle GPIO.
     
  4. brianb00
    Joined: Sep 2012
    Posts: 24
    Likes: 1, Points: 0, Legacy Rep: 25
    Location: San Francisco

    brianb00 Junior Member


    I would possibly agree. The exception is the quality of the compass. I have been coding my AP for tilt compensation and using an iphone and android to compare results. I have seen both of these devices hang in odd ways and have to roll and pitch them through 360 degrees to clear the compass operation.
    Brian
     
  5. brianb00
    Joined: Sep 2012
    Posts: 24
    Likes: 1, Points: 0, Legacy Rep: 25
    Location: San Francisco

    brianb00 Junior Member

    See >>> for answers:

    >> The gyro signals predict heading, that is they modify the much slower compass and keep a running DR heading estimate.
    <<

    So you are doing something like integrating your gyro output over time to get an estimated position change and then updating everything periodically by the compass input?

    >>>Yes. My latest version has added several more axis of data for added control in big seas. Coding continues as well as hardware development. Lots of work and testing on the water. I suppose I could simulate, but hey, why have a sail boat if you can't take it out.

    >> It works very well downwind. I sailed 2100 miles, much of it very close to DDW. THat is the nature of the course to Hawaii. I sailed night and day, sometimes in winds to 25 kts, and often asleep. You notice very quickly when the wind shifts a bit and make the appropriate course corrections with a few button pushes. I was racing, so the spinnaker was up for 9 days, 24/7. The only exception was to do changes to size for conditions.<<

    Excellent!

    >>
    The AP has 3 buttons and an IR remote. Also two LED's are on the front panel. I kept it all very simple to avoid water intrusion. One button engages/disengages the AP. Basic operation, point boat at target course and engage, then go do something else while boat steers you home. The other two buttons command course changes, Green for Star, Red for Port. There are other modes for adjusting loop parameters and engaging compass following versus wind following. I use the LED's to determine what mode I happen to be in. The IR remote allows me to stick my head into the companion way and command course changes without having to put on foulies.
    <<

    That sounds more than sufficient. I have something similar less the LEDs on a wired pendant and I use that all of the time on my current setup. I have a small LCD display that doubles as a compass in the cockpit but it can also be used for tuning. The one I am currently using is watertight.

    >>> I started with waterproof switches on a wire. THat was OK for testing but the wire would occasionally catch on things, and given the way lines tangle with anything I abandoned that idea.

    >> THis version was specifically set up to use my existing instrument set, a B&G network pack. Wind data was taken from the mast head unit via NMEA serial data stream. This mode was really great and was one of the last things I got debugged prior to the race to Hawaii. I was impressed with how well it worked given I had little time to tune it in. I could sleep comfortably knowing the boat would maintain a constant relative wind angle.
    <<

    After quite a bit of testing I have realized that sailing to a wind angle is important, much more than I previously thought.

    >>> Yes, especially in open quarters. In SF bay it is not so usable as you rarely can go 5 min without encountering some object. Of course keeping your eye on everything it works fine. In open space it makes great sense.

    >>Choice of hydraulics ?

    I had five drive units aboard, two RM Tiller pilots just in case, the hydraulic unit I made, a homemade electric drive that drives a cable, and an RM Linear tiller drive unit (electric screw drive). There is a reason all the mini transat boats employee hydraulics in heavy conditions, it is powerful and resistant to ocean conditions. The Hydraulics drove about 3000 miles of my round trip, and always in the roughest conditions. The electric screw drive drove about 2000 miles before the gears in the unit died (this happened about 300 miles from SF). The Hydraulics show no signs of wear, the motor still seems to have full power. Other than the need to add a bit of hydraulic fluid I had no other issues. As far as leaks, there were none and I assembled the unit carefully to avoid same. Hydraulics have the advantage that the only thing exposed to the elements are stainless steel, o ring seals, and hydraulic fluid. Motors/electronics exposed to salt have a bad habit of failing. Yes, hydraulics are less efficient, but the power one can achieve with standard components is impressive, and the power translates to tiller reaction time, which is key in rough seas with a dynamic boat (and so is the AP response and algorithms). If using the screw drives keep then covered and put some silicon grease or teflon lube on the tiller to keep water out and off the units. There are other electric drive choices. I would reference the around the world racers to see what they are using. Take a look at Jefa and Alpha AP s for non hydraulic choices that are supposedly very rugged.
    <<

    Obviously you were concerned about always having an autopilot available. Smart move.

    From a robustness standpoint, I really like hydraulics. I work with them frequently in my day job. But power friendly they are not. How often did you need to run your engine to recharge your batteries? Or do you have a wind turbine on your boat or other charging method/s?

    >>> The boat had the engine and about 230 watts of solar panels. The solar panels, on sunny days, could keep the charge up and I could run all night without recharge. THat said, I went 7 days with almost no direct sun. Boats dependent upon solar only were in deep exhaustion mode as they were having to hand steer many hours per day. I only had steered in the harshest conditions, read that as during squall busting. So, I ran the diesel about 90 min per day, give or take sunshine. On the return trip I dropped the parameter settings for less aggressive control and used a lot more electric drive. THat combination, plus near constant sunshine, let me roll along with nearly no motor time. I sailed the return leg in 20 days and consumed 11 gallons. Habitually I tend to run the engine at sunset while cooking the fish I just snagged. This tops the batteries up for the night sessions. If I do this course again I am adding a homemade hydro generator, drag and all.
     
  6. boat_alexandra
    Joined: Oct 2012
    Posts: 4
    Likes: 0, Points: 0, Legacy Rep: 10
    Location: new zealand

    boat_alexandra New Member

    I have built my own electric autopilot based on a remote control airplane brushless outrunner motor connected to a 120:1 planetary gear box from a truck winch. The motor is controlled from a rc car controller (forward and reverse) and an arduino controlls that. This should be fairly reliable, is extremely powerful (2000lbs on the lines to the tiller) and only uses 1-2 amps at 12 volts when running and can hard over in 1-2 seconds.

    As for the compass, I use my own 3 axis mag and 3 axis accel I built a few years ago, but you can get i2c modules for arduino for $25 now. I perform my own autocalibration routines to make it accurate to 1 degree in all orientations. This calculates 22 unknown coefficients for bias scale misalignment (between sensors) and non-orthogonality of the axes. I also compute non-linearities in the sensors but this is only needed if better than 1 degree accuracy is desired. I am going to be experimenting with gps feedback soon, as well as using boat motion to act as feedback into the system for steering in big swells, and rounding up with wind gusts. I have built a simple wind vane sensor the arduino can read from as well but I have not tested it with the autopilot.

    I use two constants, one multiplied by heading error, and the other by heading rate of change added together to determine the feedback. This is simplistic but works far better than just heading error as it does not overshoot. Eventually a much more complicated feedback loop should be developed to account for all sorts of conditions.

    I want to automatically determine a 3rd 4th or 5th order equation to determine the natural rate the boat heading slews with a given sail trim to reduce load on the autopilot. For example, if you lock the pilot when beating it keeps course in flat seas, and we can therefore use this fact to greatly reduce the effort of the pilot since it knows going off course will be corrected automatically with the sails so it need do nothing. In other cases it only needs to correct when going off course in one direction not both.

    Dave911:

    Have you tested your autopilot in the open sea with swells of 2 meters or more?
    Do you have a special website with source code repositories?

    Mine is:
    https://github.com/seandepagnier/cruisingplot

    I am also experimenting with relays controlling a screw drive. I think any drive system should be possible with the same source code. We should work together on algorithms. Anyone with interest in this can reply to this thread or email me sean at depagnier dot com.
     
  7. breezetrees
    Joined: Nov 2011
    Posts: 5
    Likes: 0, Points: 1, Legacy Rep: 10
    Location: SF Bay

    breezetrees Junior Member

    That sounds really cool, can you post a picture of your drive system?
     
  8. brianb00
    Joined: Sep 2012
    Posts: 24
    Likes: 1, Points: 0, Legacy Rep: 25
    Location: San Francisco

    brianb00 Junior Member

    Your drive current sounds very low, even lower than commercial implementations. I wonder how you are measuring current ? In my implementation the control processor does real time monitoring of motor currents through a sampling resistor. I can measure currents at various moments during motor drive and hence capture peak current levels. Are you capturing peak levels ? Another course means of measurement I have used is to apply various size fuses and see where they blow and under what conditions, this gives some sense of peaks (averaged somewhat by the fuse heating times). The other question is what is the boat dynamics/mass/keel type, etc. A 10,000 lb fin feel boat is going to have significantly different loading than a 30,000 lb boat of similar dynamics or a full keel cruiser of any weight. If I measure currents using a digital multimeter I obviously never see the real peak currents. In a sea way, large swell and a spinnaker driving down wind , is the most demanding, and in those conditions on my vessel I see currents in the 8 amp range at peak steering effort, for the hydraulic drive. My electric drive solutions are lower currents, but they don't have quite the power of the hydraulics.

    Brian
     
  9. brianb00
    Joined: Sep 2012
    Posts: 24
    Likes: 1, Points: 0, Legacy Rep: 25
    Location: San Francisco

    brianb00 Junior Member

    current drain.

    another measure I have used is the ability of 200watts of solar panel to keep up with the AP. During an extended voyage I noted that my solar panel array, 200watts total, could more than maintain battery charge even during demanding conditions, as long as there was no cloud cover. So roughly speaking, the solar array likely averaged something like 10 amps per hour over the course of 6 hours of the day, and that could keep the batteries in the green during that time. Of course if clouds were overhead the loss in power was very noticeable. I concluded that my average current drain was around 5 amps in moderate swell and winds to about 20kts with the spin. up. Reduced sail allowed for reduced gain on various parameters and greatly reduced power draw.
     
  10. boat_alexandra
    Joined: Oct 2012
    Posts: 4
    Likes: 0, Points: 0, Legacy Rep: 10
    Location: new zealand

    boat_alexandra New Member

    My drive current is low, but you are right I am not counting peak loads which occur for a fraction of a second. Also I draw 4-5 amps when going hard over in 1.5 seconds, but at 2 amps it takes 6 seconds. [​IMG] I have a brushless motor which is more efficient than the typical commercial implementations. I am measuring with a shunt across the main battery.

    Also I have 480 watts of solar panels on a 3 ton vessel, but mostly the power is used for motoring, a very small fraction is needed to run an electric autopilot.
     
  11. brianb00
    Joined: Sep 2012
    Posts: 24
    Likes: 1, Points: 0, Legacy Rep: 25
    Location: San Francisco

    brianb00 Junior Member

    Thanks for photo. Two questions:

    1) Do you really use the stainless shackle as a fair lead for the drive cable ?
    2) Ever get your toes caught in the cable drive pulley ?

    Brian
     
  12. boat_alexandra
    Joined: Oct 2012
    Posts: 4
    Likes: 0, Points: 0, Legacy Rep: 10
    Location: new zealand

    boat_alexandra New Member

    1) yes,the drive is way too powerful anyway
    2) no
     
  13. kipper
    Joined: Oct 2012
    Posts: 3
    Likes: 0, Points: 0, Legacy Rep: 10
    Location: Ocean Grove Aust

    kipper New Member

    B_A: Hi from across the pond.

    This is my first post on this forum. Presently I'm going down a similar path to you with a diy autopilot- Arduino controlling a brushless motor coupled to a home brew oar similar to a hydrovane self steering. For the motor I am using a fisher and paykel washing machine motor ( made in your country!) Since it is used as a direct drive (300mm dia with 14x3 poles) it will not need much step down gearing thus making it extremely efficient and quiet. Being brushless also means wiring can be better encapsulated. Important for long dist cruising. I'm having trouble making the controller electronics and am now on my third iteration. Commercial controllers run to hundreds of dollars and I'd need at least another as a spare so I'd prefer to make it. Didnt suceed directly controlling it with arduino and now proposing using a dedicated chip -MC33033.

    Interested in seeing your auto pilot code in Lisp. Well I haven't seen any of that since when I dabbled in autocad customising -to me a dog of a language with all those brackets making it hard to read/debug. I havent written my higher level autopilot code yet but was hoping to adapt someone else's code. Funny thing is I have only come across yours and another (from memory SCA for a pic controller) that were specific to boat autopilots. Unless I can source a boat specific I'll probably adopt either ardupilot or openpilot. The later is good but only works on arm processors for now and the former seems no longer maintained. Initially all I need is the PID controller stuff and Ill add the sensors incrementally later.

    I'd also like to see Dave11's code if available.


    R
    Kipper
     
  14. kipper
    Joined: Oct 2012
    Posts: 3
    Likes: 0, Points: 0, Legacy Rep: 10
    Location: Ocean Grove Aust

    kipper New Member

    Dave11: You have PM disabled?

    The Openpilot source code site has module using an android phone to communicate with the 'autopilot module. Perhaps this might give you some clues although I'm not up to that level of sophistication yet. (git clone git://git.openpilot.org/OpenPilot.git OpenPilot)


    As for the gyro/compass/accel these can be had for about $20 now on ebay -search for imu
     

  15. brianb00
    Joined: Sep 2012
    Posts: 24
    Likes: 1, Points: 0, Legacy Rep: 25
    Location: San Francisco

    brianb00 Junior Member

    Kipper:

    You can make one work with the same processor as used in the Arduino UNO. I have based my design (see entries above) on the same processor as in the Arduino and it fits with a tiny bit of room to spare.

    regards,
    brian s/v redsky.

     
Loading...
Similar Threads
  1. Deering
    Replies:
    2
    Views:
    1,759
  2. Bumbleguy
    Replies:
    3
    Views:
    3,286
  3. missinginaction
    Replies:
    1
    Views:
    4,939
  4. sv alexandra
    Replies:
    2
    Views:
    3,449
  5. missinginaction
    Replies:
    1
    Views:
    1,923
  6. missinginaction
    Replies:
    2
    Views:
    2,052
  7. Jdawg
    Replies:
    9
    Views:
    2,580
  8. Tony.R
    Replies:
    0
    Views:
    2,080
  9. Steve W
    Replies:
    0
    Views:
    1,746
  10. cal_d_44
    Replies:
    0
    Views:
    2,085
Forum posts represent the experience, opinion, and view of individual users. Boat Design Net does not necessarily endorse nor share the view of each individual post.
When making potentially dangerous or financial decisions, always employ and consult appropriate professionals. Your circumstances or experience may be different.