Sticky notes on the fridge get lost, and messages on a phone get buried. In this lesson you build a Wi-Fi message board for your home. The ESP32 joins your Wi-Fi and serves a little web page: anyone in the family opens it on their phone, types their name and a short note, and taps Send. A second later the note appears on the 1602 LCD with a two-note chime. Long messages scroll along the bottom line. Whoever reads it presses the button, and the web page shows "read" next to the message, so the sender knows it arrived. With nothing new to show, the board turns into a clock.
What you'll learn
- How to receive text from a web form on the ESP32 with an HTTP POST request
- How to keep the last few messages in an array of structs, newest first
- How to scroll a long text on a 16-character LCD line
- Why the LCD can't show emoji, and how to clean up text before showing it
- How to get the real time from the internet for time stamps and a clock
What you need
- ESP32 board, expansion board and USB cable (ESP32 IoT Starter Kit)
- 1602 LCD display, a 10 kΩ potentiometer and a 220 Ω resistor (ESP32 IoT Starter Kit)
- Passive buzzer module (ESP32 IoT Starter Kit)
- Button module (ESP32 IoT Starter Kit)
- A 2.4 GHz Wi-Fi network and a phone
- Breadboard and jumper wires (ESP32 IoT Starter Kit)
Before you start
The LCD has 16 connections in a row. If yours has no pins, solder 16 pins from the kit's male header first, as in the LCD lesson.
Wiring

Build it step by step
Plug in all the parts first, then add the wires in this order. In each picture the new wires are bright and the ones from earlier steps are faded. Click a picture to see it larger.




| From | To |
|---|---|
| LCD VSS, RW and K | GND |
| LCD VDD | 5V |
| LCD V0 | Middle pin of the potentiometer (outer pins to 5V and GND) |
| LCD RS, E | ESP32 GPIO 13, 14 |
| LCD D4, D5, D6, D7 | ESP32 GPIO 27, 26, 25, 33 |
| LCD A (backlight +) | 220 Ω resistor, then 5V |
| Buzzer module S (signal) | ESP32 GPIO 23 |
| Buzzer module − | GND |
| Button module S | ESP32 GPIO 22 |
| Button module + | 3V3 (never 5V) |
| Button module − | GND |
Sensor modules from different makers can label and order their pins differently. Always follow the labels printed on your module.
The LCD runs on 5V, and the ESP32 sends it 3.3 V signals. That works, because the LCD treats anything above about 2.2 V as "high", and with RW on GND the LCD never sends anything back to the ESP32.
Build this circuit in EEMENTOR Lab
Wire it yourself in your browser before you touch a real wire. No sign-up, nothing to install.
Build it yourself
- The ESP32 and this lesson’s parts are already placed. Wire them using the wiring table above. Pins with no wire show red.
- Missing a part? Add it from the parts list on the left.
- Press Run, then try the inputs: click, hold or slide them under Selected.
- Wi-Fi and Bluetooth don’t run in the Lab yet, so use it to build the circuit and check the wiring before you upload the real sketch.
EEMENTOR Lab is free and in beta. Results are a guide; a real build can differ slightly. About the Lab
The sketch
The LiquidCrystal library is built into the Arduino IDE, so there is nothing to install.
Replace YOUR_WIFI_NAME and YOUR_WIFI_PASSWORD with your own network details (2.4 GHz only).
Set TIME_ZONE for your place, so the time stamps are right. Some examples: UK GMT0BST,M3.5.0/1,M10.5.0, Estonia and Finland EET-2EEST,M3.5.0/3,M10.5.0/4, New York EST5EDT,M3.2.0,M11.1.0, India IST-5:30, UAE <+04>-4.
#include <WiFi.h>
#include <WebServer.h>
#include <ESPmDNS.h>
#include <LiquidCrystal.h>
#include <time.h>
// ---------- settings ----------
const char* WIFI_NAME = "YOUR_WIFI_NAME";
const char* WIFI_PASSWORD = "YOUR_WIFI_PASSWORD";
const char* BOARD_NAME = "messageboard"; // the page is at http://messageboard.local
const char* TIME_ZONE = "CET-1CEST,M3.5.0,M10.5.0/3"; // Central Europe; see the lesson for yours
const int BUZZER_PIN = 23;
const int BUTTON_PIN = 22;
const bool PRESSED = LOW; // HIGH if your button module gives HIGH when pressed
const int KEEP = 5; // how many messages the board remembers
LiquidCrystal lcd(13, 14, 27, 26, 25, 33); // RS, E, D4, D5, D6, D7
WebServer server(80);
struct Message { char from[11]; char text[65]; time_t at; bool read; };
Message msgs[KEEP]; // msgs[0] is the newest
int stored = 0;
int showing = -1; // the message on the LCD, -1 = none
int scrollPos = 0;
unsigned long lastScroll = 0, lastClock = 0;
bool lastButton = !PRESSED;
const char PAGE[] = R"rawliteral(<!doctype html><html><head><meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1"><title>Message board</title>
<style>
body{margin:0;font-family:Arial,sans-serif;background:#F6F8FC;color:#1B3A7B;max-width:520px}
header{background:#1B3A7B;color:#fff;padding:12px 16px;font-size:20px;font-weight:bold}
.card{background:#fff;margin:12px;padding:12px 14px;border-radius:16px;box-shadow:0 2px 8px rgba(27,58,123,.08)}
input,textarea{width:100%;box-sizing:border-box;font-size:17px;padding:10px;border:2px solid #E3E8F2;border-radius:10px;margin:4px 0 10px;font-family:inherit}
button{width:100%;font-size:17px;font-weight:bold;padding:13px;border:0;border-radius:14px;background:#DE544A;color:#fff}
.msg{border-top:1px solid #E3E8F2;padding:8px 0} .msg b{font-size:15px} .msg span{float:right;font-size:13px;opacity:.7}
.msg p{margin:4px 0 0} .new{color:#DE544A;font-weight:bold}
small{opacity:.7}
</style></head><body>
<header>Message board</header>
<div class="card">
<label>Your name<input id="from" maxlength="10" placeholder="Mum"></label>
<label>Message <small id="left">64 left</small><textarea id="text" maxlength="64" rows="2" placeholder="Dinner is at 7!"></textarea></label>
<button onclick="send()">Send to the board</button>
<p id="status"><small>Letters a–z, numbers and simple punctuation work best: the LCD has no emoji.</small></p>
</div>
<div class="card" id="list">-</div>
<script>
var t = document.getElementById('text'), f = document.getElementById('from');
f.value = localStorage.getItem('from') || '';
t.oninput = function () { document.getElementById('left').textContent = (64 - t.value.length) + ' left'; };
function esc(s) { return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'); }
function send() {
if (!t.value.trim()) return;
localStorage.setItem('from', f.value);
var body = 'from=' + encodeURIComponent(f.value || 'Someone') + '&text=' + encodeURIComponent(t.value);
fetch('/send', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: body })
.then(function () { t.value = ''; t.oninput(); document.getElementById('status').textContent = 'Sent!'; list(); });
}
function list() {
fetch('/list').then(function (r) { return r.json(); }).then(function (d) {
document.getElementById('list').innerHTML = d.length ? d.map(function (m) {
return '<div class="msg"><b>' + esc(m.from) + '</b> <span>' + m.time + ' · ' + (m.read ? 'read' : '<span class="new">not read yet</span>') + '</span><p>' + esc(m.text) + '</p></div>';
}).join('') : 'No messages yet.';
});
}
list(); setInterval(list, 5000);
</script></body></html>)rawliteral";
// The LCD only knows plain letters: keep a-z, A-Z, digits and punctuation, and turn anything else into '?'.
void cleanCopy(char* to, const String& from, int size) {
int n = 0;
for (unsigned int i = 0; i < from.length() && n < size - 1; i++) {
unsigned char c = from[i];
if (c >= 0x80) { // a letter like é or an emoji takes several bytes
while (i + 1 < from.length() && (from[i + 1] & 0xC0) == 0x80) i++;
c = '?';
}
if (c == '\n' || c == '\r') c = ' '; // a new line becomes a space
if (c >= 32 && c < 127) to[n++] = c;
}
to[n] = 0;
}
void chime() {
tone(BUZZER_PIN, 1319, 120);
delay(150);
tone(BUZZER_PIN, 1760, 200);
}
int firstUnread() { // the oldest message nobody has read
for (int i = stored - 1; i >= 0; i--) if (!msgs[i].read) return i;
return -1;
}
void timeText(time_t t, char* out) { // "18:42", or "--:--" if the clock wasn't set yet
if (t > 1700000000) strftime(out, 6, "%H:%M", localtime(&t));
else strcpy(out, "--:--");
}
void show(int i) { // put message i on the LCD
showing = i;
scrollPos = 0;
lcd.clear();
if (i < 0) return;
char when[6];
timeText(msgs[i].at, when);
lcd.print(msgs[i].from);
lcd.setCursor(11, 0);
lcd.print(when);
lcd.setCursor(0, 1);
lcd.print(String(msgs[i].text).substring(0, 16));
}
void showIdle() { // no unread messages: show the clock
showing = -1;
time_t now = time(nullptr);
char line[17];
lcd.setCursor(0, 0);
if (now > 1700000000) strftime(line, sizeof(line), "%a %d.%m %H:%M ", localtime(&now));
else snprintf(line, sizeof(line), "Waiting for time");
lcd.print(line);
lcd.setCursor(0, 1);
snprintf(line, sizeof(line), "No new messages ");
lcd.print(line);
}
void receive() {
if (!server.hasArg("text") || server.arg("text").length() == 0) { server.send(400, "text/plain", "no text"); return; }
for (int i = KEEP - 1; i > 0; i--) msgs[i] = msgs[i - 1]; // make room at the top
cleanCopy(msgs[0].from, server.arg("from"), sizeof(msgs[0].from));
cleanCopy(msgs[0].text, server.arg("text"), sizeof(msgs[0].text));
if (msgs[0].from[0] == 0) strcpy(msgs[0].from, "Someone");
msgs[0].at = time(nullptr);
msgs[0].read = false;
if (stored < KEEP) stored++;
if (showing >= 0) { // the shown message moved down one place
showing++;
if (showing >= KEEP) showing = -1; // ... or fell off the end
}
Serial.printf("New message from %s: %s\n", msgs[0].from, msgs[0].text);
chime();
if (showing < 0) show(firstUnread());
server.send(200, "text/plain", "ok");
}
void sendList() {
String j = "[";
for (int i = 0; i < stored; i++) {
char when[6];
timeText(msgs[i].at, when);
String text = msgs[i].text, from = msgs[i].from;
text.replace("\\", "\\\\"); text.replace("\"", "\\\"");
from.replace("\\", "\\\\"); from.replace("\"", "\\\"");
j += String(i ? "," : "") + "{\"from\":\"" + from + "\",\"text\":\"" + text + "\",\"time\":\"" + when + "\",\"read\":" + (msgs[i].read ? "true" : "false") + "}";
}
server.send(200, "application/json", j + "]");
}
void setup() {
Serial.begin(115200);
pinMode(BUTTON_PIN, PRESSED == LOW ? INPUT_PULLUP : INPUT_PULLDOWN);
lcd.begin(16, 2);
lcd.print("Connecting...");
WiFi.mode(WIFI_STA);
WiFi.begin(WIFI_NAME, WIFI_PASSWORD);
while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print("."); }
Serial.println();
configTzTime(TIME_ZONE, "pool.ntp.org", "time.google.com");
MDNS.begin(BOARD_NAME);
server.on("/", []() { server.send(200, "text/html", PAGE); });
server.on("/send", HTTP_POST, receive);
server.on("/list", sendList);
server.begin();
lcd.clear();
lcd.print(WiFi.localIP()); // so you know where to send messages
lcd.setCursor(0, 1);
lcd.print(String(BOARD_NAME) + ".local");
Serial.printf("Open http://%s.local or http://", BOARD_NAME);
Serial.println(WiFi.localIP());
delay(4000);
showIdle();
}
void loop() {
server.handleClient();
bool button = digitalRead(BUTTON_PIN); // press: this message is read, show the next one
if (button == PRESSED && lastButton != PRESSED) {
if (showing >= 0) msgs[showing].read = true;
int next = firstUnread();
if (next >= 0) show(next); else showIdle();
delay(40);
}
lastButton = button;
if (showing >= 0 && millis() - lastScroll >= 350) { // long messages scroll along the bottom line
lastScroll = millis();
String text = String(msgs[showing].text);
if (text.length() > 16) {
String loopText = text + " " + text;
lcd.setCursor(0, 1);
lcd.print(loopText.substring(scrollPos, scrollPos + 16));
scrollPos = (scrollPos + 1) % (text.length() + 3);
}
}
if (showing < 0 && millis() - lastClock >= 10000) { // keep the clock up to date
lastClock = millis();
showIdle();
}
}

Try it
- Upload the sketch. The LCD says "Connecting...", then shows the board's IP address for 4 seconds, with as much of its name as fits below it ("messageboard.loc": a line only has 16 characters). If you see only blocks or nothing, turn the potentiometer until the text is sharp.
- Then the board shows the day, date and time, and "No new messages".
- On a phone on the same Wi-Fi, open
http://messageboard.local(or the IP address, if your phone doesn't understand .local names). Type your name and a short message and tap Send to the board. - The buzzer plays two notes and the LCD shows your name and the time on the top line and the message on the bottom line. A message longer than 16 characters scrolls.
- On the phone, the message is listed with "not read yet". Press the button module: the board goes back to the clock, and within 5 seconds the phone shows "read".
- Send three messages quickly from two phones. Each press of the button shows the next one, oldest first, until all are read. The board remembers the last 5.
- Try an emoji or a letter like é: the LCD shows a ? in its place.
What you should see

How it works

When you tap Send, the page's JavaScript sends an HTTP POST request to /send with two fields, from and text, encoded like a web form. server.arg("text") reads a field back out on the ESP32. A POST is used instead of a link like /send?text=..., because messages can contain spaces, question marks and other characters that would be awkward in an address, and because a POST is the usual way to say "this changes something".
The messages live in an array of 5 structs: each one holds the sender, the text, the time and whether it has been read. A new message pushes the others down one place, and the oldest falls off the end. The button marks the message on the screen as read and looks for the oldest unread one. /list sends the array to the phone as JSON every 5 seconds, so everyone sees the same list.
The 1602 LCD has a small built-in set of characters: English letters, numbers, punctuation and some Japanese symbols, but no é and no emoji. Web pages send text as UTF-8, where such characters take two to four bytes. cleanCopy() keeps plain characters, skips the extra bytes of the others and puts a single ? in their place, so the LCD never shows garbage. It also cuts names to 10 characters and messages to 64.
To scroll, the sketch puts the text twice in a row with three spaces in between and shows 16 characters of it, starting one place further every 350 ms. When it has moved one whole text along, it starts again, so the message seems to run round in a loop. The time comes from an internet time server through configTzTime(), the same way as in the internet alarm clock.
Try this next
- Make the backlight blink while a message is unread: connect the LCD's A pin through the 220 Ω resistor to a GPIO pin instead of 5V, and switch it on and off.
- Let a long press of the button delete all messages.
- Add a "Reply" option: a second button that sends a fixed answer ("OK!") back, shown next to the message on the web page.
- Save the messages in flash with Preferences, so they survive a power cut.
- Send messages from outside your home with a Telegram bot instead of a web page.
Troubleshooting
- It never connects to Wi-Fi: check the network name and password (both are case-sensitive) and make sure the network is 2.4 GHz.
- The LCD shows blocks or nothing: turn the potentiometer slowly from end to end. Check VSS, RW and K on GND and VDD on 5V.
- The LCD shows strange characters: one of the six data wires (RS, E, D4 to D7) is in the wrong place. Compare them with the wiring table.
- messageboard.local doesn't open: use the IP address the LCD showed at the start. Some Android phones and older Windows computers don't understand .local names.
-
The button doesn't do anything, or marks messages read by itself: your button module gives HIGH when pressed. Set
PRESSED = HIGH. - No chime: check the buzzer's S wire on GPIO 23. An active buzzer module just beeps one tone; that works too.
- The clock says "Waiting for time": the ESP32 can't reach the internet time server. Check that your Wi-Fi has internet.