I finally decided to write up a post on my experiences using Sainsmart's 20x4 2004a LCD Display module. After literally hours and hours of working on this piece of shit, I finally got it to work. The most frustrating part of it all was all I had to do was go into Sainsmart's piece of shit library and change a zero to a one. The name of the library is the LiquidCrystal_I2C library.
Arduino + Sainsmart LCD2004a Pin Configuration
The pin configuration is very simple. You only have four pins to connect.
Arduino Pin | LCD2004a Pin |
---|---|
GND | GND |
5v | 5v |
A4 | SDA |
A5 | SCL |
Resolving Issues With The Sainsmart LCD2004a Display
Though the problem may be limited to altering the .cpp file in the LiquidCrystal_I2C library, the problem could be multifaceted so here are a few things to watch out for:
I. Update The LiquidCrystal_I2C.cpp File
Step 1: In your Arduino folder (typically: C:/Program Files(x86)/Arduino) resides your Arduino libraries folder. In this folder is your LiquidCrystal_I2C library. In this library is a file named LiquidCrystal_I2C.cpp - open it with your favorite text editor. If you are having trouble finding this file, simply run a windows search.Step 2: Find the following code in the LiquidCrystal_I2C.cpp file, and change the return value from a zero to a 1. Save and close the library file. Your display should now work...if it doesn't...continue to the next sections...
II. Make Sure Your I2C Device Address For Your LCD Screen Is Correct
Step 1: Here is the he Sainsmart LCD2004a Arduino Sketch that has been tested and confirmed to work as is after completing Section I above.Step 2: When you initialize the LiquidCrystal_I2C object 'lcd' it needs to have the correct device address. The address is highlighted in the image below:
Step 3: Typically, this is going to be either 0x27 or 0x3F. If you aren't sure, here is some super simple code you can run to check what the address of your lcd screen is. The only library that it requires is the Wire.h library (which I believe is already included with most Arduino IDEs):
Voila! Your piece of shit, $10 ebay sainsmart lcd should now work. If it does not work...I suggest you try a hammer or feel free to leave a comment below. Good Luck!!
~Hacky
Very informative; I will admit there code is on the ruff side
ReplyDeleteUpdate:
ReplyDeleteIf you guys are having issues w/ the example code, change:
lcd.init() to lcd.begin() to resolve the issues.