PDA

View Full Version : BS2 Autopilot



Microyacht
02-08-2010, 01:50 AM
I want to build an Autopilot for a small boat based on the BS2 module.

The basic components:

Basic Stamp BS2 (Because I already have one)
Hitec HS-805BB Giant Servo
Parallax HMC-6352 Fluxgate compass
Analogue 2-D Joystick
Some sort of keyboard for direction entry 0º to 360º

Requirements: I'm heading 270º. I want to get some sleep and stay somewhere near to on course. I enter heading on keypad. If wind or wave pushes me of course, BS2 outputs PWM to servo to move mini-rudder. Boat now back on 270º. If I touch the joystick, any heading entered is cancelled and I can steer manually by joystick or main rudder by tiller!

The servo is connected to a secondary mini-rudder, not the main rudder.

I do have a gps but it's normally attached to my Asus Eee PC. I can't actually see the need for one connected to the Autopilot but I guess if it could be useful then an I/P could be provided or something like the Parallax PMB-248 be included.

I have no difficulty assembling the unit but the software will be another matter!

Steve Carey

Let's Go!
02-08-2010, 02:50 AM
FYI, for a long distance a heading of 270 at sea can take you to land as the wind and waves and current will move your boat sideways. To get to point b from point a, you need a gps to offset this. Yacht autopilots use gps and continue to head to point b, regardless of their actual position.

good luck

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The smarter I get, the more I understand I don't know!

Microyacht
02-08-2010, 05:12 AM
Many thanks for your comments. I agree with all you say. I am a fairly experienced yachtsman but this is a special project involving a tiny boat. When I say like 270º, tht would be the current "tack" for the night or at least for the next few hours or so and taken from information from my nav program taking into account wave and wind etc. When I sleep, I would not be able to set a new course because I would not be able to re-trim the sails for the new conditions, so under those circumstances, I'm treating the craft more like a power boat. Life on a sailboat is made up of "tacks" and if I can sleep knowing that I'm still heading somewhere in the right direction. Sideways drift (leeward) which will show up on my GPS would be corrected in the next tack taking that into account. It would take many thousands of zig-zags for anyone to sail around the world.

I will also build-in a series of alarms so when the Autopilot is unable to stay on course, significant change in wind direction, significant drop in boat speed etc . . . . . . . but with a big O F F switch, sometimes you just need to sleep and sort out the route tomorrow!

If I were to add GPS, apparent wind direction and wind speed, boat speed (obtainable from the GPS) and then add an output to a motorized sail-winch, just like on Radio Controlled Sailboats but bigger, then the boat would sail herself but that's beyond the scope of this project. The total current for BS2 + fluxgate + Keyboard etc should be no more than about 10mA or so from a 6V NiMH pack. The servo draws up to 800mA when it's running and only 8mA at idle. Have no idea what the average current will be at this stage but the only source for re-charging the batteries will be a small solar panel!

Most commercially made tiller pilots use a fluxgate compass but no GPS. Larger units for larger boats (40ft+) have an input (NMEA) for connecting a GPS.

Steve

Simrad-Navico TP10 Tiller-Pilot:

Post Edited (Microyacht) : 2/8/2010 4:51:32 PM GMT

Jonathan
02-09-2010, 12:18 AM
Steve,

What size boat? I've done some mucking about in small boats, I used to solo sail my 23' boat Chula down to Santa Cruz and So. Cal from the SF Bay Area. She was a gaff rigged, lapstraked with Port Orford cedar, double ended sloop. Lovely little boat, and tough as a brick s**thouse.

Anyway, what you outlined seems reasonable. One thing I wonder is will the mini rudder have enough strength to bring her into the wind if need be? 800mA doesn't seem like much power to wrestle with a rudder.·What about a gyro to sense heel to feather up into the wind with gusts and wind veers? I only ever used a weather-vane type of autopilot, not the·Iron Mike variety, and they automatically head into the wind.

Keep us informed on the project, it sounds like a very cool one!

Jonathan

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info (http://www.madlabs.info) - Home of the Hydrogen Fuel Cell Robot

Microyacht
02-09-2010, 01:20 AM
Hi Jonathon,

Oh dear, the boat is very small, so small I hate to tell you! Well, I've built/sailed larger radio controlled boats. It's only 8ft LOA!

The servo has torque of 350oz.in at 6V (approx 24kg/cm).

The boat won't sail any closer than 45º into the wind. If things change that much in the night (as they do!), then I'd have to completely re-set the sails on a different tack. So no need to take the power of the servo to sail through the wind.

While out cycling in the snow, I had a brainwave. No need for a keypad . . .

A: So I'm sailing on a heading and want to lock the autopilot on that course.
B: The Fluxgate compass knows the heading and is inputting it to the BS2.
C: Press a "Lock" or "Set" button which stores the heading IE 340º
D: Boat goes off course and i/p from Fluxgate is no longer 340º
E: BS2 turns Servo to correct course until Fluxgate and stored figure agree!

I see that our Parallax agent in the UK, Millford Electronics only keep the HM55B Fluxgate Compass PCB and not the HMC6352. I see that the $ price is the same for both units. I wonder if one is more accurate than the other and what major differences there are if any?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Bye for now

Steve/G4MJW
www.microyacht.com (http://www.microyacht.com)
www.aroundinten.com (http://www.aroundinten.com)
www.withamweather.co.uk (http://www.withamweather.co.uk)

Post Edited (Microyacht) : 2/8/2010 5:37:28 PM GMT

Scott4
02-09-2010, 05:06 AM
Hi Steve,

This circuit may be a bit of over-kill for your application but I thought I would pass it along.

In my application I push down on the joystick's·momentary contact·switch.·(Gravitech "Joythumb") The output·is sent to·a Sharp voltage regulator (with a pin for on-off)·to turn power on. If you press it again you toggle the flip-flop and turn the power off.

If, after you turn the power on, you program the Basic Stamp to take the "Disable Power Toggle" high, then the pushbutton on the joystick can be used for "enter" without turning the power back off. This also has the nice feature of latching the button push until your program·gets back to check for it. -Scott

Microyacht
02-09-2010, 08:57 PM
Hi Scott . . . that has got to be the biggest overkill for my application. Brilliant bit of circuitry, I even have most of the components including a optical-isolator array! Actually I was thinking of not fitting an on/off switch. According to the data-sheets, the fluxgate compass draws about 3mA and not much more for the BS2. I won't be sinking anything sort of current from the BS2, the only external device being the servo. I'll probably also loose the joystick unless I can find one that is or can be waterproofed easily.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Bye for now

Steve/G4MJW
www.microyacht.com (http://www.microyacht.com)
www.aroundinten.com (http://www.aroundinten.com)
www.withamweather.co.uk (http://www.withamweather.co.uk)

n55w131
02-11-2010, 05:52 AM
Hi Scott,

Hey, im working on a similar project, not a sailboat, but a RC helicopter...

I don't have the fluxgate compass, im am using outputs from a futaba gyro, however our concept is the same. Perhaps I can help with the software for you app. As far as wind and water currents are concerned, it is true that a gps would solve this issue but I agree that it may be overkill for your project. The condidtion you refer to is called cross track, and if you are a sailor you know that this is real common in basic auto-pilots, and cross track error, however it can be somewhat over come. I suggest keeping it simple for now, get a working model going and then you can add to it later :)

I don't have the spec sheet for the fluxgate, so I may need that so I can help with inputs. The inputs from the fluxg are important as you need to calculate and adjust for a dead zone, else the logic will constantly hunt, and wear down your battery, and wear out the servo. I have quite a few servo's and each has its own range so we will need to work on the outputs as well. As far as input are concerned, a keyboard might be quite a bit for your app, there may be an simpler way to input course changes, such as a switch array, or other type, more on that later.

Please let me know how far along you are? and if you still need some help..

Cheers...

erco
02-11-2010, 06:27 AM
Steve:

Cool project, hope you get it working fine so you can get some sleep out there! If you find that your servo is underpowered, you might sleep easier if you·upgrade to one of these monsters: http://www.servocity.com/html/spg785_pan.html

best,

erco

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."

Microyacht
02-11-2010, 06:54 AM
. . . I love those Servo City conversion kits, been looking at them for some time. Using a Hitec 805 with a 5:1 reduction could steer the boat on it's main rudder, let alone a narrower blade. A little experimentation here once I get it together. The price of those units imported here in the UK is near on double! (+ freight + Import duty + VAT). I also have a linear actuator which is a "brand New" spare part for a Navico 1000 Tiller Pilot, suitable for yachts u to 30ft. Looks a bit like a Satellite Dish positioner. Will use at last resort but really want to make a very compact unit for a very small boat.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Bye for now

Steve/G4MJW
www.microyacht.com (http://www.microyacht.com)
www.aroundinten.com (http://www.aroundinten.com)
www.withamweather.co.uk (http://www.withamweather.co.uk)

n55w131
02-11-2010, 07:01 AM
Hiya Scott,

A couple things to consider, I realized now that you may not want to input actual headings, which will make for simplified programming, and therefore what you are seeking is basically the same as my heading lock gyro. I looked for the data sheet on your fuxg and I have the one on the HMC6352. You need to make sure there is some way to physically disconnect the servo from the rudder when it does not have control. Servo's can drive just fine, but if the rudder tries to drive the servo, the fragile gears may strip. A simple on/off (Heading lock / Un-lock) switch is what I see for control (for now). The fluxg will be sending data to the Bs2 and we need to find out how much of a range is being introduced due to sea state. If you are familiar with auto-pilots you know there is an adjustment for this, when its calm you can make the auto-pilot more sensative to fluxg changes and the boat will track closer to the target heading, the oposite is true for rough condidtions to prevent excessive hunting. You could solve this with a simple pot to adjust "Sea-State" or sensitivity. As far as the calibration of the fluxg and acutal headings are concerned, we can actually eliminate that if all you seek is a heading lock. Basically we don't care what heading the fluxg actually see's, all we care is that it tracks the reading registered when we turn on heading lock. So as far as connections go, you have the fluxg, the servo, an overall on/off power switch, a pot (10k will work) for sensitivity, and a toggle switch for heading lock on/off. The only other thing you may consider is a pizeo buzzer or alarm we can set to altert you of a cross track error condition, such as the boat going way off course, or if the servo/rudder is unable to track withing a desired amount..

Just some thoughts.. Cheers.

Microyacht
02-11-2010, 07:31 AM
.
n55w131 said...
[As far as the calibration of the fluxgate and acutal headings are concerned, we can actually eliminate that if all you seek is a heading lock. Basically we don't care what heading the fluxg actually see's, all we care is that it tracks the reading registered when we turn on heading lock]

This is the very point. The actual fluxgate heading is immaterial but as it's the direction I'm traveling in just prior to hitting the "Set" button, I know it's the direction I wish to continue on while I'm asleep. I have no idea at the moment how much leeway needs to be allowed for (Dead band) but the idea of a pot is even better than my idea of connecting a laptop and modifying the program to suit the sea state. A pot that will adjust from a minimum of say 1-2º up to a max of 20º maybe. Won't know until I try it. The boat is not very dimensionally stable, it could rock continually as much as 10º either side of it's heading.

Yes, this is a fun project . . . . amazingly few components required, although I've now just added a Linear pot! Piezzo buzzer alarm a must . . . but then I thought of a few different reasons for it going off.

Boat is at zero speed, too far off course for AP to correct it, boat is healing too much danger of capsize! I had thought of an LCD display but want to keep it really simple. Either just a single-state alarm for any problem or like a single bleep every 5 seconds for one alarm, double bleep for another problem etc. As I read Morse code, error message could be sent this way. With 16+ IO lines, I have plenty to play with. As it stand, used very few:

2 for the Fluxgate Compass

1 for the Set or STORE button

1 for the Pot

1 for the servo O/P

Mmmmmmmm . . . I do have a BS1 somewhere!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Bye for now

Steve/G4MJW
www.microyacht.com (http://www.microyacht.com)
www.aroundinten.com (http://www.aroundinten.com)
www.withamweather.co.uk (http://www.withamweather.co.uk)

Post Edited (Microyacht) : 2/10/2010 11:38:49 PM GMT

n55w131
02-11-2010, 08:33 AM
Ok, sounds like we have a plan,

Just need an update on what you have started already for hardware, such as a breadboard, the carrier, a stamps-in-class board, components, etc.

Next step is to set it up on benchtop, get everything jumpered in, then we start doing some programming.

Question, the code can be short (complex) or a bit longer for ease of understanding, ie adding comments, using longhand vs. short. I think this depends on your interest in how the code will actually work so you learn as we go and tweak it to work to your perfection :)

Cheers..

n55w131
02-11-2010, 09:17 AM
Ok,

Software wise should be broken down into the following sections:

Setup/Enable/Reset section:

Actual Runtime:

1) Input - Toggle switch (True - False) VAR lable as hlstat (Heading Lock Status)
2) Input - Fluxgate Compass (Heading Variable) lable as head (Comapss Heading) lable as hstat (Compass Status) ? I show 3 pins in the 55 (Clock/Enable/Compass)
3) Input - Potentiometer (Position Variable) lable as seapot (Used to condition/buffer the servo output and set dead band) Will need to decide resolution
3) Output - Servo (Pulses to position) lable as servo (Servo Output Value) command PULSOUT
4) Output - Pizeo (Alarm sound) label as freq (Frequency Output for Speaker) command FREQOUT

Just some thoughts. I have to get my breadboard setup to this config. :)

erco
02-11-2010, 01:35 PM
Steve: Check this thread in robotics on making a stronger servo:
http://forums.parallax.com/showthread.php?p=880514

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."

W9GFO
02-12-2010, 01:14 AM
I think that it would be better to focus efforts on making the vessel capable of self trimming. I predict many problems if you rely on an "active" rudder. With such a short, broad and flat hull it will yaw very quickly. That, combined with slow headway means the sails will have the greater influence on heading.

Since you are building the boat yourself, (I think) I would urge you to choose/design a rig that does not require an auto pilot.

My last sailboat was a gaff rigged yawl, I was able to trim on any point of sail, including straight downwind, and sleep well through the night while underway.

If a boat needs an assistive device, it must be handicapped!

Rich H

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Simple Servo Tester, a kit from Gadget Gangster. (http://www.gadgetgangster.com/206)

n55w131
02-12-2010, 02:29 AM
W9GFO said...
I think that it would be better to focus efforts on making the vessel capable of self trimming. I predict many problems if you rely on an "active" rudder. With such a short, broad and flat hull it will yaw very quickly. That, combined with slow headway means the sails will have the greater influence on heading.

Since you are building the boat yourself, (I think) I would urge you to choose/design a rig that does not require an auto pilot.

My last sailboat was a gaff rigged yawl, I was able to trim on any point of sail, including straight downwind, and sleep well through the night while underway.

If a boat needs an assistive device, it must be handicapped!

Rich H


Thanks Rich, You make leaning about how to make the basic stamp work real exciting...

If a guy wants to make a flusher for his porta-potty with a basic stamp to learn how it works, More power to him!... What we need is constructive criticism, please refrain from anything else, or create your own negative thread.

Cheers.

Jonathan
02-12-2010, 05:15 AM
One point I'd make is that it will be harder to make a small sloop self trim than a larger gaff rigged yawl. Because the mizzen is forward (<< EDIT, read AFT)·of the rudder post on a yawl, and the low aspect of a gaff rig, it is arguably the easiest type of rig to make self trim. I love the yawl rig, along with it's sister, the schooner.

Still, I agree about making the vessel self steer as well as possible. If nothing else it will make autopilot work less hard.

On the gaff rigged sloop mentioned above simply lashing the tiller with a bungie provided reasonable self steering. The bungie was adjusted with a jam cleat. It wasn't great, but you could catch enough sleep that way to get by, unless conditions were variable, then it required much more work.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.madlabs.info (http://www.madlabs.info) - Home of the Hydrogen Fuel Cell Robot

Post Edited (Jonathan) : 2/11/2010 9:23:05 PM GMT

W9GFO
02-12-2010, 10:34 AM
n55w131 said...
What we need is constructive criticism, please refrain from anything else, or create your own negative thread.


Well, I sure did not intend to offend anyone. Sorry that you feel that way. There are not that many things in life where I can claim experience so when one does come up, I say what I think. It is my impression that this forum generally welcomes (or at least tolerates) differing opinions, even when that opinion is not in favor of the ideas presented in the topic. And it's not like I am against using a BS2 for an autopilot, I have built one myself for an aircraft and it worked very well.

The OP is in search of a way to steer his vessel - I recommend using the sails, not a BS2. Choose a rig that lends itself well to self trimming rather than solving the problem with electronics. Doesn't that pass for constructive criticism?

@ Jonathan, that's why I chose the yawl. Many times I crossed the San Francisco bay under jib and mizzen sipping hot cocoa with the tiller pointing skyward (it was hinged so that it could be moved out of the way) while watching the crews of the plastic boats scurrying about and getting drenched with spray. Yeah, they got there a little faster but I was warm and dry, and quite content. Occasionally I would use a bungee but generally I didn't want to have anything to do with the tiller.

Rich H

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Simple Servo Tester, a kit from Gadget Gangster. (http://www.gadgetgangster.com/206)

n55w131
02-19-2010, 02:14 AM
Well, I sure did not intend to offend anyone. Sorry that you feel that way. There are not that many things in life where I can claim experience so when one does come up, I say what I think. It is my impression that this forum generally welcomes (or at least tolerates) differing opinions, even when that opinion is not in favor of the ideas presented in the topic. And it's not like I am against using a BS2 for an autopilot, I have built one myself for an aircraft and it worked very well.

The OP is in search of a way to steer his vessel - I recommend using the sails, not a BS2. Choose a rig that lends itself well to self trimming rather than solving the problem with electronics. Doesn't that pass for constructive criticism?

@ Jonathan, that's why I chose the yawl. Many times I crossed the San Francisco bay under jib and mizzen sipping hot cocoa with the tiller pointing skyward (it was hinged so that it could be moved out of the way) while watching the crews of the plastic boats scurrying about and getting drenched with spray. Yeah, they got there a little faster but I was warm and dry, and quite content. Occasionally I would use a bungee but generally I didn't want to have anything to do with the tiller.

Rich H



Rich,

Sorry, You are correct this is an open forum.

As far as a better way, yes I can name several better ways to steer this or any vessle, be it Aircraft, Boat, Car, or anything. My point was, the OP asked for help for constructing a BS2 application of HIS choice. Its not·my place to suggest to·him there are 1001 better ways to do this, which·we all know. Rather than·deter him from constructing a device, I offerd help with his request, and I think thats what we were looking for. Had he said "I am trying to steer my sailboat with a BS2, is there a better solution?" Well that would be a totally differnt issue, and I·would then understand all the·ssuggestions to not use the BS2.

Cheers·

Microyacht
03-12-2010, 04:46 AM
Greetings. Sorry I have been away helping my son move home, shop, studio, everything. What he never said was that we had to build a new studio at the new location! He's an artist for Games Workshop!

The boat design, features and equipment has been the subject to discussion on a few forums over the past 3 years or so. It is a tiny microyacht designed for the Around in Ten (10ft) race around the world. There is NO mizzen in fact like most similar small designs, has only a single sail. Although she is short and fat, her dimensional stability is good. With a balance lug sail, she will steer straight . . . . in calm water. I have used Navico and Autohelm Tiller-pilots (Autopilots) on other craft and know from past experiences they should work well on Microyacht. However, I want to make as much as possible myself. The boat, the mast, the sail - stitched on my own sewing machine. It certainly helps to know how it is made when something goes wrong and more chance of repairing it.

That said, I already have a BS-2 left over from my days as a lighting designer and making automated searchlights for use at outside events. I also have the large servo which for now I will take as being suitable. I need to get the Fluxgate Compass be need guidance here as there seems to be a choice of two. I plan on making a self contained unit together with five 1.2V NiMH 2,500mA/H cells and a small solar panel for charging. The solar panel would be exposed to daylight (and hopefully the SUN) from sunrise to sunset. The unit is only drawing any sort of current when the servo motor is actually running. What sort of duty cycle that will represent has yet to be discovered. An alternative 6V i/p derived from the "ship's" 12V supply is a possibility as is a second set of internal batteries.

My revised layout is attached.

If I'd not done enough house building work, I'm having to re-paint my own bathroom (Wife's orders) but once done can spend some time working on the actual construction of the unit.

Help with code, very much appreciated.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Bye for now

Steve/G4MJW
www.microyacht.com (http://www.microyacht.com)
www.aroundinten.com (http://www.aroundinten.com)
www.withamweather.co.uk (http://www.withamweather.co.uk)