Go Down

Topic: LCD I2C does not work! checklist (Read 2937 times) previous topic - next topic

IoT_hobbyist

Feb 18, 2020, 10:00 am Last Edit: Feb 18, 2020, 10:10 am by IoT_hobbyist
  • Make sure that you wire LCD to Arduino correctly.
  • Make sure that you install the correct library.
  • Make sure that your code is correct.
  • Adjust the brightness of LCD by rotating potentiometer in the backside of LCD
  • Depending on manufacturers, the I2C address of LCD may be different. Usually, the default I2C address of LCD is 0x27 or 0x3F. Try these values one by one. If you still failed, run the below code to find the I2C address.

Code: [Select]
// I2C address scanner program
#include <Wire.h>

void setup()
{
  Wire.begin();
  Serial.begin(9600);
  Serial.println("I2C Scanner");
}

void loop()
{
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for(address = 1; address < 127; address++ )
  {
    Wire.beginTransmission(address);
    error = Wire.endTransmission();

    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address < 16)
        Serial.print("0");

      Serial.print(address,HEX);
      Serial.println("  !");

      nDevices++;
    }
    else if (error==4)
    {
      Serial.print("Unknown error at address 0x");
      if (address < 16)
        Serial.print("0");

      Serial.println(address,HEX);
    }
  }

  if (nDevices == 0)
    Serial.println("No I2C devices found");
  else
    Serial.println("done");

  delay(5000); // wait 5 seconds for next scan
}

Learn more about LCD I2C in Arduino - LCD I2C tutorial.

Good luck!
Visit my website: Arduino Tutorials For Beginners https://arduinogetstarted.com

DrAzzy

Adjust the brightness of LCD by rotating potentiometer in the backside of LCD
Trick here: with only power, no data, it should display a row of black and white boxes. Adjust until these are the desired darkness/brightness.
ATTinyCore and megaTinyCore for all ATtiny, DxCore for DA/DB-series! github.com/SpenceKonde
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts, mosfets, awesome prototyping board in my store http://tindie.com/stores/DrAzzy

lastchancename

Quote
Make sure that you wire LCD to Arduino correctly.
You may like to expand on this in your original post...
e.g. 4K7 resistors etc...
Beginners don't know what 'correctly' is.
Experienced responders have a nose for laziness, (they were beginners once)... Sure, there are trolls, chest-beaters, and pretenders - but the help you'll get here is about as good as it gets - if you try to help youself!.

groundFungus

#3
Mar 13, 2020, 11:45 pm Last Edit: Mar 13, 2020, 11:48 pm by groundFungus
For I2C character based LCDs with the hd4478 LCD driver the best current library is the hd44780 library by Bill Perry.  The library will, automatically, detect the I2C address and the I2C backpack to LCD pin mapping.

The library is available for install through the library manager.
You will save everyone's time if you read and follow the forum guidelines.  :)          
https://forum.arduino.cc/index.php/topic,148850.0.html
and
https://forum.arduino.cc/index.php?topic=97455.0

jackthomson42

I am trying to find the question in this thread ?
If you want to fly, you need to try .....

jubukraa

#5
May 04, 2020, 07:39 am Last Edit: May 04, 2020, 07:42 am by jubukraa
I am trying to find the question in this thread ?
Read the forum heading...




Go Up