piCorePlayer LCD – Raspberry Pi with Squeezelite and an LCD screen

Thanks to a great Python script from WiredCharlie (LCD Player), an amazing application from Triode (Squeezelite), and a small Linux build for the Raspberry Pi (piCorePlayer); I am finally able to put together a squeezebox player for less than $50!

If you are not familiar with the squeezebox, it is a multi-room wireless music player that blows the doors off of Sonos and other competitive products. Unfortunately Logitech squashed the product, but luckily the community is keeping it alive! It is a amazing product that integrates with all major streaming services and also caters to the hifi user allowing for all forms of lossless and lossy audio formats.

Step 1:
Purchase the following –
*Raspberry Pi B+ ($35.00)
*8GB SD Card ($8.00)
*HD44780 LCD Screen ($7.00 or if potentiometer to control the contrast  is needed $10.00)
*Pack of resistors ($10.00, you only need one 50ohm resistor)

Step 2:
Wire up the LCD screen according to the schematic by WiredCharlie.  Notice you need the 47K potentiometer and 50ohm resistor in addition to the LCD:

piCorePlayerLCD-672x372

Step 3:
Load the following image from your machine on the SD card
Download Here

You can copy the image using “dd” if in Linux or Win32diskimager if in windows (win32diskimager).

Step 4:
Now insert the SD card into your Pi, connect and ethernet cable and boot it up.  After about 30 seconds you can search for its IP address via your router DHCP leases.

Step 5:
Now you can open a web browser and navigate to ‘http://IP-ADDRESS’ and then upgrade to the latest version of piCorePlayer by clicking the update button.

Step 6:
After updating you will need to make some minor modifications to the LCD python script.  SSH into the IP of the Pi (username:  ‘tc’ and password: ‘nosoup4u’) and run the following commands:

sudo vi /opt/bootlocal.sh

Scroll down to a blank line….press the ‘i’ key, and then paste in the following:

sudo /mnt/mmcblk0p2/tce/readsq.py &

Now press the ‘esc’ key, then press ‘:’, then type ‘wq’ and press the enter key.  You should have saved the file and returned to the shell prompt.  Now run the following code to save the changes to the memory card:

sudo filetool.sh -b

Now finally edit the script to control the LCD screen:

sudo vi /mnt/mmcblk0p2/tce/readsq.py

Scroll down and comment out the following lines by inserting a ‘#’ in the front of the two lines of code (line ~1000 so use page down).

subprocess.Popen(["/usr/local/etc/init.d/squeezelite_initd", "stop"])
subprocess.Popen(["/usr/local/etc/init.d/squeezelite_initd", "start"])

Now save and exit as described above using the vi commands.  Finally reboot the Pi to execute the new code.

Step 7(Optional):
If you decide to change the MAC address in the piCorePlayer Squeezelite GUI (so that you can spoof a real squeezebox player to listen to Pandora, etc.) you will need to edit the readsq.py script and change the following line of code.  This will read the new spoofed MAC instead of the hardware MAC address.

mac = subprocess.check_output("grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}' /usr/local/sbin/config.cfg", shell=True).upper().rstrip()

You should now have a working player with an active LCD screen.  Happy Listening!!!

 

***Update:***

Code for the readsq.py file to update other versions of piCorePlayer:    readsq.py

23 thoughts on “piCorePlayer LCD – Raspberry Pi with Squeezelite and an LCD screen”

  1. I have a Raspberry PI2.
    I have tried to run with old image, but not run.

    Please, may you indicate the operation to load the library into the Rapsberry PI 2 1.19l image or if you have already an ready image pycoreplayer LCD for raspberry pi 2.

    thank you in advance
    best regards
    Rosario

    1. Hi Rosario,
      I do not have a PI2, but can explain what you would need to do to create a new image.

      1) Grab the latest piCorePlayer image for PI2 and install it to your device, you also may need to install python.
      2) Copy the code from the readsq.py (attached above in the bottom of the post) into a new file on your PI2 located in /mnt/mmcblk0p2/tce
      3) Follow step 6 to allow the script to run the script at startup.

      That should do it. If you have any other questions let me know.

  2. I have download the LCD image from thesterk.com and my B+ with LCD hookup as the same as the site exact pin 16.
    I don’t understand why pin 16 from the LCD has to be on pin 11. I have search the internet and no one has pin 16 to raspberry pin 11 with 50 ohm.
    Instead I leave as normal to pin 2. When I boot up from the image, it display ‘stop’ and that is!
    If I follow all the instruction, then become nothing.
    I am wondering the pin 16 to pin 11 will affect it and also I worry that it will kill the devices.

    1. Hi,
      If you are seeing the words “stopped” then more than likely things are wired fine. Did you ensure that the MAC address is set correctly in the script readsq.py? Also note that the player screen is controlled by the software. If you power off the player via squeezebox, the display will also turn off.

      sq = sc.get_player(“AA:BB:CC:DD:EE:AA”)

  3. After I updated the squeezelite MAC address, the screen “stopped’ disappear. I can play music but shows nothing.
    I have tried update to version 19k and replace the udated readsq.py file & reboot. It is back to white box.
    Can you tell me what I should look into? Thanks!

  4. Was the screen completely blank but you could hear music and it was showing up on the Server/Controller? If so, I recall I had the same problem until I wired things as per my instructions.

    1. Thanks for reply!
      I change the wiring and have the display. However, it some time displays the name of the songs and after a while it displays unknown characters. It seems have refresh problem too!
      It is so strange that it only works with analogy and hdmi ouput but not the USB DAC.It also doesn’t work with more updated versions.

      1. Great! Glad it is working. Unknown characters are probably due to unicode characters. You would have to look into changes in the code to support non ASCII characters. USB DACs are supported, but you have to look at piCorePlayer’s updates/site on which ones. Hope you enjoy the LCD player!

        1. Hi Sorry again!
          I would like to know what is the best way to update your new readsq.py? I have been using the WinSCP which is not working for me.
          Also what if I want to add more info to the display rather than just the song name and time remain?
          BTW, I want to have other character on the LCD which the songs are display correctly in LMS player.

  5. Hi,
    The best bet would be to SSH into the unit and then replace the text via the console/vi. You then will need to save the changes and then run the following to commit the changes to the memory card: sudo filetool.sh -b

    As far as your other questions, you would have to modify the code (python) within the file to change the display characters. This requires a basic understanding of the language and some basic programming skills. Good luck!

    1. How do I dedicate to a LMS server? As I have more than 1 server, and some time Picoreplayer will switch to other server even though I have setup the server on the player side.

      1. Hi,
        Check the code for the following try statment:

        try:
        ip = subprocess.check_output(“timeout -t 1 -s kill /mnt/mmcblk0p2/tce/squeezelite-armv6hf -m $(cat /sys/class/net/eth0/address) -d slimproto=info 2>&1 | grep -oP ‘(?<=(from: )).*?(?=:3483)'", shell=True) #ip = subprocess.check_output("timeout 1s ./squeezelite-armv6 -d slimproto=info 2>&1 | grep -oP ‘(?<=(from: )).*?(?=:3483)'", shell=True) Then, manually set the IP address to your server private IP. Example: ip = "192.168.1.250"

  6. Great work!

    There is reverence to “/mnt/mmcblk0p2/tce/restart-readsq.sh” in “/mnt/mmcblk0p2/tce/readsq.sh”. I cannot find this file for download. 🙁

    Can I get it somehere?

    Thanks

    1. Hi, the easiest thing to do is flash the “picorelcd.img” to an SD card and then pull it from there (IMG file is found in my post above). That is the entire OS with all of the files that you boot and run right away. I hope this helps.

  7. I have tried to get it working with:
    – AUDIOPHONICS RaspDIGI;
    – pCP 2.05l;

    Downloaded your script for readsq.py. Didn’t get it working :-(. Do I need to install Python or otherwise could you provide a new image for pCP2.0x which works for all the Raspberry’s……

    Thanks,

    ThaYapeMan

  8. Hi,

    great project!
    I’m trying to make readsq.py working with the latest version of piCorePlayer. Unfortunately I’m struggling with an i2c- connected LCD. Could you please give some hints, how to adapt readsq.py for i2c connected displays?

    Merci

  9. Got it all up and running, works really nicely, thanks for that.
    I want to now run it on a pi zero, but am somewhat stuck with the lack of a RJ45, the pi being wireless only. Can it be done? Have tried a USB to LAN adapter to no avail.
    Regards
    Mark

  10. Good day.
    I was wondering if this is still valid on this date. Can it work with raspberry pi b +?
    Install the image and it gives error to update picoreplayer.
    Thanks and cheers

    1. Hi, I would assume it is still valid, but I have not played with the latest build in years. Can you tell me what the error is?

Leave a Reply

Your email address will not be published. Required fields are marked *