[Q]hd44780 lcd screen


54 posts   Page 1 of 3   1, 2, 3
by fodi » Wed Apr 18, 2012 7:17 pm
hey,

does anyone have some circuits how can we hook an lpt-port hd44780 lcd to the pi? as it would use some serious amount of gpio pins.

is there any lcds based on this chip that might use fewer wires and can be hooked up to the pi? does anyone have some drivers for that?

it would be awesome to have a little screen connected
User avatar
Posts: 112
Joined: Wed Mar 14, 2012 9:03 pm
Location: Hungary
by jamesh » Wed Apr 18, 2012 7:36 pm
Foundations aim is to sell a screen at some point. However, cameras are more important at the moment so screens will have to wait a bit.
Soon to be unemployed software engineer currently specialising in camera drivers and frameworks, but can put mind to most embedded tasks. Got a job in N.Cambridge or surroundings? I'm interested!
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11581
Joined: Sat Jul 30, 2011 7:41 pm
by mahjongg » Wed Apr 18, 2012 7:48 pm
Obviously the R-PI doesn't have a Centronics parallel LPT: (printer) port, but just like there are USB to RS232 (COM: port) adapters there are also USB to LPT: port adapters. It a basic feature of the USB standard to support /replace "legacy devices".
User avatar
Forum Moderator
Forum Moderator
Posts: 4962
Joined: Sun Mar 11, 2012 12:19 am
by repvik » Wed Apr 18, 2012 9:09 pm
fodi said:


hey,

does anyone have some circuits how can we hook an lpt-port hd44780 lcd to the pi? as it would use some serious amount of gpio pins.

is there any lcds based on this chip that might use fewer wires and can be hooked up to the pi? does anyone have some drivers for that?

it would be awesome to have a little screen connected


Use I2C. BitWizard.nl has a breakout board:

http://www.bitwizard.nl/catalo.....kudl2pkem0

You can then connect a bunch of displays on the I2C bus:

http://www.bitwizard.nl/catalo.....kudl2pkem0

Oh, and BTW, I'm pretty sure LCDProc can control HD47780 over I2C :)

(I'm not affiliated with BitWizard, but I happen to have bought these items from them. I haven't received my RPI yet so I haven't tested them)
Posts: 4
Joined: Sun Mar 18, 2012 7:59 am
by texy » Wed Apr 18, 2012 9:48 pm
You can parallel drive a HD47780 with only 6 gpio lines and the Pi has plenty spare of those. You may have to level shift from 3.3v to 5v however.
T.
"2.8inch TFT LCD + Touch screen" add-on boards for sale here :
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=93&t=65566
50p goes to the Foundation ;-)
Forum Moderator
Forum Moderator
Posts: 2316
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by naicheben » Thu Apr 19, 2012 12:14 pm
Might work with a level shifter like this

Haven't tried it jet, but I think it looks good. Now I'm only searching for a DIP version of this or similar chip.
Posts: 346
Joined: Sat Jan 28, 2012 12:28 pm
by plugwash » Thu Apr 19, 2012 12:40 pm
Assuming you only need 6 outputs and no inputs a 74HCT04 should do what you want.
Forum Moderator
Forum Moderator
Posts: 2179
Joined: Wed Dec 28, 2011 11:45 pm
by rew » Thu Apr 19, 2012 2:24 pm
It works!

Raspberry pi connected to SPI_LCD and I2C_LCD.

Get yours from: http://www.bitwizard.nl/catalo.....p?cPath=34

I've got preliminary software working: http://www.bitwizard.nl/softwa.....120419.tgz
Check out our raspberry pi addons: http://www.bitwizard.nl/catalog/
User avatar
Posts: 396
Joined: Fri Aug 26, 2011 3:25 pm
by HansH » Thu Apr 19, 2012 5:26 pm
Good job Roger…

Aah you sell them also… when I get my Pi I will buy one or more boards from you..

breakout board is super...http://www.bitwizard.nl/catalo.....ucts_id=69
Posts: 212
Joined: Mon Sep 05, 2011 7:49 am
by Fede » Wed May 16, 2012 11:01 am
wow! Very interesting thing!
that board could drive a graphical display? which graphical display I need to find?
thanks for the replies
Posts: 14
Joined: Sun May 13, 2012 5:39 pm
Location: Italy
by cbaurtx » Sun May 20, 2012 1:42 pm
You can use a PCF8574P port extender which converts i2c to parallel. A detailed description is here:

http://lcdproc.sourceforge.net/docs/sta ... 2c.circuit

Also some HD44780 based LCD displays fashion a i2c interface already. I plan to go with the PCF8574P.
You have to run the PCF8574P and the LCD display with 3.3V. A 5V LCD should work if the IOs are 3.3V compatible.
Posts: 6
Joined: Sun Oct 30, 2011 7:49 pm
by UncleDave » Mon May 21, 2012 8:26 pm
Out of complete ignorance.......why not connect a LCD panel directly to the GPIO pins?

UD.
Posts: 24
Joined: Tue Feb 21, 2012 6:49 pm
by mahjongg » Mon May 21, 2012 10:38 pm
This board makes it slightly simpler to wire the LCD to the RPI's pinheader, because it converts the signals to a more manageable form, one that bitwizard has expansion boards for. That is almost all it does.

I'm not sure if the people from bitwizards read this, but kudos ("goed gedaan hoor") for your work.
Perhaps an I2C RTC board, and maybe a RS232 driver board to a DB-9 connector might be popular items.

And perhaps a better name for the "Raspberry serial BOB board", perhaps "raspberry breakout board to expansion boards" describes it functions better, I thought this name was slightly confusing.
User avatar
Forum Moderator
Forum Moderator
Posts: 4962
Joined: Sun Mar 11, 2012 12:19 am
by texy » Wed May 23, 2012 8:30 am
UncleDave wrote:Out of complete ignorance.......why not connect a LCD panel directly to the GPIO pins?

UD.


It can be done with suitable level shifting, but the Pi's I/O is 3.3volt and most LCD modules are 5volt.
That's why you can't directly connect an LCD to the Pi's GPIO - I am assuming you are referinf to parallel connection.
Texy
"2.8inch TFT LCD + Touch screen" add-on boards for sale here :
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=93&t=65566
50p goes to the Foundation ;-)
Forum Moderator
Forum Moderator
Posts: 2316
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by jannis » Wed May 23, 2012 8:44 am
I don't think you need the level-shifters since you usually only send from the Pi to the LCD and don't need to read any data coming from the display. And most 5V-pins will read 3.3V as a logical "1" so it might just work. But don't blame me if you fry anything while trying :P
Posts: 55
Joined: Tue Jan 17, 2012 3:48 pm
by remoraeber » Wed May 23, 2012 9:20 am
jannis wrote:I don't think you need the level-shifters since you usually only send from the Pi to the LCD and don't need to read any data coming from the display. And most 5V-pins will read 3.3V as a logical "1" so it might just work. But don't blame me if you fry anything while trying :P


Yes jannis, you are right. One can perfectly attach a 5V LCD directly to the GPIO ports. I have quickly done so recently
lcd.jpg
lcd.jpg (44.96 KiB) Viewed 19333 times
Posts: 3
Joined: Wed May 23, 2012 9:14 am
by UncleDave » Wed May 23, 2012 10:41 am
remoraeber wrote:
jannis wrote:I don't think you need the level-shifters since you usually only send from the Pi to the LCD and don't need to read any data coming from the display. And most 5V-pins will read 3.3V as a logical "1" so it might just work. But don't blame me if you fry anything while trying :P


Yes jannis, you are right. One can perfectly attach a 5V LCD directly to the GPIO ports. I have quickly done so recently
lcd.jpg


I assume that you were able to communicate with the LCD. Are you willing to share what you did and how with us?

Thanks

UD.
Posts: 24
Joined: Tue Feb 21, 2012 6:49 pm
by jannis » Wed May 23, 2012 12:16 pm
Just another method that I had running on my AVR32-based NGW100:
http://lcdproc.sourceforge.net/docs/lcd ... d44780-i2c

You can use the lcdproc-software with the I2C-kernel-driver for the RPi. The IC used in this setup is pretty cheap and you can even use 40x4-displays when you can live without backlight-switching.
Posts: 55
Joined: Tue Jan 17, 2012 3:48 pm
by remoraeber » Wed May 23, 2012 12:52 pm
UncleDave wrote:I assume that you were able to communicate with the LCD. Are you willing to share what you did and how with us?

Thanks

UD.


I can sure share my solution. However it might not be the most well-coded one ;)

During wiring I was looking at the specifications in this wiki: http://elinux.org/RPi_Low-level_peripherals

1. I soldered GND, VB0 (Backlight Ground) and V0 (Contrast Adjustment) of the LCD to the GND pin of the Raspi.
2. I soldered Vcc (Supply voltage of the whole module) to the pin labeled 5V0
3. I then soldered VB1 (Backligt Supply Voltage) to GPIO18 so I can turn backlight on/off programmatically. Of course you can also use Vcc or not even attach it at all
4. I then soldered R/W of the LCD to GND in order to have it in write mode all the time and then wired RS (register select) to GPIO24 and E (enable, the pulse which tells the LCD to read the values on the datalanes) to GPIO23
5. Finally I soldered DB4 to GPIO4, DB5 to GPIO15, DB6 to GPIO21 and DB7 to GPIO22. The other pins have been intentionally left free. I accessed the screen in 4-bit mode to save some wires
6. My source code at http://pastie.org/3954992 was then basically created using the example on the wiki & some googling.

PS: Of course i did not solder the cables directly to the Raspi but to a connector i had lying around
Posts: 3
Joined: Wed May 23, 2012 9:14 am
by UncleDave » Thu May 24, 2012 6:38 am
remoraeber wrote:I can sure share my solution. However it might not be the most well-coded one ;)


Thank you for sharing, it's still coded better than any C I could write!

:mrgreen:

UD
Posts: 24
Joined: Tue Feb 21, 2012 6:49 pm
by meepmeep » Thu May 24, 2012 5:21 pm
Hello I would like to set up an LCD display but am new to this hardware.

What cable do I need to connect the bitwizard raspi breakout board to the i2c LCD display?

And how do I power the i2c LCD module?
Posts: 13
Joined: Tue May 15, 2012 12:07 pm
by UncleDave » Thu May 24, 2012 6:30 pm
remoraeber wrote:
I can sure share my solution. However it might not be the most well-coded one ;)

During wiring I was looking at the specifications in this wiki: http://elinux.org/RPi_Low-level_peripherals

1. I soldered GND, VB0 (Backlight Ground) and V0 (Contrast Adjustment) of the LCD to the GND pin of the Raspi.
2. I soldered Vcc (Supply voltage of the whole module) to the pin labeled 5V0
3. I then soldered VB1 (Backligt Supply Voltage) to GPIO18 so I can turn backlight on/off programmatically. Of course you can also use Vcc or not even attach it at all
4. I then soldered R/W of the LCD to GND in order to have it in write mode all the time and then wired RS (register select) to GPIO24 and E (enable, the pulse which tells the LCD to read the values on the datalanes) to GPIO23
5. Finally I soldered DB4 to GPIO4, DB5 to GPIO15, DB6 to GPIO21 and DB7 to GPIO22. The other pins have been intentionally left free. I accessed the screen in 4-bit mode to save some wires
6. My source code at http://pastie.org/3954992 was then basically created using the example on the wiki & some googling.

PS: Of course i did not solder the cables directly to the Raspi but to a connector i had lying around


After copying everything that you've done I get the following compilation errors:
gcc -Wall -o "GPIO2" "GPIO2.c" (in directory: /root)
GPIO2.c: In function ‘setup_io’:
GPIO2.c:99: warning: pointer targets in assignment differ in signedness
GPIO2.c: In function ‘send_cmd’:
GPIO2.c:150: warning: implicit declaration of function ‘usleep’
GPIO2.c: In function ‘main’:
GPIO2.c:291: warning: control reaches end of non-void function
Compilation finished successfully.

Are you able to assist me :oops: ?

When I run the code the back light toggles but nothing appears on the screen.

Thanks

UD.
Posts: 24
Joined: Tue Feb 21, 2012 6:49 pm
by remoraeber » Fri Jun 01, 2012 8:08 pm
UncleDave, sorry for taking such a long time to respond!

The compiler warnings seem to be "ok" to me. I get the same when I compile with -Wall option.

So, now at least you know that you wired the backlight correctly ;)

A few troubleshooting hints I can give you are:
Once you have attached the LCD and booted the Raspi, but not yet run the program the LCD module should show a line of black "bricks" - If you cannot see the bricks you'll have to double-check VCC and GND. If they are OK, check the contrast pin - eventuall you'll have to use a potentiometer instead of soldering it to GND.

Should the LCD still show the "bricks" after running the program, there is something wrong with the initialization-sequence and you'll have to double-check the data-lanes. Also make sure you wired R/W to GND.
Posts: 3
Joined: Wed May 23, 2012 9:14 am
by texy » Mon Jun 04, 2012 9:58 am
Hi,
I get different errors when using gcc to compile the download :
Code: Select all
root@raspberrypi:/home/pi# gcc -Wall -o "GPIO" "gpio_lcd.cpp"
gpio_lcd.cpp: In function ‘void setup_io()’:
gpio_lcd.cpp:54: error: invalid conversion from ‘void*’ to ‘char*’
gpio_lcd.cpp:70: error: invalid conversion from ‘unsigned char*’ to ‘char*’
gpio_lcd.cpp: In function ‘void send_cmd()’:
gpio_lcd.cpp:121: error: ‘usleep’ was not declared in this scope
gpio_lcd.cpp: In function ‘void clear_screen()’:
gpio_lcd.cpp:131: error: ‘usleep’ was not declared in this scope
gpio_lcd.cpp: In function ‘void init_screen()’:
gpio_lcd.cpp:143: error: ‘usleep’ was not declared in this scope
gpio_lcd.cpp: In function ‘int main(int, char**)’:
gpio_lcd.cpp:253: warning: deprecated conversion from string constant to ‘char*’
gpio_lcd.cpp:257: warning: deprecated conversion from string constant to ‘char*’
root@raspberrypi:/home/pi#



This is using the 19042012 Debian image. What do I need to do to get this to compile? Note I edited the download for my GPIO line configuration.

Texy
"2.8inch TFT LCD + Touch screen" add-on boards for sale here :
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=93&t=65566
50p goes to the Foundation ;-)
Forum Moderator
Forum Moderator
Posts: 2316
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by anpfeiffer » Wed Jun 06, 2012 5:15 pm
Rename gpio_lcd.cpp to gpio_lcd.c
Posts: 1
Joined: Sat Jun 02, 2012 2:13 pm