Skip to content

ehedman/sdlSpeedometer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

206 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sdlSpeedometer

README April-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.
  • 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 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 the Pi has its own battery backup.

Currently there are eight virtual pages with instruments working:

Compass       : With heading, roll and rudder angle from NMEA-net and/or from BerryGPS-IMUv2
GPS           : Lo, Lat and Heading from NMEA-net and/or from BerryGPS-IMUv2
Log           : SOW, SOG from NMEA-net
Wind          : Real, Relative and speed from NMEA-net
Depth         : With low water warning and water temp from NMEA-net and a depth plotting screen.
Environment   : Page with Voltage, Current, Temp, volume 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)
RTSP Camera   : Capture video and audio from an RTSP camera
HDMI Capture  : Capture HDMI Video and Audio (used for plotters with HDMI out). Requires a USB HDMI capture device.

There is also a page to perform compass calibration of the BerryGPS-IMUv2 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 a shell or remotely from a web page. 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 as a slave instrument on a computer and/or a tablet with a VNC client.

Tested runtime environment

  • Note this this is mainly an EMBEDDED Kiosk 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 4B/5 and a 8 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 32 or 64 bit to start with
  • sudo apt install whiptail ttyd seatd yad gcc git make
  • sudo apt install weston xwayland
  • sudo apt install x11-utils (some tools also needed for weston/xwayland)

Note on ttyd

  • As in March 2026 the package ttyd is missing for the 64-bit trixie. You can get it from here instead.
  • wget https://github.com/tsl0922/ttyd/releases/download/1.7.7/ttyd.aarch64 and install it as /usr/bin/ttyd
  • When insalling ttyd with apt it will also start ttyd as a systemd service listening on port 7681. You probably don't want that. Disable it with sudo systemctl disable ttyd. In this applicaktion it is only used to run the remote configurator.

Note on Audio

  • This is a alsa level application for warning sounds, camera and hdmi audio interfaces. Higher level services such as PipeWire-Pulse may interfere with this app.

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
  • sudo apt install libavformat-dev libavcodec-dev libavutil-dev libswscale-dev
  • sudo apt install libswresample-dev ffmpeg v4l-utils

External applications to be launched from sdlSpeedometer

  • sudo apt install xygrib-maps 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 32 and 64 bit.

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

  • Executed from a ssh session from a host to the pi.
  • sudo systemctl stop sdlSpeedometer.service
  • ./sdlSPeedometer-config (Check the configuration - default values ​​should do)
  • DISPLAY=:0:0 ./sdlSpeedometer -i -g (-i,-g: do not use the BerryGPS hat). Weston with xwayland service must be running.
  • make install
  • systemclt restart sdlSpeedometer.service (will be enabled at boot time) or make start
  • Make sure that the user name property is enabled in /etc/sudoers.d

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 sdlSpeedometer 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 -c (create a default configuration and exit)
  • ./sdlSPeedometer-config (Check the configuration - default values ​​should do)
  • ./sdlSpeedometer -i -g -s 800x480

Utility commands

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

Enable audible warnings

  • Set audio preferences with sdlSPeedometer-config
  • Start sdlSpeedometer with ./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
  • A volume control bar will be available for DAC audio devices. Volume for HDMI is handled at the signal endpoint i.e. the display monitor

Notes on display variables

Since this application is capable to run either as an X application (DISPLAY=:0:0) thanks to xwayland or as a Wayland application (WAYLAND_DISPLAY=wayland-1) you can use either of these variables. However, when subtasks are launched they get the "DISPLAY=:0:0" set to ensure compatibility for all GUI based applications. See the spawnSubtask script.

Notes on HDMI sources

  • Types of HDMI capture USB cards tested are based on MS2109, MS213* and Guermok USB2 Video
  • Tested HDMI sources so far are a Raymarine Axiom 2 Pro 9 S and for fun a Chromecast dongle.
  • sdlSpeedometer adds a live navigation image overlay on top of the (hdmi) picture.

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