1602 shows 1 line of squares

I’ve had this lcd display working fine earlier, but I tried it on another project wher it didn’t show anything, so I moved it back. Now it only shows 1 line of squares.

I have used the scanner sketch to find the address, then I uploaded this sketch, but nothintg showed up

** 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    0x57 // <<----- Add your address here.  Find it from I2C Scanner
#define BACKLIGHT_PIN     3
#define En_pin  2
#define Rw_pin  1
#define Rs_pin  0
#define D4_pin  4
#define D5_pin  5
#define D6_pin  6
#define D7_pin  7

int n = 1;

LiquidCrystal_I2C  lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

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

// Switch on the backlight
lcd.home (); // go home


void loop()
 // Backlight on/off every 3 seconds
 lcd.setCursor (0,1);        // go to start of 2nd line
 lcd.setBacklight(LOW);      // Backlight off
 lcd.setBacklight(HIGH);     // Backlight on


I would recommend using the hd44780 library with the hd44780_I2Cexp i/o class. It is easier to install, easier to use, and is faster than the newLiquidCrystal LiquidCrystal_I2C i/o class. It will automatically locate the i2c address, and automatically determine the pin mappings. It also includes a diagnostic sketch, I2CexpDiag, which will test the h/w and s/w and report any issues it finds.

Install it using the IDE library manager. (not from a zip file), then run I2CexpDiag to test everything. The hd44780 includes lots of documentation - see the included "Documentation" example sketch.

--- bill

The I2CexpDiag sketch reports no working LCD devices. ->SDA digital pin: 18 A4 19:44:56.060 -> SCL digital pin: 19 A5 19:44:56.060 -> -------------------------------------------------------------------- 19:44:56.159 -> Checking for required external I2C pull-up on SDA - YES 19:44:56.193 -> Checking for required external I2C pull-up on SCL - YES 19:44:56.259 -> Checking for I2C pins shorted together - Not Shorted 19:44:56.424 -> -------------------------------------------------------------------- 19:44:56.490 -> Scanning i2c bus for devices.. 19:44:56.557 -> i2c device found at address 0x57 19:44:56.590 -> Total I2C devices found: 1 19:44:56.590 -> -------------------------------------------------------------------- 19:44:56.689 -> Scanning i2c bus for all lcd displays 19:44:56.821 -> No working LCD devices

I only bought it a couple of months ago now, what a bummer!


Do you have other slaves connected to the bus? Is it consistent if you push the reset button and let it run again? can you post some photos of the LCD device and the wires / connectors being used?

--- bill

My apologies are called for as it was down to me making an error.

I removed all the connections and wires and rebuilt it back, but I had the SDA and SCL wires on the LCD the wrong way round.
Now I have corrected that, the LCD screen does indeed work ok.