Giter VIP home page Giter VIP logo

raspi-oled-menu's Introduction

RasPi-OLED-Menu

This code is for a homemade internet radio. It is based on a Raspberry Pi Zero W with a USB sound card. Only controllable via a web interface was no option for me, so I added a small OLED display and a rotary encoder. There is a menu to navigate through with the rotary encoder. The controller chip of the little oled is the sh1106. (I bought it from ebay)

It connects to Mopidy for music playback and webradio stations and to shairport-sync for airplay status information and automatic pausing of Mopidy.

Windows/Usage

Some screenshots from the different menu windows (sometimes the font is a bit off because of the simulator):

Now playing Connection lost Main Menu
Now playing Connection lost Mainmenu
Radio stations Playlist selection menu Shutdown menu
Radio station menu Playlist menu Shutdown menu

When the software is started, it shows a loading screen until it gets a connection to Mopidy. If the connection is lost while active, it shows a little icon on the idle screen. If shairport-sync is installed on the system, Mopidy will be paused when an AirPlay connection is established and the screen will show now playing information. You can also skip the current track or go back to the previous track using the rotary encoder controls.

Installation

The code is provided without further warranty or support. There is no guarantee that it will work properly, since I am not a professional developer and only develop this project in my spare time.

  1. Install Raspberry Pi OS (Lite) to your SD Card and set it up (there are lots of great guides online)
  2. Install Mopidy and configure it to create a playlist of radio stations.
  3. Optional: Install Shairport-Sync and enable the metadata pipe.
  4. Install some prerequisites: sudo apt-get install python3-dev python3-pip libfreetype6-dev build-essential libopenjp2-7 libtiff5
  5. Download the code: git clone https://github.com/techdiem/RasPi-OLED-Menu.git oledctrl && cd ./oledctrl
  6. Install python requirements: pip3 install -r requirements.txt
  7. Move the systemd config to the correct folder: sudo mv oled.service /etc/systemd/system/
  8. Reload systemd: sudo systemctl daemon-reload
  9. Switch to the main code folder: cd ./oled
  10. Move font files to the fonts directory, they aren't included due to their copyright. instructions
  11. Copy the config file cp settings.example.py settings.py
  12. Set the pinout and other configuration values with nano settings.py

Start it using python3 oled.py for debug and using sudo systemctl start oled.service for production. To start on system boot, use sudo systemctl enable oled.service.

Configuration notes

Mopidy configuration

For using the radio station menu, you need to tell mopidy a path to create playlist files. The Mopidy-MusicBox-Webclient has a streams tab which saves the stations to a playlist file called [Radio stations].m3u8. In the mopidy configuration (/etc/mopidy/mopidy.conf) configure the m3u component:

[m3u]
enabled = true
base_dir =
default_encoding = latin-1
default_extension = .m3u8
playlists_dir = /music/playlists

Enter the same folder here as in the settings.py of this control software. Make sure, that the user running mopidy has read/write access to this directory! Now streams added by the MusicBox-Webclient are shown in the radio menu.

Shairport configuration

You need to enable the shairport metadata pipe. To do so, edit your /etc/shairport-sync.conf file and uncomment/edit the following options:

metadata =
{
    enabled = "yes";
	pipe_name = "/tmp/shairport-sync-metadata";
	pipe_timeout = 5000;
};

Now there should be now playing information on the screen if you connect via AirPlay.

raspi-oled-menu's People

Contributors

techdiem avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.