Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use nextion 2.8 : Examples, Pinouts, and Specs

Image of nextion 2.8 Design with nextion 2.8 in Cirkit Designer

Introduction

The Nextion 2.8 is a smart display module manufactured by Nextion, featuring a 2.8-inch resistive touchscreen interface. It is designed to simplify the development of Human-Machine Interfaces (HMI) by integrating a built-in microcontroller and a user-friendly design environment. The module communicates via UART (serial communication), making it compatible with a wide range of microcontrollers, including Arduino, Raspberry Pi, and other embedded systems.

Explore Projects Built with nextion 2.8

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Arduino Nano-Based Environmental Monitoring System with Nextion Touch LCD and CAN BUS Communication: A project utilizing nextion 2.8  in a practical application
Arduino Nano-Based Environmental Monitoring System with Nextion Touch LCD and CAN BUS Communication

This circuit features an Arduino Nano microcontroller interfaced with a Nextion Touch LCD for user input/output, multiple SSR-10A solid-state relays for controlling high-power devices, and a single-channel relay for additional switching capabilities. It includes an Adafruit MCP9600 for temperature measurements, an MQ-5 gas sensor for detecting gas concentrations, a Hall effect sensor for magnetic field detection, and a CAN BUS module for vehicle communication. The circuit is powered by an LM2596 step-down module and includes various resistors for voltage/current adjustments and protection.

Open Project in Cirkit Designer
Image of Arduino Mega 2560 Controlled Automation System with 8-Channel Relay and Nextion Touch LCD Interface: A project utilizing nextion 2.8  in a practical application
Arduino Mega 2560 Controlled Automation System with 8-Channel Relay and Nextion Touch LCD Interface

This circuit is centered around an Arduino Mega 2560, which controls a Nextion Touch LCD for user interface and a series of relays for switching various loads. The Arduino is powered by a 9V SMPS, and it drives an 8-channel 5V relay module to control devices like pumps, a loudspeaker, actuators, a heating plate, and a plucker. The relays are interfaced with solid-state relays (SSRs) and a thermistor for temperature sensing, enabling controlled power distribution to the connected devices based on programmed logic and user input.

Open Project in Cirkit Designer
Image of Arduino Nano-Based OLED Clock with RTC and LiPo Battery Charging: A project utilizing nextion 2.8  in a practical application
Arduino Nano-Based OLED Clock with RTC and LiPo Battery Charging

This circuit features an Arduino Nano connected to an OLED display and a DS3231 real-time clock (RTC) module for displaying the current time. The Arduino Nano is powered through a toggle switch connected to its VIN pin, with power supplied by a TP4056 charging module that charges and manages two 3.7V LiPo batteries connected in parallel. The OLED and RTC module communicate with the Arduino via I2C, with shared SDA and SCL lines connected to the A4 and A5 pins of the Arduino, respectively.

Open Project in Cirkit Designer

Common Applications and Use Cases

Technical Specifications

Below are the key technical details of the Nextion 2.8 smart display module:

Specification Details
Display Type 2.8-inch TFT resistive touchscreen
Resolution 320 x 240 pixels (QVGA)
Color Depth 65K (16-bit RGB)
Communication Interface UART (TTL, 9600 bps default)
Input Voltage 4.75V to 7V
Power Consumption 90mA (typical)
Operating Temperature -20°C to 70°C
Storage Temperature -30°C to 85°C
Flash Memory 4MB
RAM 3584 bytes
Dimensions 85mm x 50mm x 5.1mm

Pin Configuration and Descriptions

The Nextion 2.8 module has a 4-pin interface for power and communication:

Pin Name Description
1 GND Ground connection
2 VCC Power supply (4.75V to 7V)
3 TX Transmit data (output from Nextion to host device)
4 RX Receive data (input to Nextion from host device)

Usage Instructions

How to Use the Component in a Circuit

  1. Powering the Module: Connect the VCC pin to a 5V power source and the GND pin to the ground of your circuit.
  2. Serial Communication: Connect the TX pin of the Nextion module to the RX pin of your microcontroller, and the RX pin of the Nextion module to the TX pin of your microcontroller.
  3. Programming the Display:
    • Use the Nextion Editor software to design your user interface (UI). This software allows you to add buttons, sliders, text fields, and other UI elements.
    • Compile and upload the UI design to the Nextion module via a microSD card or serial connection.
  4. Interfacing with a Microcontroller:
    • Use UART communication to send and receive commands between the Nextion module and your microcontroller.
    • Libraries such as the Nextion Arduino library can simplify communication.

Important Considerations and Best Practices

Example Code for Arduino UNO

Below is an example of how to interface the Nextion 2.8 with an Arduino UNO:

#include <Nextion.h>

// Define Nextion display object with serial communication
// Connect Nextion TX to Arduino pin 2 (RX) and RX to pin 3 (TX)
SoftwareSerial nextionSerial(2, 3); // RX, TX
Nextion myNextion(nextionSerial, 9600); // Initialize Nextion with 9600 baud rate

void setup() {
  nextionSerial.begin(9600); // Start serial communication with Nextion
  Serial.begin(9600);        // Start serial communication with PC for debugging

  // Send a command to clear the screen and display "Hello, World!"
  myNextion.init(); // Initialize the Nextion display
  myNextion.sendCommand("cls WHITE"); // Clear screen with white background
  myNextion.sendCommand("xstr 50,50,200,30,0,BLACK,WHITE,1,1,1,\"Hello, World!\"");
}

void loop() {
  // Example: Read touch events (if any)
  String touchData = myNextion.listen();
  if (touchData != "") {
    Serial.println("Touch Event: " + touchData); // Print touch data to Serial Monitor
  }
}

Troubleshooting and FAQs

Common Issues and Solutions

  1. Display Not Powering On:

    • Ensure the VCC and GND pins are properly connected.
    • Verify that the power supply provides sufficient voltage (4.75V to 7V).
  2. No Communication with Microcontroller:

    • Check the TX and RX connections. Ensure they are not swapped.
    • Verify that the baud rate in your code matches the baud rate of the Nextion module.
  3. Touchscreen Not Responding:

    • Ensure the display is not physically damaged.
    • Recalibrate the touchscreen using the Nextion Editor.
  4. UI Not Displaying Correctly:

    • Confirm that the UI design was successfully uploaded to the module.
    • Check the microSD card for errors if used for uploading.

FAQs

Q: Can I use the Nextion 2.8 with a 3.3V microcontroller?
A: Yes, but you must use a level shifter for the TX and RX lines to ensure proper communication.

Q: How do I reset the module to factory settings?
A: Use the Nextion Editor to upload a blank project or send the rest command via serial communication.

Q: Can I use the Nextion 2.8 for video playback?
A: No, the Nextion 2.8 does not support video playback. It is designed for static and interactive UI elements.

Q: What is the maximum size of the UI project I can upload?
A: The module has 4MB of flash memory for storing UI projects. Ensure your project size does not exceed this limit.