2.4 inch HMI UART DWIN IPS Display Documentation
The 2.4 inch HMI UART DWIN IPS Display is a compact, high-resolution display module designed for human-machine interface (HMI) applications in the Internet of Things (IoT) domain. This display module features a 2.4-inch IPS screen with a resolution of 320x240 pixels, and communicates with a microcontroller or other devices via a UART interface. It's suitable for various IoT projects, such as industrial control systems, medical devices, and consumer electronics.
Display Size: 2.4 inches
Display Type: IPS (In-Plane Switching)
Resolution: 320x240 pixels
Interface: UART (Universal Asynchronous Receiver-Transmitter)
Communication Speed: Up to 115200 bps
Operating Voltage: 5V
Operating Current: 150mA (typical)
Dimensions: 65.5 x 44.5 mm
The display module has a 6-pin interface:
VCC (5V power supply)
GND (ground)
TX (UART transmit)
RX (UART receive)
RST (reset)
NC (not connected)
Here are three code examples demonstrating how to use the 2.4 inch HMI UART DWIN IPS Display in different contexts:
This example demonstrates how to display a simple text message on the display using an Arduino Uno board.
```c
#include <SoftwareSerial.h>
// Define UART pins for the display
#define DISPLAY_RX 2
#define DISPLAY_TX 3
SoftwareSerial displayUART(DISPLAY_RX, DISPLAY_TX);
void setup() {
displayUART.begin(9600);
delay(100);
displayUART.println("Hello, World!");
}
void loop() {
// Do nothing
}
```
Example 2: Raspberry Pi (Python)
This example shows how to display an image on the display using a Raspberry Pi board with Python.
```python
import serial
import time
from PIL import Image
# Open the serial port
ser = serial.Serial('/dev/ttyUSB0', 9600, timeout=1)
# Load an image
image = Image.open('image.bmp')
# Send the image data to the display
ser.write(b'x11x45x00x00x00x00') # Command to set image data
for pixel in image.tobytes():
ser.write(pixel.to_bytes(1, 'big'))
# Wait for the display to process the data
time.sleep(1)
# Send a command to update the display
ser.write(b'x11x46x00x00x00x00')
```
Example 3: ESP32 (MicroPython)
This example demonstrates how to display a numeric value on the display using an ESP32 board with MicroPython.
```python
import machine
import utime
# Define UART pins for the display
uart = machine.UART(1, 9600, tx=25, rx=26)
def display_number(value):
uart.write(b'x11x43') # Command to set text data
uart.write(str(value).encode('utf-8'))
uart.write(b'x11x42') # Command to update the display
# Initialize the display
uart.write(b'x11x41x00x00x00x00') # Command to initialize the display
# Display a numeric value
display_number(42)
```
These examples illustrate the basic usage of the 2.4 inch HMI UART DWIN IPS Display in different contexts. For more advanced usage, please refer to the display module's datasheet and documentation provided by the manufacturer.