Introduction: Quick Setup Guide to Arduino LCD 2004 With PCF8574

About: In San Francisco Bay Area. Enjoying good food and making stuff out of the little things I find is what I like to do. Miniaturization of things and making things in a tight budget are my expertise. Visit my Thi…

This is a quick setup guide for your Arduino LCD.

Things you must know before getting started:

1. LCDs are not created equally, some have different pins than the other.
2. Main elements of setting up: the LCD, the library and the code.

Step 1: Read Your Connectors - Compare to Mine

There are many types of LCDs you can purchase from the internet. I bought mine on ebay and it comes soldered with a PCF8574 backpack.

From my research, by default, I found that the "backpack" connects

-GND to GND
-VCC to 5V or VCC
-SDA to A4
-SCL to A5

Some "backpacks" are different from one another, you can read about this from https://arduino-info.wikispaces.com/LCD-Blue-I2C#v...

Step 2: Control Your Contrast

Turn the knob on the blue potentiometer using a screwdriver. All the way clockwise increases the pixel whiteness, and darkness vice versa.

Step 3: Library

If your LCD does not come with a "backpack", you may use the LiquidCrystal library by default from Arduino. (That means you have the one that needs tons of wiring).
Otherwise, LCDs with "backpack" are often related to LiquidCrystal_I2C. Know the difference.
Arduino does not have LCD I2C library by default. The only way is to download it. I spent about an hour looking for the library and essentially I learned about a few things:

1. If your Arduino software is updated to the latest version, download the latest LCD I2C library
2. If you lookup on Google, you will always come across this Liquid Crystal Library by fmalpartida.

3. Apparently that didn't really worked for mine, so I used New_LiquidCrystal_Library.zip instead:
4. Download the library to your Arduino folder, typically located in your Program Files x86.
5. Unzipping the folder is unnecessary.

Step 4: Adding/ Import Your Library

A library in Arduino is somewhat like a pre-cooked meal. Getting the right library is essential for starting up your LCD.

1. Open your Arduino software click on Sketch>Include Library>Add .zip library.
2. Navigate where you last downloaded your NewLiquidCrystal library and open.
3. Now you can check if the library is installed by going to the Examples and check it out.

Step 5: The Worst Part: Coding

I spent countless hours finding the right code to power up my LCD but I learned a few tricks that can troubleshoot the problems. Take notes:

1. Make sure your LCD matrix: 16X2 or 20X4? 16 characters with 2 lines or 20 characters with 4 lines?
2. The LCD address, common ones are: 0x3F. 0x27, 0x20, 0x38... these are related to the "backpack" of your LCD.
3. To find your LCD Address... connect your LCD and Arduino, fire up the I2C_scanner code.
Make sure to open your serial monitor and set to Baud 9600 to read the LCD address.

Step 6: Final Coding

Refer to images: I came to a conclusion that there are 3 things that bothered my process:

1. The LCD address
2. The LCD matrix: some used the code: lcd.init or lcd.begin(20,4) and I think they both work for different libraries.
3. The backlight code is annoying. Sorry but you have to study the code for backlight, essentially you have to read through the code indicating that the backlight is on. (I attached the example codes in Conclusion)

In my case, I use this code because it works: https://bitbucket.org/celem/sainsmart-i2c-lcd/src/...

void setup()

{ lcd.begin (20,4);
// Switch on the backlight
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);

UPDATE (02/03/2016):

~~lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);~~

I found that removing the backlight code will disable the backlight (obviously), and you will see dimmed texts.


Step 7: Conclusion

Step 8: Extras

Updated 10/09/2016:

I just 3D printed a case for my LCD. I messed up the dimensions, you'll see it in the picture. Download the .STL file and you'll know. The top is slightly modified to enclose the LCD further.

Arduino All The Things! Contest

Participated in the
Arduino All The Things! Contest