I2c lcd 20x4 not printing on display

So Im doing a project where I need a lcd display to show me de temperature and humidity in the room via a dht22 sensor.

But first I decided to test the i2c lcd display that I bought.

But when I tested a simple code it wouldn’t show any text, just white squares on line 0 and 3 from the display.

I add already ran a address scanner and the address was: 0x3F

the connections are the following:
-GND → GND
-VCC → +5V
-SDA → A4
-SCL → A5

i2c_demo.ino (625 Bytes)

There are lots of previous posts about problems with I2C LCDs and the recommendations in most of the more recent ones are pretty much the same.

What have you tried?

Don

1. Upload the following codes – this is your codes; but, slightly modified to take the shape of my codes which work well for me.

/* I2C LCD 16x2 Arduino Tutorial
 * More info http://www.ardumotive.com/i2clcd(en).html
 * Dev: Michalis Vasilakis Date: 19/11/2016 Ver. 1.0 */

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

LiquidCrystal_I2C lcd(0x3F, 16, 2);//2, 0, 0, 4, 5, 6, 7, 3, POSITIVE);  
// Set the LCD I2C address, if it's not working try 0x27.

void setup(){
  lcd.init();//begin(16,2);   // iInit the LCD for 16 chars 2 lines
  lcd.backlight();   // Turn on the backligt (try lcd.noBaklight() to turn it off)
  lcd.setCursor(0,0); //First line
  lcd.print("Test1");
  lcd.setCursor(0,1); //Second line
  lcd.print("*Test2*");
}

void loop(){
}

2. Slowly adjust the contrast pot.

  1. What is the rationale behind suggesting a change to using the default constructor parameters for the library when you don't even know if the library is the correct one for the hardware in use?

  2. Why would he want to readjust the contrast potentiometer if it is already set adequately?

Don

So atm nothing as helped me with the i2c lcd, i have tried to chage the wiring from: a4 to SDA pin and a5 to SCL pin.

I have tried another arduino uno but it also didnt work.

I have tried with GolamMostafa code and didnt work.

I also have tried to use some help from solved posts like this:

https://forum.arduino.cc/index.php?topic=128635.90 https://forum.arduino.cc/index.php?topic=57268.0

And tried from another site: https://dronebotworkshop.com/lcd-displays-arduino/

Note: this project that im doing is really important because withouth it done i cant pass on the course that im currently in, and i have to present this project to finish it, so all the help that i can have is basically as important as finishing the project

LiquidCrystal_I2C lcd(0x3F, 2, 0, 0, 4, 5, 6, 7, 3, POSITIVE);

That constructor looks funny. The RS and RW pins are the same, not sure that that will work.

Are you sure of the I2C expander to LCD wiring (that is in the constructor)?

groundFungus: LiquidCrystal_I2C lcd(0x3F, 2, 0, 0, 4, 5, 6, 7, 3, POSITIVE);

groundFungus: LiquidCrystal_I2C lcd(0x3F, 2, 0, 0, 4, 5, 6, 7, 3, POSITIVE);

That constructor looks funny. The RS and RW pins are the same, not sure that that will work.

Are you sure of the I2C expander to LCD wiring (that is in the constructor)?

The constructar mensioned doesnt have all those parameters thats why it doesnt work for me

You have tried so many things; try these things one-by-one:

1. Install this library and execute an example from the IDE.

2. Install this library and execute an example from the IDE.

3. Change the I2CLCD.

I also have tried to use some help from solved posts like this:

https://forum.arduino.cc/index.php?topic=128635.90 https://forum.arduino.cc/index.php?topic=57268.0

The recommendation in reply #1 specified looking at recent posts. I would not consider 2011 and 2016 as being recent. April or May 2018 would be more appropriate.

Don

My recommendation is to ignore GolamMostafa. Particularly post #7.

Things like "try this", "try that", are typically not helpful and just waste time.

What you want is advice that points you to something that really works. In order to do that you need to be working with known s/w so you want to be downloading s/w from the REAL source not just some "random" site that has who knows what s/w and version or even a copy of somebody else's s/w. This is why I can't say with strong enough words to avoid his #1 recommendation in post #7. That is recommending getting and archived version of my hd44780 library, not only are you not assured that is an official copy but downloading and installing it from a site like that is more effort and prone to error and incorrect installation than installing it directly from the Arduino IDE using the built in IDE library cloud service.

As Don said there are many many threads about i2c backpacks on LCDs. There are many libraries called "LiquidCrystal_I2C" or that have a i/o class called "LiquidCrystal_I2C" and they do not all work the same. Searching on the Arduino formum site is painful because the admins for the arduino site removed the forum search capability. I've never worked on any other forum site (and I use hundreds of forums) that had no search capabilities. Yes there is "search" on the Arduino forum but it isn't a forum search. It calls google to search the forum site. While you can find information, it isn't nearly as useful as a true search capability that is built in to the forum s/w as you can't do simple things like search a particular sub forum or search for threads or subjects by a particular forum member.

Because of all this "LiquidCrystal_I2C" library mess, I created the hd44780 library package which can offer "plug and play" for i2c based lcd backpacks. So My recommendation is to use a library that works, and that will be my hd44780 library. It is available in the IDE library manager so you can quickly and easily install it with just a few clicks in the IDE. You will need to read the Documentation as it describes where to find the examples. The i/o class for an i2c backpack is hd44780_I2Cexp The library also includes a diagnostic sketch, I2CexpDiag to test your i2c signals and LCD device. Here is a link to the github page which has additional information including installation instructions: https://github.com/duinoWitchery/hd44780

With my hd44780 library package you can be up and running in literally just a couple of minutes after you spend a couple of minutes reading the documentation on the library that describes where to find the example for your i/o class. Just remember, reading will be required so don't try to skip that part.

--- bill