No way to make work this I2C LCD

Hi people.

I don’t know what else to try. I have an LCD with an PCF8574AT I2C backpack.

The wiring on electronics are:

A5-SCL
A4-SDA
GND-GND
5V-VCC

Scanner says that I2C address is 0x3F

And using this code I have taken from another thread:

/*
** Example Arduino sketch for SainSmart I2C LCD Screen 16x2
** based on https://bitbucket.org/celem/sainsmart-i2c-lcd/src/3adf8e0d2443/sainlcdtest.ino
** by
** Edward Comer
** LICENSE: GNU General Public License, version 3 (GPL-3.0)

** This example uses F Malpartida's NewLiquidCrystal library. Obtain from:
** https://bitbucket.org/fmalpartida/new-liquidcrystal 

** Modified - Ian Brennan ianbren at hotmail.com 23-10-2012 to support Tutorial posted to Arduino.cc

** Written for and tested with Arduino 1.0
**
** NOTE: Tested on Arduino Uno whose I2C pins are A4==SDA, A5==SCL

*/
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>

#define I2C_ADDR    0x3F // <<----- Add your address here.  Find it from I2C Scanner
int n = 1;
LiquidCrystal_I2C lcd(I2C_ADDR,6,5,4,11,12,13,14,3,POSITIVE);  // Set the LCD I2C address

void setup()
{
 lcd.begin (16,2); //  <<----- My LCD was 16x2

 
// Switch on the backlight
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
lcd.home (); // go home

 lcd.print("SainSmartI2C16x2");  
}

void loop()
{
 // Backlight on/off every 3 seconds
 lcd.setCursor (0,1);        // go to start of 2nd line
 lcd.print(n++,DEC);
 lcd.setBacklight(LOW);      // Backlight off
 delay(3000);
 lcd.setBacklight(HIGH);     // Backlight on
 delay(3000);
}

Compilation is correct. I’m using Arduino 1.7.11. The libraries are the NewliquidCrystal_1.3.4.zip from fmalpartida.
The LCD blue light blinks every 3 seconds on and off but no text. All full blue screen blinking.

You think i’ve left something?

Thank you.

Sounds familiar, I had the same effect.

There is a potentiometer for adjusting the contrast, and it comes set to zero contrast. At least the ones I got were so. Good Luck.

Your constructor makes no sense: (The PCF8574 has only got bits 0 to 7)

LiquidCrystal_I2C lcd(I2C_ADDR,6,5,4,11,12,13,14,3,POSITIVE);  // Set the LCD I2C address

If you run Bill Perry's diagnosis sketch you would get the correct constructor.

However most common backpacks need:

LiquidCrystal_I2C lcd(I2C_ADDR,2,1,0,4,5,6,7,3,POSITIVE);  // Set the LCD I2C address

David.

You have a I2C display, and need the corresponding Library.

My display says “Hello, world!”, so I assume I used the following example from LiquidCrystal_I2C

//DFRobot.com
//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

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()
{
}

To be more precise:

You took the correct library (name), but a constructor for the parallel interface.

This must be a different version than the one I recently downloaded.

My version has only the following constructor:

LiquidCrystal_I2C(uint8_t lcd_Addr,uint8_t lcd_cols,uint8_t lcd_rows);

And my display also has address 0x3F, but I didn't save this change.

At this point the phrase "the blind leading the blind" comes to mind.

You should take the advice in reply #2. If you don't understand what is meant by "Bill Perry's diagnosis sketch" then you haven't taken the time to read through other threads in this forum section.

Don

There are several libraries that all use the same class name: LiquidCrystal_I2C
But have different methods and "reliability".

I recommend FMalpardita or Bill Perry (bperrybap) libraries

In an ideal world, people would choose a new unique name for their library class.
It is a good idea to implement the same methods e.g. begin()

Then the punter would simply #include "LiquidCrystal_I2C_ZinggjM.h"
And have an appropriate constructor().

The rest of the program would be unchanged.
But at least we would know which particular library you are using.

And it would make life easier when you have a problem.
For example, bperrybap (and floresta) probably know which bugs come from which "LiquidCrystal_I2C" library.

All that the punter knows is : I downloaded it from somewhere

The FMalpardita constructor specifies which PCF8574 IOPORT bits are connected to the LCD module.

David.

First thing that concerns me is “using Arduino 1.7.11”.
That version number means it is an Arduino.org IDE vs an Arduino.cc IDE.
I HIGHLY recommend NOT using IDEs from Arduino.org.
Not because I have any issues with Arduino.org but because their IDE is a fork of the Arduino.cc IDE and it has MANY issues/bugs.
The Arduino.org IDE simply has not kept up with the Arduino.cc IDE functionality nor its bug fixes.

In terms of libraries, you could use my lcd library.
It is called hd44780 and is available in the IDE library manager.
It can automatically locate the backpack and auto configure the pin mappings.
You can read more about here:

It also includes a full diagnostic sketch to test the i2c lines and the LCD internal memory.
See the examples in the included hd44780_I2Cexp i/o class.

I will say that some of the examples included in the hd44780 library won’t compile with the Arduino.org IDE because of bugs in that IDE and that is one of the reasons why you will notice on the hd44780 github repository in the s/w requirements section, that I do not recommend using IDEs from Arduino.org

— bill

Thank you all for your answers. My LCD is this one of the link.

http://osoyoo.com/2014/12/07/16x2-i2c-liquidcrystal-displaylcd/

And there is a tutorial with it's library download. But I also do not make it work with that library using that constructor of the example project it comes with.

ZinggJM, I think it is the same LCD as yours. Adjusting the potentiometer does nothing.

Still searching info to make it work.

mariusmartin:
Still searching info to make it work.

Read my previous post. (#7)
---- bill

bperrybap:
Read my previous post. (#7)
---- bill

The use of the official and up-to-date Arduino IDE version from Arduino.cc certainly makes sense.
But then, why not take and install the LiquidCrystal_I2C library by the library manager?
For me, this works well, and from the picture I really seem to have the same display.

regards, ZinggJM

connected with 4 wires

ZinggJM:
The use of the official and up-to-date Arduino IDE version from Arduino.cc certainly makes sense.
But then, why not take and install the LiquidCrystal_I2C library by the library manager?

Because the LiquidCrystal_I2C library in the IDE library manager may or may not work with the backpack that you have.
And while it may work with the backpack you have today, it may not work with the next one you buy.

Most the low cost i2c backpacks being used on hd4480 LCDs use a PCF8574 i/o expander chip.
There is no standard for how to hook up the 8 i/o port pins to the hd44780 signal pins and backlight circuit.
Therefore, not all manufacturers wire them up the same way.
The library must know how the i/o expander port pins are wired to the hd44780 pins.
Most libraries including the LiquidCrystal_I2C library in the IDE library manager hard code the pin mappings.
If the mappings in the library do not exactly match how the PCB has wired the pins, the LCD will not work.
So with a hardcoded library, you can have a situation where the backpack does not work and there is no way to ever make it work - unless you go in and modify the actual code.

Some like fm's library and my hd44780 library allow the user to configure the mappings and backlight active level.
But to make it work with a library that allows pin mapping configuration, the user must enter the pin mapping information into the library constructor to tell the library how the pins are mapped.

My hd44780 library also has the ability to auto detect the i2c address and all the pin mapping information so the user doesn't have to know or enter any low level i2c address or mapping information.
It offers an easier to use solution that should work on all the low cost i2c backpacks that you typically find on ebay.

--- bill

bperrybap:
Because the LiquidCrystal_I2C library in the IDE library manager may or may not work with the backpack that you have.
And while it may work with the backpack you have today, it may not work with the next one you buy.

Thank you for your information, this really helps me and certainly many others.

I will download your library, check and learn its use, but maybe keep the official one as long as it works on my displays, because of the automatic updates.

regards, ZinggJM

ZinggJM:
I will download your library, check and learn its use, but maybe keep the official one as long as it works on my displays, because of the automatic updates.

There is no "official" i2c backpack library for the IDE.
The IDE bundles certain libraries with the IDE. Those are the "official" libraries in that they are developed and supported by the arduino.cc dev team.

The only "official" LCD library that comes bundled with the IDE is the LiquidCrystal library.

The LiquidCrystal_I2C library that is in the library manager is a 3rd party library.

Any Arduino library that uses the IDE library manager has the ability to do updates through the library manager.
i.e. every time I create a new release of hd44780, it becomes available to the IDE library manager in about an hour or so - just like any other 3rd party library that has library manager support.

--- bill

Sorry, and thank you. I had just discovered your library in the library manager.
The problem with no-name devices is that you don't really know what it is, and therefore I did not look for hd44780.

ZinggJM:
Sorry, and thank you. I had just discovered your library in the library manager.
The problem with no-name devices is that you don't really know what it is, and therefore I did not look for hd44780.

hd44780 is a library not a device.

But in terms of installing the library,
That is why I provided detailed instructions on the github page that provided EXACT step by step instructions on how to install it as well as the IDE s/w requirements.
But you have to take the time to actually read the instructions.....
--- bill

Thanks. You are helping me a lot.

Now I have installed Bill's hd44780 library from library manager (I had to uninstall 1.7.11 and install 1.6.11 from arduino.cc).

I assume that I have to use ioClass > hd4480_I2Cexp examples with my low cost LCD with backpack as you said Bill, on your readme.

I still not seeing text when running Hello World example, and allso I turn the contrast potentiometer left and right and nothing happens.

So then I run I2CexpDiag and this is the generated log:

********************************************************************
Serial Initialized
--------------------------------------------------------------------
I2CexpDiag - i2c LCD i/o expander backpack diagnostic tool
--------------------------------------------------------------------
hd44780 lib version: 0.8.1
--------------------------------------------------------------------
Reported Arduino Revision: 1.6.11
F_CPU: 16000000
--------------------------------------------------------------------
 A4: digital pin: 18
 A5: digital pin: 19
SDA: digital pin: 18
SCL: digital pin: 19
--------------------------------------------------------------------
Checking for required external I2C pull-up on SDA - YES
Checking for required external I2C pull-up on SCL - YES
--------------------------------------------------------------------
Scanning i2c bus for devices..
 i2c device found at address 0x3F
Total I2C devices found: 1
--------------------------------------------------------------------
Scanning i2c bus for all lcd displays
 LCD at address: 0x3F | config: P01245673H | R/W control: Yes
Total LCD devices found: 1
--------------------------------------------------------------------
LCD Display Memory Test
Display: 0
 Walking 1s data test: PASSED
    Address line test: PASSED
--------------------------------------------------------------------
Each display should be displaying its #, address, and config information
If display is blank, but backlight is on, try adjusting contrast pot
If backlight is off, wait for next test
--------------------------------------------------------------------
Blinking backlight test: to verify BL level autodetection
If backlight is mostly off but
you briefly see "BL Off" on display with backlight on,
then the library autodetected incorrect BL level
and the library cannot autoconfigure the device
--------------------------------------------------------------------
Displaying 'uptime' on all displays
--------------------------------------------------------------------

No blinking led on Arduino. Potentiometer does noting again. Is the library unable to autoconfigure the device?

In order for the memory test to pass, it auto detected, autoconfigured and is working well enough for the sketch to talk to the LCD as the sketch is writing and reading the RAM inside the LCD module.
In order to do that, all the LCD data data and control connections must be good and the LCD is responding to commands as it takes commands to read/write to memory.

[1] What type of display do you have?yellow/green background with black text or is the dark/blue background with white text?
[2] Did you see anything at all on the display during any of these tests?
[3] Did the backlight blink or turn on at all during the backlight blink test?

If you have a dark background with light text then you won’t see anything until the backlight is on.

Post a photo of the front of the LCD so we can see the soldering of the backpack to the LCD.

— bill

I am curious how/why you picked IDE version 1.6.11 vs 12 or 13?