/tabletop-heads-up

A small Heads-Up Display (HUD) to show some useful information at a glance, like the current time and weather. Designed for a small LCD screen attached to a Raspberry Pi that I have running at home.

Primary LanguageRubyBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Table-top Heads-Up Display (HUD)

A small Heads-Up Display (HUD) to show some useful information at a glance, like the current time and weather. Designed for a small LCD screen attached to a Raspberry Pi that I have running at home. Some design principles I've followed:

  • Fits on a 480×320 pixel screen.
  • Easy to see the basic information from far away, meaning not too much information on a single screen.
  • Not too many separate screens, as that prevents useful information from being visible more often.

The current weather page, showing an icon and description for the weather condition and the temperature.

For more information about the development process, see the following blog posts:

  1. Setting up an LCD screen on the Raspberry Pi, 2019 edition
  2. Writing GUI applications on the Raspberry Pi without a desktop environment
  3. Creating Raspberry Pi applications with Raylib and Ruby
  4. Creating Raspberry Pi applications with Raylib and Ruby - Part II

Despite running primarily on a Raspberry Pi, nothing about this project is specific to the platform.

Quick Start

  1. Install Raylib. Build a shared library, instead of the default static library:

    cd /path/to/raylib
    cd src
    
    make RAYLIB_LIBTYPE=SHARED
  2. Install development dependencies. On Debian-based systems:

    sudo apt install build-essential swig
  3. Ensure you have a suitably new version of Ruby (3.x), along with its development headers needed to build native extensions. If you're using the system-wide Ruby installation on Debian-based systems:

    sudo apt install ruby ruby-dev

    I prefer using rbenv and ruby-build to manage my Ruby installations. This allows me to have multiple installations on the same system.

  4. Build the Ruby extension:

    # Install rake
    gem install bundler
    bundle
    
    # If Raylib is installed to standard location (with include + lib
    # subdirectories). Defaults to `/usr/local` if installed system-wide.
    bundle exec rake raylib RAYLIB_INSTALL_PATH=/path/to/raylib
    
    # If Raylib is installed to non-standard locations
    bundle exec rake raylib \
        RAYLIB_HEADER_INSTALL_PATH=/path/to/raylib/header \
        RAYLIB_LIB_INSTALL_PATH=/path/to/raylib/lib
    
    # If compiling on the Raspberry Pi, pass the `PLATFORM` flag. This flag
    # can be combined with the other flags from above.
    bundle exec rake raylib PLATFORM=PLATFORM_RPI
  5. Register for the OpenWeatherMap API and obtain an App ID.

  6. Run the HUD Ruby application, specifying the App ID as an environment variable:

    OPEN_WEATHER_APPID='<app-id-from-above>' ./hud.rb

Clean up

The intermediate files generated during the building of the extension can be cleaned up:

# To clean up all intermediate files, but leave the final extension library:
#
#   rake clean
#
# To clean up all build artifacts, including the final extension library:
#
#   rake clobber

Packaged Dependencies

Open Weather Icons

Roboto Condensed Font