SainSmart 20 x 4 LCD wanting to use I2C from Arduino Uno

Aaron_dyer:
FM,

Is that you in your picture for your profile? It looks like a girl I went to High school with

Lets just say that the picture was taken 22 odd years ago.
Lets also say that fm = fmalpartida

Pretty!

Aaron_dyer:
Pretty!

Thanks. :*

:wink: you know it too

Ya, that was the idea, to use the SPI printouts for a GPS to interface the I2c LCD as well as our other circuitry......ill post my YouTube video of it all later today or tomorrow....

Pinouts*

fm:
This whole thing of not publishing correct information about device addresses is a bit of a bother.

What I am pleased about is that they've linked the library in and respected the Open Source Creative Commons license! Cool.

Hey, Thanks for all your work and support on the library and being willing to support different devices. I have the SainSmart LCD 2004 also and was able to get mine working by following this thread. My device uses 0x27 as the address.

/---When I asked the people at Sainsmart why their code didn't work, they sent me some other documentation etc that didn't work. I don't understand how they can sell products marketed specifically at the Arduino market and not have legitimate support. ---/

Is there a way to have a 16x2 display with address 0x20 and a 20x4 with address 0x27 on the same I2C bus and be able to differentiate them in the code??? sending each different information etc.?

Yes, there is no problem what so ever. Just create two objects (variables) initialising them correctly and they will work. I have use a chain of 4 devices: 2 lcds and keyboards.

I had same problem reported by others using the SainSmart examples and libraries. Finally found this and followed Andrew's advice and now it works! Must agree with displayed message.

Thanks guys!

After blundering about the internet for a while trying to get this Sainsmart 2004 display working with help for their 'excellent documentation' :~, I stumbled on this thread.

A few minutes and I was up & running.

Registered on the forum just to say thanks Andrew!

Hello Guys,

marry christmas and sorry for my bad english but i got yesterday the SainSmart Mega 2560 with LCD2004 and Sensorshield V5.0. After assembling the boards, i started the I2C-Scanner but I didn't found a device! I'm 100% sure that my wire-connection is correct and the sensor-shield-board can't also be wrong mounted without destroying. After trying some libraries I decided to demount the sensor-shield and connecting the LCD2004 directly to the SainSmart (GND, 5V, SDA and SCL) and started the I2C-Scan again and got the address 0x3F (happy!!!).

My question is.... what could by my mistake by assembling the boards? Or is it neccessary to write more code to connect the sensor-shield-board?

Hey everybody! Happy New Year! My new sainsmart 20x4 LCD showed up today and all I got was the LCD? No documentation and no cable for connecting it to the arduino. Could someone tell me what type of connector I need so I can make a cable? Thanks!

worsethenu:
Hey everybody! Happy New Year! My new sainsmart 20x4 LCD showed up today and all I got was the LCD? No documentation and no cable for connecting it to the arduino. Could someone tell me what type of connector I need so I can make a cable? Thanks!

You will get a more reliable answer if you post a better description or a link to the actual device.

Don

Haha, sorry. good call.

worsethenu:
Hey everybody! Happy New Year! My new sainsmart 20x4 LCD showed up today and all I got was the LCD? No documentation and no cable for connecting it to the arduino. Could someone tell me what type of connector I need so I can make a cable? Thanks!

Happy new year.

I use LiquidCrystal_I2C.h. You could make up a cable using standard 0.1" 4 pin females, but I just tore off four conductors from a 40-way ribbon with females already included.

The 40-way worked great. Thanks for the tip!

Hey guys, finally got the sainsmart lcd2004 sheild wired up (5v,gnd, SDA(pin 20), SCL (pin 21)) into the mega2560. When I run the hello world code (which apprears in the examples section of the IDE) below (directly from the new LiquidCrystal v1.2.1) all it does is flash very dimly. If I unplug the SDA and SCL it lights up and is clearly getting power. Any ideas?

0x3F came from the I2C scanner program I ran. There are no errors compiling.

#include <Wire.h>
#include <LiquidCrystal_I2C.h>

#define BACKLIGHT_PIN 21

LiquidCrystal_I2C lcd(0x3F); // Set the LCD I2C address

//LiquidCrystal_I2C lcd(0x3F, BACKLIGHT_PIN, POSITIVE); // Set the LCD I2C address

// Creat a set of new characters
const uint8_t charBitmap[][8] = {
{ 0xc, 0x12, 0x12, 0xc, 0, 0, 0, 0 },
{ 0x6, 0x9, 0x9, 0x6, 0, 0, 0, 0 },
{ 0x0, 0x6, 0x9, 0x9, 0x6, 0, 0, 0x0 },
{ 0x0, 0xc, 0x12, 0x12, 0xc, 0, 0, 0x0 },
{ 0x0, 0x0, 0xc, 0x12, 0x12, 0xc, 0, 0x0 },
{ 0x0, 0x0, 0x6, 0x9, 0x9, 0x6, 0, 0x0 },
{ 0x0, 0x0, 0x0, 0x6, 0x9, 0x9, 0x6, 0x0 },
{ 0x0, 0x0, 0x0, 0xc, 0x12, 0x12, 0xc, 0x0 }

};

void setup()
{
int charBitmapSize = (sizeof(charBitmap ) / sizeof (charBitmap[0]));

// Switch on the backlight
pinMode ( BACKLIGHT_PIN, OUTPUT );
digitalWrite ( BACKLIGHT_PIN, HIGH );

lcd.begin(20,4); // initialize the lcd

for ( int i = 0; i < charBitmapSize; i++ )
{
lcd.createChar ( i, (uint8_t *)charBitmap );

  • }*

  • lcd.home (); // go home*

  • lcd.print("Hello, ARDUINO "); *

  • lcd.setCursor ( 0, 1 ); // go to the next line*

  • lcd.print (" FORUM - fm ");*

  • delay ( 100000 );*
    }
    void loop()
    {

  • lcd.home ();*

  • // Do a little animation by writing to the same location*

  • for ( int i = 0; i < 4; i++ )*

  • {*

  • for ( int j = 0; j < 20; j++ )*

  • {*

  • lcd.print (char(random(7)));*

  • }*

  • lcd.setCursor ( 0, 1 );*

  • }*

  • delay (2000);*
    }

We have the same library and the display should probably work the same. The display is disconcerting on start-up and you might think it is faulty. The light comes on and then goes goes off, then comes on fully operational.

Here is the start of a clock. Note that I don't define the backlight pin.

//Arduino 1.0+ Only
//Arduino 1.0+ Only

#include <LiquidCrystal_I2C.h>
#include "Wire.h"
#define DS1307_ADDRESS 0x68

LiquidCrystal_I2C lcd(0x27,20,4);  

void setup(){
  Wire.begin();
  Serial.begin(9600);
  lcd.init();  
    delay(1000);
 lcd.clear();
      lcd.backlight();  //Backlight ON if under program control
      lcd.setCursor(0,0); 
  // Print a message to the LCD.
 lcd.print("Today it is");
 
}

void loop(){
  printDate();
  delay(1000);

}

Thanks for the reply! I gave it shot but it did not work.

I changed this:
#include "Wire.h"
to
#include <Wire.h>

The line below however now throws the error: invalid conversion from 'int' to 't_backlighPol'
LiquidCrystal_I2C lcd(0x27,20,4);

I've been trying a bunch of different things and i can get the LCD to fully light and blink the cursor if the only thing in the loop is lcd.setCursor(X,Y); if I put anything else in the loop the LCD either does not illuminate or dims by 50+%.

I didn't realise I had "wire.h" and not <wire.h>. I can only conclude it makes no difference!

(EDIT)

I've changed it and it works the same.

Also Dafes looks the same as mine, except he is using 16x4 instead of 20x4. The backlight bit is the same.