Arduino Nano 33 IoT - LCD

This guide explains how to use the Arduino Nano 33 IoT with an LCD I2C. We will learn:

Arduino Nano 33 IoT LCD I2C display

Hardware Preparation

1×Arduino Nano 33 IoT
1×Micro USB Cable
1×LCD I2C
1×Breadboard
1×Jumper Wires
1×Optionally, DC Power Jack
1×Recommended: Screw Terminal Expansion Board for Arduino Nano
1×Recommended: Breakout Expansion Board for Arduino Nano
1×Recommended: Power Splitter for Arduino Nano

Or you can buy the following sensor kits:

1×DIYables Sensor Kit (30 sensors/displays)
1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

Overview of LCD I2C 16x2

LCD I2C Pinout

The LCD display that uses I2C has four pins.

  • VCC pin: This pin provides power to the LCD and should be connected to 5V.
  • GND pin: Connect this pin to ground (0V).
  • SCL pin: This pin is for the I2C clock signal.
  • SDA pin: This pin is for the I2C data signal.
LCD I2C Pinout

LCD 16x2 Coordinates

LCD I2C 16x2 has two rows and sixteen columns, and the numbers start at 0.

Arduino Nano 33 IoT LCD I2C Coordinate

Wiring Diagram between LCD I2C and Arduino Nano 33 IoT

  • When you use the USB port to give power to the Arduino Nano 33 IoT board.
The wiring diagram between Arduino Nano and 33 IoT LCD I2C

This image is created using Fritzing. Click to enlarge image

  • When you power the Arduino Nano 33 IoT board using the Vin pin.
The wiring diagram between Arduino Nano and 33 IoT LCD I2C 5V power source

This image is created using Fritzing. Click to enlarge image

※ NOTE THAT:

When you power the Arduino Nano 33 IoT through the USB port, you can try powering the LCD display using the VBUS pin. This means you don't need an extra power source. However, keep in mind that the VBUS pin may not provide enough power for the LCD display to work properly.

How To Program LCD I2C using Arduino Nano 33 IoT

  • Add the LiquidCrystal_I2C library:
#include <LiquidCrystal_I2C.h>
  • Create a LiquidCrystal_I2C object:
LiquidCrystal_I2C lcd_i2c(0x27, 16, 2); // Initialize I2C LCD at address 0x27 with 16 columns and 2 rows
  • Set up the LCD.
lcd_i2c.init(); lcd_i2c.backlight();
  • Place the cursor at your chosen spot (column number, row number)
lcd_i2c.setCursor(column_index, row_index);
  • Show a message on the LCD screen.
lcd_i2c.print("HelloArduino Nano 33 IoT!");

※ NOTE THAT:

The LCD I2C address may vary between manufacturers. In the code, we used the 0x27 address provided by the DIYables manufacturer.

Arduino Nano 33 IoT Code

#include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27, 16, 2); // Create an LCD object with I2C address 0x27, supporting 16 columns and 2 rows void setup() { lcd_i2c.init(); // Start the LCD display connected via I2C lcd_i2c.backlight(); // Enable the LCD backlight } void loop() { lcd_i2c.clear(); // Erase all text from the display lcd_i2c.setCursor(0, 0); // Position the cursor at column 0, row 0 lcd_i2c.print("Hello"); // Output the text "Hello" at the current cursor location lcd_i2c.setCursor(2, 1); // Move the cursor to column 2, row 1 lcd_i2c.print("newbiely.com"); // Display "newbiely.com" starting at the current cursor position delay(2000); // Pause for 2000 milliseconds to allow the message to be seen lcd_i2c.clear(); // Remove all content from the display lcd_i2c.setCursor(3, 0); // Set the cursor to column 3, row 0 lcd_i2c.print("DIYables"); // Print "DIYables" beginning at the current position lcd_i2c.setCursor(0, 1); // Place the cursor at column 0, row 1 lcd_i2c.print("www.diyables.io"); // Show "www.diyables.io" starting at the new cursor position delay(2000); // Wait for 2000 milliseconds before refreshing the display }

Detailed Instructions

If you are new to the Arduino Nano 33 IoT, be sure to check out our Getting Started with Arduino Nano 33 IoT tutorial. Then, follow these steps:

  • Connect the components to the Arduino Nano 33 IoT board as depicted in the diagram.
  • Use a USB cable to connect the Arduino Nano 33 IoT board to your computer.
  • Launch the Arduino IDE on your computer.
  • Select the Arduino Nano 33 IoT board and choose its corresponding COM port.
  • Open the Library Manager by clicking the Library Manager icon on the left side of Arduino IDE.
  • In the search box, type LiquidCrystal I2C and find the LiquidCrystal_I2C library by Frank de Brabander. Click the Install button to add the LiquidCrystal_I2C library.
Arduino Nano 33 IoT LiquidCrystal I2C library
  • Copy the code above and paste it into the Arduino IDE.
  • Compile and upload the code to your Arduino Nano 33 IoT board by clicking the Upload button.
  • See the result on the LCD screen.
  • Try changing the text and its position.

Video Tutorial

Do More with LCD

Custom Character

If you want to show special characters or symbols (for example, emoticons), check out this guide on how to display special characters on an LCD.

Troubleshooting on LCD I2C

If your LCD screen is blank, please check this link: LCD does not work!- Checklist

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!