🛠 Robust IoT Automation with UEXT-CH390 and ESPHome

Olimex UEXT-CH390: SPI to Ethernet 10/100 Mbps Module for Microcontrollers · avance · Déployez un nœud de capteurs autonome et fiable utilisant la connectivité Ethernet filaire du module UEXT-CH390.

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

Steps

  1. 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.
  1. 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
  1. 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
  1. 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
  1. Adding Sensors: Integrate your sensors (DHT22, BMP280, etc.) and expose them via MQTT or native Home Assistant API.

Verification

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

← Back to the board 🛠 All tutorials