Fix steppers connection. #13

This commit is contained in:
osiu97
2026-07-10 18:40:42 +02:00
parent dd8f6b2277
commit a1d93c747b
9 changed files with 61 additions and 58 deletions
+8 -8
View File
@@ -25,11 +25,11 @@ only BLE between the ESP32 firmware and a local web SPA.
| **MCU** | Tenstar Robot ESP32-C3 Super Mini |
| **Framework** | PlatformIO + Arduino core |
| **Motors** | 2× 28BYJ-48 (unipolar stepper via ULN2003 driver) |
| **Motor mode** | `AccelStepper::FULL4WIRE`2048 steps/rev |
| **Motor 1 pins** | IN1=0, IN2=1, IN3=3, IN4=4 |
| **Motor 2 pins** | IN1=5, IN2=6, IN3=7, IN4=10 |
| **Motor mode** | `AccelStepper::HALF4WIRE`4096 steps/rev |
| **Motor 1 pins** | IN1=0, IN2=3, IN3=1, IN4=4 |
| **Motor 2 pins** | IN1=5, IN2=7, IN3=6, IN4=10 |
| **USB Serial** | Native USB CDC (`-D ARDUINO_USB_MODE=1 -D ARDUINO_USB_CDC_ON_BOOT=1`) |
| **Default speed** | 600 steps/s, accel 100 steps/s² |
| **Default speed** | 800 steps/s, accel 400 steps/s² |
### Mechanism geometry (critical — do NOT change without hardware verification)
@@ -62,8 +62,8 @@ d = 25.8 mm (full motor separation)
d2 = 12.9 mm (half separation)
l1 = 85.0 mm (proximal link)
l2 = 110.0 mm (distal link)
STEPS_PER_REV = 2048
STEP_ANGLE = 360/2048 ≈ 0.17578125 °/step
STEPS_PER_REV = 4096
STEP_ANGLE = 360/4096 ≈ 0.087890625 °/step
```
---
@@ -454,7 +454,7 @@ To add a new section:
assume a specific physical motor orientation. If the real arm moves in the wrong direction
when clicking a target, negate the step delta for that motor in `moveToXY()`.
- **Home position**: Stall homing is fully implemented matching the original C++ routine but adjusted to align with physical motor mappings. Homing pushes the motors against their physical limits and sets `steps1 = -1024` (-180°, points left) and `steps2 = 0` (0°, points right). This corresponds to the arms folded OUTWARDS.
- **Home position**: Stall homing is fully implemented matching the original C++ routine but adjusted to align with physical motor mappings. Homing pushes the motors against their physical limits and sets `steps1 = 2048` (+180°, points left) and `steps2 = 0` (0°, points right). This corresponds to the arms folded OUTWARDS.
- The initial web simulation starts with these coordinates, meaning the UI assumes the arm has already been homed before the browser connects.
- Homing can be triggered individually per-motor (`HOME1`, `HOME2`) or combined (`HOMEALL`) from the web UI.
@@ -463,7 +463,7 @@ To add a new section:
- `BOX_HALF_W`, `BOX_Y_MAX`: size of the actual motor housing
- `ELBOW_BOX_X_INNER`, `ELBOW_BOX_Y_MAX`: elbow clearance above the housing
- **Step speed / acceleration**: `DEFAULT_SPEED = 600`, `DEFAULT_ACCEL = 100` in firmware.
- **Step speed / acceleration**: `DEFAULT_SPEED = 800`, `DEFAULT_ACCEL = 400` in firmware.
28BYJ-48 motors are slow; these may need adjustment. Adjustable at runtime via `SPD:<n>`
and `ACC:<n>` BLE commands.