Self steer control

Hello.. This is my first post on this section. The project is based on Arduino MEGA 2560+Button+LSM303 Magnetometer+Accelerometer used to self-steer a small sailboat as aid in single handed sailing. I have to say first, that my skills in programming are out of date/order... (or both) Ok... The LSM303 is the source to get Magnetic North fixed and alignet in a sealed tiny box o top of the boat cabin door, free of magnetic influences. On POWER-ON, the LSM starts reading Heading (Angle measured between Mag. North and the Bow of the boat in CW direction) Once I steer manually to a desired Heading, by pressing a single button, I store the existing heading and simultaneously, start to compare the stored value (desired heading) with the following data from LSM303 (I call it "error" ). If the error increases (more than stored value) is a POSITIVE error( +XXX.X), if the error decreases (less tha stored value) is a NEGATIVE error (-XXX:X). As you probably noticed, if I convert the errors in two Pulsed With Modulated (PWM) signals, the bigger the error the faster will turn a DC motor driven by H-Bridge. But in the meantime less power waste and less current drained.. (and also less wear of mechanical parts).. On a second pushbutton action, system returns to the prevous state (manual steer), ready to store a new heading to steer an do the same. Before I proceed to the next step on the project and after reading how to use the +/- errors on PID´s , PWM´s, H-BRIDGES, DC motors etc, I would like to read your advice (if any..). I first consider to use a Proportional Integrate Derivative (PID) on the project using some feedback from output (electrical or mechanical) ... But. thinking about it, .. If the error´s drive the motor (and the boat tiller (LSM303 included) to steer opposite to the error)... The feedback to reduce the error using PID is not needed.. right?. Instead, the errors in self-steer mode could be used direcly in PWM signals to control the H-Bridge. Well.. I think you have a better idea of my project. I will appreciate any suggestions / ideas / corrections . Thanks in advance. PD.. As you also might noticed, my skills in english are critical... (native language is spanish)

PID control is pretty flexible:

I would advise starting with just a P term, proportional, and tune that to the highest value that's stable (too high and you'll oscillate).

If the behaviour is adequate for your vessel you should probably stop there, its simple and robust.

If you find its sluggish to respond, try setting the other parameters to non-zero and tuning them:

Then increase the I term (integral) to increase the accuracy (stability may suffer).

Then increase the D term to kill any instability.

You can then try small increases in P to the point of instability, upping D term to regain stability - a few iterations of this should speed up the systems response.

Then back off the P and I terms a little to reduce the risk in instability.

Thanks MarkT... I understang that you consider PID control necessary for the project. On my previous post I assumed that using directly the error values as INPUT to the PWM to control the boat steering, in the correct direction (sensor included) would be a way to avoid the PID usage. Thanks a lot..

But. thinking about it, .. If the error´s drive the motor (and the boat tiller (LSM303 included) to steer opposite to the error)... The feedback to reduce the error using PID is not needed.. right?.

What you are describing is PID, using only the P term, with a gain of magnitude 1.

The hard part of this project is the electromechanical part of the steering system (motor and controller, motor power supply, mechanical connection to tiller, etc.). In a couple of the medium-sized boats I've sailed, this was accomplished with a very simple belt drive to the helm wheel, which has the great advantage that the belt slips, so in an emergency, you just override the system by turning the wheel yourself. Connecting to a tiller directly manipulating the rudder angle would be more difficult and would likely get in the way of normal manual steering.

Get that working to your satisfaction first and the rest will be easy.

Great jremington!!!.. You´ve seen clearly what I´m trying to do.
Sure my poor english knowledge is a handicap.
You´re right… The feedbak in my project is the boat+sensor.
You probably have experienced at sea with tiller or wheel electric autopilots and know how noisy they are when they are installed on cockpit area.
I found on circuit diagrams of those autopilots that errors in heading simply drive the H-Bridge of Motor control WITHOUT any kind of Modulation.
Current peaks on H-Bridge/Motor sometimes go up to 15 Amps, for milliseconds on each turn (here´s the noise and wear).
In others words, it doesn´t matter if the error is +/5º or +/-10º… in all cases full DC power is used.
So… I guess that using the error to modulate the DC voltage applied, will reduce wear in mechanical parts (less noise), less current drain and, in turn, less battery waste.
How about define a code in Arduino tha converts +/- errors in PWM signals applied to H-Bridge??..
I pretend that errors greather than 10º on either CW/CCW sides of desired heading, will drive the motor at full RPM (constant HIGH output from PWM).
If errors get >10º, I wont care… since I know the motor is doing all possible to return to desired heading. In case on such errors, probably I choose the wrong day for sailing (or wrong seas),… Better disengage autopilot and return to manual steer.
The real “fashion” part of my project is about errors < 10º.
As error reduces with the "virtual LSM303&Boat PID" returnig to desired heading, the TWO PWM signals applied to H-Bridge&Motor will be from 100% HIHG to the minimun % that still move the motor, on either positive or negative errors. (PWM_A for CW and PWM for CCW).
That will generate a damping effect on autopilot steering.
Of course, before I engage autopilot a good sail trim is a “must”… Steering with sails trimed at existing wind sometimes need minimun steer corrections. That´s the time to engage autopilot!!!..

pacheco: I found on circuit diagrams of those autopilots that errors in heading simply drive the H-Bridge of Motor control WITHOUT any kind of Modulation. Current peaks on H-Bridge/Motor sometimes go up to 15 Amps, for milliseconds on each turn (here´s the noise and wear). In others words, it doesn´t matter if the error is +/5º or +/-10º.... in all cases full DC power is used.

From my experience of sailboats the load on the tiller/wheel can be very high even if only a small correction is needed. I think that's why the commercial devices use full power all the time - we're gonna move that sucker, or we're gonna break in the attempt.

I think if you want to use PWM to reduce the power to the motor you will need a position feedback system that will enable the power to be increased if the tiller/wheel is not moving. This is quite separate from boat direction feedback.

You want to move the rudder long before the direction error is so big that it gives rise to full power for the motor.

...R

Hi Robin2.. Thanks for the reply.. Of course, sometimes forces at tiller/wheel could increase. But such conditions, in most cases, are due to an impropper balance of forces (sail trim, wind changes, sea state changes,...), that need to be fixed before going to autopilot... Or if in autopilot mode swith bak to manual to fix the trouble. I always have my autopilot connected and in standby ready to use it if I need to go to the mast or inside the cabin... Normally, on my 31 feet sailboat, when sails are trimmed, the tiller goes so smooth that can be mooved with a finger. If I notice an abnormal force, a little adjust on mainsail or genoa shape is enough to return to a smooth and easy steering. I consider that each selected heading is a compilation of forces to achieve a single result: A rudder blade aligned with the boat. Any other angle (on my idea) will decrease boat speed. But... you´re probably right: I bought the Arduino just to play around with my favorit sport... At the end of this thread I hope all participants (me included), we know how to sail... instead of how to connect sensors and electronic stuff.... :D

pacheco: If I notice an abnormal force,

I think your autopilot will also need to be able to detect an abnormal force.

If you are good at sailing (I never was) you will, as you say, maintain a careful balance between sail settings and rudder angle. But when the autopilot is in control it cannot adjust the sails - hence the rudder forces can build quickly.

I went below to get a bar of chocolate on one occasion and when back on deck I sat/lay down looking over the stern. I eventually realized the boat (motoring in a flat calm) had turned 90 deg and was heading for a rocky shore. It took a while to figure out that when I went below my clothes accidentally switched off power to the autopilot. I subsequently moved the switch.

Now I have a canal boat.

...R

Hello …
I have been working with code below in order to find positive or negative errors from a stored
reading .
Every tme the button is used, error resets to “0”
further changes on Heading work correct except for readings around 360 degrees.
As shown in attached pic, the error turns “all the way around”
I think it is the calculation method in use. ¿Any ideas to work around this issue?

#include <Wire.h>
#include <LSM303.h> 

const int buttonPin = 2;                                         // Used to start comparations
int storedHeading;                                               // Desired course
int deltaHeading;                                                // +/- Difference (Course +/- Desired Course)
boolean buttonState;                                             // Initiates comparations
LSM303 compass;                                                  // Output from LSM303

void setup ()
{
  Serial.begin(9600);                                            // Initiates debuging serial COM
  Wire.begin();                                                  // Initiates I2C comunication
  compass.init();                                                // Initiates LSM303 
  compass.enableDefault();                                       // Enable dafault parameters on LSM303
  compass.m_min = (LSM303::vector<int16_t>){-361, -424, -268};   // Last parameter calibration readings made AUG-2014
  compass.m_max = (LSM303::vector<int16_t>){+371, +287, +378};   // Last parameter calibration readings made AUG-2014
}

void loop()
{ 
  compass.read();
  int heading = compass.heading();
  Serial.print("Heading: ");
  Serial.println(heading);
  int buttonState = digitalRead(buttonPin);
  if (buttonState == HIGH)
  {
    storedHeading = heading;
    Serial.print("Stored Heading: ");
    Serial.println(storedHeading);
  }
  deltaHeading = storedHeading - heading;                          /////////////////////////////////////////////
  if(abs(deltaHeading > 180))                                      //       errors when comparing data        //
  {                                                                //                 around                  //
    if(storedHeading < heading) deltaHeading = deltaHeading - 0;   //              360 degrees                //
    if(storedHeading > heading) deltaHeading = 360 + deltaHeading; //          ¿how to prevent that?          //
  }                                                                /////////////////////////////////////////////
  Serial.print("Error: ");
  Serial.println(deltaHeading);
  delay (1000);
}

Thanks in advance

deltaHeading_0.jpg

Just a word about P-term only control - which is what you have if just using the error to generate the PWM level.

The error will not fall to zero.

The error is needed to generate the driving force, so unless you are lucky and no force is needed the error will persist and the system will be off course.

The I-term is what cures this problem, since it allows the output drive to be at any required level while the error input is zero (or more exactly averages zero, as usually there is a little fluctuation).

However a system with just P and I terms is very likely to oscillate due to overshoot - thus the D-term is required to damp down oscillations.

To a human its effortless to steer a boat, but actually the way the brain handles such a control loop is very sophisticated, and far better than even a PID loop.

Just using proportional control is likely to be disappointing, but with a PID loop you get the option to start with just proportional control and play with the other terms to improve the behaviour (tune the system).

Thanks MarkT... I think I understand what you say about the way feed back need to be applied ... I have experienced the "sanake" path with all autopilots I have tried. Even with a windpilot I have, it´s impossible to follow a straight path. Sailing (or motoring) out there is kind of "try to follow the most accurate heading" but , there´s always an error to correct. On a previous replay, Robin2 says that I wil find strong forces to handle steering (I agree)... As a secondary but same project, I can find the project useful to move the vane on the wind pilot I have on board. The vane itself is weight balanced so, a light breeze turns the vane either side. The "swing" motor explained on Arduino forums could be enough... All is perfect with exception of sailing on a broad reach or even worst on running courses (all of them are winds coming from the stern) Windpilots fail to steer in those instances and is neccesary to find an "extra hand". First of all I need to test each case. Depending on which needs (tiller or wind vane), current needs are different. I bought an Arduino an a few electronic stuff to play with. I hace motors, servos, electronic parts and the most important tool... TIME . In the meantime I am trying to figure out how to write the right code to see the errors propperly on the sketch i posted before..

Finally, with the valuable help of experts on this forum I can get “deltaHeading” on my sketch. Now is time to determine which is the bes approach to use this data to steer the boat.
Will continue reading information and trying to go ahead on my best…

pacheco:
Hello …
I have been working with code below in order to find positive or negative errors from a stored
reading .
Every tme the button is used, error resets to “0”
further changes on Heading work correct except for readings around 360 degrees.
As shown in attached pic, the error turns “all the way around”
I think it is the calculation method in use. ¿Any ideas to work around this issue?

#include <Wire.h>

#include <LSM303.h>

const int buttonPin = 2;                                         // Used to start comparations
int storedHeading;                                               // Desired course
int deltaHeading;                                                // +/- Difference (Course +/- Desired Course)
boolean buttonState;                                             // Initiates comparations
LSM303 compass;                                                  // Output from LSM303

void setup ()
{
 Serial.begin(9600);                                            // Initiates debuging serial COM
 Wire.begin();                                                  // Initiates I2C comunication
 compass.init();                                                // Initiates LSM303
 compass.enableDefault();                                       // Enable dafault parameters on LSM303
 compass.m_min = (LSM303::vector<int16_t>){-361, -424, -268};   // Last parameter calibration readings made AUG-2014
 compass.m_max = (LSM303::vector<int16_t>){+371, +287, +378};   // Last parameter calibration readings made AUG-2014
}

void loop()
{
 compass.read();
 int heading = compass.heading();
 Serial.print("Heading: ");
 Serial.println(heading);
 int buttonState = digitalRead(buttonPin);
 if (buttonState == HIGH)
 {
   storedHeading = heading;
   Serial.print("Stored Heading: ");
   Serial.println(storedHeading);
 }
 deltaHeading = storedHeading - heading;                          /////////////////////////////////////////////
 if(abs(deltaHeading > 180))                                      //       errors when comparing data        //
 {                                                                //                 around                  //
   if(storedHeading < heading) deltaHeading = deltaHeading - 0;   //              360 degrees                //
   if(storedHeading > heading) deltaHeading = 360 + deltaHeading; //          ¿how to prevent that?          //
 }                                                                /////////////////////////////////////////////
 Serial.print("Error: ");
 Serial.println(deltaHeading);
 delay (1000);
}



Thanks in advance

Hi there

I’ve similar project going on with my fishing boat… I’m using cmps10 for compass and two-wire 12VDC linear actuator for turning… I had also similar issues with the north while I was trying to calculate ‘error’ over it… I had to ditch this kind of turning procedure by other reasons but before it I solved the math issue concerning North like this:

LockedBearing = Bearing;
DeltaBearing = Bearing - LockedBearing;

//The boat is going NE side (0-180) of the North but it should go NW side (180-360)..
if(Bearing < 180 && LockedBearing > 180) 
     DeltaBearing = 360 - LockedBearing + Bearing; //.. so negative turn is needed

//The boat is going NW side (180-360) of the North but it should go NE side (0-180)...
if(LockedBearing  < 180 && Bearing > 180)  
     DeltaBearing = (360 - Bearing + LockedBearing) * -1; //..so positive turn is needed

Only direction 180.0 degrees will give faulty result, but I thought that there are bigger issues involved if I’d like to aim some angle near North and 180.0 would be my Bearing… :slight_smile:

Thanks TommiP for the input. I got the answer thanks to an expert here http://forum.arduino.cc/index.php?topic=260411.msg1852045#msg1852045 It works great... I see you´re using a linear 12 VDC motor. I have a couple of defective tiller to work with this project. Basicaly, the idea is to convert the the errors (*/_ degrees from stored heading) into a pair of PWM signals to control an "H-Biridge". The PWM signals I need will be MAX PWM output any time the error goes +10º or -10º . This means to drive the motor at its max. speed above + or - 10º. If the error get´s smaller the frequency decreases an the motor slows down to reduce current drain and noisy gear. The problem seems to appear when the PWM control decreases frequency ---> reducing the force applied to the tiller. Of course, your solution (once the code generates the propper signals), is almost solved. With an H-Bridge you can move your linear motor both ways to steer. I plan to dig more on the PWM control using stepmotors or similar to "damp control" the steering. There are also linear servomotors with different sizes/precission/ an PRIZES.. :D I´ll keep this thread updated if I find something to work with...

pacheco: Thanks TommiP for the input. I got the answer thanks to an expert here http://forum.arduino.cc/index.php?topic=260411.msg1852045#msg1852045 It works great... I see you´re using a linear 12 VDC motor. I have a couple of defective tiller to work with this project. Basicaly, the idea is to convert the the errors (*/_ degrees from stored heading) into a pair of PWM signals to control an "H-Biridge". The PWM signals I need will be MAX PWM output any time the error goes +10º or -10º . This means to drive the motor at its max. speed above + or - 10º. If the error get´s smaller the frequency decreases an the motor slows down to reduce current drain and noisy gear. The problem seems to appear when the PWM control decreases frequency ---> reducing the force applied to the tiller. Of course, your solution (once the code generates the propper signals), is almost solved. With an H-Bridge you can move your linear motor both ways to steer. I plan to dig more on the PWM control using stepmotors or similar to "damp control" the steering. There are also linear servomotors with different sizes/precission/ an PRIZES.. :D I´ll keep this thread updated if I find something to work with...

You're welcome. It seems that you are bit further than I am. In this prototype I'm using two relays instead of H-bridge and I use'em to steer the actuator by changing the polarity. I haven't had a reason to adjust actuator speed yet so it will be run it always at full speed (~12mm/sec) and time to run is adjusted instead.

About the software, my first principle to steer was to use only error. When the error was for example >5 degrees, it turned the engine to correct it and when boat turned back and error reached 1-2 degrees on same side, it turned engine to the middle.. It didn't work because of two thing.. First problem was wiggeling.. It was hard to find correct angle for the engine. I had adjustable turning time in my program so I could adjust the amount of turning angle but if the angle was quite large, it started to wiggle 'cos slow turn speed back to the middle.. Other reason why it didn't work was caused by the wind.. Against the wind you have obviously drive with a little angle in the engine. First version of my autopilot turned engine to the middle after locked bearing was close enough desired bearing and second after that it had to turn it again 'cos the wind pushed bow.. So I ditch that idea.

Now I'm trying to use the method that 1Hz timer will check the bearing each second and compare it to the value 1 second ago and second before that.. So it will compare three bearing value each second and if they are smaller each another or greater each another, it will turn engine bit to the corrective direction.. Turning time (time which the engine is turned at the time) , delay between turns and react angle (how much bearing angle has to change each second to cause pilot to react) can be adjusted with switches any time. l'll think it should work and now it should find turn angle for the engine which will keep the course, at least long enough that I could troll the fish in.. :)

Main principle idea has been all the time, that pilot will keep the course well enough and prevent hard turns, mostly because of the wind and lack of focusing to steer because of the fish or something else what's going on. Now boat can easily make 180 degree turn in ten seconds, if I'm concentrating to do something else.. It doesn't look good in 6-7 fishing lines after the turn.. :/ I haven't got a possibility to test this version yet (except some emc tests) on the lake but I can't imagine a reason why I shouldn't work.. The engine can be turned small turns (turning time 200milliseconds at the time) and large turns (990ms), the frequency of turns could be high (every ~ 600ms) or low (every 6000ms) and also the angle to react could be 0.1-10 degrees / second.. I'm sure if the principle works, I will find correct values. Maybe in the future I will also try progressive way to steer, dependent of 'error'.. If I understood correctly, your pilot will steer kind of same but it will do it linear and mine will steer by step by step, right?

Hello Tommip…
The H-Bridge is commonly used on tiller pilots… Differences among them are the rated Amps., always high enough to support the first milliseconds due to the counter-electromotive force (EMF). At the end of this post you¨ll see a simple but powerfull H-Bridge i have test this one at sea and believe it supports the load without overheat.
Have to use alluminum heat-sinks for the MOSFET´s.
I thought on relays first but in my opinion relay contacts sometimes get soldered, so I went for the H-Bridge.
Autopilots, generally use what they call sensitivity. On your procedures to control your steering I see something similar to the sensitivity i mention.
They have a procedure to adjust this value alowing the user to set values from +/-1º to +/- 9º.
Notice that miniimun error is 1º (not 0)… Also, they recommend to set a value of +/-5º.for “normal” seas…
Let me tell you the way I see all af this:
Out there, in the real sea, when the autopilot detects the error to trigger the motor at a given speed (important this factor),the correction initiates a turn to compensate heading.
Due to the inertia to re-align the steering, when the motor stops before matching the heading , could be enough to reach (even going further…) the desired heading.
I´m trying to say that out there we´re always working with errors-over-errors. The “perfect sea” doesn´t exists , And if exists… sail boats can´t do nothing.
Nice to share your progress…

Sin título.png

Not surprised heatsinks needed, that H-bridge has shoot-through - its a bad circuit pulling very large current spikes direct from the supply to ground every time its switched (this can cause malfunction due to inducing voltages on other parts of the circuit, its not a happy state of affairs)

These days its rare for a MOSFET H-bridge to get even warm below 5A if properly designed (that's without heatsinking). Devices with a few milliohms on-resistance are cheap and plentiful.

pacheco:
Hello Tommip…
The H-Bridge is commonly used on tiller pilots… Differences among them are the rated Amps., always high enough to support the first milliseconds due to the counter-electromotive force (EMF). At the end of this post you¨ll see a simple but powerfull H-Bridge i have test this one at sea and believe it supports the load without overheat.
Have to use alluminum heat-sinks for the MOSFET´s.
I thought on relays first but in my opinion relay contacts sometimes get soldered, so I went for the H-Bridge.
Autopilots, generally use what they call sensitivity. On your procedures to control your steering I see something similar to the sensitivity i mention.
They have a procedure to adjust this value alowing the user to set values from +/-1º to +/- 9º.
Notice that miniimun error is 1º (not 0)… Also, they recommend to set a value of +/-5º.for “normal” seas…
Let me tell you the way I see all af this:
Out there, in the real sea, when the autopilot detects the error to trigger the motor at a given speed (important this factor),the correction initiates a turn to compensate heading.
Due to the inertia to re-align the steering, when the motor stops before matching the heading , could be enough to reach (even going further…) the desired heading.
I´m trying to say that out there we´re always working with errors-over-errors. The “perfect sea” doesn´t exists , And if exists… sail boats can´t do nothing.
Nice to share your progress…

Hi

Thanks for sharing information about’em H-bridges… :slight_smile: I had this relay board already “in stock” so I thought to use that… I know that 0.1 degree is way too accurate and also 1 to ~5 degree is too accurate to use in action but I just scaled it like that to have possibility to research how it will work if it’s too accurate… I’ve have a habit to learn things by doing them wrong first… :slight_smile: The resolution of CMPS10 compass bearing value is 0.1 degree from 16-bit register.

I know also that relays aren’t best way to do it and that there should be some PWM to control actuator because of the coil inductance which will try to resists changes in electric current passing through it and also because of mechanical issues you mentioned. Also some people keep thinking that relays are old-fashioned technology… I partly share that but still they are easy way to try to control electricity.

I’ve seen already seen some issues in 12VDC source voltage during running linear actuator but they have been still minors instead of major, so I haven’t done anything else yet than isolated my arduino directly from 12V. It’s now fed thru 12V - 5V DCDC converter http://www.ebay.com/itm/380794929775?_trksid=p2059210.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT, I had it already in my concept for LCD-displays and for the relay board. Arduino kept booting earlier but I haven’t tried it after isolation. After I’ve now learned some about H-bridges, I’ll change the relays into H in the future but I have to know first could this concept work… I’ll have to do some research is something like this http://www.ebay.com/itm/1pcs-L298N-Dual-H-Bridge-DC-Stepper-Motor-Drive-Controller-Board-Module-/351153728740?pt=LH_DefaultDomain_0&hash=item51c264ace4 adequate for my needs. I’ve build pcb’s by myself earlier but since I found ebay I had become bit lazybone… :slight_smile:

With engine power there could be “perfect sea” when there is no wind at all and for those conditions, Autopilot would be easier to build but with smaller boats “perfect” conditions could be ruined also by changing position in the boat. If I move myself away from the middle line of the boat, it will start to turn 'cos of pitch.

In attachment you’ll see the issue in source 12VDC I mentioned: green line is input 12VDC and blue line is I/O line which controls another of relays… That peek sometimes booted Arduino, sometimes it didn’t while Arduino was fed via dc power jack…

But now my curiosity woke up about H-bridge… Did I understood correctly, that you meant that with H-bridge the PWM-% should look like in my another attachment file, as principle (of course there should be hysteresis and also it should go all the way to the zero angle when returning from larger turning angles) ? When error grows, power for turn engine should grow (PWM pulse will wide), right ? I think there could be some difficulties with linear actuator 'cos there is worm gear and engine don’t center itself if power is turned off but instead it should be turning angle controlled like in that diagram… If bearing error angle grows, the engine turn angle grows… Am I even close what you meant?

Edit 8:07pm: It seems that isolation of Arduino’s source voltage helped with rebooting problem… I drove it for awhile in the boat (boat was on the trailer) and it worked well.

TommiP:

pacheco: Hello Tommip.. The H-Bridge is commonly used on tiller pilots.. Differences among them are the rated Amps., always high enough to support the first milliseconds due to the counter-electromotive force (EMF). At the end of this post you¨ll see a simple but powerfull H-Bridge i have test this one at sea and believe it supports the load without overheat. Have to use alluminum heat-sinks for the MOSFET´s. I thought on relays first but in my opinion relay contacts sometimes get soldered, so I went for the H-Bridge. Autopilots, generally use what they call sensitivity. On your procedures to control your steering I see something similar to the sensitivity i mention. They have a procedure to adjust this value alowing the user to set values from +/-1º to +/- 9º. Notice that miniimun error is 1º (not 0)... Also, they recommend to set a value of +/-5º.for "normal" seas... Let me tell you the way I see all af this: Out there, in the real sea, when the autopilot detects the error to trigger the motor at a given speed (important this factor),the correction initiates a turn to compensate heading. Due to the inertia to re-align the steering, when the motor stops before matching the heading , could be enough to reach (even going further..) the desired heading. I´m trying to say that out there we´re always working with errors-over-errors. The "perfect sea" doesn´t exists , And if exists... sail boats can´t do nothing. Nice to share your progress..

Hi

Thanks for sharing information about'em H-bridges.. :) I had this relay board already "in stock" so I thought to use that.. I know that 0.1 degree is way too accurate and also 1 to ~5 degree is too accurate to use in action but I just scaled it like that to have possibility to research how it will work if it's too accurate.. I've have a habit to learn things by doing them wrong first.. :) The resolution of CMPS10 compass bearing value is 0.1 degree from 16-bit register.

I know also that relays aren't best way to do it and that there should be some PWM to control actuator because of the coil inductance which will try to resists changes in electric current passing through it and also because of mechanical issues you mentioned. Also some people keep thinking that relays are old-fashioned technology.. I partly share that but still they are easy way to try to control electricity.

I've seen already seen some issues in 12VDC source voltage during running linear actuator but they have been still minors instead of major, so I haven't done anything else yet than isolated my arduino directly from 12V. It's now fed thru 12V - 5V DCDC converter http://www.ebay.com/itm/380794929775?_trksid=p2059210.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT, I had it already in my concept for LCD-displays and for the relay board. Arduino kept booting earlier but I haven't tried it after isolation. After I've now learned some about H-bridges, I'll change the relays into H in the future but I have to know first could this concept work.. I'll have to do some research is something like this http://www.ebay.com/itm/1pcs-L298N-Dual-H-Bridge-DC-Stepper-Motor-Drive-Controller-Board-Module-/351153728740?pt=LH_DefaultDomain_0&hash=item51c264ace4 adequate for my needs. I've build pcb's by myself earlier but since I found ebay I had become bit lazybone.. :)

With engine power there could be "perfect sea" when there is no wind at all and for those conditions, Autopilot would be easier to build but with smaller boats "perfect" conditions could be ruined also by changing position in the boat. If I move myself away from the middle line of the boat, it will start to turn 'cos of pitch.

In attachment you'll see the issue in source 12VDC I mentioned: green line is input 12VDC and blue line is I/O line which controls another of relays.. That peek sometimes booted Arduino, sometimes it didn't while Arduino was fed via dc power jack..

But now my curiosity woke up about H-bridge.. Did I understood correctly, that you meant that with H-bridge the PWM-% should look like in my another attachment file, as principle (of course there should be hysteresis and also it should go all the way to the zero angle when returning from larger turning angles) ? When error grows, power for turn engine should grow (PWM pulse will wide), right ? I think there could be some difficulties with linear actuator 'cos there is worm gear and engine don't center itself if power is turned off but instead it should be turning angle controlled like in that diagram.. If bearing error angle grows, the engine turn angle grows.. Am I even close what you meant?

Edit 8:07pm: It seems that isolation of Arduino's source voltage helped with rebooting problem.. I drove it for awhile in the boat (boat was on the trailer) and it worked well.

For your information, it didn't work. Boat wiggled and I couldn't found correct settings for adjustable values (steer frequency, steering time and point of react). This method wasn't accurate or fast enough to steer. I also think that you misunderstood one thing: I didn't try to react if bearing deviated 0.1 - 10 degree but this method was planned to react is the bearing value will change 0.1-10 degrees/second. I'm not sure did you misunderstood but I though you did. :) In next version I should get back to the first idea: compare Bearing to LockedBearing after and after H-Bridge has arrived, implement it to my system..