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.
Notes:
These modules are currently supplied with a default I2C address of either 0x27 or 0x3F. To determine which version you have check the black I2C adaptor board on the underside of the module. If there a 3 sets of pads labelled A0, A1, & A2 then the default address will be 0x3F. If there are no pads the default address will be 0x27.
The module has a contrast adjustment pot on the underside of the display. This may require adjusting for the screen to display text correctly.
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 ensure when the LCD is installed in your application that no external object is applying pressure to the back of the module.
Pinout:
1.....GND
2.....VCC (+5V)
3.....SDA
4.....SCL
Arduino:
For library please see attached file
Example sketch:
Code: Select all
/* 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);
}
}
Datasheet: