Site Guide

Find your way around the Engineering Club.

Know what you need? Search for a component, concept or project.

Around the site

Start

Labs

TestingExperimental

Build

Club

LearnExperimental

Go a little deeper

Entry points to larger collections. Use Search for individual records.

Learning paths & reference

Inside PiCrawlerExperimental

Inside Inventory

← Mega Components

ELEGOO MEGA · LESSON 22

LCD Display

Show “Hello, World!” and elapsed seconds on a parallel LCD.

Drive a 16×2 LCD through its four-bit parallel interface.

Parts List

  • ELEGOO Mega 2560 R3 is a 5 V ATmega2560 AVR board with many I/O pins and four hardware UARTs for control systems with several peripherals. Long ELEGOO-branded Mega PCB with USB-B and barrel connector, ATmega2560 marking, extended side headers and a large double-row digital header at the end. Read printed Mega labels; its SPI hardware placement is not the same numeric pins as an Uno.
  • A USB-A to USB-B cable carries USB power and, when its data conductors are present, a host/device data link. USB-A plug and square USB-B plug. Inspect the plug shape; micro-USB is not USB-C, and USB-B is the squarer device connector.
  • An 830-contact solderless breadboard joins inserted leads through hidden spring strips so circuits can be rebuilt without solder. Full-size rectangular board, center channel, numbered five-hole terminal groups and side power rails. Counted contact holes are not component units.
  • A parallel LCD1602 displays two rows of sixteen characters using liquid-crystal cells and a character-controller interface. Long rectangular 16×2 window and carrier PCB. A parallel header row is present; check the back to ensure no backpack has been added.
  • A screwdriver-adjusted trimmer forms an adjustable voltage divider for calibration or a user control. Blue square screwdriver-adjusted trimmer shown in the KS3020 source crop and PXL_20260924_195451704.jpg. Identify both track ends and wiper with an unpowered resistance measurement.
  • 220 Ω resistor provides a fixed opposition to current. LED current limiting is a common use when its unverified power and tolerance limits fit the circuit. Small axial body with one wire at each end. Find the labeled value compartment and measure an isolated loose part with a meter; the shared inventory image is a form reference.
  • Male-to-male jumper leads make removable point-to-point connections for low-current prototype signals. Pins at both ends; count individual leads rather than ribbon groups. Check intact insulation and snug contacts before use.

Assembly

  1. Disconnect USB; use the 16-pin parallel display and the original layout, applying the backlight resistor addition in the table.
  2. Set the contrast trimmer near the ground end; reconnect USB and adjust until text appears.
Illustration © ELEGOO. All rights reserved.
Illustration © ELEGOO. All rights reserved. Open full-size ↗

Reviewed connections

FromToNote
Mega D7,D8,D9,D10,D11,D12LCD pins 4,6,11,12,13,14RS,E,DB4,DB5,DB6,DB7
Mega 5 V / GNDLCD 2 VDD / 1 VSS, 5 R/W and 16 KLeave LCD DB0–DB3 unconnected
10 kΩ trimmer ends → 5 V/GND; wiper → LCD 3 VOContrastRead the actual trimmer wiper identification
Mega 5 V → 220 Ω → LCD 15 ABacklight limit addedUse this series resistor even if the module has its own resistor; reduced brightness is expected

Source-reviewed wiring. Hardware not bench-tested; firmware uploads have not been performed.

Code

Download complete PlatformIO project
ZIP includes platformio.ini, src/main.cpp, and bundled libraries (LiquidCrystal).

Extract the ZIP, then open its lesson-22-project/workspaces/lesson-22 folder in VS Code. Keep the adjacent third-party folder in place.

PlatformIO configuration
platformio.ini
[env:mega]
platform = atmelavr@5.3.0
board = megaatmega2560
framework = arduino
monitor_speed = 9600
lib_deps =
  file://../../third-party/LiquidCrystal
main.cpp
// ELEGOO/Arduino LiquidCrystal Hello World example; original example is public domain.
#include <Arduino.h>
#include <LiquidCrystal.h>  // HD44780-compatible PARALLEL display, not an I2C backpack.
// Constructor order is RS, enable, D4, D5, D6, D7. The data bus transfers four bits at a time.
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
void setup() {
  lcd.begin(16, 2);  // There are 16 columns and two character rows.
  lcd.print("Hello, World!");
}
void loop() {
  lcd.setCursor(0, 1);  // Positions start at zero, so row 1 is the second visible row.
  // millis counts milliseconds since reset; integer division converts them to whole seconds.
  lcd.print(millis() / 1000);
}

Source: SOURCE_RECONCILED. Compile: COMPILE_VERIFIED. Hardware: NOT_TESTED. Upload: NOT_PERFORMED.

Expected behavior

First row reads Hello, World!; the second counts whole seconds since reset. A backlight alone does not verify data wiring.

Experiments & Challenges

  • Change the greeting without exceeding 16 columns.

Troubleshooting

  • Blocks/no text: check VO contrast and RS/E/DB4–DB7 order; an I2C-backpack library does not fit this circuit.