[Q]hd44780 lcd screen


54 posts   Page 2 of 3   1, 2, 3
by texy » Wed Jun 06, 2012 8:50 pm
Thankyou! Somehow I missed that. Now working.
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: 2318
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by chowanec » Sun Jun 10, 2012 6:34 am
Can someone confirm that these parts are the ones to go with? I've got an idea to build a mini display for my Sonos setup so I can see what is playing on each Zone Player...

http://www.bitwizard.nl/catalog/product_info.php?products_id=69
http://www.bitwizard.nl/catalog/product_info.php?products_id=85

Is that all I would need to get this up and running?

Thanks!

-Chow
Posts: 21
Joined: Tue Jun 05, 2012 2:41 am
by texy » Sun Jun 10, 2012 6:47 am
You can do it that way, but that's not the only way. See above on how to connect an LCD directly to the pi without additional I2C interfaces.
If you already have an LCD without either a serial or I2C interface, ie just the generic parallel port module then connect it directly to the gpio lines
of the pi. I will be posting a thread shortly on how I did it, and the python code to get it to display a message.

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: 2318
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by texy » Sun Jun 10, 2012 12:45 pm
Driving LCD via python :
viewtopic.php?f=32&t=8021

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: 2318
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by meepmeep » Wed Jun 13, 2012 8:00 pm
I have a bitwizard screen connected via the i2c interface as above.

In order to control it, do I need to recompile the kernel with the right driver (eek!) or is there another way around this?
Posts: 13
Joined: Tue May 15, 2012 12:07 pm
by texy » Wed Jun 13, 2012 10:30 pm
They must of given some code examples?
If not ask them, they are nice guys.
I also have there board, haven't had time to play with it yet.
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: 2318
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by rpdom » Fri Jun 15, 2012 9:50 pm
remoraeber wrote:I can sure share my solution. However it might not be the most well-coded one ;)

Thanks, I tried your method and code and it works - although I can't get the contrast right on the displays I've tried it with :-(

I also modified the move_cursor routine to take a row and column parameter.

remoraeber wrote:5. Finally I soldered ... DB5 to GPIO15

I guessed that you meant GPIO17 here?
Posts: 3137
Joined: Sun May 06, 2012 5:17 am
Location: Essex, UK
by rew » Sun Jun 17, 2012 7:47 am
Aaargh. Lost this thread from view. Sorry.

Perhaps an I2C RTC board, and maybe a RS232 driver board to a DB-9 connector might be popular items.

Someone else was already working on the I2C RTC board. And personally I think the RPI strategy of leaving-to-software whatever CAN be left to software a good one.

So, for ethernet connected raspberries, you install NTP and it gets the time. (more accurate than a RTC!). My raspberry here is going to be GPS-connected. Gives acurate time as well :-)

The RS232 is not an issue. You can buy them from china delivered to your door for less than $3. Then they connect through USB. For interfacing with embedded processors we have the FTDI breakout board. That has 3.3V or 5V CMOS level IO.

Thanks for trying to help!

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


The LCD has a CMOS chip. This will see signals higher than about 2.5V as "high". With 3.3V signal levels the noise margin is maybe not as big as you'd like, but it can work.

What I don't like about your solution is that you power the backlight from a GPIO on the broadcom. The backlight can use up to 100mA of current and that is certainly over the limit for the broadcom chip.


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?

You need a female-female or female-male 4-pin cable. We looked into making them ourselves. But they don't look good enough and they are a lot of work. So we were hoping the hobbyists would be able to make them themselves.

We've recently found a source for affordable SPI cables. We've added them to the shop. We'll ask the supplier if they might be able to do the 4-pin I2C cables as well.

The power comes from the 'pi through the cable.

Can someone confirm that these parts are the ones to go with? I

Yes, that would work. If you place the order and ask nicely I'll make you a cable to go with it. You'll have to tolerate a bit of home-made look :-)...
I have a bitwizard screen connected via the i2c interface as above.

http://www.bitwizard.nl/wiki/index.php/ ... l_software

I only added that this morning because I found it was missing.
Sorry.

There are the userspace programs that write to the LCD. Once the kernel drivers are finished, there will be a different set of programs that will use the kernel driver. (like is going on with the SPI version of the display).
Thanks, I tried your method and code and it works - although I can't get the contrast right on the displays I've tried it with :-(
Yes, some displays work with grounded "contrast" pin.
The official rule is: you connect a potentiometer between VCC and GND and adjust the voltage with that. This is awkward. Here you see they suggest that it works with grounded VO: http://wiki.ultimaker.com/Simple_LCD_Interface_PCB1.5 It turns out this doesn't work for me.

It turns out you can use PWM to tell the LCD the contrast value. At least that works on the displays I have. And that's the trick that the bitwizard boards use.
Check out our raspberry pi addons: http://www.bitwizard.nl/catalog/
User avatar
Posts: 396
Joined: Fri Aug 26, 2011 3:25 pm
by meepmeep » Wed Jun 20, 2012 9:35 pm
Hello, I'm still not getting the i2c display to work.

I connected the expansion board to the LCD by using 4 female to female jumper leads. It wasn't clear which order the 4 should go in on the screen, so I tried both - one direction the screen lit up, the other the Raspi shut down, so I guess the first one was correct!

The screen is lit and showing 'tiny_i2c_lcd 1.4 A:00'

I'm using arch linux, so I downloaded the i2c-tools package from here http://www.lm-sensors.org/wiki/I2CTools and did 'make' and 'make install' as root (docs say configure is not required).

I then downloaded the file linked in the docs above http://www.bitwizard.nl/software/bw_rpi ... 120616.tgz, unpacked and ran 'make' and 'make install' again as root.

I then tried running commands like './clrdisplay' and './writedisplay hello'. At the terminal I get hex codes returned, no errors, but the LCD screen does nothing - just stays showing the 'tiny_i2c_lcd 1.4 A:00'.

Any ideas what I've missed? Thanks
Posts: 13
Joined: Tue May 15, 2012 12:07 pm
by rew » Thu Jun 21, 2012 5:21 am
As far as I know, they REALLY shouldn't be connected the wrong way around....

However.... It seems that your has survived. :-)

There is one little thing: It seems that its address in the eeprom has been cleared.. The tools assume address 0x82 for the LCD, and yours is now living at address 0x00.

So... Try:

send_i2c 0 0 41 42 43

and hope that you get to see ABC in the top left corner of your screen. :-)

Next, we're going to put the display back at address 0x82.

send_i2c 0 f0 82

and then powercycle the display to see if it sticks....
Check out our raspberry pi addons: http://www.bitwizard.nl/catalog/
User avatar
Posts: 396
Joined: Fri Aug 26, 2011 3:25 pm
by meepmeep » Thu Jun 21, 2012 10:35 pm
Thankyou, that works perfectly!

I also realised that the commands I was calling were using the spi versions of the c scripts and not the i2c ones.

I wrote the following bit of python to output specific strings to the LCD:
Code: Select all
#!/usr/local/bin/python
import os
import sys

os.system('./send_i2c 82 10 0')
if (len(sys.argv) >1):
    os.system('./send_i2c 82 0 '+''.join([c.encode('hex')+' ' for c in sys.argv[1]]))

...but what command do I need to send to move the cursor to the second row of the display?
Posts: 13
Joined: Tue May 15, 2012 12:07 pm
by rew » Fri Jun 22, 2012 12:38 am
The protocol is described here: http://www.bitwizard.nl/wiki/index.php/ ... 3_protocol

So you've been using: 0x10: any data clears the screen .

You want: 0x11: move the cursor to line l, position p.
Check out our raspberry pi addons: http://www.bitwizard.nl/catalog/
User avatar
Posts: 396
Joined: Fri Aug 26, 2011 3:25 pm
by meepmeep » Sun Jun 24, 2012 9:44 pm
Posts: 13
Joined: Tue May 15, 2012 12:07 pm
by aanderson » Sun Jul 01, 2012 4:51 am
I got this working as well using 6 GPIO pins. My language of choice is C# so I wrote a GPIO library for the Raspberry Pi at https://github.com/cypherkey/RaspberryPi.Net. I used the MicroLiquidCrystal library for the NetDuino as the interface.
Attachments
IMG_0256.JPG
IMG_0256.JPG (53.3 KiB) Viewed 6675 times
IMG_0255.JPG
IMG_0255.JPG (62.37 KiB) Viewed 6675 times
Posts: 12
Joined: Thu Jun 28, 2012 5:11 am
by BoogeyCZ » Mon Jul 02, 2012 9:11 pm
Hello, I connect display using GPIO and I wrote C++ library to GPIO and HD44780 functions. It supports almost all that the HD44780 provides.

You need:
BCM2835 library http://www.open.com.au/mikem/bcm2835
my GPIO library https://gitorious.org/rpi-gpio/rpi-gpio
my Display library https://gitorious.org/rpi-hd44780/rpi-hd44780

I think that usage is very easy:

Display display(Gpio::PIN_22, Gpio::PIN_24, Gpio::PIN_26,
Gpio::PIN_03, Gpio::PIN_05, Gpio::PIN_07, Gpio::PIN_11,
Gpio::PIN_13, Gpio::PIN_15, Gpio::PIN_19, Gpio::PIN_21);

display.showText("RaspberryPi");
display.showText("Hello World!");

I appreciate any help or cooperation ;)

Have a nice day
Posts: 1
Joined: Mon Jul 02, 2012 8:59 pm
by max00 » Sat Jul 07, 2012 10:20 am
Hi all,

recently i ported the arduino LiquidCrystal Library to the raspberry.
It works pretty well an offers a really easy to use programming interface (in C).

Feel free to use it:
https://bitbucket.org/marcoster/rpi_lcd/overview

Attached a picture of it running witha 4x20 display.

greets
Marco
Attachments
IMG_20120707_121014.jpg
IMG_20120707_121014.jpg (61.59 KiB) Viewed 6557 times
There are only 10 types of people in the world:
Those who understand binary, and those who don't!
Posts: 2
Joined: Sat Jul 07, 2012 9:39 am
Location: Austria
by Reider » Sat Jul 14, 2012 7:05 pm
Just an FYI. If you`re using Python as per the program Texy made up it worked perfectly for me even though it was constructed with a 16x2 LCD Module in mind. Mine is a 4x20 and though I haven`t checked for 20 characters on each line (0-19) I have got the program adjusted to suit all 4 lines. It seems each is addressed by a cmd code as follows;

Line 1 = 0
Line 2 = 64
Line 3 = 20
Line 4 = 84

and no that isn`t a mistake between Line 2 and 3, as I first assumed. Line 1 goes 0-19 and jumps to Line 3 to continue at 20 for the first character cell. Whereas Line 2 starts at 64 and ends at 83 (64-83 inc 64 as start is 20) to start at Line 4 with 84. That`s the way the onboard LCD chip is programmed and how it works.

Except, we don`t address it that way. Just to compound it even more we have to add 128 to each number before we use them. So to print a character at the start of every line, using lcd_cmd and then lcd_print after the code is entered on the line preceding it;

Line 1 = 128
Line 2 = 192
Line 3 = 148
Line 4 = 212

and Texys` amended code to suit a 20x4 LCD Module is;

Code: Select all
#!/usr/bin/python
        # -*- coding: utf-8 -*-
        #
        #       gpio_play6.py
        # Texy 2012

        import RPi.GPIO as GPIO
        import time

        def main():

            GPIO.setmode(GPIO.BCM) # use BCM I/O names
            GPIO.setup(24, GPIO.OUT) # E
            GPIO.setup(4, GPIO.OUT) # RS
            GPIO.setup(18, GPIO.OUT) # DB4
            GPIO.setup(21, GPIO.OUT) # DB5
            GPIO.setup(22, GPIO.OUT) # DB6
            GPIO.setup(23, GPIO.OUT) # DB7
            GPIO.setup(17, GPIO.OUT) # LED
            lcd_cmd(0x33) # $33 8-bit mode   
            lcd_cmd(0x32) # $32 8-bit mode   
            lcd_cmd(0x28) # $28 8-bit mode   
            lcd_cmd(0x0C) # $0C 8-bit mode   
            lcd_cmd(0x06) # $06 8-bit mode   
            lcd_cmd(0x01) # $01 8-bit mode
            lcd_cmd(128) # This is Line 1
            lcd_string("Hello Pi")
            lcd_cmd(192) # This is line 2
            lcd_string("Forum peeps!")
            lcd_cmd(148) # This is line 3
            lcd_string("Nice to")
            lcd_cmd(212) # This is line 4
            lcd_string("meet you all.")

        def lcd_cmd(bits):
           bits=bin(bits)
           bits=bits[2:]
           zeros=(8-len(bits))*"0"
           bits=zeros+bits
           GPIO.output(4, False) # RS low
           GPIO.output(18, False)
           GPIO.output(21, False)
           GPIO.output(22, False)
           GPIO.output(23, False)
           if bits[0]=="1" :
              GPIO.output(23, True)
           if bits[1]=="1" :
              GPIO.output(22, True)
           if bits[2]=="1" :
              GPIO.output(21, True)
           if bits[3]=="1" :
              GPIO.output(18, True)
           time.sleep(0.01)
           GPIO.output(24, True) # E high
           time.sleep(0.01)
           GPIO.output(24, False) # E low
           time.sleep(0.01)
           GPIO.output(18, False)
           GPIO.output(21, False)
           GPIO.output(22, False)
           GPIO.output(23, False)
           if bits[4]=="1" :
              GPIO.output(23, True)
           if bits[5]=="1" :
              GPIO.output(22, True)
           if bits[6]=="1" :
              GPIO.output(21, True)
           if bits[7]=="1" :
              GPIO.output(18, True)
           time.sleep(0.01)
           GPIO.output(24, True) # E high
           time.sleep(0.01)
           GPIO.output(24, False) # E low
           time.sleep(0.01)

        def lcd_string(message):
           msg_len = len(message)
           for i in range(msg_len):
              lcd_char(message[i])
             
             
             


        def lcd_char(bits):
           bits=bin(ord(bits))
           bits=bits[2:]
           zeros=(8-len(bits))*"0"
           bits=zeros+bits
           GPIO.output(4, True) # RS high
           GPIO.output(18, False)
           GPIO.output(21, False)
           GPIO.output(22, False)
           GPIO.output(23, False)
           if bits[0]=="1" :
              GPIO.output(23, True)
           if bits[1]=="1" :
              GPIO.output(22, True)
           if bits[2]=="1" :
              GPIO.output(21, True)
           if bits[3]=="1" :
              GPIO.output(18, True)
           time.sleep(0.01)
           GPIO.output(24, True) # E high
           time.sleep(0.01)
           GPIO.output(24, False) # E low
           time.sleep(0.01)
           GPIO.output(18, False)
           GPIO.output(21, False)
           GPIO.output(22, False)
           GPIO.output(23, False)
           if bits[4]=="1" :
              GPIO.output(23, True)
           if bits[5]=="1" :
              GPIO.output(22, True)
           if bits[6]=="1" :
              GPIO.output(21, True)
           if bits[7]=="1" :
              GPIO.output(18, True)
           time.sleep(0.01)
           GPIO.output(24, True) # E high
           time.sleep(0.01)
           GPIO.output(24, False) # E low
           time.sleep(0.01)

        if __name__ == '__main__':
           main()

    Posts: 55
    Joined: 04 Mar 2012 12:00



Thankyou to Texy for producing the program, the guys who all helped and joined in the threads we used, but also to Gordon who initially told me about the chip and its complexity in line addressing and combining lines 1/3 and 2/4 when moving to the start of the next line, this was well before I found a post on the codes.

Steve
Posts: 75
Joined: Sun Mar 04, 2012 12:00 pm
by wallarug » Thu Aug 23, 2012 10:42 am
How would I do this with an old fax machine board? It uses the HD44780 chip but I don't know how I am going to wire it. Images are on E14 site (see below).

I have a thread running on element14 forums as well: http://www.element14.com/community/thre ... 3?tstart=0
Youtube Channel: http://www.youtube.com/user/CMDenterprises
Project page: http://code.google.com/p/cmd-robot/
~~ Now selling Apps on the Google Play, WP and Apple App Stores. ~~
Posts: 432
Joined: Mon May 14, 2012 8:21 am
by mr_duck » Wed Dec 26, 2012 4:44 pm
rew wrote:The protocol is described here: http://www.bitwizard.nl/wiki/index.php/ ... 3_protocol

So you've been using: 0x10: any data clears the screen .

You want: 0x11: move the cursor to line l, position p.


Hi!

I've ordered the breakoutboard & lcd but cannot find a proper guide with pics on how to get it to work, can you snap some pictures of how to set it up?

Cheers
Posts: 6
Joined: Wed Dec 26, 2012 4:10 pm
by bgreat » Wed Dec 26, 2012 6:36 pm
AdaFruit has a nice tutorial at: Drive a 16x2 LCD with the Raspberry Pi with easy to follow directions, photos, and code.

Enjoy!
Bill
User avatar
Posts: 235
Joined: Mon Jan 23, 2012 2:09 pm
by texy » Wed Dec 26, 2012 7:03 pm
I am assuming mr duck is referring to the I2C version, but maybe not ;-)
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: 2318
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England
by mr_duck » Thu Dec 27, 2012 10:18 am
texy wrote:I am assuming mr duck is referring to the I2C version, but maybe not ;-)
Texy


Yes the l2C version :)
Posts: 6
Joined: Wed Dec 26, 2012 4:10 pm
by rew » Thu Dec 27, 2012 10:58 am
If you have the BitWizard I2C LCD, then here is het picture-howto.

I hope I have taken enough pictures to make any text redundant...

Image
Image
Image
Image
Image
Image
Image
Image
Image
Image

Let me know how you get on. :-)
Check out our raspberry pi addons: http://www.bitwizard.nl/catalog/
User avatar
Posts: 396
Joined: Fri Aug 26, 2011 3:25 pm
by mr_duck » Thu Dec 27, 2012 12:35 pm
rew wrote:If you have the BitWizard I2C LCD, then here is het picture-howto.

I hope I have taken enough pictures to make any text redundant...

Let me know how you get on. :-)


Hi!

Thank you, this is great! Although the breakoutboard I have received looks a bit different then yours (my has all the pins horizontal, 3 rows at the top, 1 at the bottom - while yours has 1 row of pins vertical and the rest horizontal) , are there any changes from the versions?
Posts: 6
Joined: Wed Dec 26, 2012 4:10 pm
by rew » Thu Dec 27, 2012 1:40 pm
The one you have was designed before we got our hands on a raspberry pi. Once we did manage to get one, we decided that some people might like to keep the breakout board within the physical dimensions of the raspberry pi. On the one I have in the pictures, we made the mistake to make a cutout of 8mm for the TV connector, while I should have "kept 8mm of the PCB". Manual sawing to get it to fit. :-(

Anyway, all the connectors have remained exactly the same. So you'd need to find the I2C connector on your board, and use that. The orientation is important too.

Here is a picture that shows the one you have.
http://www.bitwizard.nl/wiki/index.php/ ... _Pi_Serial
Image

The I2C connector is the one on the bottom right, as oriented in the picture. The red, power line would go on the left.

My cable has white, black black red. Normally black would be ground, red power, and anything else signals. So I'd have preferred the cable to be black white white red. However we're not big enough (yet) to have them make custom cables for us that remain in an attractive price bracket. So, I'm using the RED side of my cable for the POWER connection (pin 4).
Check out our raspberry pi addons: http://www.bitwizard.nl/catalog/
User avatar
Posts: 396
Joined: Fri Aug 26, 2011 3:25 pm