Posted on Leave a comment

Arduino Uno I2C LCD Display Using Arduino IDE | In-Browser Code Uploader

The I2C LCD display is a simple way to show text, sensor readings, and status messages in Arduino projects while using only two communication pins. In this project, we will interface a 16×2 I2C LCD with an Arduino Uno and display text on the screen.

Using the In-Browser Flash feature, you can upload the program directly from your browser without copying the code manually.


Components Required

  • Arduino Uno
  • 16×2 I2C LCD Display
  • USB Cable
  • Jumper Wires

About the I2C LCD Display

A standard 16×2 LCD normally requires many Arduino pins. The I2C module attached to the LCD reduces the connection requirement to only four pins:

  • VCC
  • GND
  • SDA
  • SCL

This makes wiring simpler and leaves more pins available for other sensors and modules.


Circuit Connections

I2C LCD PinArduino Uno Pin
VCC5V
GNDGND
SDAA4
SCLA5

Circuit Diagram

Open circuit Open circuit

Arduino Code

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

LiquidCrystal_I2C lcd(0x27, 16, 2);

void setup()
{
lcd.init();
lcd.backlight();

lcd.setCursor(0, 0);
lcd.print("Hello EXASUB");

lcd.setCursor(0, 1);
lcd.print("Arduino Uno");
}

void loop()
{
}

In-Browser Flash

Upload the program directly to your Arduino Uno using the button below.

How to use the In-Browser Flash button


How the Code Works

Include Required Libraries

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

The Wire library enables I2C communication, while the LiquidCrystal_I2C library controls the LCD display.

Create LCD Object

LiquidCrystal_I2C lcd(0x27, 16, 2);

This creates an LCD object with:

  • I2C Address: 0x27
  • 16 columns
  • 2 rows

Initialize LCD

lcd.init();
lcd.backlight();

The LCD is initialized and the backlight is turned on.

Set Cursor Position

lcd.setCursor(0, 0);

Moves the cursor to the first column of the first row.

lcd.setCursor(0, 1);

Moves the cursor to the first column of the second row.

Display Text

lcd.print("Hello EXASUB");
lcd.print("Arduino Uno");

These commands display text on the LCD screen.


Expected Output

After uploading the code, the LCD should display:

Hello EXASUB
Arduino Uno

Troubleshooting

LCD Shows Nothing

  • Check VCC and GND connections.
  • Ensure SDA is connected to A4.
  • Ensure SCL is connected to A5.
  • Adjust the contrast potentiometer on the I2C module.

LCD Displays Random Characters

The I2C address may be incorrect.

Most modules use:

0x27

Some modules use:

0x3F

Finding the I2C Address

If the LCD does not respond, use the following I2C Scanner sketch.

#include <Wire.h>

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

Serial.println("Scanning...");
}

void loop()
{
byte error, address;

for(address = 1; address < 127; address++)
{
Wire.beginTransmission(address);
error = Wire.endTransmission();

if(error == 0)
{
Serial.print("I2C device found at 0x");
Serial.println(address, HEX);
}
}

delay(5000);
}

Open the Serial Monitor to view the detected I2C address.


Applications

  • Digital clocks
  • Temperature displays
  • Home automation systems
  • Menu-driven projects
  • Sensor monitoring systems
  • Robotics projects

Conclusion

In this project, we learned how to interface a 16×2 I2C LCD display with an Arduino Uno and display text on the screen using only two communication pins. I2C LCDs are widely used in Arduino projects because they simplify wiring and provide an easy way to display information.

Use the In-Browser Flash button above to quickly upload the project and start experimenting with LCD displays.

Leave a Reply

Your email address will not be published. Required fields are marked *