This is a short demo of how an LCD display with the I2C module works…

What will I learn?

You will learn how to communicate with an LCD display – the simple way!

Prerequisites

A Computer with a configured Arduino IDE tested and working. If you don’t know how to get the basic set up working, check out my guide for Getting started (1/5)

This instruction relies on the New Liquid Crystal library, so this must be installed before uploading the code to Arduino. You can download the library from here:

To install it, extract the library zip file (NewliquidCrystal_1.3.4.zip or later) to the library directory of where you installed the Arduino IDE. After this, you must restart all open Arduino IDE editors.

Now you can upload code to the Arduino utilizing the New Liquid Crystal library.

Important notes

  • Respect minus and plus, otherwise you may damage the components.
  • It’s important to double check the connections for this project. The LCD Display can be damaged.

What you need

  • Breadboard
  • Dupont wires & connection wires
  • CP2102
  • Arduino Pro Mini
  • 1602 LCD Display with the I2C module (IMPORTANT)

Below is an image of the 1602 LCD display with the I2C module:

screenshot-from-2017-01-07-21-14-28

Connecting instructions

  • Arduino VCC → LCD display VCC
  • Arduino GND → LCD display GND
  • Arduino A4 → LCD display SDA
  • Arduino A5 → LCD display SCL

 

Fritzing

lcd-display-with-i2c_bb

 

Code

/**
* This is a short demo of how an LCD panel works...
* Connecting instructions:
* - Arduino VCC → LCD display VCC
* - Arduino GND → LCD display GND
* - Arduino A4 → LCD display SDA
* - Arduino A5 → LCD display SCL
*
*  Author: Jakob Maaloe
*  https://wackydeveloper.wordpress.com
*/
#include 

#include 

// set the LCD address to 0x27 for a 16 chars 2 line display
// Set the pins on the I2C chip used for LCD connections:
// addr, en,rw,rs,d4,d5,d6,d7,bl,blpol
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address

void setup() {
Serial.begin(9600);

lcd.begin(16, 2);

// Blink 3 times
for (int i = 0; i  0) {
// display each character to the LCD
lcd.write(Serial.read());
}
}
}

Next steps

Add an LCD Display to one of the other example projects or try the advanced LCD module without the I2C module on the next project, LCD module without I2C module.

Advertisements