Back to engineering archive

Record 013 / Firmware and control

Encoder-adjusted dual-stepper draft

Two encoder inputs adjust the steppers’ maximum speeds. Separate timers queue alternating relative moves, while both stepper handlers run on each loop.

Archived firmware draft
Stepper controlEncoder inputAccelStepper API

Archived source flow

Selected dual-axis loop: encoder deltas set maximum speeds; each axis starts a completion timer and queues an alternating random relative move when its timer is due. Both stepper run calls are serviced. This is an archived untested draft, not position feedback or UART command handling.
Per-axis decisions reconstructed from archived source. Encoders adjust maximum speed, not measured motor position. Compilation and hardware operation are unverified. View diagram at full size

Technical notes

Speed input

Each encoder delta changes one maximum-speed setting by twice the delta. The settings are constrained to 0–500 before being passed to AccelStepper; encoder readings are then retained for the next loop.

Independent movement phases

Each axis has its own completion timer and direction phase. After a target is reached and the timer condition passes, generateSteps() selects a random(100, 5000) relative length and the direction phase alternates. Both run() calls are serviced on each loop.

Source limits

Serial is initialized but no UART command parser is present. The encoders adjust speed settings, not a measured motor-position feedback loop. Timer rollover handling, compilation and mechanical behaviour have not been verified.

Engineering archiveArchive record

Project enquiries

Discuss your project.

Tell us what you’re developing and where you need engineering support.

Discuss your project