🛠 Robust IoT Automation with UEXT-CH390 and ESPHome
Objectives
This tutorial aims to create a complete and reliable environmental monitoring node. Unlike Wi-Fi solutions prone to interference, we will use the wired 10/100 Mbps Ethernet connectivity of the UEXT-CH390 module to guarantee minimal latency and maximum stability. The goal is to integrate this node into a home automation ecosystem (Home Assistant) with OTA updates and automatic discovery, leveraging the 16KB SRAM of the WCH CH390 controller for smooth packet processing.
Required Hardware
- Olimex UEXT-CH390 module (WCH CH390 controller, integrated MAC/PHY).
- Compatible microcontroller: Raspberry Pi Pico (RP2040) or ESP32 (S3, C3, C5, C6) with UEXT or pUEXT connector.
- Standard RJ45 Ethernet cable.
- Stable 3.3V power supply (via USB-C of the microcontroller or external power).
- Computer with ESPHome 2026.9.0 or higher installed.
Steps
- Hardware Configuration: Insert the UEXT-CH390 module into the UEXT connector of your host board. Ensure the power supply is correctly set to 3.3V. The module uses SPI lines (MOSI, MISO, SCK, CS) and control signals. Check pin compatibility according to the official Olimex schematic to avoid conflicts.
- Firmware Preparation: Create a new ESPHome project. In the YAML file, configure the SPI bus. Note that the CH390 supports SPI modes 0 and 3 up to 72 MHz, but start with a conservative frequency (e.g., 10 MHz) to validate communication.
spi:
clk_pin: GPIO2
mosi_pin: GPIO3
miso_pin: GPIO4
cs_pin: GPIO5
- CH390 Driver Integration: Use the specific driver developed for RP2040 or compatible ESPHome libraries. Enable the Ethernet interface.
ethernet:
type: CH390
spi_bus: spi
reset_pin: GPIO6
- Network and Services Configuration: Configure DHCP for automatic IP assignment. Enable Home Assistant discovery and the local web server for debugging.
wifi: # Disabled or ignored
ethernet:
dhcp: true
web_server:
port: 80
- Adding Sensors: Integrate your sensors (DHT22, BMP280, etc.) and expose them via MQTT or native Home Assistant API.
Verification
- Plug in the Ethernet cable. The module's LED should light up.
- Open the serial monitor to check DHCP connection logs.
- Access the assigned IP address via a web browser to view the local interface.
- In Home Assistant, verify that the node appears automatically and that sensor data is updated in real-time.
Going Further
Explore direct use of the Raspberry Pi Pico SDK with the lwIP stack for critical real-time applications, or optimize OTA updates to minimize memory footprint.
Other tutorials for this board
Code examples for this board
esp32-ch390-lwip-station.inoC++rp2040-pico-ch390-micropython.pyPythonesp32-ch390-udp-sensor-gateway.inoC++esp32-ch390-web-server-local.inoC++rp2040-ch390-iot-home-assistant.inoYAMLrp2040-lwip-ethernet-ping-6.inoC/C++ (Raspberry Pi Pico SDK)