Skip to content

M5Stack Tough (ESP-32) Sailing Instruments Display and Autopilot Control

License

Notifications You must be signed in to change notification settings

bareboat-necessities/bbn-m5stack-tough

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

M5Stack Tough (ESP-32) Sailing Instruments Display and Autopilot Control

M5Stack Tough (ESP-32) Sailing Instruments Display and Autopilot Control Arduino sketches

With LVGL UI

Mostly oriented for boating projects (can be interesting to RV and off-grid living users, or Arduino and esp32 or other microcontroller enthusiasts and hobbyists)

Set up on a boat

  • Turn on your boat instruments
  • Boot your boat computer with SignalK. Make sure it is accessible on your local boat Wi-Fi.
  • Optionally: Turn on your Victron Cerbo GX or pi running Victron Venus OS if you have any of those. Make sure it is accessible on your local boat Wi-Fi.
  • Plugin m5stack tough into USB power and see it's booting into Wi-Fi settings screen.
  • Pick your local boat Wi-Fi in m5stack menu and enter password to connect your m5stack to your boat Wi-Fi (not to your marina's Wi-Fi). Use 2.4GHz WiFi bands, do not use 5GHz (it's not designed for IoT)
  • Reboot m5stack
  • Make sure that the devices m5stack is connecting to are set up with STATIC IP addresses
  • Optionally: For Vitron Cerbo you might need to edit ip address and port of your Victron MQTT server in m5stack connection settings. Make sure you set up MQTT broker on Cerbo side (passwordless and with no encryption)

M5Tough mount kit

Panel Frame for M5Core (SKU: A125)

https://shop.m5stack.com/products/panel-frame-for-m5core

Screenshots

https://github.com/bareboat-necessities/bbn-m5stack-tough/blob/main/screenshots/VIEW.md

Register M5Stack Board in Arduino IDE

Use (tested) Arduino IDE 1.8.x

  1. Add this URL https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json as additional in Arduino IDE board manager settings

  2. Install esp32 (by Espressif) board via Board Manager

  3. Pick 'M5Stack-Core2' as your board in IDE

  4. Set port (Something like /dev/ttyACM1 or so, you will find out by ls -ltr /dev/tty* after connecting your M5Tough device to USB)

Required Libraries

In Arduino IDE you need to install few libraries:

You can look at .github/workflows/build.yaml for specific versions this project was tested with

Checking out code

git clone https://github.com/bareboat-necessities/bbn-m5stack-tough/

Compiling and uploading code to the device

  • In Arduino open the bbn-m5stack-tough/bbn_m5tough_active_boat/bbn-m5stack-tough.ino file
  • Click 'Upload' icon (Looks like an arrow pointing right)
  • It will take a while to compile and upload the sketch. Compilation might give some warnings which can be ignored.
  • ESP32 device will reboot and ask you to choose a Wi-Fi network to connect to. Choose the one which has access to your boat LAN.

Implemented Interfaces:

  • SignalK (partially ✔️ )
  • NMEA 0183 (partially ✔️ )
  • NMEA 2000
  • PyPilot ( ✔️ )
  • MPD
  • NTP ( ✔️ )
  • MQTT (for Victron and others) ( ✔️ )
  • mDNS ( ✔️ )

Sleep

Deep sleep with waking up by touch screen. Backlight is off during sleep

Implemented Displays and Instruments:

  • Autopilot / PyPilot Remote Control Screen ✔️
  • IMU (compass and attitude) ✔️
  • Engine RPM, alternator voltage, oil temp display ✔️
  • Batteries Status, etc Display ✔️
  • Wind Display (Ground/(True?)/Apparent) ✔️
  • Drift and set, speed through water (knot meter) ✔️
  • Depth Display ✔️
  • Victron Data Display ✔️
  • Rudder Position, Rate of Turn Display ✔️
  • Heel (Clinometer) and Pitch ✔️
  • GPS Location, speed, heading (true/mag) ✔️
  • Compass Display (True/Magnetic), Magnetic Variation for the location ✔️
  • Clock Display ✔️
  • Trip data display, VMG ( ✔️ )
  • Local Sunset/Sunrise ✔️
  • Tanks levels display ✔️
  • Boat Design parameters ✔️
  • Smart Discovery of available services using mDNS and other ways ✔️
  • Brightness, screen orientation settings ✔️
  • WiFi set up, password on screen keyboard ✔️
  • Data providers IP addresses editors ✔️
  • Connections statuses ✔️
  • Reboot, reset, power off ✔️

Possible future ehnancements:

  • Lightning Detector with Screen (AS3935 sensor or better)
  • Engine fuel burn per nautical mile, etc display
  • Wind Rose from climatology data for current location and time Display
  • Barometer (+Temp Humidity) with History
  • Dangerous gases alarms
  • LoRa Tracker receiver and display
  • SignalK Alarms Display
  • Weather Display, Air/Water temp, pressure, humidity, air quality, illuminance, UV index, water salinity
  • Tides and Currents Display
  • AIS Display
  • Sailboat Polar Diagram Display
  • Anchor Alarm Set up and Display
  • Nav Lights and Digital Switching Control (ex: NMEA 2000 PGN 127501 "Binary Status Report" and PGN 127502 "Binary Switch Control")
  • Windlass remote control, chain counter display
  • Emergency steering Control by Autopilot
  • Bow Truster Remote Control
  • MOB Button
  • Music Player Controls (Spotify/Mopidy, etc)
  • Bilge Monitoring Screen
  • Wave Height, G-Forces Display based on: https://bareboat-necessities.github.io/my-bareboat/bareboat-math.html
  • Fog Alarm, Fog Signals (reminders)
  • AC/Fridge/Heater/Watermaker/Hot Water Tank monitoring
  • Fridge/AC thermostat control
  • Retrievable Keel Status
  • Alarm Clock / Timer / Stopwatch
  • Solar Panel/Generator (Wind/Prop/Diesel) Power Monitoring
  • Cabin, Deck, Search, Underwater lights controls, Fans, Blower controls, Solenoid status/control
  • Shrouds Load Forces Display from sensors
  • Hatches Status Display
  • Dinghy location (via LoRa and putting data into AIS stream)
  • Ship bell sound
  • Fish detected alarm (Do not know for sure how to implement that winner feature. It's possible though)
  • Weather forecast using location adjusted Zambretti algorithm, based on pressure and wind history, date time, and location.
  • Calculate mileage as integral of avg SOG
  • Predict open sea state based on tables from https://en.wikipedia.org/wiki/Wind_wave#Formation
  • Calculate dew point, air dencity. Detect fog conditions from pressure/temp/humidity
  • Long wave time signals decoding DCF77, HBG, ALS162, WWVB
  • BMS displays ex: https://github.com/wholybee/esp32-smartBMSdisplay
  • TimeZone from location
  • Power winches controls
  • Power furler controls
  • UI to control fog horn signal, and horn in general

Download binaries

Main branch:

https://github.com/bareboat-necessities/bbn-m5stack-tough/releases/tag/main

Using command line to upload firmware

Examples:

Linux:


python3 "~/.arduino15/packages/esp32/tools/esptool_py/4.5.1/esptool.py" \
 --chip esp32 --port "/dev/ttyACM0" --baud 921600  \
 --before default_reset --after hard_reset write_flash -z \
 --flash_mode dio --flash_freq 80m --flash_size 16MB \
 0x1000 "bbn_m5tough_active_boat.ino.bootloader.bin" \
 0x8000 "bbn_m5tough_active_boat.ino.partitions.bin" \
 0xe000 "~/.arduino15/packages/esp32/hardware/esp32/2.0.15/tools/partitions/boot_app0.bin" \
 0x10000 "bbn_m5tough_active_boat.ino.bin"

Windows:


<PATH>/esp32/tools/esptool_py/4.5.1/esptool.exe --chip esp32 --port COM5 --baud 921600 
 --before default_reset --after hard_reset write_flash -z 
 --flash_mode dio --flash_freq 80m --flash_size 16MB 
 0x1000 bbn_m5tough_active_boat.ino.bootloader.bin 
 0x8000 bbn_m5tough_active_boat.ino.partitions.bin 
 0xe000 <PATH>/esp32/hardware/esp32/2.0.15/tools/partitions/boot_app0.bin 
 0x10000 bbn_m5tough_active_boat.ino.bin 

Project Home

https://bareboat-necessities.github.io/

Related projects:

https://github.com/m5stack/M5Tough

https://github.com/JohnySeven/SensESPWatch

https://github.com/JohnySeven/TWatchSK

https://github.com/SignalK/SensESP

https://github.com/norbert-walter/esp32-nmea2000

https://github.com/hatlabs/SH-wg-firmware

https://github.com/hatlabs/SH-ESP32-nmea2000-gateway

https://github.com/andyrbarrow/SignalKM5StackInstrument

https://github.com/bareboat-necessities/my-bareboat/tree/master/m5-boat-display

https://github.com/andyrbarrow/MQTTNMEADisplay

https://github.com/bareboat-necessities/rust-modules/tree/main/lightning-detect

https://github.com/idreamsi/LoRa-GPS-Tracker

https://bareboat-necessities.github.io/my-bareboat/bareboat-math.html

https://github.com/BjarneBitscrambler/SignalK-Orientation

https://github.com/SensESP/ve.direct_mppt

https://github.com/SensESP/VEDirect

https://github.com/joelkoz/CommonSens/tree/main/signalk-smart-switch

https://github.com/arduino-libraries

https://github.com/mhaberler/SensESP-M5Stack

https://github.com/wellenvogel/esp32-nmea2000

https://github.com/AK-Homberger/NMEA2000WifiGateway-with-ESP32

https://github.com/AK-Homberger/NMEA2000-SignalK-Gateway

https://github.com/AK-Homberger/NMEA2000-AIS-Gateway

https://github.com/AK-Homberger/ESP32-Evo-Remote-Pilot-NMEA2000

https://github.com/AK-Homberger/NMEA2000-TempPressure

https://github.com/wholybee/esp32-smartBMSdisplay

https://github.com/ChrisLizon/VictronSOCLCD

https://github.com/jukolein/W132

https://github.com/RalfJL/VE.Direct2MQTT

https://github.com/humppafreak/SensESP-PeetBrosWind

https://github.com/sharandac/My-TTGO-Watch

https://github.com/spascual90/Fenix

https://github.com/KimBP/AIS/blob/master/Examples/AISDecode/AISDecode.ino

https://github.com/skpang/Teensy40_800x400_LCD50_LVGL_NMEA2000_mfd

https://github.com/bareboat-necessities/bbn-nmea200-m5atom

https://github.com/speters/ClipperDuet2N2k

TackTick Micronet to NMEA DIY https://github.com/Rodemfr/MicronetToNMEA

Seatalk (arduino mega). esp32 doesn't support 9-bit UART required for Seatalk1 https://github.com/yOyOeK1/seatalk4

Script that reads 9-bits seatalk 1 messages from any GPIO port using bitbanging, and converts it into NMEA0183 messages https://github.com/marcobergman/seatalk_convert

LoRa anchor alarm https://github.com/factoidforrest/anchor-alarm-lora

SeaTalk Autopilot Control https://github.com/nauti-control/STWirelessRemote

https://github.com/Glinnes/NMEAParser

https://github.com/norbert-walter/esp32-nmea2000-obp60

https://github.com/rob42/FreeboardMega/tree/signal_k_dev

https://github.com/pypilot/pypilot_mfd

https://github.com/htool/ESP32_Precision-9_compass_CMPS14