I may have missed someone already giving this advice, if I have I apologise.
Not all the I2C displays out there are pin for pin compatible.
Also the I2C address is very important.
50% of the display driver boards and LCDs I have come across use the 0x27 base address as in the original arduino sketch for this project.
However the other common I2C LCD display boards I have use address 0x20.
Unfortunately simply changing the I2C address to 0x20 instead of 0x27 doesn't make them work.
This is because the pins utilised on the PCF9574 I2C control chip to drive the display are different for different driver board manufacturers.
I currently am using the 0x27 boards that have a link on one end of the board to disable the backlight and they work perfectly in the sketch
If you are using boards from Alioexpress (or other Chinese suppliers) that have 'IICLCD' printed on the board they are 0x20 base address boards and the sketch will need a bit of work in the "LiquidCrystal_I2C lcd () " statement to make them function.
This is the line I use for my I2C 0X20 boards from Aliexpress
LiquidCrystal_I2C lcd (0x20, 4, 5, 6, 0, 1, 2, 3, 7, NEGATIVE);
You may need to change NEGATIVE to POSITIVE depending on how you find the display backlight functions.
I hope that may help someone
73
Slim Haines G4IPZ