Author Topic: 20x4 LCD with serial i2c daughter board Arduino mega problems  (Read 12569 times)

sphinta

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
I have your 20 x 4 LCD and serial interface board.  The serial board has been soldered to the 20 x 4 LCD as per your images. I'm using a Arduino Mega to interface.  I have been using the lcdcrystal_i2c.h library.  I found the address to be 0x27, not 0x3F as advised with the product.  I can only get the backlight to turn on and off.  1st and 3rd row come up as solid blocks, all pixels on on all the characters in these rows and cannot be changed while 2nd and 4th row always remain blank.  Any suggestions?

modtro2

  • Administrator
  • Hero Member
  • *****
  • Posts: 564
    • View Profile
Re: 20x4 LCD with serial i2c daughter board Arduino mega problems
« Reply #1 on: March 11, 2014, 06:25:16 PM »
Hi, could you post your test code?

sphinta

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: 20x4 LCD with serial i2c daughter board Arduino mega problems
« Reply #2 on: March 12, 2014, 01:39:11 AM »
Here is one of the tests I have used, plus the various differences I have tried. ( now commented out ).  I added a few extra delays to see if this would help.
/*
 * Displays text sent over the serial port (e.g. from the Serial Monitor) on
 * an attached LCD.
 */
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

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

void setup()
{
  delay(1000);
  lcd.init();   // initialize the lcd
  delay(2000);
  lcd.backlight();
 
  Serial.begin(9600);
}

void loop()
{
  // when characters arrive over the serial port...
  if (Serial.available()) {
    // wait a bit for the entire message to arrive
    delay(100);
    // clear the screen
    lcd.clear();
    delay(100);
    lcd.home();
    delay(100);
    lcd.cursor_on();
    delay(100);
    // read all the available characters
    while (Serial.available() > 0) {
      // display each character to the LCD
      lcd.write(Serial.read());
      //lcd.print(Serial.read());
      delay(10);
    }
  }
}

modtro2

  • Administrator
  • Hero Member
  • *****
  • Posts: 564
    • View Profile
Re: 20x4 LCD with serial i2c daughter board Arduino mega problems
« Reply #3 on: March 12, 2014, 06:23:07 PM »
I will try the code later. I downloaded the library from here:
http://hmario.home.xs4all.nl/arduino/LiquidCrystal_I2C/

In the mean time, can you try a different I2C address. These boards use the PCF8574, which have a different address to the PCF8574A. Looking in the library, they say the address is 0x20. But, looking at the PCF8574 datasheet, it says 0x40. Can you try it with 0x40.

sphinta

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: 20x4 LCD with serial i2c daughter board Arduino mega problems
« Reply #4 on: March 12, 2014, 07:59:42 PM »
I use that library for the LCD.

I have tried the addresses you suggest be no comms.

I found the serial address using the following sketch:

//Written by Nick Gammon
// Date: 20th April 2011

#include <Wire.h>

void setup() {
  Serial.begin (115200);

  // Leonardo: wait for serial port to connect
  while (!Serial)
    {
    }

  Serial.println ();
  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;
 
  Wire.begin();
  for (byte i = 1; i < 120; i++)
  {
    Wire.beginTransmission (i);
    if (Wire.endTransmission () == 0)
      {
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);
      Serial.println (")");
      count++;
      delay (1);  // maybe unneeded?
      } // end of good response
  } // end of for loop
  Serial.println ("Done.");
  Serial.print ("Found ");
  Serial.print (count, DEC);
  Serial.println (" device(s).");
}  // end of setup

void loop() {}

I have a video but it is 2.8M and of type .MOV which I cannot attach.

sphinta

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: 20x4 LCD with serial i2c daughter board Arduino mega problems
« Reply #5 on: March 12, 2014, 08:05:24 PM »
Here is a picture of the LCD screen.

clayton_spencer

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: 20x4 LCD with serial i2c daughter board Arduino mega problems
« Reply #6 on: March 13, 2014, 10:41:25 PM »
Hi, I've came up against the same issue but with the 16x2 LCD.

I found the following worked

[start of code, I've cut and paste a bit which is not relevant]
Code: [Select]
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C LCD(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  // Set the LCD I2C address

void setup() {
    LCD.begin(16, 2);  // 16 lines by 2 rows
    LCD.clear();
    LCD.backlight();
    LCD.setCursor(0,0);
    LCD.print("Hello Line 1");
    LCD.setCursor(0,1);
    LCD.print("Hello Line 2");
}

void loop() {
    delay(500);
    LCD.clear();
    LCD.home();
    LCD.print(millis());
}
[end of code]

the library code I used is attached.

the infomation was taken from http://arduino-info.wikispaces.com/LCD-Blue-I2C#v3

Hope this works for you

Clayton
« Last Edit: March 15, 2014, 06:16:41 PM by modtro2 »

sphinta

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: 20x4 LCD with serial i2c daughter board Arduino mega problems
« Reply #7 on: March 17, 2014, 03:30:08 AM »
Hi Clayton,

Thanks for your help.

I've downloaded the library from your link and removed the one I had before.  Copied your example into a sketch but it won't compile.  Comes back with the following errors.

sketch_mar17h:4: error: 'LiquidCrystal_I2C' does not name a type
sketch_mar17h.ino: In function 'void setup()':
sketch_mar17h:7: error: 'LCD' was not declared in this scope
sketch_mar17h.ino: In function 'void loop()':
sketch_mar17h:18: error: 'LCD' was not declared in this scope

I've read through the web site you mentioned but I have just ended up more confused.  Are you able to shed any light on it?

clayton_spencer

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: 20x4 LCD with serial i2c daughter board Arduino mega problems
« Reply #8 on: March 17, 2014, 02:14:41 PM »
make sure you have the library in the correct location under libraries and that the Wire folder is also there. If they are correct you should be able to select an example from the LiquidCrystal library (File -> Examples -> LiquidCrystal -> ...)

what version of arduino are you using, i'm using 1.0.5-r2, make sure you close and restart the arduino IDE when you make changes to the libraries folder

otherwise, not sure what is wrong, your code just can't find the object in the LCD I2C library

hope this might help
Clayton

sphinta

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: 20x4 LCD with serial i2c daughter board Arduino mega problems
« Reply #9 on: March 18, 2014, 01:52:39 AM »
Hi Clayton,

Many many thanks.  My problem was my own making, I forgot to restart after updating the library!!!

Well time for a beer, and I'll have one for you too.

Thanks again.