Jump to content
meanpc

i2c LCD

Recommended Posts

Couple of questions:

 

1: Have you confirmed if I2C is talking to the LCD? You can probably read some registers to see if it gives anything back.

2: What chip do you have in the LaunchPad?

3: To what pins have you connected I2C SDA and SCL?

4: What is the I2C address?

5: Can you post your sketch so that we can have a look at it?

 

Robert

Share this post


Link to post
Share on other sites

1. I have not confirmed this with the Launchpad. The display works fine with Arduino boards, though

2. 2553

3. 14 and 15, or P1.6,P1.7

4. 0x27

5. I am using the library found here (at the bottom of the page): http://www.dfrobot.com/index.php?route= ... GYpGk3A9TI

 

I am just trying to upload the 'Hello World' sketch from that library which is:

 

//YWROBOT
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include 
#include 

LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup()
{
 lcd.init();                      // initialize the lcd 

 // Print a message to the LCD.
 lcd.backlight();
 lcd.print("Hello, world!");
}

void loop()
{
}

Share this post


Link to post
Share on other sites

I have to ask so please don't be offended. Is P1.6 connected to SCL of the display?

The Wiki says it's a 5 Volt device.. How do you have it hooked up to I2C of the LaunchPad? And what voltage are you supplying VCC on the LCD with?

Share this post


Link to post
Share on other sites
I have to ask so please don't be offended. Is P1.6 connected to SCL of the display?

The Wiki says it's a 5 Volt device.. How do you have it hooked up to I2C of the LaunchPad? And what voltage are you supplying VCC on the LCD with?

 

Not offended at all - I do stupid stuff all the time, so your questions are relevant.

 

I tried SDA and SCL connected to both 1.6 and 1.7. I have the display powered from the 5V test points near the USB connector on the launchpad. I was thinking of the display's logic being passive and not having to worry about 5V coming back to the Launchpad...but I didn't check. I just measured the voltage on SDA and SCL pins of the display while it's powered up and I'm measuring 150mV, but I don't know if that measurement is valid or not.

Share this post


Link to post
Share on other sites

First of all you will need to take care of the 3.3<->5 Volt incompatibility. Here is a good guide: http://www.savagecircuits.com/forums/co ... 3V-Devices

 

The 150mV is definitly not right and indicates that there are no pull resistors. I2C requires a pull up resistor on both SCL and SDA. You can enable the internal pull up in the msp430 on the I2C lines by doing:

 

pinMode(P1_6, INPUT_PULLUP);
pinMode(P1_7, INPUT_PULLUP);

 

Or you you can put external pull up resistors on both lines.

 

Be carefull with the 5Volt stuff though. This could fry your msp430.

Share this post


Link to post
Share on other sites

Sorry to resurrect this but I'm looking at a similar situation and think I may have a partial solution.

 

I have VCC and GND connected to the pins next to the USB port: the first and third line of the display show signs of being "on" if I turn the contrast all the way up. SCL connected to P1.6, SDA to P1.7.

 

The datasheet for the I2C chip here indicates Vcc of 2.5-6V. Obviously that's the chip, not the display. It also specs the SCL and SDA chips as "high" when not busy, requiring pull-up resistors. Logic level voltages on those two lines are: "LOW"= -0.5 to +0.3Vdd (presumably that means "0.3 * Vdd", so with 5v would be 1.5v); and "HIGH" as 0.7Vdd ( = 3.5v with 5v Vdd) to Vdd + 0.5.

 

I think we have confirmation that some level shifting needs done on SCL & SDA.

 

 

 

But I have another issue as well. I have tried the library for the dfrobot display, and a few different revisions of Sainsmart / YwRobot boards' libraries (one of which is the linked to in a bit and doesn't compile). The ones that do compile do not show any affect on the display, likely due to the level mismatch. The recommended library for the IIC circuit board I have (reads "Arduino-IIC-LCD GY-LCD-V1" along the bottom) is here. But will not compile a sketch. It fails with an error about missing file "pins_arduino.h".

 

One other comment- if that is the IIC board on the display, the address is 0x20, not 0x27 as the vendor states.

Share this post


Link to post
Share on other sites

Made some progress using this library: http://www.xs4all.nl/~hmario/arduino/LiquidCrystal_I2C/V1.0/LiquidCrystal_I2C_V1.0.zip

 

Used +5V and ground from near the USB port to an adjustable voltage regulator. I had 4.84V on the input to the regulator and 3.74V out.

As for IIC/I2C connections, SCL to P1.6, SDA to P1.7.

 

Sketch:

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x20,20,4);  // set the LCD address to 0x20 for a 20 chars and 4 line display

void setup()
{
  lcd.init();                      // initialize the lcd 
 
  // Print a message to the LCD.
  lcd.backlight();
  lcd.print("43oh.com rocks!     ");
  lcd.print("Now for some RFID...");
}

void loop()
{
}
 

 

Result:

8309990726_fbac5e04ce_z.jpg

Share this post


Link to post
Share on other sites

Okay, that gave me the cajones to try something else... same sketch as above, didn't even re-load it, just unplugged the MSP from USB, removed the cables and breadboard and plugged everything back together:

 

8310001456_a9c7d60d29_z.jpg

Share this post


Link to post
Share on other sites

Something I thought worth mentioning: on the 20x4 display, it's more like a 40x2.

Line 1 overflows to line 3. When line 3 overflows, it wraps to line 2. When line 2 overflows, it wraps to line 4.

When line 4 overflows, it's back to line 1.

 

I'm sure there's something in the library to deal with that but I haven't gone there yet: I'm just happy it's working.

Share this post


Link to post
Share on other sites

why i can't just compile the code you post on top?

i'm really need to connect my IIC interface LCD1602 module to my launchpad G2553

what you guys were talking about seems just like the cure for me

but i had tried, and it didn't work.

i'm a little bit depressed right now,

could you give me some advice?

 

thanks a lot

 

the error imformation that Energia showed when i compile the "hello word" example

------

In file included from HelloWorld.cpp:2:0:
C:\energia-0101E0009\hardware\msp430\libraries\LiquidCrystal_I2C_V1/LiquidCrystal_I2C.h:80:16: error: conflicting return type specified for 'virtual void LiquidCrystal_I2C::write(uint8_t)'
C:\energia-0101E0009\hardware\msp430\cores\msp430/Print.h:55:20: error:   overriding 'virtual size_t Print::write(uint8_t)'
------

 

if you can figure it out what happened, please tell me.

Share this post


Link to post
Share on other sites

G'day,

Well it's been over a year since the last unanswered post on this  topic.

I am trying to use  a IIC module ( that's soldered to  the back of an LCD) so that it can be controlled by I2C.

The libraries mention in the posts are two Arduino's plus an IAR. Have started to rewrite the Arduino where the last post error was fixed etc

But am before I spend more time, has anyone  successfully used Energia to drive a I2C LCD.

Grant

Share this post


Link to post
Share on other sites

Yosh,

Am using a I2C to LCD port convertor (uses a PCF8574 chip) that is soldered to the 16 pins on a 1602 LCD. 

Am sure others have used this setup as one can buy the two components.

http://www.aliexpress.com/item/5pcs-lot-1602-2004-LCD-Adapter-Plate-IIC-I2C-Interface-Free-Shipping-Dropshipping/1122976396.html

and

http://www.aliexpress.com/item/IIC-I2C-1602-Serial-Blue-Backlight-LCD-Display-For-Arduino-2560-UNO-AVR-A004-Free-Shipping/690912591.html

 

All I need is a Energia library to drive this system.

Grant

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...