The Nextion Touch LCD 2.4" is an intelligent Human Machine Interface (HMI) solution that provides a control and visualization interface between a human and a process, machine, application, or appliance. It is a standalone device that includes an onboard processor and memory for the creation of custom user interfaces. Common applications include IoT devices, DIY electronics projects, industrial controls, and consumer electronics.
Pin Number | Pin Name | Description |
---|---|---|
1 | +5V | Power supply (4.75V to 7V) |
2 | TX | Transmit pin for UART communication |
3 | RX | Receive pin for UART communication |
4 | GND | Ground |
#include <SoftwareSerial.h>
// Define the Nextion RX and TX pins
#define NEXTION_RX 10
#define NEXTION_TX 11
// Initialize the Nextion display
SoftwareSerial nextion(NEXTION_RX, NEXTION_TX);
void setup() {
// Set the baud rate for the Nextion display and the Arduino serial monitor
nextion.begin(9600);
Serial.begin(9600);
}
void loop() {
// Check if data is available to read from the Nextion display
if (nextion.available()) {
String message = nextion.readString();
Serial.print("Message from Nextion: ");
Serial.println(message);
}
// Check if data is available to read from the serial monitor
if (Serial.available()) {
String command = Serial.readString();
nextion.print(command);
}
}
Q: Can I use the Nextion display with a 3.3V microcontroller? A: Yes, but a logic level converter is recommended to match the voltage levels for reliable communication.
Q: How do I update the user interface on the Nextion display? A: Use the Nextion Editor to create or modify the user interface and upload it to the display via a micro USB cable.
Q: What is the maximum length for serial communication cables? A: It is recommended to keep the cable length as short as possible, ideally less than 2 meters, to prevent signal degradation.
For further assistance, consult the Nextion community forums or contact technical support.