Same-day dispatch before 2 PM · Free delivery over ₹999 · GST invoices Get the appPrices incl. GST
Geekobot
Snap & SendNEWGeeko AIWhere's myOrder
Log in
Products
  • Projects
    • Component guidesHow parts work, with code you can run
    • Learning pathsFrom your first LED to your first robot
    • Workshops & eventsOnline sessions for makers and classes
    • ElectrolarkFree guided builds, simulator and certificates
    • Students & teachersStudent discount and classroom help
    • CommunityShare builds and ask other makers
    • CalculatorsOhm's law, LED resistor, 555 and 100+ more
    • Circuit builderWire parts and run the circuit, powered by Electrolark
    • Geeko AIAsk what to buy or how to wire it
    • Snap & SendPhotograph a part or list, we find it
    • Part finderAnswer a few questions, get the right part
    • Compatibility checkWill these two parts work together?
    • Compare partsSpecs side by side
    • Business & bulk ordersGST invoices, credit and volume prices
    • Request a quotationSend your list, get a quote
    • Classroom kitsPer-student kits and lab bundles
    • Gift cardsFor students, teams and events
  • Atal Tinkering Lab
BOM to cart
Geekobot

Components, kits and know-how for makers, students, engineers, labs and businesses across India.

Ask Geeko AIOrders, parts and projects, any timeEmail supportReply within 1 working dayGet the Geekobot appAdd it to your home screen, free

Follow us

Shop

  • Boards & SBCs
  • Sensors & Modules
  • IoT & Wireless
  • Drone & FPV
  • 3D Printing
  • Filaments & Resins
  • Motors & Drivers
  • Power & Batteries
  • Semiconductors
  • Passive
  • Displays & LEDs
  • Switches & Relays
  • Wires & Cables
  • Prototyping
  • Tools & Test
  • Robotics
  • STEM Kits
  • Atal Tinkering Lab
  • Mechanical Parts
  • Audio

Orders

  • Track your order
  • Help & support
  • Shipping and delivery
  • Refunds and cancellation
  • Contact us

Learn

  • Projects
  • Geeko AI project assistant
  • Learning paths
  • Guides
  • Calculators
  • Electrolark: free guided builds

Part tools

  • Part finder
  • Compare parts
  • Will it work with my board?

Institutions

  • Classroom kits
  • Atal Tinkering Lab
  • Students & teachers
  • Workshops & Events

Business

  • Business & education
  • Request a quotation
  • BOM bulk upload
  • Quick order by SKU

Company

  • About Geekobot
  • Community
  • Gift cards
  • Terms & conditions
  • Privacy policy
  • Product directory
  • Sitemap

© 2026 Geekobot, a trade name of OLatus Systems Private Limited. All rights reserved.

20, 1st Floor, Neeladri Complex, 10th Cross, Sampige Rd, 2nd Main, Malleshwaram, Bengaluru, Karnataka 560003 · GSTIN 29AACCO0462F1ZM

+91 91810 15607 · connect@geekobot.in · Monday to Saturday, 10 AM to 2 PM IST

UPI · CARDS · NETBANKING · GST INVOICES

ShopProjectsGeeko AIGuides
Compare 0 parts →
Log in

Shop by category

Shop all components
  • Boards & SBCs1,910 products
    • Alternative Single Board Computers
    • Arduino Ecosystem
    • FPGA & Logic Boards
    • Microcontroller & Wireless Boards
    View all
  • Sensors & Modules4,701 products
    • Biomedical & Heart Rate
    • Current, Voltage & Power
    • Force, Weight & Pressure
    • Gas, Weather & Environmental
    View all
  • IoT & Wireless2,314 products
    • RF Modules
    • RFID & NFC
    • Antennas & RF Accessories
    • Cameras & Smart Vision
    View all
  • Drone & FPV3,558 products
    • Flight Control & Navigation
    • FPV Video & Optics
    • Frames & Structural Parts
    • Motors & Propulsion
    View all
  • 3D Printing2,204 products
    • 3D Printers
    • 3D Scanners & Digitizers
    • Laser Engravers & Cutters
    • Material Management & Upgrades
    View all
  • Filaments & Resins1,472 products
    • Filaments
    • Photopolymer Resins
    View all
  • Motors & Drivers463 products
    • BLDC Motor Drivers
    • DC & Geared Motors
    • DC Motor Drivers
    • Linear Actuators & Solenoids
    View all
  • Power & Batteries557 products
    • Battery Holders & Connectors
    • Breadboard Power
    • Chargers & BMS
    • DC-DC Converters
    View all
  • Semiconductors295 products
    • Diodes & Rectifiers
    • Interface & RF Encoder ICs
    • Logic ICs (74xx)
    • Logic ICs (CD4000)
    View all
  • Passive67 products
    • Capacitors
    • Circuit Protection
    • Crystals & Oscillators
    • Inductors
    View all
  • Displays & LEDs572 products
    • 7-Segment & Dot Matrix
    • Addressable LEDs
    • Character LCDs
    • Graphic LCDs
    View all
  • Switches & Relays184 products
    • Keypads & Touch
    • Push Buttons & Tactile
    • Relay Modules
    • Relays
    View all
  • Wires & Cables233 products
    • Board-to-Wire Connectors
    • Crimp & Splice
    • Headers & Dupont
    • Heat Shrink & Sleeving
    View all
  • Prototyping101 products
    • Breadboards
    • Interface Modules
    • PCBs & Perfboards
    View all
  • Tools & Test717 products
    • Bench Power Supplies
    • Hand Tools
    • Measuring Tools
    • Meters & Testers
    View all
  • Robotics180 products
    • Humanoid & Legged Robots
    • Robot Chassis & Platforms
    • Robotic Arms & Grippers
    • Wheels & Casters
    View all
  • STEM Kits268 products
    • Arduino Learning Kits
    • Coding & IoT Kits
    • Early Coding (Ages 3-8)
    • Invention Kits
    View all
  • Atal Tinkering Lab196 products
    • Package 1: Electronics, Robotics, IoT and Sensors
    • Package 2: Rapid Prototyping Tools
    • Package 3: Mechanical, Electrical and Measurement Tools
    • Package 4: Power Supply, Accessories and Safety Equipment
    View all
  • Mechanical Parts212 products
    • Bearings
    • Brackets & Mounts
    • Couplers
    • Fasteners & Standoffs
    View all
  • Audio109 products
    • Amplifier Modules
    • Buzzers & Sirens
    • Speakers
    View all
  1. Home
  2. ›Guides
  3. ›Displays & LEDs
  4. ›16x2 LCD with I2C
Step 7 of 17 in Displays and lightsPart of a learning path.
Next

How-to · Beginner · 3 min read

16x2 LCD with I2C

Wiring, Address, Contrast and Code

By Geekobot Learning Team · Updated 24 Oct 2026

I'm using
Wiring, code and the Run it panels follow your board.
On this page
Short answerWiring a 16x2 LCD with I2C backpackArduino code for an I2C LCDTroubleshooting a blank or garbled LCDUsing a 5 V I2C LCD with ESP32 or Pico16x2 LCD vs OLED vs TFTCommon mistakesFAQsParts and next steps
Short answer

A 16x2 LCD shows two lines of 16 characters using the HD44780 controller. With a PCF8574 I2C backpack it needs only four wires: VCC, GND, SDA and SCL. The backpack's address is usually 0x27 or 0x3F, and its blue trimmer sets contrast. If the screen lights up but shows nothing or a row of blocks, adjust that trimmer first.

Key specs at a glance

Display
16 characters x 2 lines, 5 x 8 dot characters
Controller
HD44780 or compatible
Supply
5 V (3.3 V versions exist)
Parallel mode
6 pins in 4-bit mode (RS, E, D4 to D7)
I2C backpack
PCF8574, address 0x27 (PCF8574A: 0x3F)
Custom characters
8 user-defined
01

Wiring a 16x2 LCD with I2C backpack

Backpack pinArduino UnoESP32Raspberry Pi Pico
GNDGNDGNDGND
VCC5V5V (VIN)VBUS (5 V)
SDAA4GPIO 21GP4
SCLA5GPIO 22GP5
GND
Arduino Uno:
GND
ESP32:
GND
Raspberry Pi Pico:
GND
VCC
Arduino Uno:
5V
ESP32:
5V (VIN)
Raspberry Pi Pico:
VBUS (5 V)
SDA
Arduino Uno:
A4
ESP32:
GPIO 21
Raspberry Pi Pico:
GP4
SCL
Arduino Uno:
A5
ESP32:
GPIO 22
Raspberry Pi Pico:
GP5
02

Arduino code for an I2C LCD

Install LiquidCrystal I2C (by Frank de Brabander or a maintained fork) from the Library Manager. If the address is unknown, run the I2C scanner first.

Hello on a 16x2 I2C LCD · Arduino C++Verify & upload in Electrolark
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);   // try 0x3F if blank

void setup() {
  lcd.init();
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("Hello, maker!");
  lcd.setCursor(0, 1);
  lcd.print("Geekobot");
}

void loop() {}
03

Troubleshooting a blank or garbled LCD

SymptomLikely causeFix
Backlight on, no textContrast set wrongTurn the blue trimmer on the backpack slowly
Top row of solid blocksDisplay not initialisedCheck address, SDA/SCL wiring and lcd.init()
Nothing at allNo power or backlight jumper missingCheck 5 V and the backlight jumper on the backpack
Random charactersLoose wires or long leadsShorten wires, add a common ground
Works on Uno, faint on ESP32Powered from 3.3 VPower the LCD from 5 V
Backlight on, no text
Likely cause:
Contrast set wrong
Fix:
Turn the blue trimmer on the backpack slowly
Top row of solid blocks
Likely cause:
Display not initialised
Fix:
Check address, SDA/SCL wiring and lcd.init()
Nothing at all
Likely cause:
No power or backlight jumper missing
Fix:
Check 5 V and the backlight jumper on the backpack
Random characters
Likely cause:
Loose wires or long leads
Fix:
Shorten wires, add a common ground
Works on Uno, faint on ESP32
Likely cause:
Powered from 3.3 V
Fix:
Power the LCD from 5 V
04

Using a 5 V I2C LCD with ESP32 or Pico

The LCD needs 5 V for good contrast. The backpack's pull-up resistors then hold SDA and SCL at 5 V, which is above the ESP32's and Pico's 3.6 V limit. Many people run it this way without trouble, but the safe method is a BSS138 level shifter between the board and the backpack, or removing the backpack's pull-ups so the 3.3 V board's pull-ups set the level.

05

16x2 LCD vs OLED vs TFT

Choose a 16x2 or 20x4 LCD for large, readable text in bright rooms and on control panels. Choose an SSD1306 OLED for small graphics and battery projects. Choose a TFT for colour and touch interfaces.

06

Common mistakes to avoid

  • !Giving up on a blank screen before adjusting the contrast trimmer.
  • !Using the wrong address; 0x27 and 0x3F are both common.
  • !Powering the LCD from 3.3 V so the text is faint or invisible.
  • !Calling lcd.clear() every loop, which makes the display flicker; overwrite text instead.
  • !Mixing up libraries: several share the name LiquidCrystal_I2C with different init() and begin() calls.
07

Frequently asked questions

What is the I2C address of a 16x2 LCD?

Usually 0x27 for backpacks with the PCF8574 chip and 0x3F for the PCF8574A. Solder pads A0 to A2 change it. An I2C scanner confirms the address.

Why does my LCD show only boxes?

A row of blocks means the display is powered but not initialised. Check SDA/SCL wiring, the address in your code, and adjust the contrast.

Can I use a 16x2 LCD without I2C?

Yes, in 4-bit parallel mode using six digital pins (RS, E, D4 to D7) and the built-in LiquidCrystal library, plus a 10 kΩ potentiometer for contrast.

Does a 16x2 LCD work with ESP32?

Yes. Power it from 5 V and use GPIO 21 and 22 for I2C. A level shifter is the safest way to handle the backpack's 5 V pull-ups.

How do I show custom symbols on an LCD?

Use lcd.createChar(slot, pattern) with an 8-byte pattern. You can store up to eight custom characters, such as a degree sign or battery icon.

Parts for this guide

  • LCD1602 16x2 Character LCD Display
    ₹109View
  • 4-Channel Logic Level Converter (BSS138)
    ₹20View
  • 16mm Rotary Potentiometer (Linear)
    ₹14View
Shop Character LCDs

Terms in this guide

I2CInter-Integrated Circuit: a two-wire bus (SDA and SCL) that connects many devices by address.HD44780The standard controller chip used in character LCDs such as 16x2 and 20x4 displays.Pull-up resistorA resistor from a signal line to the supply that keeps the line high when nothing pulls it low.Logic levelThe voltage that represents a digital high: 5 V on classic Arduinos, 3.3 V on ESP32, Pico and Raspberry Pi.

Projects that use it

Put this into practice: 249 step-by-step builds in our project library use parts from this guide.

Beginner · 1–2 hoursTemperature-controlled fanView projectBeginner · 1 hourFreezer temperature alarmView projectIntermediate · 2 hoursAquarium heater controllerView project
Browse all 249 projects

Keep learning

Concept explainerIntermediateI2C ExplainedI2C is a two-wire bus that lets one microcontroller talk to many sensors and displays using a data line (SDA) and a clock line (SCL).4 min read · Electronics FundamentalsHow-toBeginnerSSD1306 OLED DisplayThe SSD1306 is the driver chip in most small monochrome OLED displays, such as the popular 0.96 inch 128x64 module.3 min read · Displays & LEDsHow-toIntermediate3.3 V vs 5 V LogicYou need level shifting when a 5 V device sends signals to a 3.3 V board such as an ESP32 or Raspberry Pi Pico, because 5 V on their pins can damage them.4 min read · Prototyping & WiringComponent guideBeginnerArduino UnoThe Arduino Uno is a beginner-friendly microcontroller board that reads sensors and controls LEDs, motors and relays using simple C++ programs called sketches.5 min read · Boards & Microcontrollers

Sources

  • HD44780U dot-matrix LCD controller datasheet (Hitachi)
  • PCF8574 remote 8-bit I/O expander datasheet (NXP / Texas Instruments)

Written by the Geekobot team from manufacturer datasheets. Always check the datasheet for the exact part and variant you buy.

On this page
Short answerWiring a 16x2 LCD with I2C backpackArduino code for an I2C LCDTroubleshooting a blank or garbled LCDUsing a 5 V I2C LCD with ESP32 or Pico16x2 LCD vs OLED vs TFTCommon mistakesFAQsParts and next steps
Need a hand?Ask Geeko AI which part fits your project, or talk to the Geekobot team.Ask Geeko AIHelp & support

Parts for this guide3 items · ₹143

LCD1602 16x2 Character LCD Display · 4-Channel Logic Level Converter (BSS138) · 16mm Rotary Potentiometer (Linear)

Run itChange the inputs and watch the output

A 16x2 screen shows 16 characters per row. Longer text is cut off, as it is here.

Hello, maker!
Geekobot
text showsResult

A simulation of the sketch above, so you know what to expect. Real readings vary with your parts and wiring.

Ask the Community

Ask a question