LCD 1602 have backlight and boxes but not displaying anything from sketches

Hi to all,

Trying to connect a mega 2650 to a 1602 lcd display without success.

Using I2C address of 0x27 and port speed 9600 which is correct for my display. connected SCA to pin a5 and SDA to pin a4

Library is Adafruit_FRAM_I2C and sketch "Hello World"

Have adjusted backlight so can see pixel squares but when I compile and upload, compiles no problem,get message "done compiling" tx and rx lights on arduino cease flashing but all I can get on the display are the pixel squares.

I am a complete newbie and completely stuck, Anyone and ideas please, please, please.

Thanks in advance

Keith

I suggest tweaking the contrast a little more. I was sure mine was broken, but I finally adjusted contrast /after/ sketch uploaded, hello world finally appeared.

Thanks for the reply.

Yes tried that from stop to stop, still nothing.

Also tried a different 1602 and I2C and a 2004 all give same result i.e. pixels but no characters.

Keith

Check the Wire reference page- the Mega uses different pins for I2C.

different manufacturers use different base addresses for the display. 3 of mine use 0x38, one uses 0x27. find an I2C address scanner and stick it in a utilities folder in your sketchbook

connected SCA to pin a5 and SDA to pin a4

BJHenry has a valid point. On the Mega SDA is pin 20, SCL is pin 21. Or on the header where pins 8-13 are the order is 12, 13, Ground, Aref, SDA, SCL. SCL nearest to the USB connector.

and port speed 9600 which is correct for my display

Serial baud rate has nothing to do with an I2C LCD.

An I2C scanner:

// I2C scanner by Nick Gammon.  Thanks Nick.

#include <Wire.h>

void setup() {
  Serial.begin (115200); //*****  make sure serial monitor baud matches *****

  // Leonardo: wait for serial port to connect
  while (!Serial) 
    {
    }

  Serial.println ();
  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;
  
  Wire.begin();
  for (byte i = 1; i < 120; i++)
  {
    Wire.beginTransmission (i);
    if (Wire.endTransmission () == 0)
      {
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);
      Serial.println (")");
      count++;
      delay (1);  // maybe unneeded?
      } // end of good response
  } // end of for loop
  Serial.println ("Done.");
  Serial.print ("Found ");
  Serial.print (count, DEC);
  Serial.println (" device(s).");
}  // end of setup

void loop() {}

I'm not using an Arduino UNO, but a Geekcreit. Does this make a difference? I did a scan and it said "0x3F", but I'm having the same problem as OP.

Eophex. you should start your own thread. The Geekcreit is an Uno "clone" so a totally different board from the OP. And we have no idea what LCD you have.

Read the how to use this forum sticky to get some advice on what information that we need to know to be able to help you. A schematic of your project wiring will be helpful, too.

Your 'pixels' are what most others call 'boxes'. Your display is not being properly initialized.

Use the stealth search box at the upper right and search for I2C LCD boxes.

Don

EDIT: Also go back and edit your original post to make the appearance of your 'subject' less offensive.

From what I can tell the “Adafruit_FRAM_I2C” library is not a library to control an LCD and does not include a sketch called “Hello World”
So, IMO, no one can help you since we don’t know what type of lcd device you have and what library and or software you are using to try to control it.

— bill

Hello everyone.

floresta my apologies but after 27 years in military where all subject lines are capitalised I occasionally slip up.

groundFungus re post 5 I have to disagree with quote " Serial baud rate has nothing to do with an I2C LCD. " It has everything to do with LCD as if they are not the same baud rate if they do manage to commumicate then the result is garbage. Also see line 4 in the sketch you gave quote " Serial.begin (115200); //***** make sure serial monitor baud matches ***** " unquote

Any way display is now working after I moved leads to 20/21 and since I ham fistedly broke the pin off a lead and had to replace it, I am guessing the lead was broken in the first place.

So I can now go forward thanks to all who replied.

wishing everyone good weeks

Keith

Kaybee327: groundFungus re post 5 I have to disagree with quote " Serial baud rate has nothing to do with an I2C LCD. " It has everything to do with LCD as if they are not the same baud rate if they do manage to commumicate then the result is garbage. Also see line 4 in the sketch you gave quote " Serial.begin (115200); //***** make sure serial monitor baud matches ***** " unquote

You are mistaken about I2C. I2C (the interface that the Wire object users) and and the "serial" (asynchronous serial) interface that the Serial object uses are completely different interfaces that work very differently. I2C is bus that uses a Master and multiple individually addressable slaves with a clock signal and a bi-directional data signal. There is no matching of clocks involved or needed. The Master drives the clock signal and the slave uses it, whatever it is. Slaves typically have limitations on the maximum clock rate that they can support but there is no matching of clocks between the Master and the slave since the Master drives it and the slave uses it whatever it is. Whereas the interface that the Serial object uses (asynchronous serial) is a point to point interface with dedicated TX and RX wires that is not self clocking so both ends have to configured to use baud rate clocks that are same in order to communicate.

--- bill

Kaybee327: floresta my apologies but after 27 years in military where all subject lines are capitalised I occasionally slip up.

That was because Teletype machines did not have lower case and practices do not change. :grinning:

Kaybee327: Also see line 4 in the sketch you gave quote " Serial.begin (115200); //***** make sure serial monitor baud matches ***** " unquote

Yeah but that's so that these lines work properly:

Serial.print ("Found address: ");

The word "matches" refers to the Serial.begin()'s baud rate matching that of the serial monitor.