Ein umfassendes Entwicklungssystem für ESP32-S3 mit Multi-Touch-Display, Audio, Kommunikation und Sensorik.
Dieses Repository enthält eine vollständige Entwicklungsplattform für ESP32-S3 mit 2.8" Touch-LCD. Das System bietet professionelle Hardware-Integration für:
- Multi-Touch-Interface mit Gesten-Erkennung
- I2C Audio-System für Multimedia-Anwendungen
- Dual-Bus-Kommunikation (RS232/RS485)
- Sensor-Integration (Gyroskop, RTC)
- Drahtlose Konnektivität (WiFi, Bluetooth)
- Power-Management mit Batterie-Support
| Komponente | Typ | Interface | Status |
|---|---|---|---|
| Display | ST7789 320x240 | SPI | ✅ Implementiert |
| Touch Controller | CST328 (5-Punkt) | I2C Wire1 | ✅ Multi-Touch |
| Audio | I2S/I2C Audio | I2C Wire | 🔄 Geplant |
| RTC | DS3231/PCF8563 | I2C Wire | 🔄 Geplant |
| Gyroskop | MPU6050/ICM20948 | I2C Wire | 🔄 Geplant |
| RS232/485 | MAX3232/MAX485 | UART | 🔄 Geplant |
| WiFi/BT | ESP32-S3 integriert | - | 🔄 Geplant |
| Batterie | LiPo Management | ADC/GPIO | 🔄 Geplant |
| RGB LED | WS2812/Neopixel | GPIO | 🔄 Geplant |
// ============================================
// DISPLAY SYSTEM (SPI)
// ============================================
#define DISPLAY_SCLK 40 // SPI Clock
#define DISPLAY_MOSI 45 // SPI Data
#define DISPLAY_DC 41 // Data/Command
#define DISPLAY_CS 42 // Chip Select
#define DISPLAY_RST 39 // Reset
#define BACKLIGHT_PIN 5 // PWM Backlight
// ============================================
// TOUCH SYSTEM (I2C Wire1)
// ============================================
#define TOUCH_SDA 1 // I2C Data
#define TOUCH_SCL 3 // I2C Clock
#define TOUCH_INT 4 // Interrupt
#define TOUCH_RST 2 // Reset
// ============================================
// I2C PERIPHERALS (I2C Wire)
// ============================================
#define I2C_SDA 11 // I2C Data (Audio, RTC, Gyro)
#define I2C_SCL 10 // I2C Clock
#define I2C_FREQ 400000 // 400kHz
// ============================================
// AUDIO SYSTEM
// ============================================
#define AUDIO_SDA 11 // I2C Audio Data (shared)
#define AUDIO_SCL 10 // I2C Audio Clock (shared)
#define AUDIO_INT 12 // Audio Interrupt
#define I2S_BCLK 13 // I2S Bit Clock
#define I2S_LRC 14 // I2S Left/Right Clock
#define I2S_DIN 15 // I2S Data In
#define I2S_DOUT 16 // I2S Data Out
// ============================================
// COMMUNICATION (UART)
// ============================================
#define RS232_TX 17 // RS232 Transmit
#define RS232_RX 18 // RS232 Receive
#define RS485_TX 17 // RS485 Transmit (shared)
#define RS485_RX 18 // RS485 Receive (shared)
#define RS485_DE 19 // RS485 Direction Enable
#define RS485_RE 20 // RS485 Receive Enable
// ============================================
// SENSORS & PERIPHERALS
// ============================================
#define RTC_INT 21 // RTC Interrupt
#define GYRO_INT 38 // Gyroskop Interrupt
#define BATTERY_ADC 6 // Battery Voltage Monitor
#define POWER_EN 7 // Power Enable/Control
#define RGB_LED 8 // Addressable RGB LED
#define USER_BUTTON 9 // User Button| GPIO | LCD | SD Card | IMU | RTC | UART | I2C | Speak | Other |
|---|---|---|---|---|---|---|---|---|
| 0 | GPIO 0 | |||||||
| 1 | TP SDA | |||||||
| 2 | TP RST | |||||||
| 3 | TP SCL | |||||||
| 4 | TP INT | |||||||
| 5 | LCD BL | |||||||
| 6 | Key BAT | |||||||
| 7 | BAT Control | |||||||
| 8 | BAT ADC | |||||||
| 9 | RTC INT | |||||||
| 10 | IMU SCL | RTC SCL | SCL | |||||
| 11 | IMU SDA | RTC SDA | SDA | |||||
| 12 | IMU INT2 | |||||||
| 13 | IMU INT1 | |||||||
| 14 | SD SCLK | |||||||
| 15 | SD D2 | GPIO 15 | ||||||
| 16 | SD MISO | |||||||
| 17 | SD MOSI | |||||||
| 18 | SD DI | GPIO 18 | ||||||
| 19 | D N | |||||||
| 20 | D P | |||||||
| 21 | SD CS | |||||||
| 33 | Internal occupan | |||||||
| 34 | Internal occupan | |||||||
| 35 | Internal occupan | |||||||
| 36 | Internal occupan | |||||||
| 37 | Internal occupan | |||||||
| 38 | 12S LRCK | |||||||
| 39 | LCD RST | |||||||
| 40 | LCD SCK | SD SCLK | ||||||
| 41 | LCD D/C | |||||||
| 42 | LCD CS | |||||||
| 43 | UART TXD | GPIO 43 | ||||||
| 44 | UART RXD | GPIO 44 | ||||||
| 45 | LCD MOSI | SD MOSI | ||||||
| 46 | LCD MISO | SD MISO | ||||||
| 47 | I2S DIN | |||||||
| 48 | I2S BCK |
- 5 gleichzeitige Touch-Punkte mit CST328 Controller
- Konflikt-freie Gesten-Erkennung mit State-Machine
- 60fps Performance (~43fps real)
- Live-Visualisierung aller Touch-Punkte
// Ein-Finger-Gesten
GESTURE_TAP // Kurzer Touch
GESTURE_DOUBLE_TAP // Doppel-Touch innerhalb 400ms
GESTURE_LONG_PRESS // Touch > 800ms
GESTURE_SWIPE_* // Wischbewegungen (4 Richtungen)
// Multi-Finger-Gesten
GESTURE_TWO_FINGER_TAP // Zwei-Finger-Touch
GESTURE_THREE_FINGER_TAP // Drei+-Finger-Touch#include "multitouch_system.h"
void setup() {
initMultiTouchSystem();
}
void loop() {
updateMultiTouch();
// Gesten-Events verarbeiten
if (last_gesture.type != GESTURE_NONE) {
switch (last_gesture.type) {
case GESTURE_DOUBLE_TAP:
handleZoomIn(last_gesture.x, last_gesture.y);
break;
case GESTURE_SWIPE_LEFT:
handlePageTurn();
break;
case GESTURE_THREE_FINGER_TAP:
handleMenuOpen();
break;
}
}
}- I2C Audio Codec (z.B. WM8960, ES8388)
- I2S Digital Audio für hohe Qualität
- Stereo Input/Output mit Mikrofon-Support
- Volume Control über Touch-Interface
- Audio-Effekte (EQ, Filter)
// Audio-System-Klasse
class I2CAudioSystem {
private:
uint8_t codec_address = 0x1A; // I2C Audio Codec
uint8_t volume_level = 50;
bool is_playing = false;
public:
bool initAudioCodec();
void setVolume(uint8_t level);
void playAudio(const uint8_t* data, size_t length);
void recordAudio(uint8_t* buffer, size_t length);
void configureI2S();
void setupMixer();
};
// Integration mit Touch-System
void handleVolumeGesture() {
if (last_gesture.type == GESTURE_SWIPE_UP) {
audio.setVolume(min(100, current_volume + 10));
}
if (last_gesture.type == GESTURE_SWIPE_DOWN) {
audio.setVolume(max(0, current_volume - 10));
}
}class SerialCommunication {
private:
HardwareSerial* serial_port;
bool rs485_mode = false;
public:
void initRS232();
void initRS485();
void switchToRS485();
void switchToRS232();
// RS485 spezifische Funktionen
void setTransmitMode();
void setReceiveMode();
bool sendRS485Data(const uint8_t* data, size_t length);
// Protokoll-Handler
void handleModbusRTU();
void handleCustomProtocol();
};
// Verwendung
SerialCommunication comm;
void setup() {
comm.initRS232();
// oder: comm.initRS485();
}
void loop() {
if (comm.dataAvailable()) {
String received = comm.readData();
processIncomingData(received);
}
}#include <RTClib.h>
class RTCManager {
private:
RTC_DS3231 rtc; // oder RTC_PCF8563
bool rtc_found = false;
public:
bool initRTC();
DateTime getCurrentTime();
void setTime(DateTime dt);
void setAlarm(DateTime alarm_time);
bool isAlarmTriggered();
// Touch-Interface für Zeiteinstellung
void showTimeSetInterface();
void handleTimeAdjustment(GestureEvent gesture);
};
// Integration mit Display
void drawClock() {
DateTime now = rtc_manager.getCurrentTime();
tft.setTextSize(3);
tft.setCursor(50, 100);
tft.printf("%02d:%02d:%02d", now.hour(), now.minute(), now.second());
tft.setTextSize(2);
tft.setCursor(50, 140);
tft.printf("%02d.%02d.%04d", now.day(), now.month(), now.year());
}#include <MPU6050.h>
class MotionSensor {
private:
MPU6050 mpu;
float accel_x, accel_y, accel_z;
float gyro_x, gyro_y, gyro_z;
float temperature;
public:
bool initIMU();
void readSensorData();
void calibrateSensor();
// Bewegungs-Erkennung
bool detectShake();
bool detectTilt();
float getOrientation();
// Integration mit Touch
void enableMotionGestures();
void handleMotionEvent();
};
// Verwendung für Display-Rotation
void handleAutoRotation() {
float orientation = motion_sensor.getOrientation();
if (abs(orientation) < 45) {
tft.setRotation(1); // Landscape
} else if (orientation > 45) {
tft.setRotation(2); // Portrait
}
}
// Shake-to-Clear Funktionalität
void checkShakeGestures() {
if (motion_sensor.detectShake()) {
clearDisplay();
triggerHapticFeedback();
}
}class PowerManager {
private:
float battery_voltage = 0.0;
uint8_t battery_percentage = 0;
bool is_charging = false;
bool low_power_mode = false;
public:
void initPowerSystem();
float readBatteryVoltage();
uint8_t calculateBatteryPercentage();
bool isCharging();
// Power-Modi
void enterLowPowerMode();
void exitLowPowerMode();
void enterDeepSleep();
void configureSleepWakeup();
// Display-Integration
void drawBatteryIndicator();
void showPowerMenu();
};
// Auto-Sleep bei Inaktivität
void handlePowerManagement() {
static unsigned long last_touch = millis();
if (active_touch_count > 0) {
last_touch = millis();
power_manager.exitLowPowerMode();
}
if (millis() - last_touch > 30000) { // 30s Inaktivität
power_manager.enterLowPowerMode();
}
if (millis() - last_touch > 300000) { // 5min Inaktivität
power_manager.enterDeepSleep();
}
}#include <FastLED.h>
#define NUM_LEDS 1
#define LED_TYPE WS2812B
class RGBLEDManager {
private:
CRGB leds[NUM_LEDS];
uint8_t brightness = 128;
public:
void initLEDs();
void setColor(CRGB color);
void setBrightness(uint8_t level);
void rainbow();
void breathe(CRGB color);
// Status-Anzeigen
void showTouchFeedback();
void showBatteryStatus();
void showConnectionStatus();
void showErrorState();
};
// Touch-Feedback mit LED
void handleTouchLED() {
if (active_touch_count > 0) {
rgb_led.setColor(CRGB::Green);
} else if (last_gesture.type == GESTURE_DOUBLE_TAP) {
rgb_led.setColor(CRGB::Blue);
} else {
rgb_led.setColor(CRGB::Black);
}
}#include <WiFi.h>
#include <BluetoothSerial.h>
class WirelessManager {
private:
BluetoothSerial bt_serial;
bool wifi_connected = false;
bool bt_connected = false;
public:
// WiFi Management
bool connectWiFi(const char* ssid, const char* password);
void startWiFiAP(const char* ap_name);
void handleWiFiEvents();
// Bluetooth Management
bool initBluetooth(const char* device_name);
void handleBluetoothData();
void sendBluetoothData(const String& data);
// Web-Interface
void startWebServer();
void handleWebRequests();
// OTA Updates
void initOTA();
void handleOTAUpdates();
};
// Touch-Interface für WiFi-Setup
void showWiFiSetupMenu() {
tft.fillScreen(0x0000);
tft.setTextColor(0xFFFF);
tft.setTextSize(2);
tft.setCursor(10, 10);
tft.println("WiFi Setup");
// WiFi-Netzwerke scannen und anzeigen
wireless.scanWiFiNetworks();
displayAvailableNetworks();
}
// Bluetooth-Datenübertragung
void handleBluetoothCommands() {
if (bt_serial.available()) {
String command = bt_serial.readString();
if (command.startsWith("SET_TIME")) {
// Zeit über Bluetooth setzen
handleTimeCommand(command);
} else if (command.startsWith("GET_SENSOR")) {
// Sensor-Daten senden
sendSensorData();
}
}
}ESP32-S3-Touch-LCD-2.8/
├── src/
│ ├── main.cpp # Haupt-Anwendung
│ ├── multitouch/
│ │ ├── touch_system.h # ✅ Touch-Controller
│ │ ├── touch_system.cpp # ✅ Multi-Touch-Logic
│ │ ├── gesture_recognition.h # ✅ Gesten-Erkennung
│ │ └── gesture_recognition.cpp # ✅ Gesten-Implementation
│ ├── audio/
│ │ ├── i2c_audio.h # 🔄 Audio-System
│ │ ├── i2c_audio.cpp # 🔄 I2C Audio Codec
│ │ └── audio_effects.cpp # 🔄 Audio-Effekte
│ ├── communication/
│ │ ├── serial_comm.h # 🔄 RS232/RS485
│ │ ├── serial_comm.cpp # 🔄 Dual-Mode Serial
│ │ └── protocols.cpp # 🔄 Modbus, Custom
│ ├── sensors/
│ │ ├── rtc_manager.h # 🔄 Real-Time Clock
│ │ ├── rtc_manager.cpp # 🔄 Zeit-Management
│ │ ├── motion_sensor.h # 🔄 Gyroskop/IMU
│ │ └── motion_sensor.cpp # 🔄 Bewegungs-Erkennung
│ ├── power/
│ │ ├── power_manager.h # 🔄 Batterie-Management
│ │ ├── power_manager.cpp # 🔄 Sleep-Modi
│ │ └── battery_monitor.cpp # 🔄 Batterie-Überwachung
│ ├── wireless/
│ │ ├── wifi_manager.h # 🔄 WiFi-Funktionen
│ │ ├── wifi_manager.cpp # 🔄 WiFi-Management
│ │ ├── bluetooth_manager.h # 🔄 Bluetooth-System
│ │ └── bluetooth_manager.cpp # 🔄 BT-Kommunikation
│ ├── display/
│ │ ├── display_manager.h # ✅ Display-Control
│ │ ├── display_manager.cpp # ✅ ST7789 Driver
│ │ └── ui_elements.cpp # 🔄 UI-Framework
│ └── utils/
│ ├── config.h # Hardware-Konfiguration
│ ├── hardware_hal.h # Hardware-Abstraktion
│ └── debug_utils.cpp # Debug-Funktionen
├── examples/
│ ├── single_touch_demo/ # ✅ Single-Touch Demo
│ ├── multitouch_demo/ # ✅ Multi-Touch Demo
│ ├── audio_demo/ # 🔄 Audio-Test
│ ├── sensor_demo/ # 🔄 Sensor-Test
│ ├── communication_demo/ # 🔄 RS232/485-Test
│ └── complete_system_demo/ # 🔄 Vollständiges System
├── docs/
│ ├── hardware_guide.md # Hardware-Dokumentation
│ ├── calibration_guide.md # Kalibrierungs-Anleitung
│ ├── troubleshooting.md # Fehlerbehebung
│ └── api_reference.md # API-Dokumentation
├── tools/
│ ├── calibration_tool/ # Touch-Kalibrierung
│ ├── config_generator/ # Hardware-Konfigurator
│ └── firmware_updater/ # OTA-Update-Tool
├── libraries/ # Externe Bibliotheken
├── platformio.ini # PlatformIO-Konfiguration
├── README.md # Diese Datei
└── LICENSE # MIT License
# PlatformIO Installation
pip install platformio
# Repository klonen
git clone https://github.com/zonfacter/ESP32-S3-Touch-LCD-2.8
cd ESP32-S3-Touch-LCD-2.8
# Dependencies installieren
pio lib install; platformio.ini
[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
lib_deps =
lovyangfx/LovyanGFX@^1.1.12
adafruit/RTClib@^2.1.1
electroniccats/MPU6050@^1.0.0
fastled/FastLED@^3.6.0
bblanchon/ArduinoJson@^6.21.3
ottowinter/ESPAsyncWebServer@^3.0.0- Single Touch Implementation
- Multi-Touch System (5 Punkte)
- Gesten-Erkennung
- Display-Integration
- Performance-Optimierung
- I2C Audio Codec Integration
- I2S Audio Pipeline
- RS232/RS485 Dual-Mode
- Modbus RTU Protocol
- Audio-Touch-Integration
- RTC Integration
- Gyroskop/IMU System
- Batterie-Management
- Power-Modi Implementation
- RGB LED Control
- WiFi Management
- Bluetooth Integration
- OTA Updates
- Web-Interface
- Cloud-Connectivity
- Complete System Demo
- Performance-Tuning
- Documentation
- Testing & Validation
- Production Release
#include "src/multitouch/touch_system.h"
void setup() {
Serial.begin(115200);
initMultiTouchSystem();
Serial.println("Multi-Touch System bereit!");
}
void loop() {
updateMultiTouch();
handleGestureEvents();
delay(16); // ~60fps
}#include "src/audio/i2c_audio.h"
I2CAudioSystem audio;
void setup() {
audio.initAudioCodec();
audio.setVolume(50);
}
void loop() {
if (last_gesture.type == GESTURE_TAP) {
audio.playTone(440, 500); // A4, 500ms
}
}#include "src/sensors/rtc_manager.h"
#include "src/sensors/motion_sensor.h"
RTCManager rtc;
MotionSensor motion;
void setup() {
rtc.initRTC();
motion.initIMU();
}
void loop() {
DateTime now = rtc.getCurrentTime();
displayTime(now);
if (motion.detectShake()) {
clearDisplay();
}
}// config.h - Hardware-spezifische Einstellungen
// Display-Varianten
#define DISPLAY_ST7789_320x240 1
#define DISPLAY_ILI9341_320x240 2
#define DISPLAY_TYPE DISPLAY_ST7789_320x240
// Touch-Controller-Varianten
#define TOUCH_CST328_5POINT 1
#define TOUCH_GT911_10POINT 2
#define TOUCH_TYPE TOUCH_CST328_5POINT
// Audio-Codec-Varianten
#define AUDIO_WM8960 1
#define AUDIO_ES8388 2
#define AUDIO_TYPE AUDIO_WM8960
// Kommunikations-Module
#define COMM_RS232_ONLY 1
#define COMM_RS485_ONLY 2
#define COMM_DUAL_MODE 3
#define COMM_TYPE COMM_DUAL_MODE📊 FPS: 43.2 | Aktive Touches: 2 | Heap: 343KB
🎭 Geste-Latenz: <50ms
📍 Touch-Präzision: ±2-3 Pixel
🔄 Gesture-Cooldown: 150ms
| Komponente | Performance-Ziel |
|---|---|
| Touch-Update | 40-60 FPS |
| Audio-Latency | <10ms |
| Sensor-Rate | 100Hz |
| Serial-Speed | 115200-460800 baud |
| WiFi-Throughput | 10-50 Mbps |
| Battery-Life | 8-24h (je nach Nutzung) |
Wir freuen uns über Beiträge! Besonders willkommen sind:
- Audio-System Implementation (I2C Codec Integration)
- RS485 Modbus Protocol (Industrial Communication)
- RTC & Alarm Management (Real-Time Features)
- IMU Motion Gestures (Advanced Interaction)
- Power Optimization (Battery Life Extension)
- WiFi/BT Examples (Connectivity Demos)
# Fork & Development
git clone https://github.com/your-username/ESP32-S3-Touch-LCD-2.8
cd ESP32-S3-Touch-LCD-2.8
# Feature Branch
git checkout -b feature/audio-integration
# Development & Testing
pio run -t upload
pio test
# Pull Request
git push origin feature/audio-integration
# Create PR with description- GitHub Issues: Bug Reports & Feature Requests
- Discussions: Community Forum
- Documentation: Wiki Pages
- Examples: Code Examples
MIT License - Siehe LICENSE für Details.
- ESP32 Community für Hardware-Support
- LovyanGFX Team für die exzellente Display-Bibliothek
- CST328 Developers für Touch-Controller-Dokumentation
- Open Source Contributors für Inspiration und Code-Beispiele
⭐ Wenn dieses Projekt hilfreich ist, geben Sie ihm einen Stern! ⭐
🚀 Ready für die nächste Entwicklungsphase: I2C Audio Integration! 🎵