Above image showing LCD connected to an Arduino Uno with a V4.0 sensor shield and 4 way anti-reverse cable (additional items not supplied with LCD)
I2C 2004 Serial 20 x 4 LCD Module:
This the larger version of our 16x4 LCD display. Its 24 character by 4 line display has a very clear and high contrast white text upon a blue background/backlight. It also includes a serial I2C/IIC adaptor board pre-soldered to the back of the LCD. This means it can be controlled with just 2 I2C serial data pins (SDA & SCL) and so requires far less digital IO pins when controlled from a microcontroller. In total the module only requires 4 wires including 5V power and GND. Contrast adjustment is also provided by the daughter board via a potentiometer. If you plan to use this with an Arduino board you can download a compatible library and example sketch from our support (see below).
Product Code HCMODU0010
Features 76mm x 25.5mm LCD display, supports IIC / I2C
Application DIY Arduino based project. Allows remote panel mounting. Requires only 2 IO pins.
FAQ:
What is the I2C address of this display?
Depending on the version of the daughter board fitted to your display it will have an I2C address of either 0x27 or 0x3F
I have run the demo sketch but I'm not seeing any characters displayed on the screen, is it faulty?
The most likeliest cause is of this issue is the displays contrast being set too low. To adjust the contrast there is an adjustment pot on the underside of the display. This may require adjusting for the screen to display text correctly.
My display is just showing solid black squares, is my display faulty?
This may be one of three things:
1) The displays contrast is too high, see previous question.
2) The display is uninitialised due to the sketch or library being incorrect, or a wrong I2C address. If using with an Arduino please ensue that you use the library and demo sketch available in the first post. If you have downloaded a library from elsewhere you will also need to remove it from your library folder.
3) It is possible for the I2C daughter board to bend and come in contact with the LCD module if enough pressure is applied to it. Please check that the daughter board is not pressing against the back of the display.
The backlight is not working, is it faulty?
On the daughter board which is fitted to the rear of the display there is a 2 pin header which should also have a jumper fitted to it. Removing the jumper will break the supply to the displays backlight. Sometimes this jumper can work loose in shipping. If the jumper is missing please check the packaging. If it's not in the packaging it can sometimes get lodged underneath the daughter board.
When I run the demo sketch I a 'lcd' was not declared in this scope error.
Locate the following 2 lines in the sketch and uncomment one of them depending on the I2C address of your display. To uncomment a line just remove the two forward slashes (//) at the beginning of the line.
- //LiquidCrystal_I2C lcd(0x27,20,4);
- //LiquidCrystal_I2C lcd(0x3F,20,4);
Pinout:
1.....GND
2.....VCC (+5V)
3.....SDA
4.....SCL
Example sketch:
- /* FILE: ARD_LCD_HCMODU0010_I2C_Hello_World_Example
- DATE: 24/05/13
- VERSION: 0.1
- This is a simple example of how to use the Hobby Components 20 x 4 line
- I2C LCD module (HCMODU0010). To use this module you will require the
- appropriate LiquidCrystal_I2C library, which can be downloaded from our support
- forum:
- http://forum.hobbycomponents.com
- This code also demonstrates the correct pin assignment for the LCD. When you
- run this program you should see a greeting message appear on the display.
- DEVICE PINOUT (SPI Interface):
- PIN 1: GND
- PIN 2: +5V
- PIN 3: SDA - Connect to Arduino analogue PIN 4
- PIN 4: SCL - Connect to Arduino analogue PIN 5
- You may copy, alter and reuse this code in any way you like, but please leave
- reference to HobbyComponents.com in your comments if you redistribute this code.
- This software may not be used directly for the purpose of selling products that
- directly compete with Hobby Components Ltd's own range of products.
- THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS LTD MAKES NO WARRANTIES, WHETHER
- EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR LACK OF NEGLIGENCE.
- HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR ANY DAMAGES,
- INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
- REASON WHATSOEVER.
- */
- /* Include the SPI/IIC Library */
- #include <Wire.h>
- #include <LiquidCrystal_I2C.h>
- /* Create some custom graphic characters to make a simple border */
- uint8_t TopLeftCorner[] = {0x00,0x00,0x0f,0x08,0x0b,0x0a,0x0a,0x0a};
- uint8_t TopRightCorner[] = {0x00,0x00,0x1e,0x02,0x1a,0x0a,0x0a,0x0a};
- uint8_t BottomLeftCorner[] = {0x0a,0x0a,0x0b,0x08,0x0f,0x00,0x00,0x00};
- uint8_t BottomRightCorner[] = {0x0a,0x0a,0x1a,0x02,0x1e,0x00,0x00,0x00};
- uint8_t VerticalBar[] = {0x0a,0x0a,0x0a,0x0a,0x0a,0x0a,0x0a};
- /* Initialise the LiquidCrystal library. Note that the displays will have a default I2C
- address of either 0x27 or 0x3F. Uncomment one of the lines below depending on
- the address of your module. */
- //LiquidCrystal_I2C lcd(0x27,20,4);
- //LiquidCrystal_I2C lcd(0x3F,20,4);
- void setup()
- {
- /* Initialise the LCD */
- lcd.begin();
- /* Transfer the custom characters into the LCD's memory */
- lcd.createChar(0, TopLeftCorner);
- lcd.createChar(1, TopRightCorner);
- lcd.createChar(2, BottomLeftCorner);
- lcd.createChar(3, BottomRightCorner);
- lcd.createChar(4, VerticalBar);
- }
- /* Main program loop */
- void loop()
- {
- /* Make sure the backlight is turned on */
- lcd.backlight();
- /* Use the custom graphic characters to draw a border */
- lcd.setCursor(0, 0);
- lcd.write(0); //Write the top left graphic
- lcd.print("==================");
- lcd.write(1); //Write the top right graphic
- lcd.setCursor(0, 1);
- lcd.write(4); //Write the vertical bar graphic
- lcd.setCursor(0, 2);
- lcd.write(4); //Write the vertical bar graphic
- lcd.setCursor(19, 1);
- lcd.write(4); //Write the vertical bar graphic
- lcd.setCursor(19, 2);
- lcd.write(4); //Write the vertical bar graphic
- lcd.setCursor(0, 3);
- lcd.write(2); //Write the bottom left graphic
- lcd.print("==================");
- lcd.write(3); //Write the bottom right graphic
- /* Display some text inside the border */
- while (1)
- {
- lcd.setCursor(2,1);
- lcd.print("HOBBY COMPONENTS");
- lcd.setCursor(2,2);
- lcd.print("**HELLO WORLD**");
- delay(500);
- lcd.setCursor(2,1);
- lcd.print(" ");
- lcd.setCursor(2,2);
- lcd.print(" ");
- delay(500);
- }
- }
Arduino Library: EDIT (16/01/16): New version now works with Arduino IDE version 1.6.7
Datasheet: