Project in progress
Tiller Pilot for Yacht

Tiller Pilot for Yacht © GPL3+

Project using Arduino to steer a full-size boat on a compass heading.

  • 1,603 views
  • 3 comments
  • 6 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
×1
LSM303 Compass Board
×1
Relay (generic)
Share To DC5V 2 Way 2CH Channel Relay Module
×1
Button
Provided with Arduino Starter Kit
×3
Mfr 25fbf52 221r sml
Resistor 221 ohm
Provided with Arduino Starter Kit
×1
4415447 jg5sklyzsj
Resistor 220 ohm
×1
12002 04
Breadboard (generic)
×1
11026 02
Jumper wires (generic)
×1

About this project

I sail a yacht that can be steered by an electronic device called a tiller pilot, which acts on the boats tiller.

The circuit board in my tiller pilot burned out, so I had to replace it. At about the same time my daughter bought me an Arduino Starter Kit.

I thought it would be easy to construct a new brains for my old tiller pilot.

It wasn't.

It has taken me over a year to get this far.

The tiller pilot has three buttons, i.e. port, ON/standby and starboard.

When the tiller pilot is powered up, the LED flashes indicating that the tiller pilot is in standby mode. Pressing either of the port and starboard buttons drives the boat in the desired direction. NO compass heading is maintained.

When the ON/standby button is pressed the LED stays ON continuously and the boat steers on the current course. Pressing either the port and starboard buttons changes the current couse by one degree, each time the button is pressed.

Pressing the ON/standby button again puts the unit back into standby mode.

Next, I will be looking at improving the accuracy of the unit by exploring proportional control.

Code

TillerPilot_V05Arduino
//TillerPilot 04/05/2019
//Buttons wired to A8 A9 and A10
//LED wired D5
//Relay wired from IN1 to A0 and IN2 to A1
//Compass SDA to A4 & SCL to A5
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_LSM303_U.h>
Adafruit_LSM303_Mag_Unified mag = Adafruit_LSM303_Mag_Unified(12345);
const int B_Port = 8;
const int B_Lock = 9;
const int B_Star = 10;
int Heading;
int Course;
int Val_01 = 0;
int Val_02 = 0;
int Tillerpilot_off = 0;
int B_State = 0;
int R_Port = A0;
int R_Star = A1;
int LED_Port = 13;
int LED_Lock = 5;
int LED_Star = 12;
void setup() 
{
Serial.begin(9600);
if(!mag.begin()) 
 {
 while(1); 
 }
  pinMode(B_Port, INPUT_PULLUP);
  pinMode(B_Lock, INPUT_PULLUP);
  pinMode(B_Star, INPUT_PULLUP);
  pinMode(LED_Port, OUTPUT);
  pinMode(LED_Lock, OUTPUT);
  pinMode(LED_Star, OUTPUT);
  pinMode(R_Port, OUTPUT);
  pinMode(R_Star, OUTPUT);
  digitalWrite(R_Port, HIGH);
  digitalWrite(R_Star, HIGH);
  digitalWrite(LED_Port, HIGH);
  digitalWrite(LED_Lock, HIGH);
  digitalWrite(LED_Star, HIGH);
}
void loop() 
{
//Tillerpilot in standby mode
Val_01 = digitalRead(B_Lock);
if(Val_01 == HIGH && Tillerpilot_off == LOW)
 {
 B_State = 1-B_State; // Debound Button
 delay(1);
 }    
Tillerpilot_off = Val_01;
if(B_State == HIGH)
  {
  //Flash ON/OFF Lock LED
  digitalWrite(LED_Lock, HIGH);
  delay(250);
  digitalWrite(LED_Lock, LOW);
  delay(250);
   {
   if (digitalRead(B_Port) == LOW)
   digitalWrite(R_Port, LOW);
   digitalWrite(LED_Port, HIGH);
   }
    {
    if (digitalRead(B_Star) == LOW)
    digitalWrite(R_Star, LOW);
    digitalWrite(LED_Star, HIGH);
    }
  delay (250);
  digitalWrite(R_Port, HIGH);
  digitalWrite(LED_Port, LOW);
  digitalWrite(R_Star, HIGH);
  digitalWrite(LED_Star, LOW);
  Val_02 = 0;
  }
else
  {
  //Tillerpilot in steering mode
  //Lock LED continuous ON
  digitalWrite(LED_Lock, HIGH);
  delay(1); 
  Serial.print("Course: ");Serial.print(Course);Serial.print("   ");
  sensors_event_t event; 
  mag.getEvent(&event);
  float Pi = 3.14159;
  int Heading = (atan2(event.magnetic.y,event.magnetic.x) * 180) / Pi;
   {
   if (Heading < 0)
   Heading = 360 + Heading;
   }
  Serial.print("Heading: "); Serial.println(Heading);
  if (Course +3 <= Heading)digitalWrite(R_Port, LOW); digitalWrite(LED_Port, HIGH);
  if (Course -3 >= Heading)digitalWrite(R_Star, LOW); digitalWrite(LED_Star, HIGH);
   {
   if (Val_02 == 0) 
   Course = Heading;  
   Val_02 = (Val_02 +1);
   }
    {
    if (digitalRead(B_Port) == LOW)
    Course = (Course - 1);
    }
     {
     if (Course < 0)
     Course = 360 + Course;
     }
    {
    if (Course > 360)
    Course = Course - 360;
    }
   {
   if (digitalRead(B_Star) == LOW)
   Course = (Course + 1);
   }
  delay (250);
  digitalWrite(R_Port, HIGH);
  digitalWrite(LED_Port, LOW);
  digitalWrite(R_Star, HIGH);
  digitalWrite(LED_Star, LOW);
  }
}

Custom parts and enclosures

Tiller Pilot Schematic
tillerpilot_3h1HSgIWGi.mp4

Schematics

Tiller Pilot Schematic
Tiller pilot schematic xcnvwqfhcw

Comments

Similar projects you might like

Arduino Bluetooth Robot for Android Device

Project showcase by aip06

  • 2,975 views
  • 2 comments
  • 15 respects

Smart Parking System

Project in progress by Md. Khairul Alam

  • 49,419 views
  • 37 comments
  • 117 respects

Turn On and Off LED by LDR (Toggle LDR)

Project showcase by muhammed amar slik

  • 32,529 views
  • 2 comments
  • 18 respects

Arduino 4WD RC Car

Project tutorial by Andriy Baranov

  • 18,859 views
  • 7 comments
  • 55 respects

How to Use Modbus with Arduino

Project tutorial by

  • 8,011 views
  • 3 comments
  • 17 respects

Healthcare Skin Pressure Detector

Project tutorial by David Escobar

  • 6,831 views
  • 3 comments
  • 20 respects
Add projectSign up / Login