How to connect 4 pin LCD?

I have a lcd with a gnd, vcc, sda and scl. I also have the arduino uno. I've been trying to wire the lcd to the board and have it display the "hello world" message.

i had the gnd connected to the gnd on the uno

the vcc was connected to the 5v

the sda was connected to A5

the scl was connected to A4

any help? Thanks!!

scl to A5 sda to A4 for I2C connection. don't forget 4.7K pull up resistors. wire library and liquidcrystal_i2c library for code

what do you mean by wire resistors?

and I put the .zip file for liquidcrystal into my libraries and still nothing

the lcd backlight and all the leds light up when plugged in. Just not text gets displayed. also tried adjusting the contrasts

post your code. no way to help with so little information.

as far as the resistors, the I2C interface requires that the SDA and SCL lines be pulled up to 5v thru 4.7K resistors. you place a resistor between SDA an 5V and another from SCL to 5V.

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

LiquidCrystal_I2C lcd(0x27,16,2); // set the LCD address to 0x20 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()
{
}

I tried this, but do i need to put anything in the code to define the pins 4 and 5 as something?

Hi ski803.

maybe have a look at these two -

http://forum.arduino.cc/index.php?PHPSESSID=3duugreba8cf6ua48map0ilpu6&topic=128635.0

http://arduino-info.wikispaces.com/LCD-Blue-I2C

good luck Pedro.

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

#define I2C_ADDR    0x27  // Define I2C Address where the PCF8574A is
#define BACKLIGHT_PIN     3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7


LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

void setup(){
  lcd.begin (16,2);
  lcd.print("hello world"); 
  }

this works for my I2C lcd with PCF8574 expander.
pins A4 and A5 are the I2C pins and do not need to be defined (they already are).

Thanks for the help all, still not working

I tried this code

/* YourDuino.com Example Software Sketch
16 character 2 line I2C Display
Backpack Interface labelled “YwRobot Arduino LCM1602 IIC V1”
terry@yourduino.com */

/-----( Import needed libraries )-----/
#include <Wire.h> // Comes with Arduino IDE
// Get the LCD I2C Library here:
// https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads
// Move any other LCD libraries to another folder or delete them
// See Library “Docs” folder for possible commands etc.
#include <LiquidCrystal_I2C.h>

/-----( Declare Constants )-----/
/-----( Declare objects )-----/
// set the LCD address to 0x27 for a 20 chars 4 line display
// Set the pins on the I2C chip used for LCD connections:
// addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address

/-----( Declare Variables )-----/
//NONE

void setup() /----( SETUP: RUNS ONCE )----/
{
Serial.begin(9600); // Used to type in characters

lcd.begin(16,2); // initialize the lcd for 16 chars 2 lines, turn on backlight

// ------- Quick 3 blinks of backlight -------------
for(int i = 0; i< 3; i++)
{
lcd.backlight();
delay(250);
lcd.noBacklight();
delay(250);
}
lcd.backlight(); // finish with backlight on

//-------- Write characters on the display ------------------
// NOTE: Cursor Position: (CHAR, LINE) start at 0
lcd.setCursor(0,0); //Start at character 4 on line 0
lcd.print(“Hello, world!”);
delay(1000);
lcd.setCursor(0,1);
lcd.print(“HI!YourDuino.com”);
delay(8000);

// Wait and then tell user they can start the Serial Monitor and type in characters to
// Display. (Set Serial Monitor option to “No Line Ending”)
lcd.clear();
lcd.setCursor(0,0); //Start at character 0 on line 0
lcd.print(“Use Serial Mon”);
lcd.setCursor(0,1);
lcd.print(“Type to display”);

}/–(end setup )—/

void loop() /----( LOOP: RUNS CONSTANTLY )----/
{
{
// when characters arrive over the serial port…
if (Serial.available()) {
// wait a bit for the entire message to arrive
delay(100);
// clear the screen
lcd.clear();
// read all the available characters
while (Serial.available() > 0) {
// display each character to the LCD
lcd.write(Serial.read());
}
}
}

}/* --(end main loop )-- */

/* ( THE END ) */

It uploaded to the board but the lcd didnt display anything

also attached are some pics

another pic

I see no pull up resistors in the pictures. They must be there. Your I2C to LCD interface is the same as mine. The code I posted works on my LCD. are you SURE of the address? Try 0x3f address as that is what mine is.

When I try to put in your code i get the message attached in the pic

and how do I wire the resistors? I have them and the bread board also. Could you put a picture of the setup or something?

code3.tiff (53.7 KB)

I forgot to put in the required loop function. at the end of the sketch, after setup put:

void loop() {
}

Put a 4.7k resistor between the A4 pin and +5V, put a 4.7K resistor between A5 and +5V.

Very late reply, got a new job...

But when you mean "put a resistor between*" what does that specifically mean?*

Try the I2C Address: 0x3F

Cheers!

Ref. http://forum.arduino.cc/index.php?topic=128635.0

But when you mean "put a resistor between" what does that specifically mean?

I mean one end of the resistor goes to 5V and the other to SCK(A5). One end of another resistor to 5V and the other end of the resistor to SDA(A4).

If you want to be certain that you are using the right i2C address, run this i2C scanner

Definitely run the I2C scanner. If it finds your LCD, you'll know what address it is on. If it doesn't, that means that something isn't connected properly.

I've made a little schematic of how things should be connected, hope it helps:

groundfungus: [u]post your code[/u]. no way to help with so little information.

as far as the resistors, the I2C interface requires that the SDA and SCL lines be pulled up to 5v thru 4.7K resistors. you place a resistor between SDA an 5V and another from SCL to 5V.

Sorry to hijack the thread. I have an I2C LCD connected without the resistors. It works fine except that it does not always reset when I upload new code or hit the reset button. Are the missing resistors the reason why?

Sorry to hijack the thread. I have an I2C LCD connected without the resistors. It works fine except that it does not always reset when I upload new code or hit the reset button. Are the missing resistors the reason why?

Why not install the required resistors and find out?

Not all LCD boards with I2C interface are created the same. Some may have different I2C addresses, some will have different pins between interface and LCD, so which one do you have? Give us a URL, maybe it will tell.