More > JRiver Media Center 27 for Linux
Quick Start Guide for Installing LCD Matrix on rPi, reading track info
Wheaten:
Updated on 26-03-2021, to include extended ASCII chars.
Changes with previous installation:
New driver:
If V2.x
--- Code: ---sudo pip install RPLCD
--- End code ---
If V3.x
--- Code: ---sudo pip3 install RPLCD
--- End code ---
new script
Installation has been performed on a fresh instance of Raspbian:
Make sure to pay attention to your python version, as mixing python 2.x and 3x might cause all kind of strange errors. Instruction to check your version are further down in this post.
It’s just a very basic of 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 track.py below. The script comes as is.
When Artist or track exceeds 20 chars, the line will scroll. Due to the physical properties, scrolling looks like blinking for the scrolling lines, but I do prefer this over strange shorten text.
If you see text that belongs to 1 line appearing on other lines, your LCD_WIDTH is set incorrect.
What is needed:
* rPi board
* A compatible LCD Matrix (I am using a GeeekPi IIC/I2C 2004 20x4 Character LCD Module Display from Amazon.) https://www.amazon.nl/gp/product/B07QNKCLJM
* 4 wires to connect everything
* SSH access to the Pi, or run everything from the rPi desktopPerform the needed setups:
- Enable wait for boot till network is available:
--- Code: ---sudo raspi-config
--- End code ---
- Create a new directory in your home folder
--- Code: ---cd ~/
mkdir jriverapi && cd jriverapi
--- End code ---
Place lcd_V2.0.zip in this folder.
- Unzip the content
--- Code: ---unzip lcd_V2.0.zip
--- End code ---
We will execute the script: “Enable_I2C.sh”. This scipt will, if needed, enable I2C and install i2c-tools.
- Make script executable, execute it and shutdown the rPi:
--- Code: ---chmod a+x Enable_I2C.sh
sudo ./Enable_I2C.sh
sudo shutdown
--- End code ---
- Connect display
rPiDisplayPin3 (SDA)SDAPin2 (5V)VCCPin5 (SCL)SCLPin39 (GND)GND
Boot the rPi
Check your python version, important to avoid random errors. The libraries we are going to add need to be for the correct version.
--- Code: ---python --version
--- End code ---
If V2.x
--- Code: ---sudo pip install RPLCD
sudo apt-get install python-smbus
--- End code ---
If V3.x
--- Code: ---sudo pip3 install RPLCD
sudo apt-get install python3-smbus
--- End code ---
Reboot the rPi
Locate the address for the display. Depending on the version of your rPi, you need to run one off the following lines:
--- Code: ---i2cdetect -y 0
--- End code ---
--- Code: ---i2cdetect -y 1
--- End code ---
- Configure the library
Make sure to respect the indents, don’t add spaces or tabs. This will result in errors like below:
--- Code: ---cd ~/jriverapi
--- End code ---
- Configure track.py
Set your display width, URL and credentials.
--- Code: ---nano track.py
LCD_WIDTH = 20
sURL = 'http://localhost:52199/MCWS/v1/Playback/Info?Zone=-1'
sUsername = 'username'
sPassword = 'password'
--- End code ---
Modify the address with the info taken form the previous command:
--- Code: ---mylcd = CharLCD('PCF8574', 0x27,charmap='A00')
--- End code ---
When done: press "CTRL + X, ENTER CTRL + O" to save it.
You can test the script by running:
--- Code: ---cd ~/jriverapi
python track.py
--- End code ---
If all went well, you'll see:
When JRiver is playing:
If you want the script started when the rPi boots, you can do this very easy by adding a line to the cron:
--- Code: ---crontab -e
@reboot sleep 10 && python /home/pi/jriver_api/track.py
--- End code ---
Reboot your Pi. If all went well it should come up with the hostname and time.
If the screen stays blank, you might need to increase “sleep 10” to a higher number.
This should not happen as we "Enable wait for boot till network is available".
Good luck.
JimH:
Thanks for the nice guide!
Wheaten:
OLED version is WIP (Work In Progress)
Had to gamble on the used fonts for the logo, Is there a logo available in pure black white?
Due to the lo-res of the display, I can't use the site logo.
bob:
I ordered a GeeekPi IIC/I2C 2004 20x4 Character LCD Module Display, really interested in trying this!
Wheaten:
Will post a tut, when ready.
Currently the screens, error handling is done.
Need to cleanup the code and document everything.
Preview:
Navigation
[0] Message Index
[#] Next page
Go to full version