Installing an LCD on a Raspberry Pi with LogitechMediaServer Script On Arch Linux

Stacks Image 2015
This will be a tutorial on installing an LCD screen on a Raspberry Pi and using a script file for querying music from the LogitechMediaServer service.

Eventually this will find it’s way in a nice shiny enclosure but the good news is the installation is still fresh in my mind so it’ll be easier to show how it was done.

My hardware is as follows:

- Raspberry Pi A+ -
- HiFiBerry DAC+ HD44780
- Adafruit 16x2 LCD
- 8GB mini SD card
- Radio Shack board, terminal blocks (or a
- Hook up wire (jumper kit wires)

Okay the assumption is that if you are looking at this page you already know a thing or two and are looking to try a little tougher Pi Project.

Good on ya.

Also the assumption is that you have your Pi working with Arch Linux installed. Every tutorial I saw on the web page said to use Wheezy Raspbian but I found that Arch was just as easy.

I don’t want to work you through the whole installation although I will tell you it might be easier to slap your micro SD card in a Raspberry Pi B, B+ or Pi 2 where you have some USB ports and an ethernet port. It would be most helpful to go that route if you can. When you are done you can swap the card into the A+ and it will work perfectly.

Another gotcha is that you will have to compile LogitechMediaServer from the AUR. There is no easy downloadable package. It takes some time to accomplish.

Instructions for installing Arch are here. Poke around on my webpage here and I discuss the installation of Logitechmediaserver in that manner. It’s on here somewhere.

Lastly while I was doing this there are several webpages where I drew information from. Nowhere was one simple installation site. It was tough putting it all together but I have worked through it and now I’ll try to share.

Ok, you have Arch, Logitechmediaserver, and Squeezelite working. Now it’s time to tackle the hardware.

We’ll be attaching wires directly to the HiFiBerry DAC. I fed my wires up from the bottom of the DAC where they are hidden and soldered them on top which gave me the best access. Here goes.

Stacks Image 2018
Pin 1 has the square on it. That is the single most important point to be made. Wait a minute. There is another important point. In the Raspberry Pi world when they talk about pins there are GPIO pins and pins.

For example in the picture above the hole directly on top of pin 1 is pin 2, the pin directly to the right of pin 1 is pin 3.

The row closest to you is 1, 3, 5, 7, 9, etc.
The row behind it is 2, 4, 6, 8, 10, etc.

Now lets talk about GPIO assignments. In the picture below PIN 3 is GPIO2, PIN 5 is GPIO 3, PIN 12 is GPIO 18. Confusing isn’t it? Just remember that PIN NUMBERS ARE NOT GPIO NUMBERS.
Stacks Image 2022
Okay lets talk pin assignments on the LCD. It’s easy. 1 - 16.
Stacks Image 2026
Now we need to physically connect them. Again I soldered them in permanently. You may want to solder the header pins on and connect the wires with these. However you still have to breadboard or mount the power wires and ground and the LCD potentiometer. I recommend a breadboard first go around to practice.

Only 12 of the 16 wires get hooked up.

Also I’m wiring this in accordance with LCDPROC which is the code we’re using for this project. Look around the web and there are lots and lots of python scripts and tutorials that have different pin mappings.

LCDPROC wants it wired like this:

#GPIO Pin mappage for HiFiBerry DAC+

Okay Pin 18 is used by the HiFiBerry DAC so we have to work around that. We’ll move it to GPIO 17

#GPIO Pin mappage for HiFiBerry DAC+

Okay, now there are no wiring conflicts. Essentially we wire it like this
(from the perspective of the LCD to the Pi)


Pin 1 - is a ground.
Pin 2 - Vcc - 5volts

Think about it this way. It’s like a car battery. Pin 2 is positive , Pin 1 is negative.

Pin 3 - Contrast to LCD. This attaches to the middle leg of the potentiometer that comes with the LCD
Pin 4 - (RS) this goes to GPIO 7 on the Pi (THAT IS PIN NUMBER 26)
Pin 5 - to ground.
Pin 6 - (EN) this goes to GPIO 8 on the Pi (THAT IS PIN NUMBER 24)
Pins 7-10 not used
Pin 11 (D4) this goes to GPIO 25 on the Pi (THAT IS PIN NUMBER 22)
Pin 12 (D5) this goes to GPIO 24 on the Pi (THAT IS PIN NUMBER 18)
Pin 13 (D6) this goes to GPIO 23 on the Pi (THAT IS PIN NUMBER 16)
Pin 14 (D7) this goes to GPIO 17 on the Pi (THAT IS PIN NUMBER 11)

This is the pin I moved. We’re going to have to reconfigure something in software soon.

Pin 15 - Backlight + positive this goes to PIN 4 on the Pi (PIN 4 NOT GPIO 4)
Pin 16 - Backlight - negative this goes to PIN 6 on the Pi (Pin 6

The two unused legs left over on the rotary potentiometer go like this:

Legs facing you……..Pin on right goes to positive, pin on the left goes to negative.

So in my mind the most confusing pins are pins 1-4 and 6.

See how the breadboard lays out? Holes along the red line are hot (provide you plug a hot wire into that row) Pins along the black line at the top are neutral. See how the wires all line up neatly in the photo. Don’t goof or poof.

This is only the left side of the LCD. Pin 15 is hot and Pin 16 is neutral. Every other wire goes from LCD to Pi.

Stacks Image 2030
Here’s a good pic of the wiring WITHOUT the potentiometer and remember I MAPPED A PIN TO ANOTHER PLACE BECAUSE THE HIFIBERRY NEEDS GPIO 18. DON’T FORGET IT.
Stacks Image 2036
And below is a drawing I made based on my installation.
Stacks Image 2053
Okay, plug your Pi in, you don’t even need an SD card at this point. The LCD should light up and by rotating the top of the potentiometer with a small screwdriver the boxes should appear/disappear depending on contrast. If that is not happening you wired it up wrong. Try again.

Now it is time to get LCD proc. Boot your Pi, open your terminal (either by attached keyboard, mouse and monitor or by SSH session). Type the following and I assume you are in your home directory. My home name is /home/john Adjust accordingly for yours.

Add the following commands;


mkdir lcdproc

cd lcdproc

wget -O lcdproc.tar.gz

tar xzf lcdproc.tar.gz

cd lcdproc-0.5.7

Time to configure

./configure —enable-seamless-hbars —enable-drivers=hd44780


sudo make install

Now lets configure the .conf file

sudo nano /usr/local/etc/LCDd.conf

In the file make sure this is added/altered up near the top


Scroll way down to the hd44780 driver section and change this


#GPIO Pin mappage for HiFiBerry DAC+


Take your time and slowly look through the file and find all that stuff. You have to paste in the GPIO pin mapping thing. It isn’t in there.

Now hit CTL + X then Y and enter to save the mods you made.

Cross your fingers.


sudo LCDd

And you should get some love and see something on the screen.

Next we need to get the script for LogitechMediaServer but first lets do some stuff I know we need to do. If you installed LMS you already have perl installed but it is missing some modules.

At a terminal:

sudo pacman -S perl-uri perl-datetime perl-switch

Once those install do this:


mkdir lcdlms

cd lcdlms


sudo chmod u+x

Now lets edit the script:

sudo nano

Edit LMS server address:
my $LMS = "x.x.x.x";

Make sure you put your IP address in here where the x.x.x.x is. Mine is

Now lets launch the file. It is important that you know what your Squeezelite player name is otherwise it will bark at you that it can’t find a player however it comes back and tells you the name of the player it finds. My squeezelite player name is aplus

./ aplus

And bear in mind LCDd should be running first. And bear in mind you should be streaming music from LMS as well.

Stacks Image 2040
I’ll briefly try to explain what I did with the positive and negative wires. The red and black wires from the Pi from pins 4 and 6 flow back to the brown circuit board. The potentiometer is soldered on. In front of it are two terminal blocks. Only the two inner ones are valid. One lines up on the right leg of the potentiometer and the other one lines up on the left leg of the potentiometer. The blue wire comes from LCD pin 3 to the center leg of the potentiometer. Every red (hot) wire is shoved in the terminal block on the right leg of the potentiometer. Every black wire is shoved in the terminal block on the left leg. Ingenious, eh?

Oh yeah, I couldn’t find my small zip ties. Later I’ll cut all those big ties and replace with nice smaller ones and make it real pretty.

Really all that is left to do now is to start LCDd and at boot and we’ll work on that later. …………………..
There are a million ways to start the files. Fancy scripts that watch and restart the program. That’s very nice, but lets just start the darn thing. This is arch which doesn’t use cron I like cron. I’m using cron.

sudo pacman -S cronie

sudo systemctl enable cronie

sudo systemctl start cronie


sudo VISUAL=nano crontab -e

add this, then CTL + X, Y and enter to save

@reboot /usr/local/sbin/LCDd

That starts lcdproc at boot

Now lets start that lcd_lms script. This is Arch Linux with Systemd so lets just start it using a service

sudo nano /etc/systemd/system/lcdlms.service

paste this in. Remember to fix your path and the name of your squeezelite player.

Description=LMS LCD Display

ExecStart=/home/john/lcdlms/./ aplus


Ctl +X then Y to save. Now lets enable it at boot.

sudo systemctl enable lcdlms.service

When the lcd_lms script kicks in you’ll see a digital clock displayed. Then you know it is all set. This should keep the script alive as well if it crashes. Hope this helps. Enjoy.

I was having some problems with the LCD screen not responding after a couple days. I’d get a weird character on the screen and lcd_lms was no longer controlling the screen. I wrote a cron job to find the process and kill it every night at 3 AM and restart it. That should solve the problem. We’ll see.

0 3 * * * /usr/bin/pkill -f; /home/john/lcdlms/ aplus & &>/dev/null

Here it is in action.