Arduino UNO Q - LCD I2C
This tutorial shows you how to use an LCD I2C 16x2 display with Arduino UNO Q — from basic text to custom characters, scrolling, and remote Telegram control.
- How to connect an LCD I2C to Arduino UNO Q
- How to display "Hello World" text on both rows
- How to display text, integers, floats, and hexadecimal numbers on the LCD
- How to create and display custom characters on the LCD
- How to scroll text across the LCD display
- How to control the LCD backlight
- How to use cursor and blink modes
- How to control the LCD remotely from Linux via Bridge programming
- How to control the LCD remotely from Telegram via Bridge programming

Hardware Preparation
Or you can buy the following kits:
| 1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some of these links are for products from our own brand, DIYables .
Buy Note: Alternatively, you can assemble the LCD I2C display using LCD 1602 Display and PCF8574 I2C Adapter Module.
Overview of LCD I2C 16x2
The LCD I2C combines a standard 16x2 LCD panel with an I2C backpack module. Using the I2C interface reduces wiring to only 4 wires — much simpler than a parallel LCD connection.
The LCD Pinout
The LCD I2C has four pins:
- GND — connect to GND
- VCC — connect to 5V
- SDA — I2C data signal
- SCL — I2C clock signal

LCD Coordinate
The LCD I2C 16x2 has 16 columns and 2 rows, with columns and rows numbered starting from 0.

Wiring Diagram

This image is created using Fritzing. Click to enlarge image
| LCD I2C Pin | Arduino UNO Q Pin |
|---|---|
| GND | GND |
| VCC | 5V |
| SDA | SDA |
| SCL | SCL |
※ NOTE THAT:
The I2C address of the LCD may differ depending on the manufacturer. In this tutorial we use 0x27, which is the default for DIYables modules.
How To Program the LCD I2C
The DIYables_LCD_I2C library makes it easy to control the LCD.
- Include the library:
- Create an LCD object with I2C address, number of columns, and number of rows:
- Initialize the LCD in setup():
- Move the cursor to a position (column, row):
- Print text at the current cursor position:
See the "Do More with LCD" section for scrolling, custom characters, and more.
※ NOTE THAT:
The I2C address may differ depending on manufacturer. We use 0x27 as specified by DIYables.
Arduino UNO Q Code — Hello World on LCD I2C
The Arduino UNO Q has two processors: the STM32 MCU (handles real-time hardware control) and the Qualcomm MPU (runs Debian Linux). In this section, only the STM32 MCU is programmed — the Linux side stays idle. A later section will show how both processors work together.
The sketch below displays text on both rows of the LCD.
Detailed Instructions
- First time with Arduino UNO Q? Follow the Getting Started with Arduino UNO Q tutorial to get your development environment ready before proceeding.
- Wire the LCD: Connect VCC→5V, GND→GND, SDA→SDA, SCL→SCL.
- Connect: Plug the Arduino UNO Q into your computer with a USB-C cable.
- Open Arduino App Lab: Launch Arduino App Lab and wait until it detects your Arduino UNO Q.
- Create a new App: Click the Create New App button.

- Give the App a name, for example: DIYables_LCD_I2C
- Click Create to confirm.
- You will see a set of folders and files generated inside your new App.

- Find the sketch/sketch.ino file — this is where you will paste the MCU sketch.
- Install the library: Click the Add sketch library button (the open book icon with a + sign) in the left sidebar.

- Search for DIYables LCD I2C created by DIYables.io and click the Install button.
- Upload: Click the Run button in Arduino App Lab to compile and upload to the STM32.

Look at the LCD — row 0 shows "Hello, World!" and row 1 shows "Arduino UNO Q"!
※ NOTE THAT:
If the LCD shows nothing or only black squares, adjust the contrast potentiometer on the back of the I2C module using a small screwdriver. See Troubleshooting on LCD I2C for more help.
Arduino UNO Q Code — Display Text and Numbers on LCD I2C
This example shows how to display a plain text string, an integer, a float, and a hexadecimal number on the LCD.
Detailed Instructions
- Copy the code above and paste it into sketch/sketch.ino.
- Click the Run button in Arduino App Lab.

The LCD first shows text and an integer, then after 3 seconds clears and shows a float and a hex number.
Useful LCD Functions Reference
Quick reference for commonly-used DIYables_LCD_I2C functions:
- lcd.init() — initialize the LCD
- lcd.backlight() — turn on the backlight
- lcd.noBacklight() — turn off the backlight
- lcd.setCursor(col, row) — move the cursor to column *col*, row *row* (both 0-based)
- lcd.print("text") — print a string at the current cursor position
- lcd.print(number) — print an integer
- lcd.print(number, HEX) — print an integer in hexadecimal
- lcd.print(floatVal, decimals) — print a float with the specified number of decimal places
- lcd.clear() — clear the display and move cursor to (0, 0)
- lcd.home() — move cursor to (0, 0) without clearing
- lcd.createChar(id, array) — register a custom character (id 0–7)
- lcd.write((byte)id) — display a registered custom character
- lcd.scrollDisplayLeft() — shift all content one column to the left
- lcd.scrollDisplayRight() — shift all content one column to the right
- lcd.cursor() — show the underscore cursor
- lcd.noCursor() — hide the cursor
- lcd.blink() — show the blinking block cursor
- lcd.noBlink() — stop the blinking block cursor
Arduino UNO Q Code — Custom Characters on LCD I2C
lcd.print() only works with ASCII characters. To display a special symbol (e.g. heart, arrow), define a custom character using 8 bytes of pixel data. An LCD 16x2 character cell is 8 rows × 5 columns of pixels — you can store up to 8 custom characters (IDs 0–7).
Use the character generator below to design your character and get the binary code:
Detailed Instructions
- Copy the code above and paste it into sketch/sketch.ino.
- Click the Run button in Arduino App Lab.

The LCD displays four custom symbols: heart, smiley, music note, and arrow — two per row.
※ NOTE THAT:
To design your own characters, use the LCD Custom Character Generator — it lets you draw the pixel pattern and outputs the byte array ready for your code. You can also use the interactive generator above.
Arduino UNO Q Code — Scrolling Text on LCD I2C
scrollDisplayLeft() and scrollDisplayRight() shift the entire display content by one column per call — both rows move together. Use a loop with a short delay to create a smooth scrolling effect.
Detailed Instructions
- Copy the code above and paste it into sketch/sketch.ino.
- Click the Run button in Arduino App Lab.

The LCD content slides left 16 steps, pauses, then slides right 16 steps back to the original position.
Arduino UNO Q Code — Backlight Control on LCD I2C
Use lcd.backlight() to turn on the I2C backpack's backlight LED and lcd.noBacklight() to turn it off. This demo cycles through on → off → on → blink pattern.
Detailed Instructions
- Copy the code above and paste it into sketch/sketch.ino.
- Click the Run button in Arduino App Lab.

Watch the LCD backlight turn on, then off, then on again, and finally blink five times.
Arduino UNO Q Code — Cursor and Blink on LCD I2C
The LCD supports two cursor styles: an underscore cursor (lcd.cursor()) and a blinking block cursor (lcd.blink()). They can be shown individually or together.
Detailed Instructions
- Copy the code above and paste it into sketch/sketch.ino.
- Click the Run button in Arduino App Lab.

The LCD cycles through: underscore cursor visible → hidden → blinking block cursor → stopped → both cursor and blink → both off.
Troubleshooting on LCD I2C
- LCD shows nothing / backlight off — Check VCC→5V and GND. Ensure the lcd.backlight() call is in setup().
- LCD shows black squares on both rows — The contrast is set too high. Turn the potentiometer on the I2C backpack to reduce contrast.
- LCD shows faint/invisible text — The contrast is set too low. Increase it via the potentiometer.
- Wrong characters displayed — The I2C address may be wrong. Try 0x3F if 0x27 does not work, or run an I2C scanner sketch to find the address.
- Sketch uploads but LCD stays blank — Double-check SDA and SCL connections are not swapped.
Linux + MCU Bridge Programming
The Arduino UNO Q has two processors that work together: the MPU (Qualcomm, runs Debian Linux) and the MCU (STM32, runs Zephyr OS with your Arduino sketch). They communicate using RPC via the Arduino_RouterBridge library — never via raw serial ports.
- The LCD is connected to the MCU (STM32) — via I2C bus (SDA/SCL). Only the MCU can directly drive the LCD.
- The MPU cannot control the LCD directly — it calls MCU functions via Bridge.call("set_line1", "text") which updates the LCD and returns the result.
- The MPU has Wi-Fi — because the MPU runs full Debian Linux with Wi-Fi, it can receive Telegram commands and display any message on the LCD remotely.
- Communication: Bridge.call() on the Linux side invokes Bridge.provide_safe() functions on the MCU side (since LCD writes are hardware API calls).
- ⚠️ Reserved: /dev/ttyHS1 (Linux) and Serial1 (MCU) are used by the Arduino Router — never open them directly.
In short: MPU sends text via Telegram → MPU calls Bridge → MCU updates LCD → MCU reports result back to MPU.
MCU sketch — LCD I2C with Bridge and Monitor output:
Python script (Arduino App Lab) — display text on LCD from Linux:
- Note: Make sure Bridge.begin() is called in the MCU sketch and the sketch is uploaded before running the Python script.
- ⚠️ Warning: Never directly open /dev/ttyHS1 (on Linux) or use Serial1 (on MCU) — these are reserved by the Arduino Router.
Detailed Instructions
- Create a new App: Open Arduino App Lab, click Create New App, name it DIYables_LCD_I2C_Bridge, and click Create.
- Paste the MCU sketch: Copy the Bridge MCU code above and paste it into sketch/sketch.ino.
- Paste the Python script: Copy the Python code above and paste it into the Python file in the App.
- Install the library: Click the Add sketch library button (the open book icon with a + sign) in the left sidebar.

- Search for DIYables LCD I2C created by DIYables.io and click the Install button.
- Search for Arduino_RouterBridge created by Arduino and click the Install button.
- Run the App: Click the Run button — the Python side updates the LCD every few seconds.
App Lab Console Output
Telegram Integration
Send any message to your LCD from anywhere in the world via Telegram.
If you do not have a Telegram bot yet, see How to Create a Telegram Bot to get your bot token before continuing.
MCU sketch: Keep the same MCU sketch from the previous Bridge section — no changes needed. Make sure it is already uploaded and running on the STM32 before proceeding.
Python script (Arduino App Lab) — Telegram bot to control LCD:
- Note: Replace YOUR_BOT_TOKEN with the token obtained from @BotFather on Telegram.
- Send /display Hello World — the text appears on the LCD.
- Send /clear — the LCD screen is cleared.
- Send /status — the bot replies with the current LCD content.
Detailed Instructions
- Upload the MCU sketch: Use the Bridge MCU sketch from the previous section (upload it first if not already done).
- Paste the Telegram script: Copy the Python code above into the Python tab of your App in Arduino App Lab.
- Set your token: Replace YOUR_BOT_TOKEN in the script with your actual bot token.
- Run the App: Click Run — the bot starts listening for Telegram commands.
- Test it: Send /display Arduino UNO Q — the LCD should show the text. Send /clear to erase it.
App Lab Console Output
ArduinoBot
OpenClaw Integration
OpenClaw integration for Arduino UNO Q LCD I2C is coming soon.
- Coming Soon: OpenClaw support for LCD I2C control on Arduino UNO Q will be covered in a future update.
Application/Project Ideas
- IoT notice board: Use Telegram to push announcements to an LCD on a wall — no computer nearby needed
- Sensor dashboard: Display temperature, humidity, or other sensor values from the MPU side in real time
- Door alarm display: When a motion sensor triggers, display "MOTION DETECTED" on the LCD and send a Telegram alert
- WiFi weather station: Fetch weather data from an API on the MPU and scroll the forecast on the LCD
- Countdown timer: Send /timer 60 via Telegram and the LCD counts down the seconds using the MCU loop
Challenge Yourself
- Easy: Modify the Telegram bot to support /line1 <text> and /line2 <text> commands to set each LCD row independently
- Medium: Add a /scroll <text> command that makes long text scroll across the LCD (use lcd.scrollDisplayLeft() in a loop)
- Advanced: Display live sensor data (temperature from a DHT22) on the LCD while simultaneously keeping Telegram commands responsive using a non-blocking update timer