dhrone / Raspdac-Display

An alternate display program for the Raspdac from Audiophonics which uses a Winstar OLED 16x2 display
MIT License
11 stars 9 forks source link

NO LONGER MAINTAINED

This project is no longer being maintained. I will still try to respond to issue requests but will not commit signficant development effort to resolving them. There is a new version of the project at http://github.com/dhrone/pydPiper that you may want to consider. Unlike Raspdac-Display which is text-based, pydPiper is a graphical system and is able to handle a wider variety of display designs.

Raspdac-Display

An alternate display program for the Raspdac from Audiophonics which uses a Winstar OLED 16x2 display

The RaspDac is a Raspberry Pi audio player using a Sabre ES9023 DAC and capable of running several excellent music distros such as Volumio, RuneAudio, and Max2Play. It uses a Winstar OLED WEH001602A as a display. This python-based project is an alternate display program from what is provided by Audiophonics.

Installation

For Volumio

These instructions assume a working version of the Volumio distribution (V1.55) and that the Winstar OLED display has been wired to the Raspberry Pi according to the instructions provided by Audiophonics at http://forum.audiophonics.fr/viewtopic.php?f=4&t=1492. If you have wired the display to different pins, please make sure to adjust the GPIO pin assignments accordingly. Note: pin assignments for the V2 and V3 versions of the RaspDac are already encoded at the top of the Winstar_GraphicOLED.py file.

Retrieve the current version of the RaspDac_Display software from github

   git clone https://github.com/dhrone/Raspdac-Display
   cd Raspdac-Display

Place RaspDacDisplay.py and WinstarOled.py in a directory of your choice (e.g. /usr/local/bin/. Add RaspDacDisplay.py to /etc/rc.local to automate its startup on reboot. It is a good idea to delay its start-up to allow the system to come up completely before it attempts to start. The following examples uses a 20 second delay.

   /etc/rc.local
   #!/bin/sh -e
   #
   # rc.local
   #
   # This script is executed at the end of each multiuser runlevel.
   # Make sure that the script will "exit 0" on success or any other
   # value on error.
   #
   # In order to enable or disable this script just change the execution
   # bits.
   #
   # By default this script does nothing.
   /var/www/command/player_wdog.sh startup & > /dev/null 2>&1

   (sleep 20; python /usr/local/bin/RaspDacDisplay.py) &
   exit 0

For Runeaudio

These instructions assume you are using a newly created image of the Runeaudio distribution (V0.3-BETA) and that the Winstar OLED display has been wired to the Raspberry Pi 2 or Pi 3 according to the instructions provided by Audiophonics at http://forum.audiophonics.fr/viewtopic.php?f=4&t=1492. If you have wired the display to different pins, please make sure to adjust the GPIO pin assignments accordingly. Note: pin assignments for the V2 and V3 versions of the RaspDac are already encoded at the top of the Winstar_GraphicOLED.py file.

There are several changes that need to be made to the Runeaudio distribution to get the RaspDac fully setup. These directions will provide a step-by-step walkthrough of those changes. Please note, they have only be tested on a Raspberry Pi 3 using the V0.3-BETA image with MD5 hash a072179a40613a5cbb277cc33d1ace9c. There are some idiosyncrasies with this image that need to be addressed which may not be required in future versions.

The following steps require that your Raspdac be powered up, connected to the network and that you be logged into it as the root user. Runeaudio allows login using the ssh protocol. The username is root and the password is rune.

git clone https://github.com/dhrone/Raspdac-Display
cd Raspdac-Display

For Max2Play

These instructions assume you are using a newly created image of the Max2Play distribution (v2.36) and that the Winstar OLED display has been wired to the Raspberry Pi 2 or Pi 3 according to the instructions provided by Audiophonics at http://forum.audiophonics.fr/viewtopic.php?f=4&t=1492. If you have wired the display to different pins, please make sure to adjust the GPIO pin assignments accordingly. Note: pin assignments for the V2 and V3 versions of the RaspDac are already encoded at the top of the Winstar_GraphicOLED.py file.

Note: Max2Play supports multiple playback systems. Currently RaspdacDisplay is only tested to work with the Logitech Media Server method using the SqueezeLite Audioplayer.

The following steps require that your Raspdac be powered up and connected to your network

Find and change the following values to ones appropriate for your system.

TIMEZONE
MPD_ENABLED (should be false if using LMS)
SPOP_ENABLED (should be false if using LMS)
LMS_ENABLED (should be True if using LMS)
LMS_PLAYER (set this to the MAC address for your Max2Play system if using SqueezeLite).

To find the MAC address for your system, use the following command...

ifconfig -a | grep HWaddr

If you are using a wired network, choose the HWaddr from the eth0 interface. If you are using a wireless network, choose the HWaddr from the wlan0 interface.

# Pin Mappings V2
#OLED_DB4=25
#OLED_DB5=24
#OLED_DB6=23
#OLED_DB7=15
#OLED_RS=7
#OLED_E=8

# Pin Mappings V3
OLED_DB4=25
OLED_DB5=24
OLED_DB6=23
OLED_DB7=27
OLED_RS=7
OLED_E=8

This is important to get right as if the pins are wrong, the display will not work correctly. The screen will likely remain blank or show random characters if you do not have the pins set correctly for the version of the Raspdac DAC you are using.

History

Version 0.7 (Beta). This version is a major re-write of the display logic. It uses a pages metaphor to allow the user to more rapidly change the content of the display. It also re-integrates customized versions to support RuneAudio, Volumio, and Max2play into a single version.

Version 0.5 (Beta). This version (hopefully) solves many of the initialization challenges associated with the Winstar OLED display and implements some nice display scrolling logic based upon the content of the artist and title data supplied by MPD and/or Spotify.

Credits

The basis for most of this code comes from Lardconcepts (https://gist.github.com/lardconcepts/4947360) A great overview of LCD/OLED logic is available on Wikipedia (https://en.wikipedia.org/wiki/Hitachi_HD44780_LCD_controller). While that document is focused on the popular HD44870 LCDs, most of what is describe there applies to the Winstar OLED. There are important differences though. The OLED appears to be much more sensitive to timing issues and requires a different command sequence to reset it back to a known good state upon a warmstart. Understanding the initialization behavior of the Winstar in 4 bit mode was greatly assisted by PicAxe who currently have a PDF posted which detailed a method to resync with the display. This is described on the last page of http://www.picaxe.com/docs/oled.pdf. Most of the power management logic was pulled from discussions on the Runeaudio (http://www.runeaudio.com/forum/audiophonics-i-sabre-v3-dac-es9023-tcxo-t3377.html) and Audiophonics (http://forum.audiophonics.fr/viewtopic.php?f=4&t=1620) forums.

License

The MIT License (MIT)

Copyright (c) [2015] [Dhrone]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.