homemade autopilot

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

  1. Rolf Koehoorn
    Joined: Feb 2012
    Posts: 5
    Likes: 0, Points: 0, Legacy Rep: 10
    Location: Lemmer Holland

    Rolf Koehoorn Junior Member

    compass to slow

    Dave911

    I am using this compass: HSC100 NMEA Fluxgate Compass Sensor. It costed me 200 euros. (www.marktplaats.nl)

    My program does a read out 5 times a second.
    I believe the sensor itself can deliver much more often.
    Therefore the signal is pulled on the necesarry moment instead of the readout pushed into the program much more often then necessarry. This would slow down the program unnecessary.

    Important is, as i have noticed during much trial and error, the right settings of the serial NMEA communication and of course the right code.

    Did you also write your own code?
     
  2. Rolf Koehoorn
    Joined: Feb 2012
    Posts: 5
    Likes: 0, Points: 0, Legacy Rep: 10
    Location: Lemmer Holland

    Rolf Koehoorn Junior Member

    still todo

    Now I'm working on feedback. When I'm giving commands using the wireless mouse whilst not seeing te steeringwheel moving I still want to be sure the wheel is actual moving.

    I am experimenting using arduino uno with bluetooth shield to communicate wireless by bluetooth. I managed bidirectional communication.

    Now it should be translated in a buzzer and or vibrator in my still to design remote control. The last because the arduino uno and bluetooth shield don't fit in my wireless mouse.

    Searching the internet I found out a hall compass sensor would have been good enoug and much cheaper instead of my compass sensor.
    That is the sport isn't it; better smaller and cheaper.

    I am thinking of putting a infrared mouse close to the steeringwheel to actualy ,,see'' the wheel move.
    The elekromotor has a potentiometer in it wich would give an analoge signal. But I want to see te wheel move. An infrared mouse will do the trick.
     
  3. Dave911
    Joined: Aug 2011
    Posts: 70
    Likes: 2, Points: 0, Legacy Rep: 16
    Location: Indiana

    Dave911 Junior Member

    Hi Rolf,

    I talked the company that makes that compass. http://www.digitalyacht.co.uk/product_info.php?products_id=11653

    Looks like a good unit. I like the one I have and it can do 10 hz without a problem but I think that pushing it to 10 hz is a waste of time due to noise in the compass reading. I filter the compass signal as it is to get rid of noise and the natural yawing of the boat in waves.

    I think that the CMPS10 compass board probably works as well as the very expensive compass that I have.
    http://www.robot-electronics.co.uk/htm/cmps10doc.htm

    I had it hooked up to a PC and it looks as accurate as my very expensive KVH unit. The downside - no housing and it requires a RS232 to TTL level converter chip. But with this very little board - about 20 mm square and the converter chip and some misc wiring and soldering, plus a waterproof housing; I think an effective waterproof compass can be put together for less than $75 US.

    >>Did you also write your own code?
    Yes, I do programming of industrial controls for my living.

    >>That is the sport isn't it; better smaller and cheaper.
    I think so to the extent that it does not detract from reliability or useability. :) Since I do most of my sailing single handed, I really need the autopilot to function properly.



    I have considered doing a wireless remote/control screen using a tablet, or phone connected via Wifi. I've considered doing an Android app. I was at the store the other day and they had a 7" tablet with Android 4.0 for $80! And it really didn't look bad. Although I really like to move something or hear a click when I use a remote and for that a touch screen is not good. How about a game controller?

    I have a wired remote with an a two waterproof buttons, a joystick for steering, and a switch for auto/man/GPS. I use the wired joystick constantly. In fact I rarely actually use the tiller anymore other than leaving or entering the harbor. I auto mode I can change the target heading by 1 degree up or down by moving the joystick right or left. My unit can steer to a waypoint but I really haven't used that yet and honestly I am not so sure it is all that useful. The other buttons are for resume and tack, so I can tack right or left automatically.

    I also have a small waterproof graphics screen that doubles as a compass display in boat cockpit. I mostly use that as a compass display but it also doubles as a display for the autopilot to show deviation from course, and allows me to make gain and filter adjustments on the fly, but the last few times I have gone out I haven't adjusted anything. Just turn it on and let it steer and use the display as a compass display.

    I need to add a windvane so the boat can steer to the wind for sailing I think I need to add a gyro input also. So more work to do. :)
     
  4. breezetrees
    Joined: Nov 2011
    Posts: 5
    Likes: 0, Points: 1, Legacy Rep: 10
    Location: SF Bay

    breezetrees Junior Member

    For what it's worth, I had yaw rate (gyro) feedback in my autopilot and took it out. The bulkhead that my electronics mount to shakes so much with the engine running that the autopilot was steering violently under power. I took yaw rate feedback out and it works much the same.

    I logged data to try to fit a system model so I could use control design techniques to calculate the feedback gains. The baseline boat dynamics are so well-damped that I didn't see much advantage adding more damping with yaw-rate feedback. Downwind with the spinnaker up the boat is less stable but I didn't analyze that data and my autopilot is working pretty well so I haven't bothered. I did a doublehanded race with my 8 year old son last weekend and the autopilot steered all the spinnaker legs so I could trim and do foredeck.

    I should add the caveat that my compass heading is augmented using the gyro-- my sensor is an inertial measurement sensor, that sends out the orientation matrix that gives me heading and also pitch and roll angles. It calculates this with a kalman filter mixing compass, gyro and accelerometer data. So I have really good, fast sensor data which might be what you want to get with gyro augmentation.

    I have some videos of my system working that I'll try to upload soon, but you can check out the details at www.holdentechnology.com

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

    Dave911 Junior Member

    >> I took yaw rate feedback out and it works much the same.

    I can see how vibration could cause problems.

    >>dynamics are so well-damped that I didn't see much advantage adding more damping with yaw-rate feedback.

    I don't have a problem with damping at all. If I could augment my compass with an accelerometer and gyro I would be much better off.

    I looked at some of the software that has been developed for hobby UAVs and I dug into the Kalman filter software that many of them used and it appeared to be excessively complex initially. But I have done a lot of testing since and perhaps I need to reconsider.

    How did you set your Kalman filter constants? That seems to be the difficult part according to the UAV guys. The UAV guys really didn't have much to say about that, other than that was "the hard part".

    Does the Kalman filter effectively filter out the vibrations from the gyro and the accelerometer?

    I've got this autopilot software running on a small industrial PLC which is pretty bullet proof, and ok for floating point math but at the time I really didn't think it was up to solving matrix calculations. However it is more powerful that I first thought. Perhaps I need to look at that again since you have seen some big benefits to that.

    I may move the autopilot software to a low power Atom CPU based system for the next revision next year so I can run autopilot and chart plotter software on the same PC. Right now I have a PC I use for the Chartplotter and the PLC that I use for the autopilot. Either that or try and run the autopilot on a Raspberry PI... but I can't seem to be able to buy one here yet! :-(

    For now I guess I will try tying the gyro into the PLC and see if I can make use of it.

    I looked at your webpage and I like the idea of your boat monitor with the wifi connection. My marina also has wifi but they switched to a pay per month plan after a year of free service. :-(

    I did a job a while ago for a customer where they wanted me to be able to connect to their offroad machines for remote diagnostics and I ended up using a Virgin mobile USB Cell phone modem at the equipment end plugged into their linux computer. Then I setup a remote desktop connection to their PC. I don't think it would be too difficult to use the same type of cell phone device to substitute for the wifi connection. There are data plans out there for those USB stick cell phone modems that are as cheap as $20 per month without a contract. If you have Ting cell phone service (highly recommended), then you can add a USB cell phone device for $6.00 per month and it shares data with your cell phone which is probably even cheaper. If you ping your boat every 15 minutes and ask if it is ok, you won't use much data at all. If it says NOK, then you can poll it for further info... I've never done a twitter interface, but you are making me think. :)

    Thanks for the insight.

    Dave
     
  6. breezetrees
    Joined: Nov 2011
    Posts: 5
    Likes: 0, Points: 1, Legacy Rep: 10
    Location: SF Bay

    breezetrees Junior Member

    I didn't code the Kalman filter, lucky for me it is integrated into the IMU sensor I'm using.

    I think if I was to blend compass and gyro, I'd use a complementary filter-- high pass filter on the gyro to eliminate drift, plus an integrator, and low-pass on the compass (although this is probably already there on most compasses). The specifications are in the frequency domain rather than statistical quantities, not sure if that is better or worse. First order filters are easy to code using difference operations.
     
  7. Joakim
    Joined: Apr 2004
    Posts: 892
    Likes: 52, Points: 28, Legacy Rep: 422
    Location: Finland

    Joakim Senior Member

    I don't quite get it. You already had a gyro and then you added an other one, which spoiled the autopilot. Clearly you didn't use the second gyro very well or it was a poor one.

    I think Raymarine uses the gyro ONLY for calculating more instant and stable compass heading. Just like your IMU compass. After adding gyro to Raymarine you get 5 or 10 Hz compass output and are allowed to use also "Response levels" 4-9 (without only 1-3 can be used).
     
  8. breezetrees
    Joined: Nov 2011
    Posts: 5
    Likes: 0, Points: 1, Legacy Rep: 10
    Location: SF Bay

    breezetrees Junior Member

    No, that's not it. The sensor I use will tell me heading and turn rate and other things from its combination of compass, gyros and accelerometers. It is a very good sensor, it just happened to be mounted so that it also measured the shaking caused by the engine when it was idling.

    If I use just heading error to steer, it is traditionally called proportional control, if I use heading error and turn rate, it's called proportional-derivative (PD) control. Add in the integral (over time) of the heading error and you get proportional-integral-derivative (PID) control.

    I originally used a PID control scheme. I stopped using the derivative term because the engine vibration was larger than the boat's motion so my rudder was compensating in the wrong way. Now I've just got PI control and it works fine. The derivative term in PID is usually there to help to damp oscillations, and I didn't have trouble with this so taking it out was fine. I could write out the equations I used if you want more info...


    I don't know what raymarine does, I think it would be difficult to tell if they have derivative feedback or not, do they say anywhere? It's cool that the update rate increases with the gyro.
     
  9. Joakim
    Joined: Apr 2004
    Posts: 892
    Likes: 52, Points: 28, Legacy Rep: 422
    Location: Finland

    Joakim Senior Member

    There are two different things to consider: how to measure and how to use the measurements. We are talking about different things.

    I think it is very important to get accurate and fast heading input to autopilot. To get that gyro sensor is very helpfull, since any compass will need damping in waves due to gimbal rocking. With gyro you can reduce damping. Your device with Kalman filter does that for you.

    When you have that, you can easily calculate yaw rate as well from heading. You don't need the direct gyro input.

    Then it is a totally different story how you use that accurate heading data for steering (P/PD/PID etc).

    If you don't have a gyro in your system at all, you need to use a lot of damping for heading (or sluggish response in your control). Which means the autopilot can't response to gusts or waves before the boat has already turned too much.
     
  10. Wessmore
    Joined: Sep 2012
    Posts: 1
    Likes: 0, Points: 0, Legacy Rep: 10
    Location: Denmark

    Wessmore New Member

    Hey !!!

    I used to use a Autohelm 1000 Microtiller Pilot but it stopped working. The control chip
    8049H is fried. But I know a little about coding and electronics so I try to develop my own
    tiller pilot using the mechanics from the brooken one. What I have done so far....

    1. To get the heading in degrees I am using a Android Smartphone.
    2. To transfer Heading, tilt and roll I use a program called Brmgps which transfer the
    information via WiFI to a laptop.
    3. I am using the Comport DTR and RTS - pins to control a relay H-Bridge for motorcontrol.
    4. S-Remote, an android app, for remote control via WiFi

    I am programming in Delphi Pascal and will be back when I have solved the algorithm problem...:)
     
  11. brianb00
    Joined: Sep 2012
    Posts: 24
    Likes: 1, Points: 0, Legacy Rep: 25
    Location: San Francisco

    brianb00 Junior Member

    DIY Autopilot

    Gentlemen,

    I have created an AP of my own design. It employs an embedded processor, several MEMS sensors, a pile of software, a hydraulic drive that is external and of my own design, drive electronics, and has been race proven in several solo races. The most recent crossing the Pacific plus the return (see Single Handed TransPac (sfbaysss.org), boat is Redsky .
    http://singlehandedtranspac.com/

    The attached photo shows the boat in a tight reach with AP in control, about 20 kts of wind, flat seas (always like to show the boat !).

    Here are two videos of the design in action during the tune up phase of the software:

    http://www.youtube.com/watch?v=J8hO2vA-ukw&list=UU85HCAreLiiJvgPwvDqdWLQ&index=2&feature=plcp

    http://www.youtube.com/watch?v=rmhvT0zX1Nw&list=UU85HCAreLiiJvgPwvDqdWLQ&index=4&feature=plcp

    Regards,
    Brian
    s/v RedSky
     

    Attached Files:

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

    Dave911 Junior Member

    Thanks for posting the videos. Why did you go hydraulic? I would be concerned about excessive power draw, oil leaks, etc. Is the tiller position sensor attached to the end of your tiller and the cylinder is back near the transom?

    What did you do to merge your gyro signal into your compass heading in your software?

    How does your autopilot do downwind in following seas?

    How do you control it? A simple pushbutton, set to current heading type interface? Or more elaborate.

    Do you have a wind direction sensor input also so you can sail to a wind angle?

    Is that sea state typical for SF bay in 14, gusting to 20 knot winds? That is not bad at all!

    I finally got two Raspberry Pis! Seems like it took them forever to arrive. They are impressive little computers. Could be a good autopilot platform as they consume very little power, yet they have a lot of features. I have not measured it but 3-5 watts is mentioned. The packaging is a little odd though. There are no provisions for mounting the board. The next rev apparently has some small screw holes. Still, for $35 it is a lot of bang for the buck and it runs the usual linux software and software tools. I downloaded the SD card image and wrote it to an 8 gig card and had the computer running linux about an hour after I got it. The GCC C compiler and Python are already part of the image. The power supply I am using is a old cell phone wall wart charger. There is a guy in the UK selling an 8 input Analog input board for it for about $20. It doesn't get much cheaper than that. What I don't know is how temperature tolerant they are.

    Dave
     
  13. Joakim
    Joined: Apr 2004
    Posts: 892
    Likes: 52, Points: 28, Legacy Rep: 422
    Location: Finland

    Joakim Senior Member

    If low power consumption is your goal, Raspberry Pi is not the best choice. I have made two data logging and target calculation boxes for the instruments in my boat. The first one was based on NSLU2, which is quite similar to Raspberry Pi in this use (it doesn't have any display driver). It took 2-3 W, but I wanted to have much smaller in order to have it running all the time. The next version was based on AVR XMega and it takes only about 2 mA with 64x128 graphical display and (dim) backlight on. That is 24 mW or 0.024 W! AVR XMega certainly has the capacity needed from autopilot control unit and it can be programmed with C (GCC), but it was easier to program NSLU2.
     
  14. brianb00
    Joined: Sep 2012
    Posts: 24
    Likes: 1, Points: 0, Legacy Rep: 25
    Location: San Francisco

    brianb00 Junior Member

    Autopilot DIY

    Hi, Please see answers below:

    What did you do to merge your gyro signal into your compass heading in your software?

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

    How does your autopilot do downwind in following seas?

    >> 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.

    How do you control it? A simple pushbutton, set to current heading type interface? Or more elaborate.

    >> 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.

    Do you have a wind direction sensor input also so you can sail to a wind angle?

    >> 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.

    Is that sea state typical for SF bay in 14, gusting to 20 knot winds? That is not bad at all!

    >> SF bay has all kinds of sea state. The video was shot near an upwind shore without much room for fetch. The AP was used in very large seas both to Hawaii and upon the solo return. It handled conditions very well.

    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.

    BTW Dave, do you sail a 911 or drive a 911, or both ?
    BB
     
    Last edited: Sep 24, 2012

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

    Dave911 Junior Member

    That is incredibly low power, I didn't know that they were that low! I think that 2-3 watts used by the RPI is ok since the actuator will also be running. Ease of programming is really important for this autopilot since changes are made on the boat while underway.

    I'm going to try and recompile the chartplotter software, OpenCPN, so it will run on the RPI also and if it does it acceptably, I am hoping that I can build the autopilot on the same platform and eliminate one box. We'll see.
     
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.