LiqidCrystal_I2C in Arduino Create

This is specifically in reference to the Arduino Create Web application. Not in reference to any local installation of an Arduino IDE.

I work primarily on a Chromebook. There is no locally installable Arduino IDE for Chromebooks. So I use the Arduino Create Web application.

I am having some problems with a 16x2 LCD which has an I2C backpack installed, based on the PCF8574AT IC.

On initialization, the LCD presents with 16 black blocks across the first line, and nothing on the second line. The presence of black blocks on the first line and nothing on the second line is a clear indication that this problem is NOT related to the LCD contrast adjustment.

My internet research suggests that this problem may be the result of incorrect timing between Arduino and the I2C board. There have been suggestions that an appropriate selection of LiquidCrystal_I2C library may correct this problem.

My question, then, is: what version of LiquidCrystal_I2C library is default for the Web Application?

The "Libraries" option in the Arduino Create Web Application lists quite a number of libraries, none of which relate to LiquidCrystal_I2C.

To reiterate, this question is not in reference to any locally installable version of the Arduino IDE. This question is ONLY in reference to the Arduino Create Web application.

It's this one:

This used to be marcoschwartz/LiquidCrystal_I2C but apparently marcoschwartz transferred the repository to johnrickman.

Unless you specify a version in your sketch, the newest version will be used. That is currently 1.1.2.

And yes, there are too many different libraries that are named LiquidCrystal_I2C, or contain a file named LiquidCrystal_I2C.h.

wwoofbum:
The "Libraries" option in the Arduino Create Web Application lists quite a number of libraries, none of which relate to LiquidCrystal_I2C.

That's strange. I don't own a Chrome OS device so I can't try the Chrome app, but in the regular Arduino Web Editor definitely has it in Library Manager:

wwoofbum:
I am having some problems with a 16x2 LCD which has an I2C backpack installed, based on the PCF8574AT IC.

Unfortunately, while the large majority of "backpacks" use the PCF8574, there are a number of alternate configurations and the presently common one may not match that expected by the code you are attempting to use. :astonished:

wwoofbum:
My internet research suggests that this problem may be the result of incorrect timing between Arduino and the I2C board. There have been suggestions that an appropriate selection of LiquidCrystal_I2C library may correct this problem.

Very unlikely. The low level timing of pretty much any "LiquidCrystal" library is good enough to get the device initalized.
The 2 most common causes of LCD using a PCF8574 based backack, not initializing is either using an incorrect i2c Address, or not using the proper pin mapping between the PCF8574 chip and the LCD.

The hd44780 library hd44780_I2Cexp i/o class solves both of these issues by runtime auto-detecting both the i2c address and the pin mappings.

pert:
It's this one:
GitHub - johnrickman/LiquidCrystal_I2C: LiquidCrystal Arduino library for the DFRobot I2C LCD displays

This used to be marcoschwartz/LiquidCrystal_I2C but apparently marcoschwartz transferred the repository to johnrickman.

Unless you specify a version in your sketch, the newest version will be used. That is currently 1.1.2.

The latest is actually 1.1.3 but the library.properties file is messed up in the tagged revisions and it confuses the IDE library manager.
To fix it requires doing some patches and fixes and re-tagging some of the existing tagged releases.
I bugged it quite a while back.

But IMO, it is much simpler/easier to use the hd44780 library.

--- bill

Good point bperrybap. The newest tag is 1.1.3, but the author changed the name values and forgot to update the version value in library.properties before creating the 1.1.3 tag, so the Library Manager indexer job didn't pick up the 1.1.3 version of the library. So, even though there is a 1.1.3 in the GitHub releases page, the version you get in Arduino Web Editor is 1.1.2.

Thanks, all, for the replies. I'll try your suggestions. However...

  1. It is not clear to me how to "specify a version in your sketch..."

  2. pberrypap: The first time I connected this device to my chromebook it worked fine. That is, I used a standard "Hello World" test sketch, and the LCD behaved appropriately (it displayed "Hello World.") After disconnecting and reconnecting (an hour or so later, after lunch) I got the 16 black blocks. Is this explained by improper address or pin mapping?

  3. Yes, I found 5 varieties of Liquid Crystal I2C library (not all of which include a LiquidCrystal_I2C.h) when using the Library Manager. My question was which of these (if any) is the default that the Web Editor uses if you have not "managed" your libraries. Thanks to pert for a definitive answer to this question. And, may I assume that this is the library listed as "LiquidCrystal I2C" (note the space, not an underline) in the Library Manager? Or not...? And, while the various libraries show up when in the Library Manager, using the "Search Libraries" field in the "Libraries" pane does not report any LiquidCrystal_I2C library.

And, now, I must humbly apologize. After running an I2C scanning sketch, I find that I did, indeed, have the wrong address. Somewhere in my fiddling around, I must have changed the address between the occasion on which the LCD worked fine and the occasion on which it didn't.

So, to all, my apologies.

wwoofbum:

  1. It is not clear to me how to "specify a version in your sketch..."

Since I don't own a Chrome OS device, these instructions are based on the browser version of Arduino Web Editor, but I think they'll apply to the Chrome app just as well:

  • Open the sketch in Arduino Web Editor.
  • From the menu on the left side of the Arduino Web Editor window, click "Libraries".
  • Click the "Library Manager" button.
  • In the "Search Library" box, type "liquidcrystal i2c".
  • Press Enter.
  • From the search results, click the star next to "LiquidCrystal I2C".
  • Click the "Done" button.
  • Click the "Favorites" tab.
  • Scroll down the list of favorite libraries until you see "LiquidCrystal I2C". Hover the mouse pointer over it.
  • Click the downward pointing triangle button on the right side of the "Include" button.
  • Select the version of the LiquidCrystal I2C library you want to associate with the currently opened sketch.

That sketch will now use the version of the LiquidCrystal I2C library you selected. Unlike the standard Arduino IDE, where you can only effectively have one version of each library installed, with the Arduino Web Editor, all versions of all the Library Manager libraries are installed and available for you to use.

You will see a comment added to the sketch, something like:

// LiquidCrystal I2C - Version: 1.1.1

but this comment is not what does the actual association. The library version was written into the hidden sketch.json metadata file in the sketch folder. So don't be fooled into thinking you can just add a comment to your sketches to set the library version. You can even delete that comment and it will make no difference, the metadata entry will remain.

wwoofbum:
My question was which of these (if any) is the default that the Web Editor uses if you have not "managed" your libraries.

It may depend on the #include directives in your sketch. If your sketch only has the #include directive for LiquidCrystal_I2C.h, then the LiquidCrystal I2C library will be used. Although it's convenient that all ~2800 Library Manager libraries are pre-installed in Arduino Web Editor, it can also sometimes cause difficulties when multiple libraries contain a file matching your #include directive and the library your code was written for doesn't get chosen. It's always possible to work around that issue, and I'm happy to provide assistance with that if you ever have that problem. Just post here on the forum and we'll get you fixed up.