Skip to content

duracell80/MoodeAudio-OLED

 
 

Repository files navigation

MoodeAudio-OLED For Internet Radio Projects

OLED 128x64 for MoodeAudio

This is a forked version of the original script by naisema with some major tweaks that make the OLED screen output more useful for Internet Radio usage in a hardware project. I gutted the inside of a broken iView ATSC Box in testing. To get the best out of this script cue up your favourite radio stations in a saved playlist and have the playlist repeat at the end so that Moode can feel like a radio device.

Playing State

Tweaks

  1. Updated install instructions for Moode 6
  2. Better handling of metadata from radio stations
  3. When "changing stations" the screen will say "Tuning ..."
  4. Stations that don't show a now playing field, instead diplay bitrate (which updates kbps if VBR)
  5. Splashscreen on loading that shows the Moode logo!
  6. Display of hostname, IP Address and CPU temperature in place of volume when MPD state shows no media playing
  7. Display of data usage instead of time elapsed if currentdata.txt file setup
  8. Shutdown screen with countdown that can be tied to a GPIO pin

New Splashscreen



Host Details On Stop




Installation

  1. Login to MoodeAudio with user pi and password moodeaudio
  2. Ran raspi-config and enable i2c and auto login

How To Make Moode Auto Login
Run: sudo raspi-config Choose Boot Options Choose Desktop / CLI Choose Console Autologin Select Finish, and reboot the pi.

  1. Prerequites
    $ sudo apt-get update
    $ sudo apt-get install build-essential python-pip python-dev python-smbus git python-imaging python-mpd
  2. Adafruit Python GPIO Library
    $ git clone https://github.com/adafruit/Adafruit_Python_GPIO.git
    $ cd Adafruit_Python_GPIO
    $ sudo python setup.py install
  3. Adafruit Python SSD1306
    $ git clone https://github.com/adafruit/Adafruit_Python_SSD1306.git
    $ cd Adafruit_Python_SSD1306
    $ sudo python setup.py install
  4. Download python script from github
    $ git clone https://github.com/duracell80/MoodeAudio-OLED.git
  5. Go to MoodAudio UI menu -> Configure -> System -> Local Services Enable the metadata file (currentsong.txt) and toggle the LCD Update Engine on

Moode Metadata Settings

  1. NEW! Instead of displaying time elapsed the script can display session data usage. $ sudo touch /var/local/www/currentdata.txt $ sudo chmod 777 /var/local/www/currentdata.txt

  2. Add startup script to /etc/profile.d

    $ sudo cp /home/pi/MoodeAudio-OLED/moode-oled-startup.sh /etc/profile.d/

    The script upon startup will display the splashscreen
    $ python /home/pi/MoodeAudio-OLED/moode-oled-splash.py

    Which will linger for 15 seconds or more before running the main oled-mod script
    $ python /home/pi/MoodeAudio-OLED/moode-oled-mod.py &

  3. Optional: Use moode-oled-shutdown.sh script on a GPIO pin (9) in Moode to shutdown the OLED and then the system on button press. Do this by going in the Moode Web UI to Configure -> System -> GPIO Button Handler -> Edit. OR use the script in your favouirte place to safely shutdown the pi. The shutdown -h now command is commented out for your convenience but the screen should show a countdown timer and bring down the volume in a fade out fashion.


Notes

NOTE: For 32p resolution screens edit the splash screen script comment out the 64 line and uncomment the 32 line, rename moode-oled-mod.py to moode-oled-mod-64p.py and rename moode-oled-mod-32p.py to moode-oled-mod.py

NOTE: The original script remains in this repo, the new one has -mod at the end of the filename. If the original script this was forked from is still running, the modifed script can seek the PID of that script and kill it. Having the main screen script run multiple times causes the "weird characters" on the display. The shutdown script also tries to kill the process of the main script for this reason. If these screen glitches are occuring it's because there are multiple scripts trying to update the same screen once a second. Search your favorite search engine for process kill commands.

A helpful command to rescue the screen is
$ sudo pkill -f "python /home/pi/MoodeAudio-OLED/moode-oled-mod.py" & python moode-oled-clear.py

If you're editing the bash files in Windows there may be some line end issues, fix these with sed
$ sed -i -e 's/\r$//' ./*.sh

Todo List

  1. Make scripts robust for 32p resolution (add bitrate / station name and now playing onto one scrolling line)
  2. Add choice of splashscreens

About

OLED 128x64 for MoodeAudio

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.7%
  • Shell 1.3%