Build your own autopilot
Building your own autopilot including the hardware and software is a fun and rewarding project. I made the design and tutorial as simple as possible so that anyone can build it.
Minimal hardware
- ESP32 microcontroller - 4$
- Motor driver - 7$
- 5V power supply (usb) to the esp32- 2$
- Wires 2$
- An actuator driving your rudder
- Your phone or tablet
Recommended hardware
- Fuse
- A Box
Software
- Autopilot app for android or IOS
- Arduino IDE v2 https://docs.arduino.cc/software/ide/
- Autopilot code from Github
ESP32 Microcontroller
The ESP32 is a low-cost microcontroller with built-in wifi and bluetooth. It is perfect for this project because it is easy to program and has a lot of pins. The ESP32 can be programmed using the Arduino IDE. The ESP32 can be powered using a 5V power supply. The ESP32 can be connected to the motor driver using 4 pins. The ESP32 can be connected to your phone using wifi or bluetooth
The cheapest source is Aliexpress. https://aliexpress.com/item/1005004476867346.html. If you want the unit faster, you can buy it from a local supplier. The ESP32 is also available on Amazon and Ebay. I refer the USB C version with 30 pins because it is more durable.
Motor driver
A motor driver is something that translates the PWM signal from the ESP32 to a high switching current to control the motor direction and speed. For my projects I used the IBT-2 motor driver because of its availability, pricing and it supports motors up to 43Amps.You can use other motor drivers like the L298N or the L293D. The IBT-2 is available on Aliexpress. aliexpress.com/item/4000121484634.html. It can also be sourced locally or on amazon.
Wires
The wires to connect the ESP32 are called female to female jumper wires, or dupont female wires. you need 6 wires to connect the ESP32 to the motor driver but the package always comes with atleat 30 wires. The motor driver needs a direct supply from your boats battery. out comes to wires that have to be connected to your motor.Power supply
You can power the ESP32 by a USB cable or via the VIN pin on the ESP32. A good method is also to use a ESP32 expension board. This board converts 12volts to 5 volts and it provides you with an easier way to connect the wires. Make sure to buy an additonal DC plug to the expansion board. https://nl.aliexpress.com/item/1005004673048101.html
Actuator
You can either use your existing actuator if you have one, or buy a new one. The actuator is the motor that drives your rudder. You have 3 types of steering systems. A tiller, wheel or hydraulic.Tiller steering
You probably want to go with a linear actuator. or a fancy below deck solution. The linear actuator needs to have a stroke of 300mm, a speed of 50mm/s and a force of 200Newtons. It basically needs to be able to steer your boat from full left to right in 10 seconds. a good example is this one https://nl.aliexpress.com/item/1005004205595864.html
wheel steering
There are wheel drives available to be bought seperately from raymarine or second hand. the ST4000 wheel is a good example.
Hydraulic
You only need to install a hydraulic pump. I purchased the hy-pro 0.8 liter pump for 300 euro's. It is top quality. Make sure to size your pumps displacement to your hydraulic cilinder volume.
Phone or tablet
You can use any phone or tablet, as long as it has a compass. 95% of the phones have a compass, often called a magnetometer. Make sure to check if your phone has a compass. You can check this by downloading a compass app from the app store. The app should show you the direction you are facing. If it does, you are good to go. Look up your specs at gsmarena.com.
Wiring
Wiring The IBT-2 has 8 pins and we use 61 VCC --> +5Volts from ESP32
2 GND --> GND from ESP32
3 R_IS --> Not connected
4 L_IS --> Not connected
5 R_EN --> +5V from esp32
6 L_EN --> +5V from esp32
7 R_PWM --> GPIO 32 on ESP32
8 L_PWN --> GPIO 33 on ESP32
Software instalation
- Download the Arduino IDE v2 from https://docs.arduino.cc/software/ide/
- Install the ESP32 board in the Arduino IDE
- Download the autopilot code from Github
- Put all the files in a folder called autopilot_basic and then open the autopilot_basic.ino file in the Arduino IDE
- Connect the ESP32 to your computer using a USB cable
- Select the right board and port in the Arduino IDE
- Upload the code to the ESP32
- If it worked, you can now connect to the ESP32 using the autopilot app.