LCD1602 hello on an Arduino Uno
A 16x2 character LCD on six pins with the LiquidCrystal library: a greeting on the top line and the seconds since reset under it. The whole build, an Arduino Uno and 1 more part, runs here in your browser on the firmware below; open it in the editor to change the wiring or the code and run it again.
Teaching? Assign it to your class in one click.
Beginner Runs in your browser. Free, and no account needed.
The parts retail for about $35. On Mokxi they're free.
Step by step, with the wiring and the common mistakes: Arduino LCD 16x2 Without I2C: Wiring and Code
The code
The firmware exactly as the editor opens it. Change a line there and press Run: it compiles in the browser.
// LCD1602: a greeting on the top line and a seconds counter under it.
//
// LCD RS -> pin 12 LCD E -> pin 11
// LCD D4 -> pin 5 LCD D5 -> pin 4 LCD D6 -> pin 3 LCD D7 -> pin 2
// LCD VSS, RW, K -> GND LCD VDD, A -> 5V
// LCD V0 -> GND here for full contrast (a kit wires a 10k potentiometer)
//
// The display has its own controller, the HD44780, and it is talked to four
// bits at a time on D4 to D7 so that only six pins are used. RS says whether
// the bits are a command or a letter, and a pulse on E says "take them now".
// The LiquidCrystal library does all of that; print() feels like Serial.
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
unsigned long shown = 0xFFFFFFFF;
void setup() {
lcd.begin(16, 2);
lcd.print("Hello, kit!");
Serial.begin(9600);
Serial.println("Mokxi Uno: LCD1602 hello");
}
void loop() {
unsigned long seconds = millis() / 1000;
if (seconds != shown) {
shown = seconds;
lcd.setCursor(0, 1);
lcd.print("Up ");
lcd.print(seconds);
lcd.print(" s");
Serial.print("up ");
Serial.print(seconds);
Serial.println(" s");
}
}
Parts list
3 parts, plus the jumper wires. They retail for about $35; on Mokxi they're free.
How it is wired
8 connections, pin by pin, read from the circuit itself. Each line is one set of pins joined together, by a jumper wire or a breadboard strip.
- Arduino Uno R3 pin 12; Character LCD, 16x2 pin RS
- Arduino Uno R3 pin 11; Character LCD, 16x2 pin E
- Arduino Uno R3 pin 5; Character LCD, 16x2 pin D4
- Arduino Uno R3 pin 4; Character LCD, 16x2 pin D5
- Arduino Uno R3 pin 3; Character LCD, 16x2 pin D6
- Arduino Uno R3 pin 2; Character LCD, 16x2 pin D7
- Arduino Uno R3 pin 5V; Character LCD, 16x2 pin VDD; Character LCD, 16x2 pin A
- Ground: Arduino Uno R3 pin GND; Character LCD, 16x2 pin VSS; Character LCD, 16x2 pin V0; Character LCD, 16x2 pin RW; Character LCD, 16x2 pin K
Change it and keep it
Open it in the editor, change the circuit or the code, and keep your version in a free account.