Saturday 16 January 2016

2004 20x4 I2C LCD modules with HD44780-compatible interface + PCF8574 I2C backpacks for Arduino

Introduction

Like the more common version of I2C 1602 LCD, this LCD also has blue backlight. It has 4 rows of 20 characters. With this I2C interface LCD module, you will be able to realize data display via only 2 wires. If you already has I2C devices in your project, this LCD module actually cost no more resources at all. It is fantastic for Arduino based project. This LCD is available from our eBay Store.

Features

·       Interface: I2C
·       I2C Address: 0x27 or 0x3F
·       Pin Definition : GND,VCC,SDA,SCL
·       Back lit (Blue with White char color)
·       Supply voltage: 5V
·       Pcb Size : 60mm×99mm
·       Contrast Adjust :  Potentiometer
·       Backlight Adjust : Jumper

 

I2C ADDRESS:

There are a few versions of 2004 Lcd available with different I2c address e.g. 0x20, 0x27, 0x3F.
If not sure , I2C address can be verified by running  I2C scanner sketch from the Arduino playground.

For our LCD the address was verified as 0x27.


Hardware Setup:

Get four male to female dupont jumper wires and connect the LCD module to your Arduino as shown in the following image and table. Then connect your Arduino to the computer via USB:




Software Setup

The next step is to download and install the Arduino I2C LCD library for use with the backpack. First of all, rename the “LiquidCrystal” library folder in your Arduino libraries folder. We do this just to keep it as a backup.
If you’re not sure where your library folder can be found – it’s usually in your sketchbook folder, whose location can usually be found in the Arduino IDE preferences menu:



Next, visit  https://bitbucket.org/fmalpartida/new-liquidcrysta…  and download the latest file, currently we’re using v1.3.4. Expanding the downloaded .zip file will reveal a new “LiquidCrystal” folder – copy this into your Arduino libraries folder.

Now restart the Arduino IDE if it was already running – or open it now. To test the module we have a demonstration sketch prepared, simply copy and upload the following sketch:

Arduino Code:

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


LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

void setup()
{
  lcd.begin(20,4);
 // lcd.setBacklightPin(3,POSITIVE);
  //lcd.setBacklight(HIGH);// initialize the lcd
 
}
void loop()
{
  lcd.home ();                   // go home
  lcd.print(" Hello World !");
  lcd.setCursor(8,1);
   lcd.print("By");
   lcd.setCursor(6,2);
   lcd.print("Alictronix!");
   lcd.setCursor(2,3);
   lcd.print("++++++++++++++++");
   delay(1000);
}

Results:

After a few moments the LCD will be initialized and start to display "Hello world", – for example:

If the text isn’t clear, or you just see white blocks – try adjusting the contrast using the potentiometer on the back of the module. You can permanently turn off the backlight by removing the physical jumper on the back of the module.

1 comment:

  1. I've tried adjusting the contrast on my potentiometer several times, but still can't gain full control of the situation. Without going into details, is there a better way? Perhaps a new LCD graphic display is in order. What's your opinion? I really need a world class and reliable system for my full motion productions and scale objectives.

    ReplyDelete