---
title: Positioner Build Guide
description: Build the ESP32 dual-axis antenna positioner
---

import { Steps, Aside } from '@astrojs/starlight/components';

## Bill of Materials

| Qty | Component | Notes |
|-----|-----------|-------|
| 1 | ESP32 DevKit | Any variant with enough GPIO |
| 2 | TMC2209 stepper driver | UART mode, StallGuard support |
| 2 | NEMA 17 stepper motor | 0.9° or 1.8° step angle |
| 1 | 24V power supply | 3A+ for motors |
| 1 | 5V regulator or USB | For ESP32 |
| - | Wire, connectors | See wiring diagram |

<Aside type="tip">
The TMC2209 must be in UART mode, not standalone mode. This enables StallGuard sensorless homing and runtime configuration.
</Aside>

## Mechanical Assembly

The positioner needs two axes of rotation:

1. **Theta axis** (polar, 0-180°): Tilts the antenna from zenith to nadir
2. **Phi axis** (azimuth, 0-360°): Rotates the antenna around vertical axis

### Design Considerations

- **Cable routing**: Ensure cables can handle full rotation without tangling
- **Balance**: Center of gravity should be on the rotation axes
- **Rigidity**: Minimize wobble for accurate measurements
- **Range limits**: Mechanical stops for homing reference

### Mounting Options

| Approach | Pros | Cons |
|----------|------|------|
| 3D printed | Custom fit, cheap | Strength limits |
| Aluminum extrusion | Strong, adjustable | Heavier, more complex |
| PVC pipe | Very cheap, easy | Less precise |

## Electronics Assembly

<Steps>
1. **Mount TMC2209 drivers**

   Install both drivers on a breakout board or custom PCB. Ensure proper heatsinking—these drivers can get hot under load.

2. **Wire motor connections**

   | TMC2209 Pin | Motor Wire |
   |-------------|------------|
   | A1 | Coil A+ |
   | A2 | Coil A- |
   | B1 | Coil B+ |
   | B2 | Coil B- |

   <Aside type="caution">
   Never disconnect motors while powered—the back-EMF can damage the driver.
   </Aside>

3. **Wire UART connections**

   Both drivers share the same UART bus but have different addresses:
   - Theta driver: Address 0x00
   - Phi driver: Address 0x01

   See [Wiring Diagram](/hardware/wiring/) for full pinout.

4. **Power connections**

   - 24V to driver VMOT pins (motor power)
   - 5V/3.3V to driver VIO pins (logic power)
   - ESP32 powered via USB or separate 5V regulator

5. **Test before mounting**

   Flash the firmware and verify both motors respond before final assembly.
</Steps>

## Firmware Setup

See [Firmware](/hardware/firmware/) for build and flash instructions.

## Calibration

After assembly:

1. **Home both axes**: Run `positioner_home(axis="both")`
2. **Verify range**: Move to extremes and check for binding
3. **Tune StallGuard**: Adjust `STALL_VALUE` in `config.h` if homing is unreliable
4. **Set motion parameters**: Use `positioner_config()` to tune speed/accel

## Troubleshooting

### Motor doesn't move
- Check power supply voltage (should be 24V)
- Verify UART communication (TX/RX wiring)
- Check TMC2209 address configuration

### Homing fails (doesn't detect stall)
- Increase motor current in `config.h`
- Decrease homing speed
- Adjust `STALL_VALUE` threshold

### Motors get hot
- Reduce motor current (if torque allows)
- Add heatsinks to TMC2209
- Reduce holding current when idle

### Position drift
- Check mechanical coupling (loose setscrews)
- Verify microstepping is consistent
- Check for missed steps (reduce speed/accel)
