Go Down

Topic: SainSmart 20 x 4 LCD wanting to use I2C from Arduino Uno (Read 20645 times) previous topic - next topic

fm

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!

floresta


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.

http://www.amazon.com/SainSmart-Serial-Module-Shield-Arduino/dp/B0080DYTZQ/ref=sr_1_2?ie=UTF8&qid=1357090534&sr=8-2&keywords=sainsmart+lcd+20x4

NickPyner

#52
Jan 02, 2013, 04:22 am Last Edit: Jan 02, 2013, 08:18 am by NickPyner Reason: 1

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.


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);

}

NickPyner

#55
Jan 03, 2013, 11:10 pm Last Edit: Jan 03, 2013, 11:13 pm by NickPyner Reason: 1
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.

Code: [Select]
//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+%.

NickPyner

#57
Jan 04, 2013, 12:39 am Last Edit: Jan 04, 2013, 01:07 am by NickPyner Reason: 1
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.

dafes

Hi hopes this helps:

Code: [Select]

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


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



void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
  lcd.init();                      // initialize the lcd
  lcd.backlight();
lcd.print("Test");
}

void loop() {


}


void Test()
{
  lcd.print("Test");
}


I'have tried this with the  followign  I2C Libary┬┤s
http://www.exp-tech.de/service/library/2004%20LiquidCrystal_I2C.rar
http://www.exp-tech.de/service/library/LiquidCrystal_I2C2004V1.rar




Hey Guys.
Firstly: Thanks for all the great info about the SainSmart LCD2004.
I got it working following Andrews advice.

But now I have a problem:

I'm trying to use the Wireless SD Shield:
http://arduino.cc/en/Main/ArduinoWirelessShield
w/ the Serial LCD described in this topic.

I can get the LCD to work, but not the SD.
fm says:
"Just create two objects (variables) initialising them correctly and they will work. "

can anyone please explain that to me?
The only wires coming off the LCD2004 are:

GND
VCC
SDA
SCL

and I currently have them wired:

GND - arduino GND
VCC - arduino 5V
SDA - arduino A4
SCL - arduino A5

also the Wireless SD shield uses pin 4 as the SDCS (chip-select).

Any help is appreciated.
Thanks!

Go Up