This document describes all commands supported by the OCTv2 ESP32 motor controller firmware.
The ESP32 controller handles precise stepper motor control for the OCTv2 system via serial communication at 115200 baud. All commands are text-based and must end with a newline character.
HOME
OK
on success, ERROR: <message>
on failureExample:
HOME
OK
Notes: Must be run before any positioning commands. Sets current position to (0°, 0°)
MOVE <rotation> <pitch>
rotation
: -90.0 to +90.0 degrees (horizontal aim)pitch
: 0.0 to 60.0 degrees (vertical aim)OK
immediately (movement happens in background)Examples:
MOVE 45.0 30.0 # Set target to 45° right, 30° up
MOVE -30.0 15.5 # Update target to 30° left, 15.5° up
MOVE 0.0 0.0 # Set target to home position
Notes:
REL <delta_rotation> <delta_pitch>
delta_rotation
: Degrees to adjust horizontally (+ = right, - = left)delta_pitch
: Degrees to adjust vertically (+ = up, - = down)OK
immediately (movement happens in background)Examples:
REL 5.0 0.0 # Adjust target 5° right
REL -2.5 1.0 # Adjust target 2.5° left, 1° up
REL 0.0 -5.0 # Adjust target 5° down
Notes:
FIRE
OK
after firing sequence completeExample:
FIRE
🔥 FIRING OREO!
OK
Notes: Uses either servo (90° pulse) or solenoid (100ms pulse) depending on configuration
POS
<rotation> <pitch>
in degreesExample:
POS
45.0 30.0
STATUS
Example:
STATUS
HOMED:1 ROT:43.2 ELEV:28.7 TARGET_ROT:45.0 TARGET_ELEV:30.0 MOVING:1 EMERGENCY:0 LIMITS:0,0
Status Fields:
HOMED
: 1 if homed, 0 if notROT
: Current actual rotation in degreesELEV
: Current actual pitch in degreesTARGET_ROT
: Target rotation in degreesTARGET_ELEV
: Target pitch in degreesMOVING
: 1 if motors moving, 0 if stoppedEMERGENCY
: 1 if in emergency stop, 0 if normalLIMITS
: Limit switch states (rotation,pitch: 1=triggered, 0=clear)STOP
EMERGENCY STOP ACTIVATED
Example:
STOP
EMERGENCY STOP ACTIVATED
Notes: Disables stepper drivers, stops all motion. Use RESET
to recover.
RESET
Emergency stop reset - system ready
Example:
RESET
Emergency stop reset - system ready
Notes: Re-enables stepper drivers, resets watchdog timer
\n
) or Carriage Return + Newline (\r\n
)ERROR: Command too long
OK
: Command executed successfullyERROR: <description>
: Command failed with error descriptionWARNING: Communication timeout - emergency stop
ERROR: Not homed
- Attempted movement before homingERROR: Invalid MOVE syntax
- Incorrect command formatERROR: Invalid REL syntax
- Incorrect command formatERROR: Command too long
- Command exceeds 50 charactersERROR: Unknown command
- Unrecognized commandRESET
command to restore operationHOME
command before movement// Rotation Motor (A4988 Driver)
#define ROTATION_STEP_PIN 2
#define ROTATION_DIR_PIN 3
#define ROTATION_ENABLE_PIN 4
#define ROTATION_LIMIT_PIN 5
// Elevation Motor (A4988 Driver)
#define ELEVATION_STEP_PIN 6
#define ELEVATION_DIR_PIN 7
#define ELEVATION_ENABLE_PIN 8
#define ELEVATION_LIMIT_PIN 9
// Fire Mechanism
#define FIRE_SERVO_PIN 10
#define FIRE_SOLENOID_PIN 11
// Status
#define STATUS_LED_PIN 13
HOME # Home motors first
OK
MOVE 30.0 20.0 # Aim 30° right, 20° up
OK
FIRE # Fire Oreo
🔥 FIRING OREO!
OK
POS # Check position
30.0 20.0
REL -30.0 -20.0 # Return to center
OK
STATUS
HOMED:1 ROT:30.0 ELEV:20.0 RUNNING:0 EMERGENCY:0
# During movement:
MOVE 45.0 30.0
STATUS
HOMED:1 ROT:35.2 ELEV:25.1 RUNNING:1 EMERGENCY:0
STOP # Emergency stop
EMERGENCY STOP ACTIVATED
STATUS
HOMED:1 ROT:35.2 ELEV:25.1 RUNNING:0 EMERGENCY:1
RESET # Recover from emergency
Emergency stop reset - system ready
This ESP32 controller is designed to work with the OCTv2 Raspberry Pi server, which handles:
The ESP32 focuses purely on precise, reliable motor control and safety.