Files
barnum/README_ETH.md

1.9 KiB

RP2040-ETH WS2812 Network Control

This implementation adds ethernet connectivity to the WS2812 LED control, allowing you to control the LED color over the network.

Hardware Setup

  • Board: Waveshare RP2040-ETH
  • LED: WS2812 connected to GPIO 25
  • Ethernet: CH9120 chip handles TCP/IP communication

Network Configuration

Default settings (can be modified in ch9120.c):

  • IP Address: 192.168.1.200
  • Port: 1000
  • Mode: TCP Client
  • Target IP: 192.168.1.10
  • Target Port: 2000

Building

cd build
cmake ..
make barnum_eth

Flashing

  1. Hold BOOTSEL button and connect USB
  2. Copy barnum_eth.uf2 to the RPI-RP2 drive
  3. The board will reboot automatically

Usage

Supported Commands

Send these commands as TCP messages to control the LED:

  • RED - Set LED to red
  • GREEN - Set LED to green
  • BLUE - Set LED to blue
  • WHITE - Set LED to white
  • OFF - Turn LED off
  • RGB:r,g,b - Set custom color (e.g., RGB:255,128,0 for orange)

Python Test Client

Use the included test_client.py to test:

# Run demo sequence
python3 test_client.py

# Send single command
python3 test_client.py "RGB:255,0,255"

Features

  • Smooth color transitions between commands
  • Network status feedback via USB serial
  • Acknowledgment messages for each command

Pin Assignments

  • WS2812 Data: GPIO 25
  • UART TX (CH9120): GPIO 20
  • UART RX (CH9120): GPIO 21
  • CFG (CH9120): GPIO 18
  • RES (CH9120): GPIO 19

Troubleshooting

  1. No network connection:

    • Check ethernet cable is connected
    • Verify IP settings match your network
    • Use serial monitor to see debug output
  2. LED not responding:

    • Verify WS2812 is connected to GPIO 25
    • Check power supply to LED
    • Monitor serial output for errors
  3. Can't flash the board:

    • Make sure to use the correct board setting in CMakeLists.txt
    • The board type is already set to waveshare_rp2040_eth