User avatar
podly
Posts: 38
Joined: Fri Jun 22, 2012 8:57 pm

XBMC OpenELEC and LCD HD44780 via GPIO

Wed Aug 29, 2012 6:22 pm

I was able to connect LCD HD44780 compatibile display to RPi via GPIO and drive it from OpenELEC.

Here is short VIDEO how it looks: http://www.youtube.com/watch?v=hzmBKdnMwf8

Image

It is easiest and cheapest way to connect LCD to RPi - no need to use some special i2c interfaces.

All you need is cheap HD44780 display, your RPi and few cables.

Disclaimer – As usual I am not responsible if you damage your device so follow this tutorial at your own risk.

Hardware:

Connect your RPi to LCD as follow:

LCD D7 to RPi GPIO 18 (pin 12)
LCD D6 to RPi GPIO 23 (pin 16)
LCD D5 to RPi GPIO 24 (pin 18)
LCD D4 to RPi GPIO 25 (pin 22)
LCD E to RPi GPIO 8 (pin 24)
LCD RS to RPi GPIO 7 (pin 26)

LCD RW to RPi GND (pin 6)
LCD GND to RPi GND (pin 6)
LCD V0 to RPi GND (pin 6)
LCD +5V to RPi +5V (pin 2)

If your LCD has backlight, you can connect it to +5V and GND too.

This is the easiest way. You can put some resistors for brightness control etc.
There are many diagrams in the internet.

When you connect LCD GND, V0 and +5V you should see all upper row displaying rectangles.


Software:

There are two ways:

1. better but harder way:

You need to compile OpenELEC yourself. You need to patch it before compile.
Patch is based on Paul C. patch for lcdproc: http://lists.omnipotent.net/pipermail/l ... 14035.html

Link to patch: https://dl.dropbox.com/u/101429500/lcdp ... 2.patch.gz

Unpack and put patch into: /OpenELEC.tv/packages/sysutils/lcdproc/patches/

Edit: /OpenELEC.tv/projects/RPi/options

search for:

LCD_DRIVER="irtrans,imon,imonlcd,mdm166a,MtxOrb,lis"

and replace it by:

LCD_DRIVER="irtrans,imon,imonlcd,mdm166a,MtxOrb,lis,hd44780"

Edit: /OpenELEC.tv/packages/mediacenter/xbmc-addon-settings/source/resources

search for:

<setting id="LCD_DRIVER" type="labelenum" label="2051" values="none|irtrans|imon|imonlcd|mdm166a|MtxOrb" sort="yes" default="none" />

and replace it with:

<setting id="LCD_DRIVER" type="labelenum" label="2051" values="none|irtrans|imon|imonlcd|mdm166a|MtxOrb|hd44780" sort="yes" default="none" />

2. easier way, use my compilation, but you have to stay with this version (r11850), I rather will not upload newer.

Links for kernel and SYSTEM:
https://dl.dropbox.com/u/101429500/Open ... 850.kernel
https://dl.dropbox.com/u/101429500/Open ... 850.system

Rest is this same for both ways:

Upgrade your RPi (using fresh compilation or my files) and connect to it via ssh.

Edit /storage/.config/LCDd.conf

1. Replace Driver=something to Driver=hd44780
2. In ## Hitachi HD44780 driver ## section replace ConnectionType=something to ConnectionType=rpi, Size=something to your LCD size.

Restart XBMC and go to Programs -> OpenELEC OS Settings -> LCD/VFD and change it to hd44780

Thats all, your LCD should work.

Hope that this helps someone who wants to connect LCD to RPi.
Maybe this patch can be included in official OpenELEC builds, what makes it easier for everyone.

debugging:

run 'ps auxwww' and check for LCDd process. You should see line like this:

Code: Select all

948 root       0:35 LCDd -c /storage/.config/LCDd.conf -d hd44780 -s true
If not, try to run it manually and check again.
If you correctly connected LCD you should see Welcome message from LCDd on startup.

PS

This patch allows only connecting small displays (2x16, 2x20), it is not possible to connect 4x20 (with two Enable lines) at the moment.

Image

User avatar
podly
Posts: 38
Joined: Fri Jun 22, 2012 8:57 pm

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Wed Aug 29, 2012 11:04 pm

I can't edit my post, so I add here:

Check how much current your display needs! You may need external power supply or modified RPi if your display needs high current! Most of LCD displays needs very low current without backlight.

If you want to connect backlight of your LCD, use resistor to limit current. 47ohm should be safe value.
You should check your LCD datasheet and find resistor right for your display. It will be safe, to start without backlight at all.

csilviu
Posts: 2
Joined: Tue Sep 04, 2012 11:15 pm

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Tue Sep 04, 2012 11:20 pm

Hi,

I'm trying to connect an lcd to my RPi and, using your images, I get the following error when i start LCDd:

LCDd -c /storage/.config/LCDd.conf -d hd44780 -strue

Sep 4 23:13:47 openelec user.err LCDd: Could not open driver module server/drivers/hd44780.so: server/drivers/hd44780.so: cannot open shared object file: No such file or directory
Sep 4 23:13:47 openelec user.err LCDd: Driver [hd44780] binding failed
Sep 4 23:13:47 openelec user.err LCDd: Could not load driver hd44780
Sep 4 23:13:47 openelec user.err LCDd: There is no output driver
Sep 4 23:13:47 openelec user.crit LCDd: Critical error while initializing, abort.

It's a fresh install with your SYSTEM and kernel.img

Do you have any clue?
Thanks
Silviu

csilviu
Posts: 2
Joined: Tue Sep 04, 2012 11:15 pm

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Wed Sep 05, 2012 7:33 am

I found the solution. It's in the LCDd.conf.
Instead of DriverPath=server/drivers/ should be DriverPath=/usr/lib/lcdproc/

Silviu

texy
Forum Moderator
Forum Moderator
Posts: 5174
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Thu Nov 01, 2012 9:16 pm

Hi,
I have connected one of my 44780 LCD boards to my Pi running RaspBMC and configured the LCDproc to run it via the tut found here :
http://www.tech-fruits.com/archives/4388

However for my LCD I am driving the backlight via one of the GPIO lines. There is an option in the conf file to enable the backlight, but there is nowhere to state which GPIO pin to use to switch it on/off.

Not sure who to request this from. I,m certainly not clever enough to write the code or apply a patch to LCDproc myself :roll:

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
Boeeerb
Posts: 43
Joined: Thu Sep 27, 2012 2:40 am

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Fri Nov 02, 2012 3:54 am

texy wrote:Hi,
I have connected one of my 44780 LCD boards to my Pi running RaspBMC and configured the LCDproc to run it via the tut found here :
http://www.tech-fruits.com/archives/4388

However for my LCD I am driving the backlight via one of the GPIO lines. There is an option in the conf file to enable the backlight, but there is nowhere to state which GPIO pin to use to switch it on/off.

Not sure who to request this from. I,m certainly not clever enough to write the code or apply a patch to LCDproc myself :roll:

Texy
Hi Texy,

I wrote the tutorial on Tech-Fruits and never really thought about controlling backlight as I like the faint blue glow :D , but I will start having a look into it. I did see that LCDproc does support one but never delved into supporting it myself.

Watch this space! (Or my twitter feed)


Jason
T: @Boeeerb
Find me on Twitter - @Boeeerb
Website - http://www.boeeerb.co.uk

texy
Forum Moderator
Forum Moderator
Posts: 5174
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Fri Nov 02, 2012 7:13 am

I don't do twitter, so this place is good for me!
If you wanted to really wanted to push the boat out you could implement the hardware PWM GPIO line on 18 ;-)
Thanks
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
Boeeerb
Posts: 43
Joined: Thu Sep 27, 2012 2:40 am

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Wed Nov 07, 2012 1:54 pm

I don't think LCDproc supports PWM so you could run a Python script along side to use that.

I have modified the driver so it now support backlight control (on and off), so enter the following into your terminal/PuTTY session...

cd lcdproc
rm hd44780.so
wget http://dl.dropbox.com/u/29632026/hd44780.so
sudo nano /etc/LCDd.conf

Scroll down to the pin configurations in the HD44780 section, where it says D7=18, D6=23 etc etc
Add on the next line

BL=4

Or if your using a different pin for the backlight change as required.
Now few lines down edit the Backlight=no to yes
CTRL + X and yes to save, now restart the LCDproc daemon via

sudo /etc/init.d/LCDd restart
Find me on Twitter - @Boeeerb
Website - http://www.boeeerb.co.uk

texy
Forum Moderator
Forum Moderator
Posts: 5174
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Fri Nov 09, 2012 8:55 pm

Boeeerb wrote:I don't think LCDproc supports PWM so you could run a Python script along side to use that.

I have modified the driver so it now support backlight control (on and off), so enter the following into your terminal/PuTTY session...

cd lcdproc
rm hd44780.so
wget http://dl.dropbox.com/u/29632026/hd44780.so
sudo nano /etc/LCDd.conf

Scroll down to the pin configurations in the HD44780 section, where it says D7=18, D6=23 etc etc
Add on the next line

BL=4

Or if your using a different pin for the backlight change as required.
Now few lines down edit the Backlight=no to yes
CTRL + X and yes to save, now restart the LCDproc daemon via

sudo /etc/init.d/LCDd restart
Apologies for the delay in responding. I am very please to say that your new code is working a treat :

Image
Image
All that needs to do be done now is to get LCDproc to autoboot ;-)

Thanks again,
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

User avatar
Boeeerb
Posts: 43
Joined: Thu Sep 27, 2012 2:40 am

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Mon Nov 12, 2012 12:32 am

Looking good!

Still not figured out Raspbmc's problem, I think I know what it is, but can't figure a way to fix it. Very frustrating.
Find me on Twitter - @Boeeerb
Website - http://www.boeeerb.co.uk

texy
Forum Moderator
Forum Moderator
Posts: 5174
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Mon Nov 12, 2012 7:03 pm

I had only a little play with the scroll delay by creating an advancedsettings.xml.
Didn't quite have the effect I wanted, but at least it did slow down the scroll.
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

texy
Forum Moderator
Forum Moderator
Posts: 5174
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Tue Nov 27, 2012 7:27 pm

These are the LCDproc.conf settings when using my LCD Pi add on board,
these are all in the [hd44780] section :

Code: Select all

# Select what type of connection. See documentation for types.
ConnectionType=rpi
D7=21
D6=23
D5=22
D4=24
RS=17
EN=4
BL=18
And also enable the backlight:

Code: Select all

# If you have a switchable backlight.
Backlight=yes
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

texy
Forum Moderator
Forum Moderator
Posts: 5174
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Wed Nov 28, 2012 8:28 pm

Boeeerb wrote:Looking good!

Still not figured out Raspbmc's problem, I think I know what it is, but can't figure a way to fix it. Very frustrating.
I,ve just tried the latest version of raspbmc and LCDproc is now auto starting :D

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

adamrblack
Posts: 2
Joined: Sun Oct 21, 2012 9:23 pm

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Thu Nov 29, 2012 1:16 am

texy wrote:
Boeeerb wrote:Looking good!

Still not figured out Raspbmc's problem, I think I know what it is, but can't figure a way to fix it. Very frustrating.
I,ve just tried the latest version of raspbmc and LCDproc is now auto starting :D

Texy
Just need a

Code: Select all

sudo update-rc.d LCDd defaults
and everything works great!

canibalimao
Posts: 557
Joined: Tue Aug 07, 2012 8:48 pm
Location: Portugal

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Sat Dec 01, 2012 1:39 pm

Is there any way to put this working with openELEC without need to recompile it? Can I just install some package(s) on the distro I already have running?

texy
Forum Moderator
Forum Moderator
Posts: 5174
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Sat Dec 01, 2012 7:02 pm

canibalimao wrote:Is there any way to put this working with openELEC without need to recompile it? Can I just install some package(s) on the distro I already have running?
I didn't do any compiling - I followed the tutorial here :
http://www.dhl.co.uk/content/gb/en/expr ... 9843%0D%0A


Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

sraue
Posts: 144
Joined: Tue Feb 28, 2012 12:36 am
Location: Switzerland

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Sun Dec 02, 2012 1:26 am

canibalimao wrote:Is there any way to put this working with openELEC without need to recompile it? Can I just install some package(s) on the distro I already have running?
the way is to fill a feature request on https://github.com/OpenELEC/OpenELEC.tv/issues with much as possible info how to do this, samples and or howtos. :-)

canibalimao
Posts: 557
Joined: Tue Aug 07, 2012 8:48 pm
Location: Portugal

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Mon Dec 03, 2012 9:59 am

texy wrote:
canibalimao wrote:Is there any way to put this working with openELEC without need to recompile it? Can I just install some package(s) on the distro I already have running?
I didn't do any compiling - I followed the tutorial here :
http://www.dhl.co.uk/content/gb/en/expr ... 9843%0D%0A


Texy
Didn't you past the wrong link? :mrgreen:

sraue wrote:
canibalimao wrote:Is there any way to put this working with openELEC without need to recompile it? Can I just install some package(s) on the distro I already have running?
the way is to fill a feature request on https://github.com/OpenELEC/OpenELEC.tv/issues with much as possible info how to do this, samples and or howtos. :-)
But it could take a little bit to solve my "issue" there if there's any solution yet (besides the compilation using the patch posted on this thread) :(

texy
Forum Moderator
Forum Moderator
Posts: 5174
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Mon Dec 03, 2012 6:35 pm

Oooppps - yes did post the wrong link. This is what I meant to post :
http://www.tech-fruits.com/archives/4388

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

canibalimao
Posts: 557
Joined: Tue Aug 07, 2012 8:48 pm
Location: Portugal

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Mon Dec 03, 2012 7:47 pm

texy wrote:Oooppps - yes did post the wrong link. This is what I meant to post :
http://www.tech-fruits.com/archives/4388

Texy
Thank you very much! When the LCD screen arrives I'll test this! :D

texy
Forum Moderator
Forum Moderator
Posts: 5174
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Mon Dec 03, 2012 8:03 pm

...remeber to use the settings as per this post :
http://www.raspberrypi.org/phpBB3/viewt ... 91#p222616

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

canibalimao
Posts: 557
Joined: Tue Aug 07, 2012 8:48 pm
Location: Portugal

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Mon Dec 03, 2012 8:21 pm

Thank you, I don't forget about that!
I'll post here my results after the test! :mrgreen:

canibalimao
Posts: 557
Joined: Tue Aug 07, 2012 8:48 pm
Location: Portugal

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Wed Dec 05, 2012 2:55 pm

Hi again,

I can't use this tutorial on OpenELEC. It just work on raspbian. OpenELEC don't recognize the commands "apt-get" to download the drivers :(

I think that the only solution is to make my own image and compile it my self :(

texy
Forum Moderator
Forum Moderator
Posts: 5174
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Fri Dec 07, 2012 11:03 am

canibalimao wrote:Hi again,

I can't use this tutorial on OpenELEC. It just work on raspbian. OpenELEC don't recognize the commands "apt-get" to download the drivers :(

I think that the only solution is to make my own image and compile it my self :(
I used it with raspbmc, and it worked for me with my LCD board.

However, I do have a different problem. I cannot get my board to work with my new v2 rpi. Unfortunately my LCD board uses one of the GPIO lines that was moved between v1 and v2 boards, so what was GPIO-21 is now GPIO-27. I have modified the conf file to reflect this, but now the display does not work.
What I have not done yet is go back to the original hd44780.so file. I know my board works OK with my v2 rpi and other programs, ie my test program written in python, but its not working for raspbmc and LCDproc.
Anyone else able to try this?

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

canibalimao
Posts: 557
Joined: Tue Aug 07, 2012 8:48 pm
Location: Portugal

Re: XBMC OpenELEC and LCD HD44780 via GPIO

Fri Dec 07, 2012 6:58 pm

texy wrote:I used it with raspbmc, and it worked for me with my LCD board.
But in OpenELEC I don't have access to the functions that I need on the tutorial you posted (like "apt-get")... :(

Return to “Media centres”