🛠 Connect a RP2040 to the network with UEXT-CH390 and ESPHome

Olimex UEXT-CH390: SPI to Ethernet 10/100 Mbps Module for Microcontrollers · intermediaire · Configurez une passerelle IoT filaire robuste sur Raspberry Pi Pico en utilisant le module Ethernet UEXT-CH390 et le firmware ESPHome.

Objectives

This tutorial aims to transform a Raspberry Pi Pico (RP2040) board into a reliable wired IoT node. By using the UEXT-CH390 module, we bypass Wi-Fi limitations to achieve a stable Ethernet connection, crucial for critical home automation systems. The goal is to integrate this node into Home Assistant via ESPHome, leveraging native DHCP and OTA features.

Required Hardware

Steps

  1. Hardware Connection: Insert the UEXT-CH390 module into the Pico's UEXT connector. Ensure pins are aligned. The module is powered at 3.3V via the UEXT bus. No soldering is required if using dedicated connectors.
  2. ESPHome Configuration: Create a new YAML file in your ESPHome editor. Define the platform as rp2040. Add the spi component using the Pico's default pins (GP2, GP3, GP4, GP5 for MOSI, MISO, SCLK, CS respectively, verify with your schematic).
  3. CH390 Declaration: In the ethernet section, specify the CH390 chipset. ESPHome automatically handles the initialization of the integrated MAC and PHY.
  4. Service Activation: Enable api for communication with Home Assistant, ota for wireless updates, and web_server for local access. Configure dhcp for automatic IP assignment.
  5. Compile and Flash: Compile the firmware. Connect the Pico in bootloader mode (hold BOOTSEL while connecting USB). Drag the generated .uf2 file onto the USB mass storage drive.

Verification

Once the Pico restarts, plug in the Ethernet cable. Check your router's interface to confirm a new device has obtained an IP address. Open the IP address in a web browser to view the local ESPHome interface. In Home Assistant, the node should appear automatically via mDNS discovery. Test latency with a simple command (e.g., reading a virtual sensor) to confirm wired link stability.

Going Further

Explore using the CH390's 16KB SRAM buffer to handle heavier data streams or fast OTA updates. You can also combine this module with other sensors on the remaining I2C or SPI bus to create a high-frequency wired weather station.

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials