Skip to content

ehedman/sdlSpeedometer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

182 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sdlSpeedometer

README Mars-2026

The sdlSpeedometer application is a marine instruemnt solution that features electronic instrument displays, typically used on private sailing yachts. The look and feel of the visualized instruments tries to mimic the look of real physical instruments and will by design have less of a digital look.

This application is based on the Rasperry Pi and the Simple DirectMedia Layer - SDL

Used systems re Raspberry Pi 4B/5 with OS bookworm/trixie.

As of February 2026 the Xorg environment is deprecated in favor of a weston kiosk environment i.e. a wayland solution with xwayland=true.

The instruments can be accessed one-by-one by a mouse click or directly from the touch screen menu.

The communication mechanism between this application with its GUI and data sources uses two paralell paths:

  • Data collected from a BerryGPS-IMUv2 - GPS and 10DOF sensor for The Raspberry Pi - Accelerometer, Gyroscope, Magnetometer and Barometric/Altitude Sensor.
  • Alternatively data from an NMEA-0183 network server data from an NMEA-0183 network server such as the open source kplex application to drive other instrument from the yacht's network.
  • Alternatively data from an NMEA-2K (SeatalkNG) to an NMEA-0183 USB dongle.

This instrument can work independently and always provide compass, heading, position, speed and roll even if all power fails on the yacht, if it has its own battery backup.

Currently there are nine virtual instrument working (data source within brackets):

Compass       : With heading and roll (BerryGPS-IMUv2) and/or heading from NMEA-net
GPS           : Lo, Lat and Heading (BerryGPS-IMUv2) and/or heading from NMEA-net
Log           : SOW, SOG (NMEA-net)
Wind          : Real, Relative and speed (NMEA-net)
Depth         : With low water warning and water temp (NMEA-net)
Environment   : Page with Voltage, Current, Temp and Power plotting (proprietary NMEA net "$P" sentences)
Water         : Page with fresh water tank status and TDS quality (Requires https://github.com/ehedman/flowSensor)
Victron Venus : Victron Venus sub-system (Requires https://github.com/ehedman/victron-venus-container)

There is also a page to perform compass calibration includning on-line fetch of declination values from NOAA

External Applications

sdlSpeedometer in itself is a very responsive application runing in an embedded system context with SDL2. However, sdlSpeedometer can be parametized to launch almost any external application by means of a configuration tool invoked from the GUI or from a shell. Run sdlSpeedometer-config to add XyGrip and/or Opencpn.

Kodi can be added as an external application to be used as a Jukebox style player togheter with its Kore remote control phone app.

sdlSpeedometer has also a built-in RFB (VNC) server function so that an external VNC client can connect a slave instrument on a computer and/or a tablet with a VNC client.

Tested runtime environment

  • Note this this is mainly an EMBEDDED solution based on the Lite versions of the Pi OS and is not suitable for installation in a desktop environment but running the stand alone binary for testing purposes is doable.
  • Raspberry Pi 3B+/5 and 4B and a 7 inch touch display.
  • NMEA Network Server (kplex) to feed the yacht's set of instrument data running either on the Pi or accessible in the network neighborhood.
  • Optionaly a NMEA2K (Raymarine seatalk ng) USB to NMEA-0183 converter can be added.
  • This application will also work flawlessly under Windows WSL (Windows Subsystem for Linux).

System Software prerequisites

  • An updated Raspberry Pi OS Lite to start with
  • sudo apt install whiptail ttyd seatd yad gcc git make
  • sudo apt install x11-utils (some tools also needed for weston/xwayland)

Note on ttyd

System Software prerequisites for Xorg (deprecated)

  • sudo apt install xorg wmctrl xloadimage (not on a workstation)
  • sudo apt install devilspie2 xfwm4 xdotool

SDL2 Software prerequisites

The SDL2 packages needed are:

  • sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-net-dev libsdl2-ttf-dev

Library dependencies from Debian repos

  • sudo apt install libcurl4-gnutls-dev i2c-tools libi2c-dev sqlite3 libsqlite3-dev libpng-dev
  • sudo apt install libtiff5-dev libjpeg-dev libfreetype6-dev libts-dev libinput-dev
  • sudo apt install libwebp-dev libvncserver-dev

Other libraries

  • Optionally plot-sdl to plot a live power shart.

External applications to be launched from sdlSpeedometer

  • sudo apt install XyGrib
  • sudo apt install opencpn
  • sudo apt install kodi
  • Use sdlSpeedometer-config to add these applications and also add sdlSpeedometer-stat (included) to show system status.

Software used

  • Raspberry Pi OS Lite bookworm and trixie

Build and install on a Pi

  • make install (build and install executables)
  • make install_system (build and start the system services)

Rebuild and test new configuration

  • sudo systemctl stop sdlSpeedometer.service
  • ./sdlSPeedometer-config (Check the configuration - default values ​​should do)
  • DISPLAY=:0 ./sdlSpeedometer -i -g (-i,-g: do not use the BerryGPS hat). Weston service must be running.
  • make install
  • systemclt restart sdlSpeedometer.service (will be enabled at boot time) or make start

Remote configuration

  • A running sdlSpeedometer keeps a web based configuration terminal if it is started with the -C option. This option makes no sence unless it is running as a systemd service, so add this option to /etc/default/sdlSpeedometer.
  • Example: http://:7600 assuming the -C option is defined as number 7600.

Build and test on the host (Mint, Ubuntu, Debian)

  • make
  • ./sdlSPeedometer-config (Check the configuration - default values ​​should do)
  • ./sdlSpeedometer -i -g (-i,-g: do not use the BerryGPS hat)

Utility commands

  • make stop (stop the service)
  • make status (check the service)
  • make start ((re)start a new session)

Enable audible warnings

  • Set preferences with sdlSPeedometer-config
  • Start sdlSpeedometer with "SDL_AUDIODRIVER=alsa AUDIODEV=hw:2,0 ./sdlSpeedometer -p" and possible -i -g as well
  • Eventually set these preferences in /etc/default/sdlSpeedometer after "make install" has been executed on a Pi

HOWTOs

For bookworm with Xorg add video=HDMI-A-1:800x480M@59 to /boot/cmdline.txt and this sample file to /usr/share/X11/xorg.conf.d/Xorg.conf

Section "Device"
    Identifier "Card0"
    Option "HDMI-1"
EndSection

Section "Monitor"
        Identifier "HDMI-1"
        ModelName "LEN L1950wD"
        Modeline "800x480" 29.22  800 824 896 992  480 483 493 500 -hsync +vsync
        Option "PreferredMode" "800x480"

See also

An Open Source Yacht Glass Cockpit

Screenshots

- XyGrib just launched on a 7" touch display

- sdlSpeedometers' configurator

About

SDL2 based marine instrument solution

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors