Skip to content

Software

FastAccelStepper

From github.com/gin66/FastAccelStepper (opens in a new tab)

  • Robot arms and industry
  • Library
  • MIT

A fast alternative to the AccelStepper library that drives stepper motors via step/direction pulses with acceleration control, for many microcontroller platforms.

Facts

GitHub stars
532read on 28 Nov 2026
Last update
9 Nov 2026Newest commit on master
Maintenance
Activea commit in the last 90 days
Difficulty
Beginner
Hardware it needs, as the project states it
Supported platforms include AVR ATmega 168/328, ATmega2560 and ATmega32u4, Atmel SAM Due, Microchip SAMD51, ESP32 variants (ESP32, S2, S3, C3, C6, P4), Raspberry Pi Pico and Pico 2, and Teensy 4.0/4.1 (experimental). External demultiplexers are needed for the 32 I2S steppers.

Checked on GitHub on 28 Nov 2026.

Licenses

Code
MIT (opens in a new tab)

Read by Robotheca from LICENSE (opens in a new tab) (MIT) at commit 8e55103 (opens in a new tab), on 14 Nov 2026.

Commercial use
Yes

At a glance

What it is
  • Drives stepper motors through a driver IC (such as A4988) using 1-, 2- or 3-wire connections (step, direction, enable).
  • Runs interrupt- or task-driven, with no periodic function to call from the application loop.
  • Supports acceleration and deceleration with per-stepper maximum speed and acceleration, adjustable while running.
  • Offers auto enable, shared enable and direction pins, and a command queue that can start several steppers near-synchronously.
  • Includes an experimental multi-axis planner, FasNAxis, that keeps several axes time-synchronized along one polyline.
  • Supports AVR, Atmel SAM Due, Microchip SAMD51, ESP32 family, Raspberry Pi Pico/Pico 2 and experimentally Teensy 4.0/4.1, with step rates up to 200 kSteps/s on several platforms.

Robotheca's summary of the project's documents, not the creator's words.

Robots on Robotheca
No robot on Robotheca uses it yet.
Licence
MIT. Commercial use: Yes. Where it was read
Install
In the creator's words: The project's README (opens in a new tab)
Maintenance
Active, last commit on 9 Nov 2026.

Use it

How to install it, in the creator's words: The project's README (opens in a new tab)

Robotheca doesn't review code. Read it before running it.

Files and versions

Facts read at commit 8e55103

Robotheca read the repository at two versions: the summary at 96459ed and the facts and the README at 8e55103 (read on 28 Nov 2026).

Robotheca never hosts the code: each link goes to the creator's own page.

The README

The creator's own README, copied as written: README.md by @gin66, at commit 8e55103, under MIT (opens in a new tab). The original on GitHub (opens in a new tab).

Read the README here

FastAccelStepper

Image: PlatformIO Registry (opens in a new tab) (opens in a new tab) (opens in a new tab) (opens in a new tab) (opens in a new tab)

Overview

This is a high speed alternative for the AccelStepper library (opens in a new tab). Supported are avr (ATmega 168/328/P, ATmega2560, ATmega32u4), atmelsam due, Microchip SAMD51, esp32, esp32s2, esp32s3, esp32c3, esp32c6, esp32p4, Raspberry pi pico and pico2, and (experimentally) Teensy 4.0/4.1.

The stepper motors are connected via a driver IC (like A4988) with a 1, 2 or 3-wire connection (step / direction / enable). See Hardware & Pin Connection (opens in a new tab) for the pin restrictions of each platform.

There is an excellent AI-generated description of FastAccelStepper with deep implementation details and diagrams at deepwiki.com/gin66/FastAccelStepper (opens in a new tab). For memory footprint information across supported architectures, see the Memory Report (opens in a new tab).

Supported platforms
PlatformMax step rate [kSteps/s]SteppersCmd queue depthDoc
AVR ATmega 168/328501-216avr.md (opens in a new tab)
AVR ATmega32u450316avr.md (opens in a new tab)
AVR ATmega256050316avr.md (opens in a new tab)
ESP32 (IDF 4.x)20014 (6 MCPWM/PCNT + 8 RMT)32esp32.md (opens in a new tab)
ESP32 (IDF 5.3+)200 [1]14 (6 MCPWM/PCNT + 8 RMT) + 32 I2S *32esp32.md (opens in a new tab)
ESP32-S2200 [1]4 RMT + 32 I2S *32esp32.md (opens in a new tab)
ESP32-S3200 [1]4 MCPWM/PCNT + 4 RMT + 32 I2S *32esp32.md (opens in a new tab)
ESP32-C3200 [1]2 RMT + 32 I2S *32esp32.md (opens in a new tab)
ESP32-C6200 [1]2 MCPWM/PCNT + 2 RMT + 32 I2S *32esp32.md (opens in a new tab)
ESP32-P4200 [1]4 RMT + 32 I2S * [2]32esp32.md (opens in a new tab)
Raspberry Pi Pico2008 [3]32pico.md (opens in a new tab)
Raspberry Pi Pico 220012 [3]32pico.md (opens in a new tab)
Atmel SAM Due50632sam.md (opens in a new tab)
Microchip SAMD511003-532samd51.md (opens in a new tab)
Teensy 4.0/4.1 (exp.)2001632teensy.md (opens in a new tab)

Notes:

  1. 200 kSteps/s applies to the MCPWM/PCNT and RMT drivers. I2S Mux is limited to 40 kSteps/s; I2S Direct channels reach up to 200 kSteps/s.
  2. The ESP32-P4 hardware provides 2 MCPWM groups and 4 PCNT units, but MCPWM/PCNT is not implemented for P4 yet. ESP32-S2 has PCNT but no MCPWM, ESP32-C3 has neither, so only RMT/I2S are available there.
  3. Measured on a Pico 2: the no-__FREERTOS build connects 12 steppers and the thirteenth is refused. A -D__FREERTOS=1 build loses one state machine to the core's 2-word PIO cycle counter: 11 on the Pico 2 and an expected 7 on the Pico. The Pico's 8 without __FREERTOS follows from the same 27-word program but has not been re-measured. RISC-V always takes the PIO counter, so a RISC-V Pico 2 connects 11 even without __FREERTOS. Step pins 16..31 reach all three Pico 2 PIO blocks.

* The 32 I2S steppers require an external demultiplexer (e.g. 74HC154, or a 74HC138 cascade / 74HC595 shift registers) on the I2S data line. Using I2S slots directly (I2S Direct mode) provides only 1-3 extra steppers.

The full ESP32 driver comparison (MCPWM/PCNT vs RMT vs I2S Mux) is in platforms/esp32.md (opens in a new tab).

Features
  • 1-pin operation for e.g. peristaltic pump => only positive move
  • 2-pin operation for e.g. axis control
  • 3-pin operation to reduce power dissipation of driver/stepper
  • Lower limit of 260s per step @ 16MHz aka one step every four minute (esp32/avr/samd51), 198s for sam due
  • fully interrupt/task driven - no periodic function to be called from application loop
  • supports acceleration and deceleration with per stepper max speed/acceleration
  • Allows the motor to continuously run in the current direction until stopMove() is called.
  • speed/acceleration can be varied while stepper is running (call to move or moveTo is needed in order to apply the new values)
  • Constant acceleration control: In this mode the motor can be controled by acceleration values and with acceleration=0 will keep current speed
  • Linear acceleration increase from/to standstill using cubic speed function - configurable by setLinearAcceleration()
  • Jump start from standstill - configurable by setJumpStart()
  • Auto enable mode: stepper motor is enabled before movement and disabled afterwards with configurable delays
  • Enable pins can be shared between motors
  • Direction pins can be shared between motors
  • Configurable delay between direction change and following step
  • External callback function can be used to drive the enable pins (e.g. connected to shift register) and, only esp32 derivates: the direction pins
  • No float calculation (log2 representation in range -64..64 with 16bit integer representation and 1/512th resolution)
  • Provide API to each steppers' command queue. Those commands are tied to timer ticks aka the CPU frequency!
  • Command queue can be filled with commands and then started. This allows near synchronous start of several steppers for multi axis applications.
  • EXPERIMENTAL multi-axis planner FasNAxis (src/FasNAxis.h): drives N stepper queues from one polyline so the axes stay time-synchronized. API not stable yet. See the n-axis whitepaper (opens in a new tab), the NaxesAFAP example (opens in a new tab), and Future work.
Quick Start
#include "FastAccelStepper.h"

#define dirPinStepper    5
#define enablePinStepper 6
#define stepPinStepper   9

FastAccelStepperEngine engine = FastAccelStepperEngine();
FastAccelStepper *stepper = NULL;

void setup() {
   engine.init();
   stepper = engine.stepperConnectToPin(stepPinStepper);
   if (stepper) {
      stepper->setDirectionPin(dirPinStepper);
      stepper->setEnablePin(enablePinStepper);
      stepper->setAutoEnable(true);

      stepper->setSpeedInHz(500);       // 500 steps/s
      stepper->setAcceleration(100);    // 100 steps/s²
      stepper->move(1000);
   }
}

void loop() {
}

More details in Usage (opens in a new tab) and the UsageExample.ino (opens in a new tab).

Multi-axis planner (FasNAxis)

Experimental. The FasNAxis API is not stable yet and may change without notice. It runs a polyline as fast as the motors and geometry allow, with no requested speed or time. The call list is FasNAxis.md (opens in a new tab). A waypoint that carries its own duration is FasTimed (opens in a new tab). Other open work is listed under Future work.

For coordinated motion, FasNAxis drives N stepper queues from one polyline so the axes stay time-synchronized. The hot path has no float, division, or 64-bit integers. Full example: examples/NaxesAFAP (opens in a new tab); the theory is in the n-axis whitepaper (opens in a new tab).

FasNAxis is FasNAxis<NAXES, HORIZON = 64, Stepper = FastAccelStepper, Engine = FastAccelStepperEngine> (src/FasNAxis.h). HORIZON caps how many future polyline points are buffered and planned: a small value slows the track (a speed cap, never an error — see isSpeedLimitedByLookahead()), a larger one smooths the ramp at the cost of RAM.

#include "FastAccelStepper.h"
#include "FasNAxis.h"   // not pulled in by FastAccelStepper.h

FastAccelStepperEngine engine = FastAccelStepperEngine();
FastAccelStepper* axes[2] = {NULL, NULL};
FasNAxis<2, 32> planner(FasNAxisConfig{}, engine);   // 2 axes, HORIZON = 32

void setup() {
   engine.init();
   axes[0] = engine.stepperConnectToPin(9);
   axes[1] = engine.stepperConnectToPin(10);
   for (uint8_t i = 0; i < 2; i++) {
      axes[i]->setDirectionPin(5 + i);
      axes[i]->setSpeedInHz(4000);      // steps/s
      axes[i]->setAcceleration(2000);   // steps/s²
      planner.addAxis(i, axes[i]);
   }
   planner.setLimitsFromSteppers();     // freeze v_max / a_max per axis

   int32_t origin[2] = {0, 0};
   planner.setCurrentPosition(origin);  // open the path at the current position
}

void loop() {
   // Append exact-chord target vertices; backpressures when HORIZON is full.
   static const int32_t path[][2] = {
       {1000, 0}, {1000, 1000}, {0, 1000}, {0, 0}};
   static uint8_t wp = 0;
   if (wp < 4) {
      if (planner.addWaypoint(path[wp])) {
         wp++;
      }
      if (wp == 4) {
         planner.endPath();              // last point is rest
      }
   }
   planner.pump();   // plan and feed the committed path into the queues
}
Documentation
TopicDocument
Installation (Arduino / PlatformIO / ESP-IDF)installation.md (opens in a new tab)
Hardware & pin connectionhardware.md (opens in a new tab)
Usage & auto enableusage.md (opens in a new tab)
Move semantics & position wraparoundmove_semantics.md (opens in a new tab)
Multi-axis applicationsmulti_axis.md (opens in a new tab)
Stepper and engine APIFastAccelStepper_API.md (opens in a new tab), from header2markdown.sh on FastAccelStepper.h (opens in a new tab) and FastAccelStepperEngine.h (opens in a new tab)
FasNAxis callsFasNAxis.md (opens in a new tab)
FasTimed callsFasTimed.md (opens in a new tab), example NaxesTimed (opens in a new tab)
Driver architecturedriver_architecture.md (opens in a new tab)
Ramp generatorramp.md (opens in a new tab), ramp_cubic_quadratic.md (opens in a new tab)
Planner modes (AFAP vs timed)planner_modes.md (opens in a new tab)
ESP32 I2S driveresp32_i2s_driver.md (opens in a new tab)
Pico PIO program flowpico_pio.md (opens in a new tab)
SAMD51 design notessamd51/CONTEXT.md (opens in a new tab)
n-axis whitepapern_axes_whitepaper.md (opens in a new tab)
Future workextras/todo/README.md (opens in a new tab)
Physical stepper simulationphysical_stepper_whitepaper.md (opens in a new tab)
Test strategytesting.md (opens in a new tab)
Hardware test reports (Saleae)ESP32 platform matrix (opens in a new tab) · RP2350 platform matrix (opens in a new tab) · AVR Nano platform matrix (opens in a new tab)
Troubleshootingtroubleshooting.md (opens in a new tab)
Showcase (videos)showcase.md (opens in a new tab)
Contributors & supporterscontributors.md (opens in a new tab)
Memory footprintmemory_report.md (opens in a new tab)
ChangelogCHANGELOG.md (opens in a new tab)
Source Code Structure
DirectoryPurpose
fas_arch/Platform abstraction: compiler/framework detection, interrupt macros, Arduino-like polyfills
pd_avr/AVR pulse driver: timer-based stepper control for ATmega chips
pd_esp32/ESP32 pulse driver: RMT, MCPWM/PCNT, and I2S-based stepper control
pd_pico/RP2040/RP2350 pulse driver: PIO-based stepper control
pd_sam/SAM Due pulse driver: timer-based stepper control
pd_samd/SAMD51 pulse driver: TCC PWM-based stepper control
pd_teensy/Teensy 4.0/4.1 pulse driver: QuadTimer-based stepper control (EXPERIMENTAL)
pd_test/Test platform pulse driver: PC-based testing simulation
fas_queue/Queue implementation: command queue management
fas_ramp/Ramp calculation: acceleration/deceleration curves
fas_naxis/Experimental multi-axis planner (FasNAxis), header-only
log2/Log2 representation: fixed-point arithmetic for speed calculations

Platform-specific configuration constants (queue sizes, timing, feature flags) are defined in pd_*/pd_config.h files, which are included by fas_arch/common.h during the platform dispatch. See driver_architecture.md (opens in a new tab) for details.

Project status
Future work

Open work is one file per item in extras/todo (opens in a new tab). The filename prefix is the priority, three digits wide (050_name.md). Numbers step by 10, so a new item can take a free number between two existing ones. The list is library-wide.

Star History

(opens in a new tab)

A Bit of Nostalgia

For FastAccelStepper, the way software is developed is changing fundamentally. It has been a long way from 2020 to today. Back then, I simply needed a fast stepper driver for AVR, and with my embedded know-how I went for it, hand-optimizing the ISR code until I was satisfied. Then I added ESP32 support and found several ways to generate the pulses. Today I no longer write the documentation and implementation code myself; LLMs and coding agents are increasingly doing that work. Almost inadvertently, my role is shifting toward defining requirements, consulting on the architecture, selectively reviewing the generated code, and testing it.

Nowadays, coding agents can understand the existing code base surprisingly well and carry out most of the required modifications. This makes implementing new features significantly faster.

That said, I still take pride in hand-writing the Pico PIO code. There is something deeply satisfying about getting all the required functionality for a step/direction pin into just 32 words of PIO code. That kind of low-level optimization and craftsmanship is something I value.

Perhaps there is also a little nostalgia in this. It feels like one of those moments when a craft that has shaped the way you have worked throughout your lifetime is slowly becoming obsolete — not because it has lost its value, but because there is now a faster and more powerful way of achieving the same result. Like the expert typist who could produce flawless pages at remarkable speed, the old skills don't necessarily become less beautiful; they simply become less necessary.

Those 32 words of PIO code are perhaps one of the last pieces of FastAccelStepper where I can say, quite honestly, I wrote every word myself.

But even this will soon be history. Further changes to those 32 words will be made by an LLM, too.

Contributing

Contributions are welcome. See contributors.md (opens in a new tab) for the list of people who have helped.

Before committing, format the code with bash extras/scripts/format_code.sh and run the PC-based tests with make test in extras/tests/pc_based.

With implementation becoming faster, testing is increasingly becoming the bottleneck for maintaining quality. Any new feature idea should therefore ideally come with a patch and some level of automated testing—preferably in a pc_based or simavr_based form.

The current architecture makes it straightforward to add new multi-axes planners and test them on a PC. Adding a new pulse driver, however, requires testing on real hardware. Any contribution that introduces a new PD instance must therefore include confirmation that it has been tested on the relevant hardware.

It would be great to see the introduction of more cycle-accurate, embeddable emulators that can run in GitHub Actions. simavr was, and still is, extremely valuable to me.

Having said that, I want to point out that contributions using float, double, or 64-bit arithmetic in production code will not make it into the codebase.

Robotheca lists software as a reference: nothing is hosted or run here, and every fact links to where it was read.