I2C 1602 LCD Troubleshooting

Hi All,

I'm hoping to save future Arduino users from spending as much time on this as I did today. Just earlier today I got a 16x2 Character LCD board from eBay with an I2C interface board pre-soldered to it. Specifically it was this board, made by www.wide.hk:

http://www.ebay.com/itm/160897438212?_trksid=p2060778.m2749.l2649&ssPageName=STRK%3AMEBIDX%3AIT

The reason I went with this seller was because they were the only ones selling white letters on a black background, which seemed great for what I need. Anyways, after opening it, I spent five hours troubleshooting it and being unable to figure out which part of the device (or maybe Arduino) was hindering my ability to connect with the LCD. I was getting the bottom half of the display (second row) to dimly light up (no backlight) and that was it - no flickering, no characters, nothing. After downloading half a dozen libraries, trying every combination of I2C pin numbers (enable, read, write, digital0, digital1, etc), I just about gave up, writing it off as a defective I2C interface (since I was able to bypass the interface and use 7 Arduino pins to connect directly to the LCD board). As a last attempt at discovering something new, I decided last minute to do one last search on the specific I2C controller, the MCP23008, and came across this blog that immediately solved my problem:

http://www.wabbitwanch.net/blog/?p=818

I downloaded the library, and it worked like a charm. The reason I'm posting this is because, as someone who's new to the I2C protocol, I wasn't familiar of the fact that between different interfaces, there would need to be different libraries. This was something that I didn't read about in any other forums (which there are a whole lot of). For anyone else who experiences an issue with their board, I'd highly recommend looking up what IC or interface board is converting the I2C to 4-bit/8-bit/etc, and use that to hopefully guide you in the right direction. There are way too many kinds of boards being sold on eBay, and all of the info those sellers provide are outdated by half a decade at the least, so it can definitely be very confusing. Anyways, hope this helps, I want to give back to this awesome community as much as I can.

Pat

The key thing to remember is that i2c is a bus data transfer data protocol.
It is used to transfer data or messages between entities.
In this case the Arduino and the i2c i/o expander chip on the backpack.

The backpacks used on the LCDs are just an i2c i/o expander chip.
An i/o expander chip allows the master (arduino) to send a message to set
the output pins on the chip.
The i/o expander on the backpack board is connecting an 8 bit output port to the HD44780 LCD interface pins.
There is no standard of how to do this.
This is why there are several different implementations.
Complicating matters even further is that there are different i2c i/o expander chips.
The most popular two chips used in LCD backpacks are the PCF8574 and the MCP23008

Your backpack uses the MCP23008.

But even knowing which chip you have doesn't get you all the way there.
This is because the 8 bit output port pins can wired up differently to the HD44780
LCD interface pins.

Most libraries hard code this wire mapping for a specific vendors board.
A libraries let you configure which way the pins are wired up.
The libraries that let you configure the wiring will work with any backpack that uses
the supported chip(s).
The libraries that don't allow you to configure the wiring will only work with a specific wiring.
So keep in mind that just getting a library for the correct i/o expander chip doesn't guarantee
that the library will work with the backpack unless the wiring can be configured
to the wiring used on that specific backpack.

As a third option, there are also LCDs that have built in i2c connections.
So far all of those Ive seen use the same message protocol across the i2c bus so
there isn't any sort of wiring/mapping issues to deal with.

--- bill

That is why you have to do research first, before you buy a product.
Make sure that Everything that is needed is available from the seller, or their links.
This includes, but not limited to, Hardware, Software, Schematics and Connections.

By the way, I won't even buy a flashlight from a store that does not sell the bulbs and batteries.

I wouldn't go that far.
It depends on your expertise and knowledge level.
These backpacks are very simple boards, you can figure out everything you need
by looking at the actual board and its PCB traces in just a couple of minutes.
Then get a library for that chip and if it doesn't allow configuring the wiring
modify it to match your board.

But like most things in life you can swap attained knowledge for a lower
cost or purchase price.
However, if you need the extra support, you should expect
to pay a bit more for a fully supported product.

bperrybap:
But even knowing which chip you have doesn't get you all the way there.
This is because the 8 bit output port pins can wired up differently to the HD44780
LCD interface pins.

Thanks for adding that very important point. Even though I was very certain of what pin of the IC was going to what pin of the LCD board, I still tried every possible combination thinking that was the issue. You have to have both the correct library and the correct pin to lcd in your code.