A simple, lightweight library to drive the JC3248W535EN touch LCD display from Guition without requiring LVGL. This library provides an easy way to get started with your display using basic drawing functions and touch support.
Display: https://www.aliexpress.com/item/1005007566315926.html
Many users struggle to get started with the JC3248W535EN display after purchasing it. This library serves as an excellent starting point, abstracting away the complex initialization and providing an intuitive API for common display operations.
- Easy display initialization
- Basic drawing primitives (rectangles, circles, triangles, lines, etc.)
- Text rendering
- Touch input handling
- QR code generation and display
- Portrait orientation support
- Example with command-line screen-design feature, featuring a python GUI designer.
To use this library, you'll need to install the following before installing JC3248W535EN library:
- Arduino_GFX (aka GFX Library for Arduino by moononournation) - For the display graphics
- JPEGDecoder by Bodmer
- Arduino esp32 board library by Espressif
- Open Arduino IDE
- Go to Sketch -> Include Library -> Manage Libraries...
- Search for "JC3248W535EN"
- Click Install
- Download this repository as ZIP
- In Arduino IDE, go to Sketch -> Include Library -> Add .ZIP Library...
- Select the downloaded ZIP file
- Restart Arduino IDE
For the JC3248W535EN board, use the "ESP32S3 Dev Module" board in Arduino.
Set the following arduino settings for the ESP32S3 Dev Module up as follows under Tools menu:
- USB CDC On Boot: "Enabled" // Important for Serial communication
- CPU Frequency: "240MHz (WiFi)"
- Core Debug Level: "None"
- USB DFU On Boot: "Disabled"
- Erase All Flash Before Sketch Upload: "Disabled"
- Events Run On: "Core 1"
- Flash Mode: "QIO 80MHz"
- Flash Size: "16MB (128Mb)"
- JTAG Adapter: "Disabled"
- Arduino Runs On: "Core 1"
- USB Firmware MSC On Boot: "Disabled"
- Partition Scheme: "8M with spiffs (3MB APP/1.5MB SPIFFS)" (Can also use Custom if using partitions.csv)
- PSRAM: "OPI PSRAM"
- Upload Mode: "UART0 / Hardware CDC"
- Upload Speed: "921600"
- USB Mode: "Hardware CDC and JTAG"
- Zigbee Mode: "Disabled"
Note = If Using USB Keyboard and want your Serial device to work through the USB you need to use these 2 settings instead
- Upload Mode: "USB-OTG CDC (TinyUSB)"
- USB Mode: "USB-OTG (TinyUSB)"
NOTE: The TouchScreenAndSerialCommands example is prob the best example with the ButtonGuiClass usage
Here are pics of the TouchScreenAndSerialCommands example with the 2 panels.
#include <JC3248W535EN-Touch-LCD.h>
JC3248W535EN screen;
void setup() {
Serial.begin(115200);
// Initialize the screen
if (!screen.begin()) {
Serial.println("Screen initialization failed!");
return;
}
// Clear the screen with white background
screen.clear(255, 255, 255);
screen.flush(); // HAVE TO USE THIS ANYTIME YOU WANT SCREEN TO UPDATE!
}
void loop() {
// Your code here
}
#include <JC3248W535EN-Touch-LCD.h>
JC3248W535EN screen;
void setup() {
Serial.begin(115200);
screen.begin();
screen.clear(255, 255, 255);
// Draw a blue filled rectangle
screen.setColor(0, 0, 255);
screen.drawFillRect(50, 50, 100, 80);
// Draw a red filled circle
screen.setColor(255, 0, 0);
screen.drawFillCircle(200, 150, 40);
// Draw text
screen.setColor(0, 0, 0);
screen.prt("Hello World!", 120, 250, 2);
screen.flush(); // HAVE TO USE THIS ANYTIME YOU WANT SCREEN TO UPDATE!
}
void loop() {
}
#include <JC3248W535EN-Touch-LCD.h>
JC3248W535EN screen;
uint16_t touchX, touchY;
void setup() {
Serial.begin(115200);
screen.begin();
screen.clear(255, 255, 255);
screen.setColor(0, 0, 0);
screen.prt("Touch the screen!", 80, 200, 2);
screen.flush(); // HAVE TO USE THIS ANYTIME YOU WANT SCREEN TO UPDATE!
}
void loop() {
//check for touch interrupt. If no touch then immediatly return/continue
if (!screen.screenWasTouched ){ continue; }
else if (screen.getTouchPoint(touchX, touchY)) {
// Draw a small circle where touch is detected
screen.setColor(255, 0, 0);
screen.drawFillCircle(touchX, touchY, 5);
// Display coordinates
screen.setColor(0, 0, 0);
String coords = "X: " + String(touchX) + " Y: " + String(touchY);
screen.clear(255, 255, 255);
screen.prt(coords, 100, 240, 2);
screen.flush(); // HAVE TO USE THIS ANYTIME YOU WANT SCREEN TO UPDATE!
delay(100); // Small delay to prevent too many readings
}
}
#include <JC3248W535EN-Touch-LCD.h>
JC3248W535EN screen;
void setup() {
Serial.begin(115200);
screen.begin();
screen.clear(255, 255, 255);
// Draw a QR code (centered on screen)
screen.drawQRCode("https://github.com/AudunKodehode/JC3248W535EN-Touch-LCD",
60, 120, 4, 255, 255, 255, 0, 0, 0);
screen.setColor(0, 0, 0);
screen.prt("Scan me!", 120, 60, 2);
screen.flush(); // HAVE TO USE THIS ANYTIME YOU WANT SCREEN TO UPDATE!
}
void loop() {
}
This library uses the following default pin configuration for the JC3248W535EN display:
- Backlight: Pin 1
- Touch SDA: Pin 4
- Touch SCL: Pin 8
- Touch RST: Pin 12 ? GPIO 12 goes to the SD_MMC
- Touch INT: Pin 3 //This touch interrupt is not pin 11. Its GPIO 3
The library handles the display in portrait orientation with proper coordinate mapping for ease of use.
Contributions to improve the library are welcome! Please feel free to submit pull requests.
This project is released under the MIT License.