16x4 LCD with I2c module example newbie

Hi
I'm newbie with arduino

I have a 16X4 Display with a "elecfreaks" iic/spi module.
Link: http://www.dx.com/es/p/arduino-iic-i2c-twi-spi-serial-2-6-lcd-1604-module-electronic-building-block-150818#.UzsohKJkYpQ

I try to use this library
Link: https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads

But the device don't work.

how can I use correctly this display?
Is correct this library?
any help or example will be appreciated

Thanks!!!

Please post the sketch you're using to test the library. Is it HelloWorld_i2c? Post the wiring diagram or a sharp photo of your setup where all wires are visible. What kind of Arduino are you using?

Hello,

i'm using Arduino UNO R3

the example code is:

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

#define BACKLIGHT_PIN     13

LiquidCrystal_I2C lcd(0x20);  // Set the LCD I2C address

void setup()
{

  // Switch on the backlight
  pinMode ( BACKLIGHT_PIN, OUTPUT );
  digitalWrite ( BACKLIGHT_PIN, HIGH );
  
  lcd.begin(16,4);               // initialize the lcd 
  lcd.home ();                   // go home
  lcd.print("Hello, ARDUINO ");  
  lcd.setCursor ( 0, 1 );        // go to the next line
  lcd.print (" FORUM - fm   ");
}

void loop()
{

}

The photo of the system is:

LiquidCrystal_I2C lcd(0x20);  // Set the LCD I2C address

Why did you choose the address 0x20? Most of these devices use 0x27 or 0x3F. Did you cut the address bridges on the PCB? Have you tried an I2C scanner?

The address is correct.
I have used the IC_scanner and the result is:

I2C Scanner
Scanning...
I2C device found at address 0x20 !
done

In this case it doesn't look like any of the standard devices. On the page you linked I cannot find a datasheet or manual. You should never buy stuff from a supplier that doesn't provide datasheets.
Are you able to get the a photo of the other side of the smaller PCB, so we might find out what chips are mounted there? The library you're using is built for an I2C IO expander module that then drives the 4bit LCD interface. Because your module also offers an SPI interface it probably is controlled by a microprocessor and may speak a higher level "protocol".

I have found the display's web:
http://www.elecfreaks.com/store/i2cspi-lcd1604-moduleblack-on-green-p-432.html

In this web you can find the Library and the schematic.

I have tested it, but the display not work properly.

/*
 Demonstration sketch for Adafruit i2c/SPI LCD backpack
 using MCP23008 I2C expander
 ( http://www.ladyada.net/products/i2cspilcdbackpack/index.html )

 This sketch prints "Hello World!" to the LCD
 and shows the time.
 
  The circuit:
 * 5V to Arduino 5V pin
 * GND to Arduino GND pin
 * CLK to Analog #5
 * DAT to Analog #4
*/

// include the library code:
#include <Wire.h>
#include <LiquidCrystal.h>

// Connect via i2c, default address #0 (A0-A2 not jumpered)
LiquidCrystal lcd(0);

void setup() {
  // set up the LCD's number of rows and columns: 
  lcd.begin(16, 4);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);

  lcd.setBacklight(HIGH);
  delay(500);
  lcd.setBacklight(LOW);
  delay(500);
}

Does at least the backlight blink?

I would try to modify the library and check the return value of Wire.endTransmission() and Wire.requestFrom(). If they are 0 there was an I2C error (NAK received in most cases) and you know that you have to look for hardware errors.

Have you tried to turn the contrast knob on the i2c backpack?

Example for 1604 with i2c pcf8574 :

//Compatible with the Arduino IDE 1.6.5
//Library version:1.1
//   A4 - SCL, A5 - SDA, VCC, GND
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x3f,16,4);  // set the LCD address to 0x27 or 0x20

void setup()
{
  lcd.init();                      // initialize the lcd 
  lcd.init();                      // Print a message to the LCD.
  lcd.backlight();
  lcd.setCursor(0,0);
  lcd.print("Hello, world!");
  lcd.setCursor(0,1);
  lcd.print("AxyeTb!");
  lcd.setCursor(0,2);
  lcd.print("I2C 1604 DEMO");
  lcd.setCursor(0,3);
  lcd.print("UGR Edition");
}


void loop()
{
}
1 Like