INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Quick Start Guide for Installing an OLED display on rPi reading track info  (Read 1399 times)

Wheaten

  • Guest

Install Raspberry PI OS (32 bit)
The installation is valid for the rPi4, installing on previous version havenít been tested by me.
As always, I start with a clean install.

Pay attention. The installation script will default python to V3. If you donít want this or relying on V2, donít continue.

Itís just a very basic script displaying track data, feel free to modify to your needs. I am sure code could be more efficient (especially the attribute reading), but I am not a python programmer. (and def. not looking to master a 7th programming language  :P)
Iíve assumed that you have JRiver running, with the media network enabled and protected with a password. If you donít use a password, you need to modify the function. See scroll.py below.  The script comes as is.
When Artist/track or album exceeds 16 chars, the lines will scroll.

Perform the needed setups:
-   Enable wait for boot till network is available:
Code: [Select]
sudo raspi-config







Code: [Select]
sudo apt-get update && sudo apt-get upgrade
Add baudrate to boot config
Code: [Select]
sudo echo "dtparam=i2c_arm_baudrate=800000" >> /boot/config.txt
To setup JRiver on the rPi, read my other topic.

Setup drivers etc
I am not writing everything down, there are some good instructions that will setup all required libraries. Follow the instructions on:
Step 1:
Step 2:
Shut down your Pi and connect the display:
Code: [Select]
sudo shutdown
Connect display
Pi         display
Pin3 (SDA)   SDA
Pin1 (5V)      VCC
Pin5 (SCL)      SCL
Pin14 (GND)   GND


Boot the Pi

Create a new directory in your home folder
Code: [Select]
cd ~/
mkdir oled && cd oled
unzip OLED_V1.1.0.zip
or
Code: [Select]
unzip OLED_V1.1.0.zip
Make the script executable
Code: [Select]
Chmod a+X scroll.py
There are only a few setting to review, Iíve listen then below.
Code: [Select]
nano scroll.py
Code: [Select]
#Modify the url to your JRiver instance
sURL = 'http://xxx.xxx.xxx.xxx:52199/MCWS/v1/Playback/Info?Zone=-1'

#If you set the authentication in th emedia network, add the details below.
#If not modify function geturl(url), for the proper call
sUsername = 'username'
sPassword = 'password'

debug = 0

#Set the demensions of your OLED
WIDTH = 128
HEIGHT = 64

#Here you can rotate your display when needed, 0=0deg, 1=90deg, 2=180deg, 3=270deg
disp.rotation=2

def geturl(url):
#If you need credetials to access the media network use this line
r = requests.get(url, auth=(sUsername, sPassword))
#If you don't need credentials, use this line
#r = requests.get(url)


Check if the script will run:
Code: [Select]
python scroll.py
If all went ok the screen should work.


Add script to startup of the Pi:
Code: [Select]
sudo nano /etc/rc.local
Add the following line BEFORE exit 0
Code: [Select]
sudo python3 /home/pi/oled/scroll.py &

Save with CTRL + o, ENTER, CTRL + x

Test if the script will work on reboot. Start JRiver and select a random song.
Go back to the terminal:
Code: [Select]
cd /etc
sudo ./rc.local

If all goes well, you see something like this:


Have fun

Change log: OLED_V1.1.0:
  • When Status = 'Buffering...', 'Opening...', 'Waiting' or 'Aborting, Please wait' Show hourglass instead of JRiver logo
  • With long text, only scroll that line instead of all three lines (Artist, track and Album)

Logged

Wheaten

  • Guest

Change log: OLED_V1.1.0:
  • When Status = 'Buffering...', 'Opening...', 'Waiting' or 'Aborting, Please wait' Show hourglass instead of JRiver logo
  • With long text, only scroll that line instead of all three lines (Artist, track and Album)
Logged
Pages: [1]   Go Up