Troubleshooting 16x2 LCD Display with I2C Interface

Hi,

First of all I want to say that I have spent 5 hours today researching and troubleshooting the following issue without finding any working solution. :sweat_smile:

I have purchased the following LCD Display with I2C and SPI back: I2C / TWI SPI Serial LCD 1602 Module for Arduino and assumed it would be a breeze to connect to my Arduino Uno R2 via I2C.

The board also supports SPI which also won’t work. I have chosen to focus on getting the I2C connection running.

Circuit and Connections

LCD Arduino
GND GND
VCC +5V on Arduino
SDA A4 with 4.7k pull-up resistor
SCL A5 with 4.7k pull-up resistor

The LCD has a switch on the back to switch between I2C and SPI. This is set to I2C.

No jumpers is shorted so its address is 0x20. This is confirmed using the I2C Scanner Sketch.

I have tried running the I2C LCD Guesser sketch suggested by other users which gives me this output:

<Press or click [Send] to Continue>
Scanning i2c bus for devices…
i2c device found at address 0x20
Device found: MCP23008
Only supports PCF8574

So I assume the I2C connection is made correctly.

Code
I am using Adafruits LiquidCrystal library as other forum posts suggested this as the right library for my board and chip.

Hello World code:

/*
 Demonstration sketch for Adafruit i2c/SPI LCD backpack
 using MCP23008 I2C expander
 ( http://www.ladyada.net/products/i2cspilcdbackpack/index.html )

 This sketch prints "Hello World!" to the LCD
 and shows the time.
 
  The circuit:
 * 5V to Arduino 5V pin
 * GND to Arduino GND pin
 * CLK to Analog #5
 * DAT to Analog #4
*/

// include the library code:
#include "Wire.h"
#include "LiquidCrystal.h"

// Connect via i2c, default address #0 (A0-A2 not jumpered)
LiquidCrystal lcd(0);

void setup() {
  // set up the LCD's number of rows and columns: 
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("hello, world!");
}

void loop() {
  // set the cursor to column 0, line 1
  // (note: line 1 is the second row, since counting begins with 0):
  lcd.setCursor(0, 1);
  // print the number of seconds since reset:
  lcd.print(millis()/1000);

  lcd.setBacklight(HIGH);
  delay(500);
  lcd.setBacklight(LOW);
  delay(500);
}

Problem
The display won’t initialise and just shows the first line filled with white blocks with backlight on. At 500ms intervals the screen goes dark for a split second. Sometimes if I leave the Arduino and Display for some time while the sketch is running random characters start to show up and jump around:

Video showing the blinking: video link

I hope you can guide me in the right direction so I can find out what is going on! I have access to a 2ch oscilloscope and a DMM.

Thank you!

I have never used the mcp23008 or the library for it, but there are two things I would try. I am going to assume that you have SDA/SCL hooked up correctly and that it is a typo about which is A4/A5 or you wouldn't have gotten this far.

To run the i2c lcd guesser sketch you would have had to use the FM Malpartido library. Different LiquidCrystal libraries don't work with each other, and there should only be one library named LiquidCrytal that the IDE can get to. Since you are going back to the adafruit library version for the mcp23008, you should remove the FM LiquidCrystal folder from the libraries folder where you had it.

The lcd library and the wire library are using the internal pullups on the 12c pins. There may even be pullups on the interface board, and you should probably try without using the external pullups. I'm actually laughing at myself as I write this, thinking that you may have put the pullups there because the display wasn't working ;)

The blinking backlight is from the code, and the backlight control is independent from the data.

lcd.setBacklight(HIGH);
  delay(500);
  lcd.setBacklight(LOW);
  delay(500);

The display doesn't blink in a one second frequency, it shows very short flashes in the video.

The sketch has a remark about standard address 0, the scanner finds the module at address 20.

The fact that your module can be found and recognised, is a hint that the problem isn't in the I2C communication. Can you confirm that this is a elec freaks module like the print shows ? The unit doesn't seem to be initialised correctly, and the backlight flashing suggests incorrect wiring of the display. In this case that would be the wiring is different form what the library expects (and this seems to be fixed so not possible to set it).

These schematics shows that that module already has pull ups on board, and it shows how it is connected to the display. Try to find the Adafruit schematics, to confirm that the modules are built the same way (connection between chip and display). This library is offered by elec freaks, i have no idea if it is any different from what you are using. Did you look into that ?

Yes, I mixed up Data and Clock when writing the post. They're correctly hooked up in my circuit.

Initially I tried without the pull-ups and then I added them to see if it would make any difference.

The thing is that the LCD also blinks if I do not call the setBacklight() function. Sending text/data also causes this while nothing shows up on the screen.

--

The I2C address is at 0x20. But some libraries use addresses from 0-3 depending on which jumpers is set on the bord. I have no jumpers connected which means the board is at 0x20 and 0 for the special libraries.

That is the board yes.

You are right. I have now removed the external pull-ups.

That library version is not compiling. I guess it is for Arduino 1.0 and I need a newer one.

I think that I tried using their library without any luck. I'll try again and find the newer one.

I found a library from Elecfreak which should match the board but I still can’t get it to show any letters or numbers.

But I am able to control the backlight - turn it on and off.

Depending on the contrast a blank screen or 1 line of white blocks are shown.

So the I2C connection must be working and some of the LCD<->Library seems to function.

What to do next?

What to do next?

There is one more consideration that I don’t think has been mentioned and that is the relationship between the mcp23008 I/O pins and the pins that connect the adapter to the LCD module.

This relationship is determined by the person/program that designed the pc board and it must be considered when writing software to drive the LCD via the board. This would be true for both I2C and SPI.

The library written by francisco malpartida for the I2C boards using the PCF8574 has provisions to adapt the software to match any I/O configuration.

You should check out any library that you consider to use for your board and see if it is, or can be, configured to match your board. If the library is well written you may be able to make the necessary configuration changes in it’s ‘h’ file.

Don

You told you have some test equipment.

If you can read the schematics, use the multimeter to test connections between chip and display. Check to see all connections are present, and also check to see they go where the schematics tell they should go (and nowhere else).

The result of these tests will help you to decide what to do next. (so make notes of any discrepancies)

While typing (and some distractions), floresta replied. What he is pointing out, is what i was working towards. By mapping the connections and confirming (or not) the schematics, you can have a look at the library to see that is expecting the same setup. I suspect changing the library might be easier than changing connections on the board, unless you have to because of some defect.

Hi,

Should't it work as the I purchased the board assembled (LCD and I2C controller soldered together) and I tried using the Arduino library provided by the manufacturer?

It is hard for me to test as the LCD and controller board is soldered together so most components and connections are impossible to reach.

I am considering de-soldering the control board and try to run the LCD directly using the standard Liquid Crystal library. If that works I will continue from there and eventually find another controller which I know works with one of the libraries available.

Should't it work as the I purchased the board assembled (LCD and I2C controller soldered together) and I tried using the Arduino library provided by the manufacturer?

It should work but that doesn't always mean that it will work.

I doubt that Deal Extreme is the manufacturer. Have you contacted them to see if they can provide the missing information concerning the wiring of the adapter board.

Don

floresta: It should work but that doesn't always mean that it will work.

I doubt that Deal Extreme is the manufacturer. Have you contacted them to see if they can provide the missing information concerning the wiring of the adapter board.

Don

Yes I found out and I have probably paid the price by getting something cheap from DealExtreme. In Denmark where I live, I would have to pay 2-3 times at much for it :relaxed: .

I have contacted Deal Extreme (the seller) and Elecfreaks (manufacturer) two days ago and haven't heard from them yet.

Now I consider taking of the I2C controller and will try to control the LCD directly; eventually look for a new back board instead of getting a whole need LCD assembled with another back board. Yes is does seem a bit silly.

JakobHalskov:
Depending on the contrast a blank screen or 1 line of white blocks are shown.
So the I2C connection must be working and some of the LCD<->Library seems to function.

The 1 line of white blocks is the correct setting.

Post that code - in its entirety - and let us take a peek.

DX are no technicians or hobbyists.
They are just selling products, you need to know who or what you’re dealing with.
I have bought plenty of stuff over there, though never at some affiliate or local division.
If your display is defective (which is not impossible), you can make a ticket over there.
They can ask you to send it back (which isn’t smart to do because of what that would cost against the product’s cost).
They might offer you to send a replacement for free.
That’s my experience with them.
I don’t know if it matters how often one has done business with them before they’ll make that decision.
I showed them i’ve done all i could to get that thing going, and ended up that the product must be DOA.
But i didn’t need to desolder anything of the product to get to that conclusion.

If you decide to get an other backpack, think about what type to get.
Consider a PCF8574 solution, as that is very well known.
It still comes in a lot of different versions (where connections between PCF and display are different), but that guesser might help you out there.

Depending on the contrast a blank screen or 1 line of white blocks are shown.

So the I2C connection must be working and some of the LCD<->Library seems to function.

The fact that you are getting a line of white blocks has nothing to do with the I2C connection, the Library, or the Arduino. All it means is that the LCD controller is getting power and the contrast setting is adequate.

In other words all you need to get a row of blocks to show up on your display is a power supply. The presence of the blocks indicates that the LCD controller is functioning at least to a certain extent, but most likely it is fully functional.

Don

I had another look at that product page (DX EU store) you linked to. It appears that EU stores get the SKU prefix 844. So i had a look at DX and did a search leaving out the prefix. That points to that product, which has 2 reviews. Reviews are only published if they have a positive content, so negative reviews will be hard to find. But one of these reviews points here for schematics and library. That is the source i pointed you to to find schematics and library before. But i didn't look close enough to see that there is a second library for IDE => 1.0 the other library would have given you compile errors, i didn't see you mention that. You could have a look there to see if that will help.

Hi Everyone,

I have tried the library you link to without any luck.

DX's reply to my ticket was that I could find a place to get it repaired where I live and they will pay for it. I told them it would cost 10x the price of the original product where I live (Denmark = expensive + 20% tax on all products and services). Now they do not respond to my ticket.

Now I have asked a friend of mine, who has access to desoldering equipment, to take of the control board. Then I will try to control it directly using the pins 1-16 on the display itself.

Thanks for all your help and ideas - I'll get back to you when I have news.

DX has offered to send a replacement.

Good for you. Now you just have to wait a bit. Did they ask to return the defective one ?

Yes!

They have shipped a new LCD module free of charge. I can keep the defective one.

This will be interesting.

We will be waiting for the verdict.

I'm glad you said it.

Don