I2C/TWI LCD1602 Module (SKU: TOY0046)

From DFRobot Electronic Product Wiki and Tutorial: Arduino and Robot Wiki-DFRobot.com


This is another great LCD display compatible with Gadgeteer modules from DFRobot. With limited pin resources, your project will quicly run out of resources using normal LCDs. With this I2C interface LCD module, you only need 2 lines (I2C)to display the information.If you already have I2C devices in your project, this LCD module actually cost no more resources at all. The adress can be set from 0x20-0x27.Fantastic for Arduino or gadgeteer based projects.


  • I2C Address:0x20-0x27(0x20 default)
  • Back lit (Blue with white char color)
  • Supply voltage: 5V
  • Interface:I2C/TWI x1,Gadgeteer interface x2
  • Adjustable contrast
  • Size:82x35x18 mm

Contrast Adjust

The contrast can be adjusted by the potential-meter displayed in the following picture.

Toy0046 pinout.jpg

Address Setting

A2 A1 A0 地址
0 0 0 0x20
0 0 1 0x21
0 1 0 0x22
0 1 1 0x23
1 0 0 0x24
1 0 1 0x25
1 1 1 0x26
1 1 1 0x27

  • 0: The Jumper Cap is connected
  • 1: The Jumper Cap is disconnected
  • The default address is 0x20. All the jumper caps will be connected from the factory.

Connection Diagram

Connection Diagram
Arduino UNO: connect SDA to Analog pin 5 and SCL to Analog pin 4 on your Arduino.
Arduino Leonardo: connect SDA to digital pin 2 and SCL to digital pin 3 on your Arduino.

Library Support Functions

  • LiquidCrystal_I2C() //set the LCD address for a 16 chars and 2 line display
  • init() //Initialization for the LCD
  • clear() //clear display, set cursor position to zero
  • home() //set cursor position to zero
  • createChar() //Fill the first 8 CGRAM locations with custom characters
  • setCursor() //set the position of the cursor
  • cursor() //Turns the underline cursor on
  • noCursor() //Turns the underline cursor off
  • blink() //Turn on the blinking cursor
  • noBlink() //Turn off the blinking cursor
  • display() //Turn the display on(quickly)
  • noDisplay() //Turn the display 0ff(quickly)
  • backlight() //Turn the backlight on
  • noBacklight() //Turn the backlight off
  • scrollDisplayLeft() //Make the display scroll left without changing the RAM
  • scrollDisplayRight() //Make the display scroll right without changing the RAM
  • autoscroll() //This will 'right justify' text from the cursor
  • noAutoscroll() //This will 'left justify' text from the cursor
  • leftToRight() //This is for text that flows Left to Right
  • rightToLeft() //This is for text that flows Right to Left

Sample Code

Download Sample code and library

//Compatible with the Arduino IDE 1.0
//Library version:1.1
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup()
  lcd.init();                      // initialize the lcd 
  // Print a message to the LCD.
  lcd.print("Hello, world!");

void loop()

Sample sketch: Control the back light of the I2C LCD1602 Module

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

#if defined(ARDUINO) && ARDUINO >= 100
#define printByte(args)  write(args);
#define printByte(args)  print(args,BYTE);

LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup(){
  lcd.init();                      // initialize the lcd 
  lcd.print("Hello world...");
  lcd.setCursor(0, 1);

int backlightState = LOW;
long previousMillis = 0;
long interval = 1000;
void loop(){
  unsigned long currentMillis = millis();
  if(currentMillis - previousMillis > interval) {
    previousMillis = currentMillis;   

    if (backlightState == LOW)
      backlightState = HIGH;
      backlightState = LOW;

    if(backlightState == HIGH)  lcd.backlight();
    else lcd.noBacklight();


Nextredirectltr.pngGo Shopping I2C/TWI LCD1602 Module (SKU: DFR0063)

Category: DFRobot > Sensors & Modules > LCDs, LEDs & Displays