---
title: "Tesla Swarm Controller with WIZnet W5500"
url: "https://maker.wiznet.io/Lihan__/projects/tesla-swarm-controller-with-wiznet-w5500/"
markdown_url: "https://maker.wiznet.io/Lihan__/projects/tesla-swarm-controller-with-wiznet-w5500/md"
type: "UCC: User Created Content"
author: "Cameron Prince"
author_url: "https://teslauniverse.com/tesla-universe-news/tesla-swarm-controller-part-2-getting-net-work"
editor: "WIZnet"
editor_url: "https://maker.wiznet.io/"
original_author: "Cameron Prince"
original_url: "https://teslauniverse.com/tesla-universe-news/tesla-swarm-controller-part-2-getting-net-work"
published: "2025-08-27"
language: "en"
likes: 0
views: 1211
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# Tesla Swarm Controller with WIZnet W5500

> Raspberry Pi Pico 2–based Tesla coil swarm controller. WIZnet W5500/W6100 enable UDP network slaves; MicroPython→C migration ensures performance.

Original author: Cameron Prince (source: https://teslauniverse.com/tesla-universe-news/tesla-swarm-controller-part-2-getting-net-work)

## Article

### Project Overview

Inspired by drone swarms, this project aims to **synchronize and control multiple Tesla coils** through a master/slave architecture. The baseline hardware combines Pico 2, I2CEncoder, SPI OLED, SD, and **SPI Ethernet (WIZnet)**. WIZnet was the natural choice; since the **W6100 lacked MicroPython support**, the prototype used **W5500 + MicroPython**, while the high-performance slave target was **W6100 + C**.

### Key Features

**WIZnet Ethernet**: Provides low-latency and reliable UDP frame reception. Implemented in MicroPython (W5500) and C (W6100).

**Flexible UI**: Built on the MicroPython **uMenu** library (class-based, modular).

**Scalable Slave System**: Configuration stored in flash with **group/offset addressing** for individual or grouped slave control.

### Hardware Setup

**Pico 2 ↔ WIZnet(W5x00)**: SPI (SCK/MOSI/MISO), CS, RST. Follow board-specific power/ground guidelines.

**Input/UI**: I2CEncoders share interrupt lines; use **mutex + asyncio** to avoid race conditions.

**Output**: Hardware PWM is preferred. For noise, apply low-pass filter + resistor.

### Software Implementation

#### Core Functionality (MicroPython, W5500 Example)

```plaintext
# MicroPython UDP Slave (W5500)
import machine, network, socket, struct

spi = machine.SPI(0, baudrate=20_000_000, polarity=0, phase=0)
cs  = machine.Pin(17, machine.Pin.OUT)
rst = machine.Pin(20, machine.Pin.OUT)
nic = network.WIZNET5K(spi, cs, rst)
nic.active(True)

sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(('0.0.0.0', 5005))

pwm = machine.PWM(machine.Pin(2))
pwm.duty_u16(0)

while True:
    data, addr = sock.recvfrom(12)
    ch, freq, duty = struct.unpack('>III', data)
    pwm.freq(freq if 1 <= freq <= 200000 else 1000)
    pwm.duty_u16(duty if 0 <= duty <= 65535 else 0)
```

#### MicroPython → C Migration

When moving to W6100, implement UDP listener + PWM updates in **C with Pico SDK and WIZnet libraries** for higher performance and flash persistence.

### Network Architecture

**Master**: Generates control frames (interrupter, MIDI, etc.) and transmits via UDP.

**Slaves**: Receive UDP packets and update PWM outputs. Addressing supports both **individual** and **group** commands.

### Performance Results

**MIDI Handling**: MicroPython on a single core struggled; dual-core execution required.

**Output Quality**: Hardware PWM proved most stable; spikes/pops reduced with low-pass filters and resistors.

**Language Comparison**: CircuitPython too slow, MicroPython (W5500) worked for prototypes, C (W6100) offered best scalability.

**Demo**: 8-channel controller successfully played **“Footloose”**, with RGB ring LEDs functioning as VU meters.

### Lessons Learned

Multi-I2C devices require **mutexes** and lightweight interrupt callbacks (heavy work deferred to asyncio tasks).

**Wired UDP + WIZnet** delivered the required low latency and reliability for swarm control.

### Future Improvements

Full transition to **W6100-based slaves**; possible MicroPython integration if support matures.

Standardized **multicast/group control protocol**, explore **time synchronization (NTP/PTP)**, and add OTA firmware updates/logging.

Improve **EMI/ESD hardening** near high-voltage Tesla coils with shielding, grounding, and filtering.

### Challenges & Solutions

**I2CEncoder concurrency issues** → solved with mutex + asynchronous design.

**Performance/language trade-offs** → W5500+MicroPython succeeded initially; C on W6100 required for higher performance.

**Output spikes** → mitigated with filter/resistors; further refinement planned in future updates.

---

## DOCUMENTS

**CodeName**: uMenu (MicroPython menu library)
**Link**: `https://github.com/plugowski/umenu`
**Comment**: Class-based UI library used for the project.

**OthersName**: Project Article – Part 2
**Link**: `https://teslauniverse.com/tesla-universe-news/tesla-swarm-controller-part-2-getting-net-work`
**Comment**: Detailed description of networking, slaves, and language choices.

**OthersName**: Tesla Swarm Controller – Gallery
**Link**: `https://teslauniverse.com/tesla-news/galleries/tesla-swarm-controller`
**Comment**: Photos of development and testing.

---

Source: https://maker.wiznet.io/Lihan__/projects/tesla-swarm-controller-with-wiznet-w5500/
