ESPDuino + LCD I2C problem

so i have this ESPDuino
( https://www.amazon.com/gp/product/B09B1KWPMY/ref=ppx_yo_dt_b_asin_title_o03_s00?ie=UTF8&psc=1 )
and i want to use a LCD 20x04 I2C screen and it wont display anything on it i have tried numeras librarys and none of them display text on the screen. i dont know what to do. i have even tried the "New LiquidChristal display" ( GitHub - fmalpartida/New-LiquidCrystal: Clone of the new liquid crystal library from: https://bitbucket.org/fmalpartida/new-liquidcrystal ) library and nothing. any ideas?

Run an I2C scanner to check the display is were you think it is.
Post your code.
Post your schematic.

Don't post your project issues in the wrong forum section.

The best library to use for this display is Bill Perry's hd44780.h. It is available through the library manager.

It will self configure for a variety of display configurations.

There is a diagnostic sketch to run if problems are encountered.

The header files for the i2c backpack display class are

#include <Wire.h>
#include <hd44780.h>
#include <hd44780ioClass/hd44780_I2Cexp.h> // include i/o class header

hd44780_I2Cexp lcd; // declare lcd object: auto locate & config display for hd44780 chip

the code dose not matter same thing happends nomater what
&
schematic is

LCD >> ESPDuino

  • GND >> GND
  • VCC >> 5V
  • SCL >> SCL
  • SDA >> SDA

how would i implement the Bill Perry's hd44780.h library to this code

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

const char* ssid     = "?";
const char* password = "?";

int timezone = -8 * 3600;
int dst = 0;

LiquidCrystal_I2C lcd(0x27);

char* day_of_week(int d, int m, int y, bool ShortHand)
{
  char* DOWName;
  static int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};
  y -= m < 3;
  switch ((y + y/4 - y/100 + y/400 + t[m-1] + d) % 7){
    case 0:
      if(ShortHand){
        DOWName = "Sun";
      }else{
        DOWName = "Sunday";
      }
      break;
    case 1:
      if(ShortHand){
        DOWName = "Mon";
      }else{
        DOWName = "Monday";
      }
      break;
    case 2:
      if(ShortHand){
        DOWName = "Tue";
      }else{
        DOWName = "Tuesday";
      }
      break;
    case 3:
      if(ShortHand){
        DOWName = "Wed";
      }else{
        DOWName = "Wednesday";
      }
      break;
    case 4:
      if(ShortHand){
        DOWName = "Thu";
      }else{
        DOWName = "Thursday";
      }
      break;
    case 5:
      if(ShortHand){
        DOWName = "Fri";
      }else{
        DOWName = "Friday";
      }
      break;
    case 6:
      if(ShortHand){
        DOWName = "Sat";
      }else{
        DOWName = "Saturday";
      }
      break;
    return DOWName;
  }
}

char* getMonthName(int mm, bool ShortHand){
  char* MonthName;
  switch (mm){
    case 1:
      if(ShortHand){
        MonthName = "Jan";
      }else{
        MonthName = "January";
      }
      break;
    case 2:
      if(ShortHand){
        MonthName = "Feb";
      }else{
        MonthName = "February";
      }
      break;
    case 3:
      if(ShortHand){
        MonthName = "Mar";
      }else{
        MonthName = "March";
      }
      break;
    case 4:
      if(ShortHand){
        MonthName = "Apr";
      }else{
        MonthName = "April";
      }
      break;
    case 5:
      MonthName = "May";
      break;
    case 6:
      if(ShortHand){
        MonthName = "Jun";
      }else{
        MonthName = "June";
      }
      break;
    case 7:
      if(ShortHand){
        MonthName = "Jul";
      }else{
        MonthName = "July";
      }
      break;
    case 8:
      if(ShortHand){
        MonthName = "Aug";
      }else{
        MonthName = "August";
      }
      break;
    case 9:
      if(ShortHand){
        MonthName = "Sep";
      }else{
        MonthName = "September";
      }
      break;
    case 10:
      if(ShortHand){
        MonthName = "Oct";
      }else{
        MonthName = "Octtober";
      }
      break;
    case 11:
      if(ShortHand){
        MonthName = "Nov";
      }else{
        MonthName = "November";
      }
      break;
    case 12:
      if(ShortHand){
        MonthName = "Dec";
      }else{
        MonthName = "December";
      }
      break;
    return MonthName;
  }
}

void setup() {
  Serial.begin(9600);
  delay(1000);
  Serial.println();
  WiFi.begin(ssid,password);
  Serial.println("WiFi Connecting");
  int count = 0;
  while( WiFi.status() != WL_CONNECTED ){
      Serial.print(".");
      count++;
      delay(500);
      if(count >= 50){
        Serial.println();
        count = 0;
      }
  }
  Serial.println("\nWiFi Connected");
  delay(5000);
  configTime(timezone, dst, "pool.ntp.org","time.nist.gov");
  Serial.println("Geting WiFi Time");
  count = 0;
  while(!time(nullptr)){
    Serial.print("*");
    count++;
    delay(500);
    if(count >= 50){
        Serial.println();
        count = 0;
    }
  }
  Serial.println("Got Time from WiFi");
  delay(5000);
  count = 0;
  while(true){
    Serial.print("-");
    count++;
    if(WiFi.status() == WL_CONNECTED && time(nullptr)){
      Serial.println("\nSetting Up LCD over I2C");
      lcd.begin(20,4);
      lcd.backlight();
      lcd.clear();
      break;
    }
    delay(500);
    if(count >= 50){
        Serial.println();
        count = 0;
    }
  }
  delay(1000);
  Serial.println("<<<OK!>>>");
  count = 0;
}

void loop() {
  if(Serial.available() > 0){
    time_t now = time(nullptr);
    struct tm* p_tm = localtime(&now);
    lcd.setCursor(0, 0);
    lcd.print(day_of_week((p_tm->tm_mday), (p_tm->tm_mon + 1), (p_tm->tm_year + 1900), false));
    lcd.setCursor(0, 1);
    lcd.print(getMonthName((p_tm->tm_mon + 1), false));
    Serial.print("/");
    lcd.setCursor(0, 2);
    lcd.print((p_tm->tm_mon + 1));
    lcd.print("/");
    lcd.print((p_tm->tm_mday));
    lcd.print("/");
    lcd.print((p_tm->tm_year + 1900));
    lcd.setCursor(0, 3);
    if((p_tm->tm_hour) < 10){
      lcd.print("0");
      lcd.print(p_tm->tm_hour);
    }else{
      lcd.print(p_tm->tm_hour);
    }
    lcd.print(":");
    if((p_tm->tm_min) < 10){
      lcd.print("0");
      lcd.print(p_tm->tm_min);
    }else{
      lcd.print(p_tm->tm_min);
    }
    lcd.print(":");
    if((p_tm->tm_sec) < 10){
      lcd.print("0");
      lcd.println(p_tm->tm_sec);
    }else{
      lcd.println(p_tm->tm_sec);
    }
  }
  delay(10000);
  lcd.clear();
}

Is your I2C LCD set up for that address (0x27) ?

yes that is the address it got when i ran the I2C address finder.

#include <hd44780.h>
#include <Wire.h>
#include <hd44780.h>
#include <hd44780ioClass/hd44780_I2Cexp.h> // include i/o class header

hd44780_I2Cexp lcd; // declare lcd object: auto locate & config display for hd44780 chip

//#include <Wire.h> 
//#include <LiquidCrystal_I2C.h>
//LiquidCrystal_I2C lcd(0x27);

There are places in the code where you use lcd.println() which is not supported, You will need to move the cursor in the code to the next line.

//lcd.println( );
lcd.print( );
//move cursor to next line

There are very many warnings, some treated as errors, around your two functions.

char* day_of_week(int d, int m, int y, bool ShortHand){
char* getMonthName(int mm, bool ShortHand){

I would suggest that you start with a more simple test situation until you have the lcd printing worked out. There may be issues with the returns from the functions which you are trying to print on the lcd.

@hugulokvufoikjk, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the Installation & Troubleshooting category.

So, what does that mean?

Precisely?

Exactly what do you see?

After the LCD was detected by the I2C scanner did you run the library example? By running the Library example you'd be concentrating on one issue, the LCD instead of trying to keep your code work and the LCD to work. So pick a library and get the library example to work first. Post the code in code tags of the example you are using that does not work, post a few images of your project all wired up and not working.

I can guarantee you 100% that your code will not work with that lcd object constructor.
That constructor will cause the newLiquidCrystal library LiquidCrystal_I2C i/o class to use the incorrect pin mappings to talk to the LCd.

You are not using fm's newLiquidCrystal ibrary properly.
When using fm's newLiquidCrystal you must pass in all the parameters to configure the library to use the backack. It is how the library knows how to talk to the LCD.
i.e there are 9 more parameters than the address to fully configure the pin mappings for the library.

This is required since there are multiple backpack designs and the newLiduidCrystal LiquidCrystal_I2C i/o class supports all of them.
If you only pass in the I2C address, then the library will self configure the pin mappings for fm' LCD XIO backpack device, which I am certain you don't have since very few of them were ever made/sold and they are no longer available.

My recommendation is use the hd44780 library with the hd44780_I2Cexp i/o class. It will take literally like less than a couple of minutes to install and have up and running.
Once installed, run the included hd44780_I2Cexp i/o class I2CexpDiag sketch to verify that everything is working.
The hd44780 library will auto detect the i2c address and self configure the pcf8574 pin mappings. So it should "just work" out of the box.
If there are issues the I2CexpDiag sketch can be helpful as it tests the h/w and will print out any issues it finds.

Install the hd44780 library using the IDE library manager. It will do the download and install. Do not do a manual install using a zip file as that has issues do to the way github creates its zip files and the way the IDE extracts them.
It includes lots of documentation in the Documentation sketch
The hd44780 library readme is here:
The hd44780 library wiki is here:

The wiki for the hd44780_I2Cexp i/o class is here:

--- bill

I believe however, he needs to answer #10 first. :roll_eyes:

I don't see any post #s on the posts anymore.
They show the character "#" on the far right but no actual post number
The post # does appear to show up in the link to the post.

But regardless, the sketch cannot control the LCD using newLiquidCrystal LiquidCrystal_I2C i/o class using a constructor that only specifies the i2c address.

--- bill

Reported here: Missing post numbers within a thread

I was just wondering when someone was going to comment on that. :grin:

And that is how I knew my post was #10. :sunglasses:

No doubt, no doubt at all but I want to know even more basic things.

Such as - does it light up? Does it show the first row of "blocks".

It won't show anything if the soldering isn't good enough to supply the power.

--- bill

True, but backlight and LCD are separate.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.