Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
Voltaat Arduino Ultimate Kit
70 min
Share

Display data to LCD using Arduino

In your daily life, you deal with many devices that have an LCD display. These LCDs help the user to interact with different devices and use them more easily. LCDs are used in a range of everyday applications, including the automobile radio and the house air conditioning remote. They display data and let you control it through menus.

Project Video

Overview

In this tutorial, we will print data on your LCD using the Arduino. It is basic and straightforward. Let’s find out more together.

Getting the Items

Arduino Uno R3 (Voltaat Version)
Get Item
2×16 LCD with I2C Module
Get Item
Jumper Wires – Male to Female (40 Pack)
Get Item

Steps

Wiring it Up

Connect the Arduino to your computer using the USB cable, as shown in the image below.

Connections from the Arduino to the LCD:

  • Arduino GND pin → I2C module GND pin

  • Arduino 5V pin → I2C module VCC pin

  • Arduino pin A4 → I2C module SDA pin

  • Arduino pin A5 → I2C module SCL pin

Coding


/*
 Voltaat learn (http://learn.voltaat.com)
 Link for full tutorial:
 LiquidCrystal I2C Library:
 Wire Library:

 Tutorial: Display data to LCD using Arduino

 The function of this sketch is to print a string on the LCD
 and use the delay function to make simple animations.

 Connections from the Arduino to the LCD:
 Arduino GND pin → I2C module GND pin
 Arduino 5V pin → I2C module VCC pin
 Arduino pin A4 → I2C module SDA pin
 Arduino pin A5 → I2C module SCL pin

*/

// This library allows you to connect with I2C/TWI devices.
#include "Wire.h"

// The library allows you to control I2C displays using functions that are quite similar to those found in the LiquidCrystal library.
#include "LiquidCrystal_I2C.h"

// LCD instance (0x27 is the I2C address), 16 is 16 number of columns, 2 is number of rows.
// make sure you are using 16x2 LCD with I2C module.
LiquidCrystal_I2C lcd(0x27, 16, 2);

// Commands inside void setup run once
void setup()
{
 // initialize the lcd
 lcd.init();

 // turn on the LCD backlight.
 lcd.backlight();

}

// Commands inside void loop run forever
void loop()
{
 // Clear what is displayed on the LCD
 lcd.clear();

 // Delay for 800 milli second to make simple animation you can change this value to get a To get a different response.
 delay(800);

 // set the cursor of the LCD to column 2, line 1
 lcd.setCursor(2, 0);

 // Print "Voltaat Store" on the LCD
 lcd.print("Voltaat Store");

 // Delay for 1200 milli second to make simple animation you can change this value to get a To get a different response.
 delay(1200);

 // set the cursor of the LCD to column 0, line 1
 lcd.setCursor(0, 1);

 // Print "You are welcome!" on the LCD
 lcd.print("You are welcome!");

 // Delay for two second to make simple animation you can change this value to get a To get a different response.
 delay(2000);

}

Testing it Out

When you upload the code to your Arduino board and connect the LCD to the I2C module as described before, you will see the LCD show the words “Voltaat Store” starting at the third column and first row since we made this function lcd.setCursor(2, 0).

The second row then prints “You are welcome!” starting from the first column.

The delay function was used to animate it. Makes the words appear and disappear at different times. Play with different delay values in the code and find out different outcomes!

Resources

No items found.