homemade autopilot

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

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

    boat_alexandra New Member

    Look on hobbyking.com for brushless motor controllers for relatively cheap. The f&p motor is about 1500 watts which is way overkill but maybe you can get away with less gear ratio or a belt drive and keep it quiet. I think this would result in a slight loss in efficiency, but not too bad.

    I don't really care about what drive system people use, only the control electronics. I think a combined compass/wind setup is essential for decent operation.
    Keep in mind that the lisp code is only for development since it is much less bug-prone, and there are far fewer cases of syntax errors. It is also a much easier language to work with (if you really take the time to learn it) for when you need to re-arrange things on a significant level frequently, or perform high-level operations. I don't use a debugger because the code does what I wanted it to do when I write it. The final version will be written in c as that language is sufficient, and much easier to deal with on small embedded systems. By that point I will know exactly what algorithm works best and what is needed and can waste less time dealing with the stupid confusing situations that always result when I try to develop programs (where 95% of it is tryouts and never used)

    I have been very distracted lately by various events and I have been at sea and not really had much chance to test things other than hooking up an alternate drive system which uses a screw drive and much lower power consumption, but is also slower.
     
  2. kipper
    Joined: Oct 2012
    Posts: 3
    Likes: 0, Points: 0, Legacy Rep: 10
    Location: Ocean Grove Aust

    kipper New Member

    Thanks Brian and BA.

    Yes I know the avr mega processor aka arduino is capable but I have yet to find minimalist boat specific code for yaw control without the roll and pitch axes with the more common aircraft implementation. Perhaps later they can be used to drive up and over the waves :)

    In regards the paykel motor, its getting a bit off topic but I'm not using anywhere near the high 1500w? power only the high torque capability. The hobbyist type brushless controllers mentioned are high speed uni-directional controllers unsuitable for an autopilot application as they use back emf to infer rotor position instead of hall effect sensors which detect absolute position.

    Several posters have alluded to the robustness of hydraulic drive in comparison to direct electric drive. However an electric system is usually used to drive the pump so my rationale is all electric should be just as 'robust' if the excessive over run or feed back forces are contained with some sort of resilient spring system in the drive train. Hydraulic 'reliability' also comes with the tradeoff of higher friction losses which I am hoping to reduce to a minimum for battery powered use.
     
  3. tspeer
    Joined: Feb 2002
    Posts: 2,268
    Likes: 236, Points: 63, Legacy Rep: 1673
    Location: Port Gamble, Washington, USA

    tspeer Senior Member

    One reason to use hydraulic power is because it is easier to engineer the failure modes. Generally speaking, when a hydraulic actuator loses power, it goes to a damped trail mode of operation, but when an electromechanical actuator loses power it locks in place. The damped trail mode allows you to steer manually before disengaging the autopilot and it will let the helm neutralize itself. Locking in place is OK if the rudder is in trim when the failure occurs, but it is bad news if the rudder is hard over. And the autopilot has to be disengaged to allow manual control.

    It all depends on the requirements and what you believe are the most likely failure modes. Some installations may require the pilot to go to the back of the boat to disengage, while others can be readily disengaged from the helming station, etc. Failure modes may not be that important for a small tiller pilot, but have to be carefully considered for a high-powered installation or one that is installed below decks.
     
  4. Arne81
    Joined: Dec 2012
    Posts: 4
    Likes: 0, Points: 0, Legacy Rep: 10
    Location: The Netherlands

    Arne81 New Member

    Hi, I am also planning to build an autopilot. The following components are on my list now:

    Rapsberry pi 512
    Rapsberry pi case
    Transcend 4 GB SDHC
    DFRobot LCD Keypad Shield for Arduino
    CMPS10 - Tilt Compensated Compass Module
    Pololu Jrk 21v3 USB Motor Controller with Feedback
    Some additonal boxes and wiring

    The problem as some people mentioned before is finding the right actuator to fit below deck. I'am looking for an actuator with a clutch and feedback, without any luck so far. The RS Sail boat drive from octopuseurope.com is an good option but quite expensive (about €1400,-) the same counts for the Jefa LD100. Does anybody found a cheaper alternative yet?
     
  5. Dave911
    Joined: Aug 2011
    Posts: 70
    Likes: 2, Points: 0, Legacy Rep: 16
    Location: Indiana

    Dave911 Junior Member

    Hi Guys... sorry I have been offline for so long. I have been out of the country 4 times since Mid October doing system startups; weeks at a time for each trip. So I have literally been gone... It has been crazy. I had to call the marina from the airport last fall to have my boat pulled out of the water. I think I am back home for a while now (USA) so I am getting my head back into my autopilot development.

    Brian00 mentioned that he was experimenting with phones to use the rate gyro/compass/gps sensors.. I have a Google Nexus 7 that has all of the sensors needed (technically) except for a wind sensor. Has anyone done anyone done further experimenting with an Android or Apple device to see if the sensors are sufficiently responsive to use as navigation sensors? I can't find any specs for the onboard sensors. I am thinking about revising my Autopilot system again... integrating a Tablet to utilize the sensors and Graphical interface, and tying that to a wireless controller for the electrical interface to the actuator/motor and other nav systems. The potential cost savings are just too substantial to ignore.
     
  6. brianb00
    Joined: Sep 2012
    Posts: 24
    Likes: 1, Points: 0, Legacy Rep: 25
    Location: San Francisco

    brianb00 Junior Member

    Dave911,

    To clarify what I stated, I have been using sensors that are used in the cell phone industry, but not the cell phone itself. I have progressed quite a ways with an electronic compass and autopilot design. My experience is that the sensors are up to the task, at least the combination I use. For fun I have attached a plot of recent data and calculated data from said sensors.
     

    Attached Files:

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

    brianb00 Junior Member

    One other comment, you might turn on your cell phone compass and pass it through roll and pitch motions. The results are much less than impressive. THat gives some sense of the challenges ahead.
     
  8. Dave911
    Joined: Aug 2011
    Posts: 70
    Likes: 2, Points: 0, Legacy Rep: 16
    Location: Indiana

    Dave911 Junior Member

    Looks like you are getting decent response out of those sensors.

    I use a Samsung Transform phone which has Android 2.3 on it (not close to state of the art) and the compass works fine even when the phone is rolled and pitched. The program I am using is GPS Essentials which I got off Google Play for free..or very low cost...

    I have read about the compass hanging up on some devices, but I suspect those are bugs in the app or that particular device.

    I haven't done any Android development yet but if I can get quick access to those sensors and maintain a wireless link to an external device (external controller for the PID loops, electrical interface to motor/actuator/wind sensor etc) an Android device could get rid of a lot of sensors. If I could get 10 updates per second, I would be really happy. The program update loop on the GPS essentials program must be about 10 times per second just looking at the screen update time. I will get the Android dev system loaded up and start playing with the Google Nexus 7. From what I have seen so far the Nexus 7 is a really nice device.. I have seen them selling refurbished as low as $160 now. The existing LCD display I was using on my autopilot last year cost $160 and I at the time that was cheap for a waterproof unit. Of course the Nexus 7 is not waterproof, but I think I can overcome that. I know a lot of guys who are using Apple Tablets at the helm now for navigation devices.
     
  9. brianb00
    Joined: Sep 2012
    Posts: 24
    Likes: 1, Points: 0, Legacy Rep: 25
    Location: San Francisco

    brianb00 Junior Member

    Hi Dave,
    I would agree, the issue in the phones are the algorithms in use. I have had several phones (2 iphones and now a samsung), after playing with them I have decided to never use the compass for anything serious. But as you suggest the sensors are likely fine if you can get to the unfiltered data. 1/10 sec update rate works really well for me. I am not sure the phones employ gyro's, or at least the compass Apps don't appear to, hence their poor ability to resolve pitch and roll issues in a timely fashion. Timely means in something near a 1/10 sec. I have found that the wave frequency on SF Bay is high enough that fast response is essential to avoid unwanted tiller motion. Actually SF Bay is a great place for step response testing due to the fact that in a strong ebb and NW winds actual square waves develop that give the AP a real test.
     
  10. Royston
    Joined: Jun 2013
    Posts: 3
    Likes: 0, Points: 1, Legacy Rep: 10
    Location: Earth

    Royston New Member

    Hi Guys,

    Just thought I'd share the current progress I have with my Autopilot. First let me just say I have very little programming knowledge, and even less 'electrical' skills, my limit is I know what a resistor is. Based on this and knowing that I am going to have to learn a language I wanted to buy as much stuff off the shelf as possible.

    Originally I bought a CMPS10 and had a play, but have since given up. I have turned my attention to using an iPhone5 and its built in sensors. I think ideally I will end up using an Android phone but for proof-of-concept I am just using the iPhone. The only language I am familiar with is PHP, and therefore I am using that. I can hear the rounds of laughter as you read this, but for now its more about the 'process' of how an autopilot works. Further down the line I am sure I will need to change to something else, and buy custom components and learn how to solder. To control the rudder, I have purchased a small servo and I am also using this device (http://www.yoctopuce.com/EN/products/usb-actuators/yocto-servo) which has its own php-library.

    I download an App for the iPhone that basically streams heaps of information using UDP. (http://wavefrontlabs.com/Wavefront_Labs/Sensor_Data.html) Its buggy as hell but for now it works well. Within my navigation script running on a Raspberry Pi I have a UDP Socket Server that collects this data, splits it into $variables and then I work with them individually.

    Without going through every bit of code, essentially it does the following in a loop:

    1) Takes my current lat/long, heading and then reads from a local mySQL database for the next waypoint
    2) Calculates the bearing based on my current position and the next waypoint.
    3) Works out how far off I am the current bearing. Using if/else statements if I am 10 degrees off, then turn the servo/rudder X, 5 degrees off...turn Y etc...
    4) Again using if/else once I am within XYZ distance of my waypoint, it will update the mySQL DB to say its hit then pull down the next waypoint and re-calculate again.

    That's basically it in a nutshell.

    The only real issue I have found so far is that the servo is pretty slow to move. I am not sure if its because I am powering the device via a USB hub or if its just PHP is to slow.

    I do not own proper compass yet so I do not know how accurate the iPhone is, I know from testing it can be wildly off but there is a lot of interference around my desk. I am hoping once I get to proof-of-concept build stage I can isolate this and test properly.

    I will be happy to share my code if anyone is interested. I'd also be happy to hear from anyone who can suggest if my logic above is incorrect, and ways to improve.

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

    brianb00 Junior Member

    AP using iphone

    Great concept. You dont really need compass accuracy, you need repeatability. At least that is the case of the unit I have created. One just points at the target heading and engages. If I want course accuracy I use the calibrated deck compass.

    I played with the iphone a bit, an iphone 4. The compass seemed pretty poor at any tilt angle. What worried me was the occasional recalibration I would have to do.

    You might consider Firgelli automation as a source for actuators. I have recently tried two of their small units and find them well constructed.

    Good luck with the project.
     
  12. Arne81
    Joined: Dec 2012
    Posts: 4
    Likes: 0, Points: 0, Legacy Rep: 10
    Location: The Netherlands

    Arne81 New Member

    Hi Royston,

    I've used the CMPS10 in combination with a Raspberry PI and for me it works like a charm. I've wrote some code in C for getting the input and build a simple web interface in PHP for controlling the autopilot. (Screenshot below...)

    [​IMG]


    So far so good. The problem I am still working on is controlling the rudder. I've got a boat with a wheel, so a linear actuator is not really an option unless it has a build in clutch. Maybe I will build something like the CPT autopilot, a belt driven by a windshield whiper motor. (like on this page: http://svsoggypaws.com/steering.htm )

    Arne
     
  13. Royston
    Joined: Jun 2013
    Posts: 3
    Likes: 0, Points: 1, Legacy Rep: 10
    Location: Earth

    Royston New Member

    > I've used the CMPS10 in combination with a Raspberry PI and for me it works like a charm. I've wrote some code in C for getting the input and build a simple web interface in PHP for controlling the autopilot

    Is this using I2C via the GPIO pins? I also purchased this (http://www.robot-electronics.co.uk/htm/usb_i2c_tech.htm) because I wanted to keep my Raspberry Pi in a case but I couldn't get that working either. Software looks great btw.

    > I played with the iphone a bit, an iphone 4. The compass seemed pretty poor at any tilt angle. What worried me was the occasional recalibration I would have to do.

    Because I am using a Socket Server to stream data from the phone to my Pi, I am thinking that I could use an iPhone and Android then do something like average the results. Next stage for me is to purchase an Android phone and give that a go.

    I forgot to add that my project isn't to built an autopilot for a large boat, its going to be a small research vessel to collect data. Will run off solar panels/battery and at the moment it will be about 2m in length.

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

    brianb00 Junior Member

    Rasberry pi & CMP 10 display

    Arne,

    I assume the display your showing is on a PC screen and not a cell phone ? The display looks good.

    My set up drives the rudder stock directly, like so many AP installs. I have hydraulic and electric drive options. You could conceivably drive the quadrant with a geared down motor as shown in other posts on the web.

    Have you tried your design in a seaway ?

    Regards,
    Brian
     

  15. Arne81
    Joined: Dec 2012
    Posts: 4
    Likes: 0, Points: 0, Legacy Rep: 10
    Location: The Netherlands

    Arne81 New Member

    Hi,

    Royston I've used the GPIO pins, my PI is also in a case. For the CMPS10 module I've used an old telephone connectorbox. (see the video below)
    Interesting project, are you planning an atlantic crossing just like this guy?

    http://news.cnet.com/8301-17938_105-57464259-1/raspberry-pi-to-cross-atlantic-in-solar-powered-dinghy/


    Brian, I've still to decide what drive unit to use/build. And also which H-bridge, maybe just a cheap one from ebay or an pololu jrk with feedback for the rudder. So for now it's just the web interface and the code to read the compass. The screenshot was indeed on my computer screen. But my Raspberry is also an WIFI accespoint which my Phone could connect to. The interface is semi fluid, so it works fine on a phone. I hope the video will make it clear ;)

    http://videobam.com/ubdnN

    Regards, Arne
     
Loading...
Similar Threads
  1. bballer
    Replies:
    1
    Views:
    2,940
  2. Deering
    Replies:
    2
    Views:
    506
  3. Bumbleguy
    Replies:
    3
    Views:
    1,852
  4. missinginaction
    Replies:
    1
    Views:
    2,873
  5. sv alexandra
    Replies:
    2
    Views:
    2,132
  6. missinginaction
    Replies:
    1
    Views:
    1,085
  7. missinginaction
    Replies:
    2
    Views:
    1,165
  8. Jdawg
    Replies:
    9
    Views:
    1,529
  9. Tony.R
    Replies:
    0
    Views:
    1,371
  10. Steve W
    Replies:
    0
    Views:
    1,087
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.