aboulafia
Posts: 5
Joined: Sat Feb 02, 2013 12:36 am

I2C LCD display

Tue Feb 26, 2013 11:02 pm

Hi, I'm pulling my hairs out...

I want to drive a 2 lines LCD display http://www.dfrobot.com/wiki/index.php?t ... :_DFR0063) with my Pi
This is a HD44780 LCD + 8574 expander

Connected SDA to Pi I2C0 SDA
SCL to Pi Pi I2CO SCL
GND to Pi GND
VCC to Pi 5V (many advanced electronic users say that in this particular case it's no problem using a 5v device on the 3.3v Pi, because the Pi beeing the driver 5v is never used and the i2c device still works fine. After several hours of tries, my Pi is no yet fried. So far, so good)

i2detect -y 0

Code: Select all

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- 27 -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
So the LCD is up & running

I want to drive the LCD from a C program, and I'm using this library : https://github.com/j3557o/RPi_i2c_test/tree/master/src

Changed address to 0x27

And because I found these values on Arduino library (which drives the LCD successfully)
Changed LCD_RS from 0x20 to 0x01
Changed LCD_EN from 0x80 to 0x04

When the program executes, the LCD backlight goes on during initialisation phase, then if I try to write a string it goes off and nothing (or garbage) is displayed on the screen

ex.

Code: Select all

int main(int argc, char *argv[]){   
        char hello[] = "Funny Funny!";
        LCD_setup(); 
        usleep(500); 
        lcd_string(hello);
}
I've tried two other solutions, with the exact same result : adapted the Crystal_Clear_I2C arduino library, tried a Python one...

Reading 8574 datasheet didn't gave me a clue.

Any idea ?

User avatar
j35570
Posts: 7
Joined: Thu Oct 18, 2012 5:45 am

Re: I2C LCD display

Sat Mar 02, 2013 10:01 pm

UPDATE: Didn't see that you already used my code

Have you checked all connections thoroughly? See Image


http://raspify.stockenstrand.com

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: I2C LCD display

Sat Mar 02, 2013 11:26 pm

If you are using an I2C LCD dispaly can you put up your complete circuit and compete programme it is a bit difficult to judge what is happening.

I was unable to find the circuit of the I2C interface on the LCD display, and it may have pull-up resistors on that should be taken off as they will be pulling up to 5V not 3V3.

Did you use an example programme meant for that display or just any LCD programme?
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

Return to “Interfacing (DSI, CSI, I2C, etc.)”