INTERACT FORUM

More => Old Versions => JRiver Media Center 27 for Linux => Topic started by: Wheaten on March 17, 2021, 02:51:38 am

Title: Quick Start Guide for Installing an OLED display on rPi reading track info
Post by: Wheaten on March 17, 2021, 02:51:38 am
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 (https://yabb.jriver.com/interact/index.php/topic,128121.0.html) 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(https://i.imgur.com/LYDRgs8.png)

(https://i.imgur.com/amTVjEI.png)

(https://i.imgur.com/sEzgCT1.png)

(https://i.imgur.com/SXRLgzz.png)

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 (https://yabb.jriver.com/interact/index.php/topic,128121.0.html) 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:  (https://learn.adafruit.com/circuitpython-on-raspberrypi-linux/installing-circuitpython-on-raspberry-pi)
Step 2:  (https://learn.adafruit.com/adafruit-pioled-128x32-mini-oled-for-raspberry-pi/usage)
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
(https://i.imgur.com/52BABku.png)

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.
(https://i.imgur.com/qC9p67B.png)

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 &(https://i.imgur.com/AHkLplc.png)

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:
(https://i.imgur.com/OgGv8SU.png)

Have fun

Change log: OLED_V1.1.0:

(https://i.imgur.com/uzXAsxh.png)(https://i.imgur.com/cDdxFto.png)(https://i.imgur.com/geU2p0J.png)
Title: Re: Quick Start Guide for Installing an OLED display on rPi reading track info
Post by: Wheaten on April 11, 2021, 08:48:35 am
Change log: OLED_V1.1.0: