lcd I2C doesn't seem to work

Hello, i’m trying to build a system with a LCD display 20x4… the backlight is on and can blink, but nothing seem to be on.

I’m using an arduino mega 2650 R3 and every wire are on the good parts: 5V, GND, SDA and SCL… But nothing is happenning.

Whan it will be done, i want to display some RFID informations on it (that is why the RFID), and play some sound.

I’m using the liquid crystal ISC librairy… Do you have any idea about it?

here is my code:

#include <MFRC522.h>
#include <Wire.h>

#include <LCD.h>
#include <LiquidCrystal_I2C.h>

#include <SD.h> // Inclure la librairie SD
#define SDPIN 10 // Chip Select du lecteur SD
#include <TMRpcm.h>

#define ALL 1
#define RFID 2
#define RFID2 3
#define LOOP 5
#define DEBUG RFID

#define RST_PIN 5 // Configurable, see typical pin layout above
#define SS_1_PIN 30 // Configurable, take a unused pin, only HIGH/LOW required, must be diffrent to SS 2
#define SS_2_PIN 31 // Configurable, take a unused pin, only HIGH/LOW required, must be diffrent to SS 1

#define NR_OF_READERS 2
#define NR_OF_UIDS 1
#define EXIT_READER_INDEX 0

#define WIDTH 20
#define HEIGHT 4

File myFile;
TMRpcm tmrpcm;

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

//String uid_list[NR_OF_UIDS] = {“F6 39 4E 39”,“F6 39 4E 39”};
String uid_list[NR_OF_UIDS] = {“F6 39 4E 39”};

byte ssPins = {SS_1_PIN, SS_2_PIN};

MFRC522 mfrc522[NR_OF_READERS]; // Create MFRC522 instance.

void setup() {
Serial.begin(9600); // Initialize serial communications with the PC
while (!Serial); // Do nothing if no serial port is opened (added for Arduinos based on ATMEGA32U4)

SPI.begin(); // Init SPI bus

for (uint8_t reader = 0; reader < NR_OF_READERS; reader++) {
mfrc522[reader].PCD_Init(ssPins[reader], RST_PIN); // Init each MFRC522 card
Serial.print(F("Reader “));
Serial.print(reader);
Serial.print(F(”: "));
mfrc522[reader].PCD_DumpVersionToSerial();
}
speakerSetup();

lcd.begin(20, 4);
lcd.setCursor(0, 0);

lcd.backlight();
delay(250);
lcd.noBacklight();
delay(250);
lcd.backlight();
lcd.home ();
lcd.setCursor(3, 0);
lcd.print(“System Starting…”);
delay(1000);
}

void loop() {
rfid_loop();
//lcd.write(Serial.read());
lcd.print(“System online”);

}

Marsat:
Do you have any idea about it?

Yes.
You seem to be using fm's new LiquidCrystal library.
In order to make the lcd work with that library, you have to properly configure it to tell it how the pins from the PCF8574 chip are wired to the LCD.
The likely reason it is not working is that you have told the library the incorrect pin mapping information:

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

If you give the library the wrong pin mapping information, it obviously will not work correctly.
You will need to verify that the pin mapping information you have provided matches the wiring on the backpack that you are using. It should only take a few minutes and can be done by looking at the PCB and/or using an ohm meter.


Alternatively, you could use my hd44780 library package.
It is faster than that library and has some additional capabilities, like auto detection of the i2c address, pin mappings and backlight active level.
It can also read data from the display.
It is available in the IDE library manager.
You can read more about it here: GitHub - duinoWitchery/hd44780: Extensible hd44780 LCD library
The i/o class for pcf8574 based backpacks is hd44780_I2Cexp.
After installation, I would recommend that you first run the included diagnostic sketch (I2CexpDiag) to verify that the library and the lcd are properly working.

--- bill