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.
Tweaks
- Updated install instructions for Moode 6
- Better handling of metadata from radio stations
- When "changing stations" the screen will say "Tuning ..."
- Stations that don't show a now playing field, instead diplay bitrate (which updates kbps if VBR)
- Splashscreen on loading that shows the Moode logo!
- Display of hostname, IP Address and CPU temperature in place of volume when MPD state shows no media playing
- Display of data usage instead of time elapsed if currentdata.txt file setup
- Shutdown screen with countdown that can be tied to a GPIO pin
- Login to MoodeAudio with user pi and password moodeaudio
- 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.
- Prerequites
$ sudo apt-get update
$ sudo apt-get install build-essential python-pip python-dev python-smbus git python-imaging python-mpd - Adafruit Python GPIO Library
$ git clone https://github.com/adafruit/Adafruit_Python_GPIO.git
$ cd Adafruit_Python_GPIO
$ sudo python setup.py install - Adafruit Python SSD1306
$ git clone https://github.com/adafruit/Adafruit_Python_SSD1306.git
$ cd Adafruit_Python_SSD1306
$ sudo python setup.py install - Download python script from github
$ git clone https://github.com/duracell80/MoodeAudio-OLED.git - Go to MoodAudio UI menu -> Configure -> System -> Local Services
Enable the metadata file (currentsong.txt) and toggle the LCD Update Engine on
-
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
-
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.pyWhich will linger for 15 seconds or more before running the main oled-mod script
$ python /home/pi/MoodeAudio-OLED/moode-oled-mod.py & -
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.
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
- Make scripts robust for 32p resolution (add bitrate / station name and now playing onto one scrolling line)
- Add choice of splashscreens