Control the HD44780 LCD using HTTP/MQTT.
I use this component.
It's great work.
I made this to know if there are any notify on my HEAD LESS linux server.
ESP-IDF V5.0 or later.
ESP-IDF V4.4 release branch reached EOL in July 2024.
Character display using HD44780.
Usually called 1602LCD/1604LCD.
git clone https://github.com/nopnop2002/esp-idf-remote-hd44780
cd esp-idf-remote-hd44780
idf.py menuconfig
idf.py flash
Set the information of your access point.
You can connect using the mDNS hostname instead of the IP address.
Set the information of HD44780 device.
The initial value is no backlight control.
LCD | ESP32 | ESP32S2/S3 | ESP32C2/C3/C6 | ||
---|---|---|---|---|---|
VSS | -- | GND | GND | GND | |
VDD | -- | 3.3V/5V | 3.3V/5V | 3.3V/5V | (*2) |
VO | -- | Variable resistor output | |||
RS | -- | GPIO19 | GPIO1 | GPIO0 | (*1) |
RW | -- | GND | GND | GND | |
E | -- | GPIO18 | GPIO2 | GPIO1 | (*1) |
D0 | -- | N/C | N/C | N/C | |
D1 | -- | N/C | N/C | N/C | |
D2 | -- | N/C | N/C | N/C | |
D3 | -- | N/C | N/C | N/C | |
D4 | -- | GPIO5 | GPIO3 | GPIO2 | (*1) |
D5 | -- | GPIO17 | GPIO4 | GPIO3 | (*1) |
D6 | -- | GPIO16 | GPIO5 | GPIO4 | (*1) |
D7 | -- | GPIO4 | GPIO6 | GPIO5 | (*1) |
A | -- | 3.3V/5V | 3.3V/5V | 3.3V/5V | (*2) |
K | -- | GND | GND | GND |
(*1) You can change any GPIO using menuconfig.
(*2) 5V for 5V modules. 3.3V for 3.3V modules.
-
cursor:off blink:off(default)
curl -X POST -H "Content-Type: application/json" -d '{"lcd":"on", "cursor":"off", "blink":"off"}' http://esp32-server.local:8080/api/control
-
cursor:on blink:off
curl -X POST -H "Content-Type: application/json" -d '{"lcd":"on", "cursor":"on", "blink":"off"}' http://esp32-server.local:8080/api/control
-
cursor:off blink:on
curl -X POST -H "Content-Type: application/json" -d '{"lcd":"on", "cursor":"off", "blink":"on"}' http://esp32-server.local:8080/api/control
-
cursor:on blink:on
curl -X POST -H "Content-Type: application/json" -d '{"lcd":"on", "cursor":"on", "blink":"on"}' http://esp32-server.local:8080/api/control
-
clear lcd
curl -X POST http://esp32-server.local:8080/api/clear
-
set position
curl -X POST -H "Content-Type: application/json" -d '{"col":0, "line":0}' http://esp32-server.local:8080/api/gotoxy
-
put character on lcd
curl -X POST -H "Content-Type: application/json" -d '{"char":"s"}' http://esp32-server.local:8080/api/putc
-
put string on lcd
curl -X POST -H "Content-Type: application/json" -d '{"str":"abcdefghijklmn"}' http://esp32-server.local:8080/api/puts
-
backlight on
curl -X POST -H "Content-Type: application/json" -d '{"backlight":"on"}' http://esp32-server.local:8080/api/backlight
-
backlight off
curl -X POST -H "Content-Type: application/json" -d '{"backlight":"off"}' http://esp32-server.local:8080/api/backlight
A transistor is required for backlight control.
ESP32 3.3V/5V --------------------- LCD A
+------- LCD K
|collector
|
base /
ESP32 BL -----^^^--------| SS8050
100ohm \
|emitter
ESP32 GND -----------------+
You can use Digital transistor.
ESP32 3.3V/5V --------------------- LCD A
+------- LCD K
|OUT
|
IN /
ESP32 BL ----------------| Digital transistor
\
|GND
ESP32 GND -----------------+
sudo apt install curl
bash ./demo_http.sh
-
cursor:off
mosquitto_pub -h broker.emqx.io -p 1883 -t "/api/hd44780/cursor" -m "off"
-
cursor:on
mosquitto_pub -h broker.emqx.io -p 1883 -t "/api/hd44780/cursor" -m "on"
-
blink:off
mosquitto_pub -h broker.emqx.io -p 1883 -t "/api/hd44780/blink" -m "off"
-
blink:on
mosquitto_pub -h broker.emqx.io -p 1883 -t "/api/hd44780/blink" -m "on"
-
clear lcd
mosquitto_pub -h broker.emqx.io -p 1883 -t "/api/hd44780/clear" -m ""
-
set column
mosquitto_pub -h broker.emqx.io -p 1883 -t "/api/hd44780/col" -m "0"
-
set line
mosquitto_pub -h broker.emqx.io -p 1883 -t "/api/hd44780/line" -m "0"
-
put character on lcd
mosquitto_pub -h broker.emqx.io -p 1883 -t "/api/hd44780/putc" -m "s"
-
put string on lcd
mosquitto_pub -h broker.emqx.io -p 1883 -t "/api/hd44780/puts" -m "abcdefghijklmn"
-
backlight on
mosquitto_pub -h broker.emqx.io -p 1883 -t "/api/hd44780/backlight" -m "on"
-
backlight off
mosquitto_pub -h broker.emqx.io -p 1883 -t "/api/hd44780/backlight" -m "off"
sudo apt install mosquitto-clients
bash ./demo_mqtt.sh