If you want your Arduino project to show text instead of just blinking an LED, an LCD I2C display is the easiest way to get there. This tutorial walks through wiring a 16x2 LCD I2C screen to an Arduino Giga R1 WiFi and driving it with MicroPython, using only four wires thanks to the I2C interface, which carries data and clock signals over just two pins instead of the eight or more a plain LCD would need.
The full tutorial, with every detail and the line-by-line code explanation, is on our site: Arduino MicroPython LCD I2C
What you need
- Arduino Giga R1 WiFi
- USB Cable Type-A to Type-C (for USB-A PC)
- USB Cable Type-C to Type-C (for USB-C PC)
- LCD I2C Display 3.3V
- LCD I2C 20x4
- Jumper Wires
- Screw Terminal Block Shield for Arduino Uno/Mega/Giga
- Sensors/Servo Expansion Shield for Arduino Mega/Giga
- Breadboard Shield for Arduino Mega/Giga
- Enclosure for Arduino Giga
- Power Splitter for Arduino Giga
- DIYables Sensor Kit (18 sensors/displays)
Wiring
The LCD I2C module has four pins: GND and VCC for power, and SDA and SCL for the I2C data and clock lines. Connect GND to ground and VCC to the board's 5V supply, since most of these displays are 5V parts even though many Arduino boards run their logic at 3.3V. For that reason it's worth using the 3.3V-rated LCD I2C display rather than a generic 5V one, so you don't risk damaging the board.
On the Arduino Giga R1 WiFi, the code uses I2C bus 1, where SCL is on D8 and SDA is on D9. Double check your board's I2C pin labels if you're using a different Arduino, since they vary.
How it works
The display itself is a 16x2 grid: 16 columns and 2 rows of character cells, numbered starting from 0. A small potentiometer on the back of the module lets you adjust contrast, which is often the first thing to check if the screen looks blank. The I2C backpack on the display converts those four wires into commands the LCD understands, so your code just needs to talk I2C instead of managing a dozen individual control lines.
Each LCD also has an I2C address, commonly 0x27 or 0x3F depending on the manufacturer, which your code needs to know in order to talk to the right device on the bus.
Code
The script sets up an I2C object on bus 1, then wraps it in an LCD_I2C instance from the DIYables_MicroPython_LCD_I2C library, passing in the I2C address plus the display's row and column count. After turning on the backlight and clearing the screen, the main loop uses lcd.set_cursor() to position text and lcd.print() to write it, alternating between showing a name and URL, then an integer and a float, with a two second pause between screens using utime.sleep().
arduino-micropython-lcd-i2c.py
""" This Arduino MicroPython script was developed by newbiely.com This Arduino MicroPython script is made available for public use without any restriction For comprehensive instructions and wiring diagrams, please visit: https://newbiely.com/tutorials/arduino-micropython/arduino-micropython-lcd-i2c """ from machine import I2C, Pin from DIYables_MicroPython_LCD_I2C import LCD_I2C import utime # The I2C address of your LCD (Update if different) I2C_ADDR = 0x27 # Use the address found using the I2C scanner # Define the number of rows and columns on your LCD LCD_ROWS = 2 LCD_COLS = 16 # Initialize I2C i2c = I2C(1) # Arduino Giga R1 WiFi I2C1 pins: SCL-D8, SDA-D9 # Initialize LCD lcd = LCD_I2C(i2c, I2C_ADDR, LCD_ROWS, LCD_COLS) # Setup function lcd.backlight_on() lcd.clear() # Main loop function while True: lcd.clear() lcd.set_cursor(3, 0) # Move the cursor to column 3, row 0 (first row) lcd.print("DIYables") lcd.set_cursor(0, 1) # Move the cursor to column 0, row 1 (second row) lcd.print("www.diyables.io") utime.sleep(2) lcd.clear() lcd.set_cursor(0, 0) # Move to the beginning of the first row lcd.print("Int: ") lcd.print(str(1234)) # Print integer lcd.set_cursor(0, 1) # Move to the beginning of the second row lcd.print("Float: ") lcd.print(str(56.78)) # Print float utime.sleep(2) Things that go wrong
If nothing shows up on the screen, turn the potentiometer on the back of the module first, since low contrast often looks like a dead display. If that doesn't fix it, the I2C address is the next suspect: try 0x27 and 0x3F since those are the two common defaults, and if neither works, run an I2C scanner script on the Arduino to find the actual address and check the result printed in Thonny's shell.
Full tutorial
The complete tutorial - wiring diagram, code explanation and troubleshooting - is here: https://newbiely.com/tutorials/arduino-micropython/arduino-micropython-lcd-i2c
