Skip to content

Gimbal Electronics

The 3-axis gimbal and linear rail system runs on a 24V system with an ESP32 controlling stepper motors through TMC2209 drivers. Separate mains connection from GEO-DUDe.


Controller

MCU ESP32 DOIT DevKit V1 (already have, Aidan M)
Power 5V USB adapter (separate from 24V system)
Role Gimbal axis control (3 axes) + belt drive motor
WiFi Connects to "groundstation" network (base station Pi hotspot)
Web UI HTTP server on port 80 for motor control, driver scanning, current setting
OTA Firmware updates over WiFi (ArduinoOTA, hostname esp32-tmc)
Framework Arduino (ESP-IDF v4.4.4), TMCStepper library for UART driver control

Stepper Motors and Drivers

4 stepper motors total, driven by TMC2209 stepper drivers.

Motor Function Notes
Stepper 1 Gimbal yaw axis Base rotation on roller bearing
Stepper 2 Gimbal pitch axis Through 80mm thrust bearing
Stepper 3 Gimbal roll axis Through 80mm thrust bearing
Stepper 4 Belt drive Linear approach, housed in gimbal base

Stepper motors are provided by Aidan M. Confirmed compatible with TMC2209 drivers (under 1.77A RMS per phase). Model/specs TBD - update when Aidan provides details.

Mounting

All 4 TMC2209 modules are mounted on a breadboard inside the gimbal base enclosure. Each driver needs:

  • 100uF 50V electrolytic cap across VMOT/GND (as close to driver pins as possible)
  • 100nF ceramic cap in parallel (optional but recommended)
  • Heatsink installed on IC (included in pack)

TMC2209 Drivers

Driver IC TMC2209 (BIGTREETECH V1.3)
Quantity Pack of 5 (4 needed, 1 spare)
VMOT range 4.75-28V (24V is ideal)
Current limit 2A RMS / 2.8A peak per driver (1.77A effective max with 110 mOhm sense resistors)
Logic voltage (VIO) 3.3-5V (ESP32 3.3V is fine)
Features StealthChop (silent), SpreadCycle, UART config, sensorless homing (StallGuard4), CoolStep
Heatsinks Included in pack, must be installed
Link Amazon.ca

UART Addressing

All 4 TMC2209 drivers can share a single UART bus from the ESP32. Each driver gets a unique address via MS1/MS2 pins:

Driver Motor MS1 MS2 Address
TMC2209 #1 Yaw LOW LOW 0
TMC2209 #2 Pitch HIGH LOW 1
TMC2209 #3 Roll LOW HIGH 2
TMC2209 #4 Belt HIGH HIGH 3

ESP32 TX and RX are bridged with a 1k ohm resistor for the single-wire UART interface. The TMCStepper Arduino library handles echo stripping automatically.

Critical TMC2209 Requirements

  • 100uF electrolytic cap on each VMOT (50V rated) - protects against back-EMF spikes. Without this, drivers will die. Add 100nF ceramic in parallel.
  • Power sequencing: VMOT must power up BEFORE VIO, and VIO must power down BEFORE VMOT.
  • Never disconnect a motor while powered - the voltage spike destroys the driver instantly.
  • CLK pin must be tied to GND (uses internal 12MHz clock). Floating CLK causes erratic behavior.
  • Never hot-swap drivers - always power down first.

Current Setting

In UART mode, motor current is set digitally via IRUN/IHOLD registers (no potentiometer needed). In standalone STEP/DIR mode, adjust the onboard Vref potentiometer:

  • Formula: I_RMS = (Vref / 2.5V) x 1.77A
  • Factory default Vref ~1.2V = ~0.85A RMS
  • For 1.5A RMS motor: set Vref to ~2.12V

Wiring

Motor cables 1M, 6-pin to 4-pin (pack of 4, qty 2 packs)
Link Amazon.ca

ESP32 Pin Assignments

Driver STEP DIR
TMC2209 #1 (Yaw) GPIO 32 GPIO 33
TMC2209 #2 (Pitch) GPIO 25 GPIO 26
TMC2209 #3 (Roll) GPIO 22 GPIO 23
TMC2209 #4 (Belt) GPIO 19 GPIO 18

UART bus: ESP32 GPIO 16 (RX) / GPIO 17 (TX), bridged with 1k resistor to TMC2209 RX pin (single-wire UART)

UART Wiring (BTT TMC2209 V1.3)

The V1.3 board has separate RX and TX header pins, but by factory default only the RX pin is connected to PDN_UART. The TX pin is disconnected unless you solder R10 on the bottom of the board.

For single-wire UART (factory default, no R10 bridge):

  • ESP32 GPIO 16 (RX) connects directly to TMC2209 RX pin
  • ESP32 GPIO 17 (TX) connects through 1K resistor to TMC2209 RX pin (same pin)
  • TMC2209 TX pin is left unconnected

All 4 drivers share the same UART bus (all RX pins connected together).

24V Required for UART

The TMC2209 chip is powered internally from VM, not VIO. VIO only sets the logic level. UART will not respond without 24V on VM, even if VIO is connected.

ESP32 Firmware

Firmware source: ~/tmp/tmc2209_read/tmc2209_read.ino

The ESP32 runs a web server with:

  • Driver scanning - detects TMC2209s on the UART bus, reads version, microsteps, current, DRV_STATUS
  • Motor control - step any driver forward/backward with configurable step count
  • Current setting - adjustable 50-2000 mA via web UI (applies to all connected drivers)
  • Speed control - slow (5ms), medium (2ms), fast (500us) step delay
  • Driver setup - one-click configuration (400mA default, 16 microsteps, StealthChop)
  • OTA updates - flash new firmware wirelessly via espota.py
  • UART debug endpoint at /debug

To flash OTA:

python3 ~/Library/Arduino15/packages/esp32/hardware/esp32/3.3.7/tools/espota.py \
  -i 192.168.4.222 -p 3232 -f build/tmc2209_read.ino.bin


Power Supply

Voltage 24V
Power 480W (20A)
Input Separate mains connection (not through slip ring)
Link Amazon.ca

ESP32 is powered separately via a 5V USB adapter, NOT from the 24V bus.


Linear Rail System

Rails HGR15, 1000mm, 2 rails + 4 HGH15CA carriages
Belt 5M GT2 timing belt with pulleys and tensioners
Drive Stepper #4 in gimbal base drives belt, translates servicer along rails

Cooling

Fans 24V 80mm brushless (pack of 2, qty 2 packs = 4 fans)
Purpose Cooling gimbal base enclosure internals
Link Amazon.ca

Power Architecture

PSU -> 14 AWG -> V+ Bus Bar (250A, 5/16" stud) -> 18 AWG to each TMC2209 VMOT (ring terminals).

No DC fuse on the gimbal. Overcurrent protection is handled by:

  • TMC2209 drivers: 2A RMS current limit per driver (hardware)
  • PSU: 20A overcurrent shutdown
  • Wall breaker: 15A

AC Current Calculation (no fuse needed)

Load DC Current (24V) AC Current (120V)
4x steppers (TMC2209 limited) 8A -
Total DC 8.6A -
PSU at full load (480W) - 4.0A
With efficiency losses (~85%) - ~4.7A

Combined with GEO-DUDe on the same outlet:

System AC Draw (max)
GEO-DUDe (600W PSU) ~5.9A
Gimbal (480W PSU) ~4.7A
Total ~10.6A

15A wall breaker provides 30% margin at absolute worst case. No AC fuse needed.