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.
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!