Build your own autopilot
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
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.
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 via bluetooth with the autopilot app.
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.Hardware instalation
This part convers on how to connect the several components to the esp32. For convience, I use a ESP32 expansion board.
Wiring the IBT-2 motor driver
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
Compass (IMU)
The current compass supported is the ICM20948. This is a 9DOF compass with the best quality. It features a Accelerometer, Gyroscope and Magnetometer all in the X, Y and Z direction. I recommend the Pimoroni module. The chip itself (ICM20948) requires a 1.8V power supply and for its I2C communication it also uses 1.8V. So a DC-DC converter and logic level shifter is needed. The module made my Pimorini has this all integrated, just like the Sparkfun and Adafruit.
We do not need the int pin (interupt)
Wiring:
- VCC -> 3.3V on ESP32
- GND -> GND on ESP32
- SDA -> GPIO 21 on ESP32
- SCL -> GPIO 22 on ESP32
Wireless remote
For the wireless remote you need a receiver and a remote. I personally use a 433MHZ receiver and a 433 MHZ remote.
Make sure the receiver is 3.3Volts compatible
Wiring:
- VCC -> ESP32 3.3V
- GND -> ESP32 GND
- D0 or data -> GPIO 12
- 230821 > -1 degrees when AP=on, move motor manually
- 211124 > -10 degrees when AP=on, move motor manually
- 880810 > +1 degrees
- 190728 > +10 degrees