LCD through i2c

I’m trying to connect an i2c LCD to my raspberry pi with OSMC. I followed all the steps of this page [OSMC Forums][1], excepting the first one: changing the kernel.
But LCDd doesn’t work, it says that there is an error reading the LCDd.conf file.
My LCD is a HD44780 size 16x2, and the i2c chip uses i2c address 0x27.
Here’s the LCDd.conf file:

## This file was written by cme command.
## You can run 'cme edit <application>' to modify this file.
## Run 'cme list' to get the list of applications available on your system
## You may also modify the content of this file with your favorite editor.


[server]
Driver=hd44780
DriverPath=/usr/lib//lcdproc/
NextScreenKey=Right
PrevScreenKey=Left
ReportToSyslog=yes
ToggleRotateKey=Enter

[hd44780]
Backlight=yes
ConnectionType=i2c
DelayBus=false
DelayMult=1
Device=/dev/i2c-1
Keypad=no
OutputPort=no
Port=0x27
Size=16x2
Speed=0

[menu]
DownKey=Down
EnterKey=Enter
MenuKey=Escape
UpKey=Up

Also, while intalling the packages i2c-tools and lcdproc, dpkg gave some errors:

osmc@osmc:~$ sudo apt-get install i2c-tools lcdproc
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libalgorithm-diff-perl libcarp-assert-more-perl libcarp-assert-perl
  libclass-data-inheritable-perl libclone-perl libconfig-model-lcdproc-perl
  libconfig-model-perl libdevel-stacktrace-perl libexception-class-perl
  libfile-homedir-perl libfile-which-perl libhash-merge-perl libjson-perl
  liblist-moreutils-perl liblog-log4perl-perl libmouse-perl
  libmousex-nativetraits-perl libmousex-strictconstructor-perl
  libparse-recdescent-perl libpath-tiny-perl libpod-pom-perl libtext-diff-perl
  libyaml-perl
Suggested packages:
  libi2c-dev python-smbus libconfig-model-dpkg-perl
  libconfig-model-openssh-perl libterm-readline-perl-perl
  libterm-readline-gnu-perl libdbd-csv-perl libxml-dom-perl libyaml-shell-perl
Recommended packages:
  read-edid lcdproc-extra-drivers libalgorithm-diff-xs-perl
  libconfig-model-tkui-perl bash-completion libfuse-perl libjson-xs-perl
  liblog-dispatch-perl libipc-shareable-perl libclass-method-modifiers-perl
  libunicode-utf8-perl libyaml-libyaml-perl libyaml-syck-perl
The following NEW packages will be installed:
  i2c-tools lcdproc libalgorithm-diff-perl libcarp-assert-more-perl
  libcarp-assert-perl libclass-data-inheritable-perl libclone-perl
  libconfig-model-lcdproc-perl libconfig-model-perl libdevel-stacktrace-perl
  libexception-class-perl libfile-homedir-perl libfile-which-perl
  libhash-merge-perl libjson-perl liblist-moreutils-perl liblog-log4perl-perl
  libmouse-perl libmousex-nativetraits-perl libmousex-strictconstructor-perl
  libparse-recdescent-perl libpath-tiny-perl libpod-pom-perl libtext-diff-perl
  libyaml-perl
0 upgraded, 25 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/2328 kB of archives.
After this operation, 6535 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
Selecting previously unselected package libalgorithm-diff-perl.
(Reading database ... 23695 files and directories currently installed.)
Preparing to unpack .../libalgorithm-diff-perl_1.19.02-3_all.deb ...
Unpacking libalgorithm-diff-perl (1.19.02-3) ...
Selecting previously unselected package libcarp-assert-perl.
Preparing to unpack .../libcarp-assert-perl_0.21-1_all.deb ...
Unpacking libcarp-assert-perl (0.21-1) ...
Selecting previously unselected package libcarp-assert-more-perl.
Preparing to unpack .../libcarp-assert-more-perl_1.14-1_all.deb ...
Unpacking libcarp-assert-more-perl (1.14-1) ...
Selecting previously unselected package libclass-data-inheritable-perl.
Preparing to unpack .../libclass-data-inheritable-perl_0.08-2_all.deb ...
Unpacking libclass-data-inheritable-perl (0.08-2) ...
Selecting previously unselected package libclone-perl.
Preparing to unpack .../libclone-perl_0.37-1+b1_armhf.deb ...
Unpacking libclone-perl (0.37-1+b1) ...
Selecting previously unselected package libdevel-stacktrace-perl.
Preparing to unpack .../libdevel-stacktrace-perl_1.3400-1_all.deb ...
Unpacking libdevel-stacktrace-perl (1.3400-1) ...
Selecting previously unselected package libexception-class-perl.
Preparing to unpack .../libexception-class-perl_1.38-1_all.deb ...
Unpacking libexception-class-perl (1.38-1) ...
Selecting previously unselected package libfile-which-perl.
Preparing to unpack .../libfile-which-perl_1.09-1_all.deb ...
Unpacking libfile-which-perl (1.09-1) ...
Selecting previously unselected package libfile-homedir-perl.
Preparing to unpack .../libfile-homedir-perl_1.00-1_all.deb ...
Unpacking libfile-homedir-perl (1.00-1) ...
Selecting previously unselected package libhash-merge-perl.
Preparing to unpack .../libhash-merge-perl_0.200-1_all.deb ...
Unpacking libhash-merge-perl (0.200-1) ...
Selecting previously unselected package libjson-perl.
Preparing to unpack .../libjson-perl_2.61-1_all.deb ...
Unpacking libjson-perl (2.61-1) ...
Selecting previously unselected package liblist-moreutils-perl.
Preparing to unpack .../liblist-moreutils-perl_0.33-2+b1_armhf.deb ...
Unpacking liblist-moreutils-perl (0.33-2+b1) ...
Selecting previously unselected package liblog-log4perl-perl.
Preparing to unpack .../liblog-log4perl-perl_1.44-1_all.deb ...
Unpacking liblog-log4perl-perl (1.44-1) ...
Selecting previously unselected package libmouse-perl.
Preparing to unpack .../libmouse-perl_2.3.0-1+b1_armhf.deb ...
Unpacking libmouse-perl (2.3.0-1+b1) ...
Selecting previously unselected package libmousex-nativetraits-perl.
Preparing to unpack .../libmousex-nativetraits-perl_1.09-2_all.deb ...
Unpacking libmousex-nativetraits-perl (1.09-2) ...
Selecting previously unselected package libmousex-strictconstructor-perl.
Preparing to unpack .../libmousex-strictconstructor-perl_0.02-1_all.deb ...
Unpacking libmousex-strictconstructor-perl (0.02-1) ...
Selecting previously unselected package libparse-recdescent-perl.
Preparing to unpack .../libparse-recdescent-perl_1.967009+dfsg-1_all.deb ...
Unpacking libparse-recdescent-perl (1.967009+dfsg-1) ...
Selecting previously unselected package libpath-tiny-perl.
Preparing to unpack .../libpath-tiny-perl_0.058-1_all.deb ...
Unpacking libpath-tiny-perl (0.058-1) ...
Selecting previously unselected package libpod-pom-perl.
Preparing to unpack .../libpod-pom-perl_0.29-1_all.deb ...
Unpacking libpod-pom-perl (0.29-1) ...
Selecting previously unselected package libtext-diff-perl.
Preparing to unpack .../libtext-diff-perl_1.41-1_all.deb ...
Unpacking libtext-diff-perl (1.41-1) ...
Selecting previously unselected package libyaml-perl.
Preparing to unpack .../libyaml-perl_1.13-1_all.deb ...
Unpacking libyaml-perl (1.13-1) ...
Selecting previously unselected package libconfig-model-perl.
Preparing to unpack .../libconfig-model-perl_2.061-1_all.deb ...
Unpacking libconfig-model-perl (2.061-1) ...
Selecting previously unselected package libconfig-model-lcdproc-perl.
Preparing to unpack .../libconfig-model-lcdproc-perl_2.042-3_all.deb ...
Unpacking libconfig-model-lcdproc-perl (2.042-3) ...
Selecting previously unselected package i2c-tools.
Preparing to unpack .../i2c-tools_3.1.1-1_armhf.deb ...
Unpacking i2c-tools (3.1.1-1) ...
Selecting previously unselected package lcdproc.
Preparing to unpack .../lcdproc_0.5.7-2_armhf.deb ...
Unpacking lcdproc (0.5.7-2) ...
Setting up libalgorithm-diff-perl (1.19.02-3) ...
Setting up libcarp-assert-perl (0.21-1) ...
Setting up libcarp-assert-more-perl (1.14-1) ...
Setting up libclass-data-inheritable-perl (0.08-2) ...
Setting up libclone-perl (0.37-1+b1) ...
Setting up libdevel-stacktrace-perl (1.3400-1) ...
Setting up libexception-class-perl (1.38-1) ...
Setting up libfile-which-perl (1.09-1) ...
Setting up libfile-homedir-perl (1.00-1) ...
Setting up libhash-merge-perl (0.200-1) ...
Setting up libjson-perl (2.61-1) ...
Setting up liblist-moreutils-perl (0.33-2+b1) ...
Setting up liblog-log4perl-perl (1.44-1) ...
Setting up libmouse-perl (2.3.0-1+b1) ...
Setting up libmousex-nativetraits-perl (1.09-2) ...
Setting up libmousex-strictconstructor-perl (0.02-1) ...
Setting up libparse-recdescent-perl (1.967009+dfsg-1) ...
Setting up libpath-tiny-perl (0.058-1) ...
Setting up libpod-pom-perl (0.29-1) ...
Setting up libtext-diff-perl (1.41-1) ...
Setting up libyaml-perl (1.13-1) ...
Setting up libconfig-model-perl (2.061-1) ...
Setting up libconfig-model-lcdproc-perl (2.042-3) ...
Setting up i2c-tools (3.1.1-1) ...
/run/udev or .udevdb or .udev presence implies active udev.  Aborting MAKEDEV invocation.
Setting up lcdproc (0.5.7-2) ...
Fixing lcdproc configuration...
Warning in 'server DriverPath' value '/usr/lib//lcdproc/': missing DriverPath dir (code is: ' defined $_ ? -d : 1')
Can't exec "/usr/bin/dpkg-architecture": No such file or directory at (eval 73) line 1, <GEN0> line 58.
cannot run dpkg-architecture at (eval 73) line 2, <GEN0> line 58.
Use of uninitialized value $triplet in scalar chomp at (eval 73) line 3, <GEN0> line 58.
Use of uninitialized value $triplet in concatenation (.) or string at (eval 73) line 4, <GEN0> line 58.
Can't exec "/usr/bin/dpkg-architecture": No such file or directory at (eval 75) line 1, <GEN0> line 58.
cannot run dpkg-architecture at (eval 75) line 2, <GEN0> line 58.
Use of uninitialized value $triplet in scalar chomp at (eval 75) line 3, <GEN0> line 58.
Use of uninitialized value $triplet in concatenation (.) or string at (eval 75) line 4, <GEN0> line 58.
Can't exec "/usr/bin/dpkg-architecture": No such file or directory at (eval 129) line 1.
cannot run dpkg-architecture at (eval 129) line 2.
Use of uninitialized value $triplet in scalar chomp at (eval 129) line 3.
Use of uninitialized value $triplet in concatenation (.) or string at (eval 129) line 4.
Can't exec "/usr/bin/dpkg-architecture": No such file or directory at (eval 131) line 1.
cannot run dpkg-architecture at (eval 131) line 2.
Use of uninitialized value $triplet in scalar chomp at (eval 131) line 3.
Use of uninitialized value $triplet in concatenation (.) or string at (eval 131) line 4.
Can't exec "/usr/bin/dpkg-architecture": No such file or directory at (eval 134) line 1.
cannot run dpkg-architecture at (eval 134) line 2.
Use of uninitialized value $triplet in scalar chomp at (eval 134) line 3.
Use of uninitialized value $triplet in concatenation (.) or string at (eval 134) line 4.
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
osmc@osmc:~$**strong text**

So, I don’t know where’s the problem and I don’t know how to solve it.
Did anyone get an HD44780 LCD display working through i2c in OSMC?
And if it’s possible, what am I doing wrong?
[1]: OSMC Forums

Are you running on RPi2?
If yes then it might be lcdproc that is broken.
In which case see the patch that I submitted to the lcdproc Sourceforge site.

Read the error messages :slight_smile:

dpkg-architecture is missing, also it will complaint about missing gcc. install it via

sudo apt-get install dpkg-dev gcc

then reconfigure lcdproc

sudo dpkp-reconfigure lcdproc

the above will install lcdproc correctly.
Speaking of HD44780 - it will not work with installed binary, 'cause it missing a driver for this LCD. You would have to compile a version of lcd proc yourself from sources.

1 Like

Thank you, @GrAnD.
Okay, now I have dpkg and gcc installed, but the lcd still doesn’t work.
I’ve followed the steps here: https://www.parallella.org/2014/04/17/driving-a-display-with-i2c-and-lcdproc/, to install the lcdproc modified version. I had to install the dependencies. Now only shows me three error messages whe I install the lcdproc package:

Warning in 'server DriverPath' value '/usr/lib//lcdproc/': missing DriverPath dir (code is: ' defined $_ ? -d : 1')                                                                                        

Changes applied to lcdproc configuration:
- server DriverPath: '/usr/lib//lcdproc/' -> '/usr/lib/arm-linux-gnueabihf/lcdproc/' # applied fix                                                                                       

update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults                                                                           

I tryed to configure LCDd, and I restarted the service after that, but the LCD display doesn’t show anything, ang when I try to use LCDd or lcdproc commands it returns a segmentation error.

I configured LCDd well, cheking the LCD i2c port, I reconfigured all and reinstalled the modified lcdproc from the modified .deb files(from the link above). Also, OSMC has the lcdproc plugin.
What am I doing wrong now?
.

Thanks patched so file works great for me.

@mcobit, could you use the LCD display?
Did it show anything?
I can’t use mine, even with the patch.

Yes, it works for me. Needed to install lcdproc from repository:

sudo apt-get install lcdproc lcdproc-extra-drivers

Then copied the patched hd47780.so file from here LCDproc / Patches / #21 Add Raspberry Pi 2 support to existing HD44780-rpi driver over the existing one in /usr/lib/arm-linux-gnueabihf/lcdproc/

Then edited the configfile /etc/LCDd.conf to look like this:

## This file was written by cme command.
## You can run 'cme edit <application>' to modify this file.
## Run 'cme list' to get the list of applications available on your system
## You may also modify the content of this file with your favorite editor.

#Driver=hd44780


#DriverPath=/usr/lib/arm-linux-gnueabihf/lcdproc/

## Hitachi HD44780 driver ##
[hd44780]
ConnectionType=raspberrypi
D7=18
D6=23
D5=24
D4=25
RS=7
EN=8
Size=16x2

# LCDd.conf
#
# This file contains the configuration for the LCDd server.
#
# The format is ini-file-like. It is divided into sections that start at
# markers that look like [section]. Comments are all line-based comments,
# and are lines that start with '#' or ';'.
#
# The server has a 'central' section named [server]. Further each driver
# has a section which defines how the driver acts.
#
# The drivers are activated by specifiying them in a driver= line in the
# server section, like:
#
#   Driver=curses
#
# This tells LCDd to use the curses driver. The first driver that is
# loaded and is capable of output becomes 'the' output driver.
# All extra drivers can only serve as input.
# The default driver to use is curses.
#
# The drivers can read their own options from the config file, but most of
# them don't do this yet. They expect 'command-line'-format parameters that
# were previously placed on the command line. These parameters can be
# given to the driver in the following way:
#
#   Arguments="place arguments here"
#
# The arguments between the quotes are passed to the driver.
# As said before these are the same arguments that the driver would have
# been passed under the old command line format of
#
#   -d <driver> "<driverargs>"
#
# Note that the -d option still works, but not allows driverargs anymore.
# If -d is specified on the command line, the Driver= options in the
# config file are ignored.


[server]
# Server section with all kinds of settings for the LCDd server

#Driver=none
#Driver=curses
Driver=hd44780
DriverPath=/usr/lib/arm-linux-gnueabihf/lcdproc/
#Driver=lcdm001
#Driver=MtxOrb
#Driver=CFontz
#
# Tells the server to load the given drivers. Multiple lines can be given.
# NOTE: You may activate several input (input only) drivers but only ONE output
#       driver, which should be the first.

Bind=127.0.0.1
# Tells the driver to bind to the given interface

Port=13666
# Listen on this specified port; defaults to 13666.

#ReportLevel=5
# Sets the reporting level; defaults to 2 (warnings and errors only).
# ReportLevel=0 means NO DEBUG. This will avoid a flood of syslog ...

ReportToSyslog=no
# Should we report to syslog instead of stderr ? Default: no

WaitTime=5
# Sets the default time in seconds to displays a screen.

User=nobody
# User to run as.  LCDd will drop its root priviledges,
# if any, and run as this user instead.

ServerScreen=no
# Enables the built-in server screen [Default: no]
# yes      : always,
# no       : when there are no other screens active.

Foreground=no
# The server will stay in the foreground if set to true.
# Otherwise the server will fork to background and report
# to syslog

# TIP: The following options can also be modified from the
#      server menu (which requires a driver that supports input)

Heartbeat=open
# The server has serveral heartbeat modes
#   on    Stays on all the time
#   off   Stays off all the time
#   slash Rotating slash all the time
#   open  Can be controlled by all clients

InitialHeartbeat=on
# This sets the initial heartbeat state if the heartbeat mode is "open"
# Affects the server screen only ;)
#   on    Heartbeat activated
#   off   Heartbeat disabled
#   slash Heartbeat replaced with a rotating slash

Backlight=open
# The server has serveral backlight modes
#   on    Stays on all the time
#   off   Stays off all the time
#   open  Can be controlled by all clients

InitialBacklight=on
# This sets the initial backlight state if the backlight mode is "open"
# Affects the server screen only ;)

BacklightBrightness=255
# This sets the backlight brightness in state "on"
# NOTE: Not all drivers/devices support setting the brightness this
#       way. Some don't support switching the backlight on/off at all,
#       some can switch the backlight on or off only. If the latter is
#       the case BacklightBrightness must be > 0.


BacklightOffBrightness=0
# This sets the backlight brightness in state "off"
# NOTE: Not all drivers/devices support setting the brightness this
#       way. Some don't support switching the backlight on/off at all,
#       some can switch the backlight on or off only. If the latter is
#       the case BacklightBrightness must be = 0.


[input]
# Input section with settings that are related to input handling
# NOTE: Not all drivers have input functionality

# keypad settings
# Keyname      Function
#              Normal context              Menu context
# -------      --------------              ------------
#
# PauseKey     Pause/Continue              Enter/select
# BackKey      Back(Go to previous screen) Up/Left
# ForwardKey   Forward(Go to next screen)  Down/Right
# MainMenuKey  Open main menu              Exit/Cancel

#FreePauseKey=yes
# If set to yes, this prevents LCDd from handling the PauseKey itself

#FreeBackKey=yes
# If set to yes, this prevents LCDd from handling the BackKey itself

#FreeForwardKey=yes
# If set to yes, this prevents LCDd from handling the ForwardKey itself

#FreeMainMenuKey=no
# If set to yes, this prevents LCDd from handling the MainMenuKey itself
# TIP: Even if you "free" the above keys, you can still use the menu
#      provided you set FreeMainMenuKey=no

After that do:

sudo /etc/init.d/LCDd restart

Then install and activate the lcdproc addon in kodi.

Edit: Maybe this line is your problem?

ConnectionType=raspberrypi

I needed to change rpi to raspberrypi.

Does you display show a line of white blocks?
If not, it is not connected properly.

No, it doesn’t.
I’ll try to change the ConnectionType line when retropie finishes installing.
I’m trying to connect the display through i2c, not through GPIO

It still doesn’t work.
The ConnectionType line isn’t the problem, as I’m using i2c.
I tried to use the patch, but it didn’t solve my problem.
Does anyone have a LCD working using i2c?

Hi @mcobit, I’m trying to install the HD44780 16x2 LCD screen on my Raspberry Pi2 Model B and I’ve followed all your instructions above but all I get on my screen is a line of blocks on the top row. Do you have any tips for me? I could really do with some help.

229 days old. so yeah
BUT…
So @fraret or someone got it works LCD through i2c ?

I’m really curious…

I couldn’t. I don’t have much free time, and tvheadend is eating a lot of it. I’ll post here if I get to make it work, but first I have to set up a OSMC installation that works properly.
Also, I have 0 experience with i2c, and no knowledge of how serial communication works, so if it isn’t supported by the kernel I won’t be able to patch it.

Thanks the response :slight_smile:
Why is I asked… I’ve built an new media center with 20x4 LCD through i2c !
Took me one weeks till get it works the LCD using i2c serial inreface, your above tut not really valid, i know not by You !
No one giving us proper valid damn tutorial.
I solved

So you solved the problem and also are not going to write up a valid tutorial?

@mcobit lol still writing the tutorial
but!
Can You help me for writing this in perfect English ?
When i done i’ll send you via PM and edit if needed…

Regards.

I can try to help if you like.
I’m no native speaker either but I’ll do what I can.
My native language is german btw.

Edit: I’ve got a spare hd44780 here. I will try to follow your instructions.

Seems i’m finished with How To guide and with pictures , but i how could send you PM?

Hello @szalay, is there any way to share your tutorial with the others, please… I’m asking because currently I’m one step away of building the i2c board for all my LCDs by myself and if there is another way it will be great and will save me a lot of time.

This is partially my fault as I wanted to refine his tutorial for readability. Will do that now.