MONKEYTHUNDER.COM/GO/AUTO_ORBIT · DETERMINISTIC MECHATRONICS STUDIO · V2.1
Tabletop Auto-orbit — Bluetooth & webapp LoRA product rotator studio
Verified for 3×3×3 bananas (21" cube, 10 lb) · 3.07x torque SF (1.2s cosine ramp) · C=99.88 mm 8:1 GT2 · 3-sheet scale-bar print pack + WireViz & ESP32-S3 WDT firmware.
“Assume all AI-generated content is a lie until proven otherwise... by a human.”
Unbuilt AI-assisted, human-curated engineering concept — tread carefully & apply real shop expertise
This build package pairs human creative and engineering curation with deterministic physics, wiring, and firmware verification kernels — but a physical prototype has not yet been bench-built in our shop. Treat every cut dimension, load rating, wire gauge, power rail, and code routine as an unverified prototype: measure twice, fuse every supply, verify voltages with a multimeter before connecting logic boards, use proper guards and PPE, and never energize hardware beyond your personal trade skill.
Built this or spotted a math, wiring, or dimension error? Send human bench feedback & improvements
Zero cookies or trackers — opens GitHub Issues or copies Markdown to your clipboard.
Settled step-and-shoot (3.07x torque SF)
LIVE AZIMUTH & FRAME
000.0° · 1/24
SWEPT CORNER CIRCLE
29.7" dia
TORQUE SAFETY FACTOR (PINT)
3.07x @ 1.6A
360° RING CYCLE TIME
43 sec
3-sheet isotropic engineering print pack — co-scaled linear bar keys (8.5"×11" or 24"×36")
SHEET 1 OF 3 — Isotropic Side & Top Plan (19.0 px/in) + 4X Detail C + Dual Imperial/Metric Graphical Scale Bar
~1:5.6 @ 8.5"×11" | ~1:1.7 @ 24"×36"
SHEET 2 OF 3 — Home Depot 24"×48" Half-Sheet 1/8"-Kerf Nesting (rectpack) + Nominal-vs-Actual Stock + Drill Coordinates
~1:6.5 @ 8.5"×11" | ~1:2.0 @ 24"×36"
SHEET 3 OF 3 — Full-Width WireViz Color Harness + 5-Step Multimeter Pre-Power Gate + Untagged Offline Shop BOM
Topological Schematic · Untagged Print Compliant
WireViz color harness & PlatformIO-verified ESP32-S3 firmware
Inspect PlatformIO-verified Tabletop_Auto_Orbit_ESP32S3.ino source (SoftAP http://rotator.local + 1.2s cosine ramp + 4s WDT)
/**
* Tabletop_Auto_Orbit_ESP32S3.ino
* Single-File Arduino IDE Sketch (Generated from PlatformIO Verified Source V2.1)
* Board: ESP32S3 Dev Module (USB CDC On Boot: Enabled)
* Required Library (Arduino Library Manager): TMCStepper by teemuatlut (>= 0.7.3)
*
* Pinout & Safety Verified against electronics/auto_orbit_wireviz.yml & specs/calculations.py
*/
#include <Arduino.h>
#include <WiFi.h>
#include <ESPmDNS.h>
#include <WebServer.h>
#include <TMCStepper.h>
#include <esp_task_wdt.h>
namespace OrbitConfig {
constexpr uint8_t PIN_STEP = 4; // W3_CTRL YE -> TMC2209 STEP
constexpr uint8_t PIN_DIR = 5; // W3_CTRL BU -> TMC2209 DIR
constexpr uint8_t PIN_EN_LOW = 6; // W3_CTRL WH -> TMC2209 EN (Active LOW; HIGH = freewheel safe)
constexpr uint8_t PIN_TMC_UART_TX = 17; // W3_CTRL GN (via 1k resistor) -> TMC2209 PDN_UART
constexpr uint8_t PIN_TMC_UART_RX = 18; // W3_CTRL BN -> TMC2209 PDN_UART
constexpr uint8_t PIN_HALL_HOME = 7; // W5_SENS GY -> A3144E DO (Active LOW with internal pull-up)
constexpr uint8_t PIN_SHUTTER_TRIG = 15; // W5_SENS PK -> PC817 IN2 (Camera Shutter Release)
constexpr uint8_t PIN_FOCUS_TRIG = 16; // W5_SENS TQ -> PC817 IN1 (Camera Half-Press Focus)
constexpr uint16_t TMC_MICROSTEPS = 16; // Interpolated to 256 in StealthChop2
constexpr uint32_t USTEPS_PER_REV = 25600; // 200 * 16 * 8 = 0.0140625 deg/ustep
constexpr uint16_t TMC_RMS_CURRENT_MA = 1600; // 1.60A RMS (>3.0x torque SF w/ 1.20s S-curve ramp)
constexpr uint32_t MAX_RAMP_USTEPS = 3200; // 1.20s gentle S-curve ramp at 12 RPM
constexpr float TMC_RSENSE_OHM = 0.11f; // BTT TMC2209 v1.3
constexpr uint32_t WDT_TIMEOUT_SEC = 4; // Hardware Watchdog Timer
constexpr uint32_t HOMING_MAX_USTEPS = 32000; // 1.25 platter rev max search — halts if rim magnet missing
constexpr uint32_t SETTLE_DWELL_MS = 1000; // 1.0s damping before shutter pulse
constexpr uint32_t SHUTTER_PULSE_MS = 140; // Optocoupler TRS shutter hold
constexpr uint32_t HEARTBEAT_TIMEOUT_MS = 15000; // Auto-stop continuous spin if client disconnects
}
using namespace OrbitConfig;
HardwareSerial& TmcSerial = Serial1;
TMC2209Stepper driver(&TmcSerial, TMC_RSENSE_OHM, 0b00);
WebServer server(80);
enum class RunMode : uint8_t { IDLE = 0, HOMING, CONTINUOUS, STEP_RING };
volatile RunMode currentMode = RunMode::IDLE;
int32_t currentUstepPos = 0;
int8_t spinDir = 1;
float targetRpm = 2.4f;
uint16_t totalStops = 24;
uint16_t completedStops = 0;
bool homedOk = false;
String faultReason = "NONE";
uint32_t lastClientPingMs = 0;
void disableDriverSafe() {
digitalWrite(PIN_EN_LOW, HIGH);
currentMode = RunMode::IDLE;
}
void enableDriver() {
digitalWrite(PIN_EN_LOW, LOW);
delayMicroseconds(50);
}
void pulseStepOnce(uint32_t halfPeriodUs) {
digitalWrite(PIN_STEP, HIGH);
delayMicroseconds(4);
digitalWrite(PIN_STEP, LOW);
if (halfPeriodUs > 4) delayMicroseconds(halfPeriodUs - 4);
}
void triggerIsolatedShutter() {
digitalWrite(PIN_FOCUS_TRIG, HIGH);
delay(60);
digitalWrite(PIN_SHUTTER_TRIG, HIGH);
delay(SHUTTER_PULSE_MS);
digitalWrite(PIN_SHUTTER_TRIG, LOW);
digitalWrite(PIN_FOCUS_TRIG, LOW);
}
bool moveRelativeSmooth(int32_t deltaUsteps, float cruiseRpm) {
if (deltaUsteps == 0) return true;
enableDriver();
digitalWrite(PIN_DIR, (deltaUsteps >= 0) ? HIGH : LOW);
uint32_t steps = static_cast<uint32_t>(abs(deltaUsteps));
float cruiseHz = max(200.0f, (cruiseRpm / 60.0f) * static_cast<float>(USTEPS_PER_REV));
float startHz = 320.0f;
uint32_t rampSteps = min<uint32_t>(steps / 3, MAX_RAMP_USTEPS);
for (uint32_t i = 0; i < steps; i++) {
if ((i & 0xFF) == 0) {
esp_task_wdt_reset();
server.handleClient();
if (currentMode == RunMode::IDLE) return false;
}
float hz = cruiseHz;
if (rampSteps > 0 && i < rampSteps) {
float phase = 0.5f * (1.0f - cosf(PI * static_cast<float>(i) / static_cast<float>(rampSteps)));
hz = startHz + (cruiseHz - startHz) * phase;
} else if (rampSteps > 0 && i >= (steps - rampSteps)) {
uint32_t rem = steps - i;
float phase = 0.5f * (1.0f - cosf(PI * static_cast<float>(rem) / static_cast<float>(rampSteps)));
hz = startHz + (cruiseHz - startHz) * phase;
}
pulseStepOnce(static_cast<uint32_t>(1000000.0f / max(hz, 200.0f)));
currentUstepPos += (deltaUsteps >= 0) ? 1 : -1;
}
return true;
}
bool executeHomeRoutine() {
enableDriver();
digitalWrite(PIN_DIR, HIGH);
faultReason = "NONE";
uint32_t searched = 0;
while (digitalRead(PIN_HALL_HOME) == HIGH) {
if (searched >= HOMING_MAX_USTEPS) {
disableDriverSafe();
homedOk = false;
faultReason = "ERR_NO_HOME_MAGNET_WITHIN_1.25_REV";
return false;
}
if ((searched & 0xFF) == 0) {
esp_task_wdt_reset();
server.handleClient();
if (currentMode == RunMode::IDLE) return false;
}
pulseStepOnce(750);
searched++;
}
currentUstepPos = 0;
homedOk = true;
currentMode = RunMode::IDLE;
return true;
}
static const char INDEX_HTML[] PROGMEM = R"HTML(
<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
<title>Auto-Orbit Rotator</title>
<style>body{font-family:system-ui,sans-serif;max-width:520px;margin:24px auto;padding:0 16px;background:#f8fafc;color:#0f172a}
.card{background:#fff;border:1px solid #cbd5e1;border-radius:14px;padding:16px;margin-bottom:14px}
button{padding:10px 14px;border-radius:8px;border:1px solid #94a3b8;background:#fff;font-weight:600;cursor:pointer;margin:4px 4px 4px 0}
.pri{background:#059669;color:#fff;border-color:#059669}.stop{background:#dc2626;color:#fff;border-color:#dc2626}</style></head>
<body><div class="card"><h2>Tabletop Auto-Orbit (rotator.local)</h2>
<p id="st">Ready</p>
<button class="pri" onclick="cmd('/api/home')">0.0 deg Home</button>
<button class="pri" onclick="cmd('/api/ring?stops=24&rpm=2.4')">Shoot 24-Stop LoRA</button>
<button onclick="cmd('/api/ring?stops=36&rpm=2.4')">Shoot 36-Stop</button>
<button onclick="cmd('/api/spin?rpm=2.0&dir=1')">Spin B-Roll CW</button>
<button class="stop" onclick="cmd('/api/stop')">STOP (Freewheel)</button>
</div><script>
async function cmd(u){const r=await fetch(u);document.getElementById('st').textContent=await r.text();}
setInterval(()=>cmd('/api/status'),2500);
</script></body></html>
)HTML";
void setup() {
pinMode(PIN_EN_LOW, OUTPUT);
disableDriverSafe();
pinMode(PIN_STEP, OUTPUT);
pinMode(PIN_DIR, OUTPUT);
pinMode(PIN_HALL_HOME, INPUT_PULLUP);
pinMode(PIN_SHUTTER_TRIG, OUTPUT);
pinMode(PIN_FOCUS_TRIG, OUTPUT);
Serial.begin(115200);
TmcSerial.begin(115200, SERIAL_8N1, PIN_TMC_UART_RX, PIN_TMC_UART_TX);
driver.begin();
driver.toff(4);
driver.blank_time(24);
driver.rms_current(TMC_RMS_CURRENT_MA);
driver.microsteps(TMC_MICROSTEPS);
driver.en_spreadCycle(false);
driver.pwm_autoscale(true);
WiFi.mode(WIFI_AP);
WiFi.softAP("AutoOrbit-Studio");
MDNS.begin("rotator");
server.on("/", HTTP_GET, []() { lastClientPingMs = millis(); server.send_P(200, "text/html", INDEX_HTML); });
server.on("/api/stop", HTTP_GET, []() { disableDriverSafe(); server.send(200, "text/plain", "STOPPED"); });
server.on("/api/home", HTTP_GET, []() { lastClientPingMs = millis(); currentMode = RunMode::HOMING; server.send(200, "text/plain", "Homing..."); });
server.on("/api/spin", HTTP_GET, []() {
lastClientPingMs = millis();
if (server.hasArg("rpm")) targetRpm = constrain(server.arg("rpm").toFloat(), 0.2f, 12.0f);
if (server.hasArg("dir")) spinDir = (server.arg("dir").toInt() < 0) ? -1 : 1;
enableDriver();
digitalWrite(PIN_DIR, (spinDir > 0) ? HIGH : LOW);
currentMode = RunMode::CONTINUOUS;
server.send(200, "text/plain", "Spinning");
});
server.on("/api/ring", HTTP_GET, []() {
lastClientPingMs = millis();
totalStops = server.hasArg("stops") ? constrain(server.arg("stops").toInt(), 4, 72) : 24;
targetRpm = server.hasArg("rpm") ? constrain(server.arg("rpm").toFloat(), 0.4f, 8.0f) : 2.4f;
completedStops = 0;
currentMode = RunMode::STEP_RING;
server.send(200, "text/plain", "Starting LoRA capture");
});
server.begin();
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0)
esp_task_wdt_config_t wdt_cfg = { .timeout_ms = WDT_TIMEOUT_SEC * 1000, .idle_core_mask = 0, .trigger_panic = true };
esp_task_wdt_reconfigure(&wdt_cfg);
#else
esp_task_wdt_init(WDT_TIMEOUT_SEC, true);
#endif
esp_task_wdt_add(NULL);
lastClientPingMs = millis();
}
void loop() {
esp_task_wdt_reset();
server.handleClient();
if (currentMode == RunMode::HOMING) {
executeHomeRoutine();
} else if (currentMode == RunMode::CONTINUOUS) {
if (millis() - lastClientPingMs > HEARTBEAT_TIMEOUT_MS) {
disableDriverSafe();
faultReason = "HEARTBEAT_TIMEOUT_AUTO_STOP";
return;
}
float hz = (targetRpm / 60.0f) * static_cast<float>(USTEPS_PER_REV);
pulseStepOnce(static_cast<uint32_t>(1000000.0f / max(hz, 100.0f)));
currentUstepPos += spinDir;
} else if (currentMode == RunMode::STEP_RING) {
int32_t stepDelta = static_cast<int32_t>(USTEPS_PER_REV / totalStops);
for (uint16_t s = 0; s < totalStops && currentMode == RunMode::STEP_RING; s++) {
uint32_t t0 = millis();
while (millis() - t0 < SETTLE_DWELL_MS) {
esp_task_wdt_reset();
server.handleClient();
if (currentMode != RunMode::STEP_RING) return;
delay(10);
}
triggerIsolatedShutter();
completedStops = s + 1;
if (completedStops < totalStops) {
if (!moveRelativeSmooth(stepDelta * spinDir, targetRpm)) return;
}
}
currentMode = RunMode::IDLE;
}
}
Engineering concept plate — 12" ring bearing cutaway & 24-stop LoRA index architecture
Multi-vendor BOM & optional specialty shop tools (Amazon 90d + Home Depot)
Disclosure: As an Amazon Associate I earn from qualifying purchases. Home Depot, industrial supply-house, and optional tool links are listed by exact engineering spec (check live pricing on each retailer's cart screen before checkout).
| # | Part, engineering spec & store aisle note | Need | Order pack | Suggested source | Status |
|---|