Fab Academy 2026 — Week 11

Networking
and Communications

Stepper motor control system using the DRV8825 driver and a custom XIAO RP2040 board — integrating signal control, power electronics, and mechanical output.

Group assignment documentation
01 / intro

Introduction

In this assignment, the objective was to control an output device using a microcontroller over wire or wireless networks. I used a servo motor as the output device and controlled it using the Seeed Studio XIAO ESP32-C3 with wifi module.

The control was implemented using WiFi, where the ESP32 acts as a web server. A web interface allows controlling the servo motor position (0°, 90°, 180°) and also enables an automatic sweep mode.

02 / XIAO

Seeed Studio XIAO ESP32-C3

FIG. 01 — XIAO ESP32-C3 board

The XIAO ESP32-C3 is used as the main controller. It provides WiFi connectivity and generates PWM signals required to control the servo motor.

The Seeed Studio XIAO ESP32‑C3 is a compact and low‑power microcontroller development board designed for embedded systems and Internet of Things (IoT) applications. It is based on the ESP32‑C3 chip, which features a 32‑bit RISC‑V processor with built‑in Wi‑Fi and Bluetooth Low Energy (BLE) connectivity, making it suitable for wireless communication projects. Despite its very small form factor, the board provides multiple GPIO pins, supports analog and digital inputs/outputs, and includes USB‑C connectivity for power, programming, and serial communication. The XIAO ESP32‑C3 is compatible with popular development environments such as the Arduino IDE and ESP‑IDF, enabling rapid prototyping and experimentation. Its low energy consumption, and have integrated wireless capabilities.

03 / antenna

External Antenna

FIG. 02 — External antenna module

An external antenna is connected to improve WiFi signal strength and ensure stable communication during wireless control.

04 / servo

Servo Motor

FIG. 03 — Servo motor

The servo motor is used as the output device. It rotates between 0° and 180° based on PWM signals generated by the ESP32.

05 / wiring

Wiring

FIG. 04 — Final connection
Servo Wire Connection Function
RedVCCPower
BrownGNDGround
YellowGPIO 8PWM Signal

GPIO 8 is used to generate PWM signals for controlling the servo motor position.

06 / code

Code

Arduino
#include <WiFi.h>
#include <ESP32Servo.h>

const char* ssid = "YOUR_WIFI_NAME";
const char* password = "YOUR_PASSWORD";

WiFiServer server(80);

Servo myservo;
int servoPin = 8;

bool loopMode = false;
int pos = 0;
bool forward = true;

void setup() {
  Serial.begin(115200);

  ESP32PWM::allocateTimer(0);
  myservo.setPeriodHertz(50);
  myservo.attach(servoPin, 1000, 2000);

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
  }

  server.begin();
}

void loop() {
  WiFiClient client = server.available();

  if (client) {
    String request = client.readStringUntil('\r');
    client.flush();

    if (request.indexOf("/0") != -1) myservo.write(0);
    if (request.indexOf("/90") != -1) myservo.write(90);
    if (request.indexOf("/180") != -1) myservo.write(180);

    if (request.indexOf("/loop_on") != -1) loopMode = true;
    if (request.indexOf("/loop_off") != -1) loopMode = false;

    client.println("HTTP/1.1 200 OK");
    client.println("Content-type:text/html");
    client.println();
    client.stop();
  }

  if (loopMode) {
    myservo.write(pos);

    if (forward) {
      pos++;
      if (pos >= 180) forward = false;
    } else {
      pos--;
      if (pos <= 0) forward = true;
    }

    delay(15);
  }
}
07 / results

Results

The servo motor was successfully controlled using WiFi. The web interface allowed manual positioning (0°, 90°, 180°) and automatic sweeping using loop mode.

08 / video

Video

Servo motor demo