LCD 1602 with I2C appears to be bad out of the box?

Hi
Using Arduino UNO and a brand new 1602 lcd with the i2c adapter, pins going to analog 4, 5.

Never prints. adjusted contrast so its correct, backlight is on and bright. I have another UNO with the same display, got it working fine but with the 6 wires. This is the i2C and Ive tried every example program there is, downloaded several from github.

Wanted to ask for assistance before sending back as a dud.

scl = A5
sda = A4, have swapped them and re compiled. nowhere in code to configure which pins this uses

followed this video to the letter. used their code also, blank. Here is one of 20 or so attempts. it compiles. it uploads, the onboard LEDs blink as expected, the display shows nothing. ever. it has not worked.

Just wondering if there is some other example that could be tried? the 3 address lines are OPEN, empty.

When I ran an i2c scanner it says no device connected, but again nowhere to define which pins are used??

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup()
{
	// initialize the LCD
	lcd.init();

	// Turn on the blacklight and print a message.
	lcd.backlight();
	lcd.print("Hello, world!");
}

void loop()
{
	// Do nothing here...
}

SCL = A5, SDA = A4, there is nothing to configure. Swapping them won't work at all. NB.: On Uno R3 you can also use 18 (SDA) and 19 (SCL). Edit: on My Uno they are 16 and 17, but the text (SDA, SCL) is printed on the PCB.

Are you using duPont wires? Try some new ones, I never really trust them...

Stupid question, but I must ask it: did you connect VCC and GND to the I2C backpack?

Can you test the LCD itself (without the backpack), maybe on the other Arduino? If that works, the problem must be in the backpack or the Uno (!).

Yes, the vcc and gnd off the board, its lit up, red led on the botton. what does that jumper do on the i2c board? either way is the same.

and yes its wired as you said, and no SDA or SCL on this UNO. i burned out the other UNO board it has some odd problem now.

Forgot I have a logic analyzer, so its outputting something for sure on those pins, but as to what its sending out? not sure.

For an I2C LCD display to work, the I2C address and the I2C backpack to LCD pin mapping must be correct. If the library default settings for either or both are not correct the LCD will not work. You can try to figure out the right pin mapping and use an I2C scanner to find the address, but if you install and use the hd44780 library that is done automatically by the library.

To install the hd44780 library. The hd44780 library is the best available for I2C LCDs. The library is available in the Library Manager. Go to Library Manager (in the IDE menus, Sketch, Include Libraries, Manage Libraries) and in the Topics dropdown choose Display and in the Filter your search box enter hd44780. Select and install the hd44780 library by Bill Perry.

The class that you want to use is the hd44780_I2Cexp class. There are examples to show how to use the library. The nice thing about the hd44780 library is that it will autodetect the I2C address and the I2C backpack to LCD pin mapping.

In the examples, there is a diagnostic sketch that will help us to help you if you still have trouble with the display. Run the diagnostic sketch and post the results. Bill Perry, the library author, frequents this forum and can usually figure out what the problem is if the rest of us mere mortals fail.

A photo of your wiring can also be helpful.

The hd44780 library hd44780_I2Cexp i/o class diagnostic sketch is called I2CexpDiag

Run it and if it doesn't "just work" or there are any issues detected, post the serial output.

--- bill

groundFungus:
For an I2C LCD display to work, the I2C address and the I2C backpack to LCD pin mapping must be correct. If the library default settings for either or both are not correct the LCD will not work. You can try to figure out the right pin mapping and use an I2C scanner to find the address, but if you install and use the hd44780 library that is done automatically by the library.

To install the hd44780 library. The hd44780 library is the best available for I2C LCDs. The library is available in the Library Manager. Go to Library Manager (in the IDE menus, Sketch, Include Libraries, Manage Libraries) and in the Topics dropdown choose Display and in the Filter your search box enter hd44780. Select and install the hd44780 library by Bill Perry.

The class that you want to use is the hd44780_I2Cexp class. There are examples to show how to use the library. The nice thing about the hd44780 library is that it will autodetect the I2C address and the I2C backpack to LCD pin mapping.

In the examples, there is a diagnostic sketch that will help us to help you if you still have trouble with the display. Run the diagnostic sketch and post the results. Bill Perry, the library author, frequents this forum and can usually figure out what the problem is if the rest of us mere mortals fail.

A photo of your wiring can also be helpful.

Yes, thanks will try this with the next lcd coming. used one of the i2c scanners listed on a couple various pages, but with the logic analyzer on there it only tested address 0 every 5 seconds, according to the output anyway, the code would write to addresses 1 to 126 and an error result meant nothing there, increment and test.
I kept trying different drivers, this one too I think. after giving up went back and tried more thinking i missed something. nope. went back again after putting it away to be returned, didnt want to give up, by 1am? gave up on it, sent it back.
will see when the new ones get here. Rechecked the 2 wires for SDA and SCL even reversed them in case the label on the i2c adapter was wrong; and it lit up, set the contrast etc

rogersb:
Rechecked the 2 wires for SDA and SCL even reversed them in case the label on the i2c adapter was wrong; and it lit up, set the contrast etc

There really is no point swapping SDA and SCL "in case the label on the i2c adapter was wrong". It simply will not be wrong.

You say you have set the contrast. Please do confirm so we are clear, what you are actually seeing. A picture (proper picture in full daylight, not a dark room) of the whole setup would be nice. :grinning:

So you never bothered to run the hd44780 library I2CexpDiag sketch which could show that the h/w is working or provide information as to any issues it can identify?

Keep in mind that there is more than one design of i2c backpacks.
The library you were using (LiquidCrystal_I2C) only works with one of them. One of the more popular designs, but non the less, it is only one of several designs.
If you happened to have received a backpack that is a different design than what the LiquidCrystal_I2C library is hard-coded to use, it will not work.

That is value of using the hd44780 library. It can work with all the designs and will auto detect which one you have.

--- bill


Just as an FYI about Arduino scanners and i2c address.
While many of the Arduino i2c scanner sketches out there (including the one that comes with the IDE, start scanning at address 1, this not a good thing to be doing since according to the I2C spec, the first address is actually 8.
The signal patterns created on the i2c signals when attempting to use address 0 to 7 have special meaning.
While they work on the AVR i2c (Wire) implementation, they will not work on some implementations.
According to the spec, I2C address 0 to 7 do not exist and no slave should attempt to ever use them.
HOWEVER.... that said, there are a few commercial chips out there that did not officially register their product to get an i2c address and used an address below 8.
So while using addresses below 8 work with the AVR wire library, since it is out of spec, it is not guaranteed to work, and in fact does not work with some other i2c implementations.

IMO, it risky to use addresses below 8 since those addresses can not be used on some platforms.
For example, attempting to use those addresses will cause a lockup on the pic32 platform.

This topic was automatically closed after 77 days. New replies are no longer allowed.