1.9 KiB
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
- Hold BOOTSEL button and connect USB
- Copy
barnum_eth.uf2to the RPI-RP2 drive - The board will reboot automatically
Usage
Supported Commands
Send these commands as TCP messages to control the LED:
RED- Set LED to redGREEN- Set LED to greenBLUE- Set LED to blueWHITE- Set LED to whiteOFF- Turn LED offRGB:r,g,b- Set custom color (e.g.,RGB:255,128,0for 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
-
No network connection:
- Check ethernet cable is connected
- Verify IP settings match your network
- Use serial monitor to see debug output
-
LED not responding:
- Verify WS2812 is connected to GPIO 25
- Check power supply to LED
- Monitor serial output for errors
-
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