Introduction: Quick Setup Guide to Arduino LCD 2004 With PCF8574

Picture of Quick Setup Guide to Arduino LCD 2004 With PCF8574

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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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

Picture of 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.

Comments

Winston 8 (author)2016-04-03

Hello

Do you by any chance have the codes for a 20x4 lcd thermometer with a ds18b20 or can you get them for me because I looked all over the internet I can't find the specific package I want.

Kind Regards

paddyding (author)Winston 82016-04-07

I am not sure where you got the DS18B20 with the LCD package but I am sure that temperature sensors output digital or analog signals (meaning that it uses analogRead/Write or digitalRead/Write to process the signals to give you the temperature). I highly doubt that LCDs are directly connected to the temperature sensor without any FTDI board or interface.

Maybe this site could help you:

https://arduino-info.wikispaces.com/Brick-Temperature-DS18B20

Extracukor made it! (author)2016-02-06

Learnt a lot again! Thanks for it!

paddyding (author)Extracukor2016-02-06

Great! Glad that I helped!

About This Instructable

5,666views

119favorites

License:

Bio: 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 ... More »
More by paddyding:Classic Jumping Stick ManParty Speaker GrillParty Speaker Grill
Add instructable to: