ESP32 & ESP8266

Daisy-Chain NEMA 17 Steppers Over CAN With ESP32-S3 Driver Boards

Daisy-Chain NEMA 17 Steppers Over CAN With ESP32-S3 Driver Boards

Picture a capstone team two weeks before defense, staring at a camera slider, a turntable and a robotic arm that need six stepper motors between them. The bench is a tangle of jumper wires running to six A4988 carriers, an Arduino Mega is out of free pins, and nobody remembers which STEP line goes where. Josh Rogan’s CANBUS Stepper project is built for exactly that moment.

One brain per motor

Instead of wiring every motor back to a central controller, Josh gives each NEMA 17 its own small board that bolts onto the back of the motor. Each board carries an ESP32-S3, a TMC2209 silent driver and a 14-bit magnetic absolute encoder, so every axis runs closed loop and knows its real shaft angle. The boards then chain together like an addressable LED strip: you talk to the first node over USB, Wi-Fi or UART serial, and it relays commands to everyone else on the CAN bus. Hackaday featured it this week, and the design files and firmware live at github.com/joshr120/CANBUS-Stepper under GPL-3.0.

How the chain is wired and addressed

Power and CAN travel together through high-current pass-through connectors, so one cable hops from motor to motor instead of a star of wires back to the PSU. Up to 31 boards can share a single bus. Setting a node ID needs no code: hold button SW1 while powering up, count the flashes on LED 1, and let go when the count matches the ID you want. The tricky part is that every ID on the bus must be unique, so label each motor before you close up the enclosure.

Each board ships with node firmware already flashed, and you can reprogram it in the Arduino IDE starting from CANBUS_Stepper_Node.ino, which also documents the pin map. There is a Qwiic / STEMMA QT port for I2C sensors, a configurable AUX connector, sensorless homing through the TMC2209, a browser GUI over WebSerial, and ESPHome support. On the PC side, a Python package called canbus-stepper wraps it all:

  • bus.node(1).set_position(180.0) moves node 1 to 180 degrees
  • set_acceleration(720.0) and set_position_speed(360.0) shape the motion profile
  • get_voltage() reads supply voltage back from the node
  • bus.broadcast.estop() stops every motor on the chain at once

Klipper integration and serial examples are still marked as in progress in the README, so plan around USB or Wi-Fi control for now.

What the team takes away

The lesson goes beyond steppers: push intelligence to the edge and the wiring problem shrinks to one bus. If you want to try the idea before buying kits, put two ESP32 boards on a breadboard with a pair of SN65HVD230 CAN transceivers, enable the TWAI peripheral, and send position commands from one to the other. Read the datasheet PDF in the repo for supply voltage and current limits before you power a full chain.

Frequently Asked Questions

How many stepper motors can I chain with the CANBUS Stepper boards?

Up to 31 boards can sit on one CAN bus, each with a unique node ID. You set the ID by holding SW1 at power-up and releasing after the matching number of LED 1 flashes, then control every node through the first one over USB, Wi-Fi or serial.

Can I program the boards myself or am I stuck with the stock firmware?

The default node firmware is open source under GPL-3.0, and the board can be reprogrammed in the Arduino IDE using CANBUS_Stepper_Node.ino as the starting point for pin definitions. You can also drive it from a PC with the canbus-stepper Python package or use the ESPHome integration.

What will I learn if I build this?

You will learn how CAN bus networking and node addressing work, closed-loop motor control with a magnetic encoder, configuring a TMC2209 driver including sensorless homing, and scripting multi-axis motion from Python. These skills map directly to robotics competitions and thesis projects with many actuators.

This article was inspired by reporting from Hackaday. Find the parts and modules to build it at Circuitrocks.

// written by Ann Arandia

Ann Arandia covers community projects and maker events for the Circuitrocks blog. She writes about local workshops, kid-friendly electronics, and the Philippine maker scene — the people, the meet-ups, the projects that come out of them.