All paths

Stepper motion planning

What a printer’s firmware does between a line of G-code and two STEP pins: microsteps, trapezoid and S-curve ramps, AccelStepper, Bresenham, a G-code parser, homing and limits, and a plotter that does it all.

Arduino Uno R3Free7 lessons7 h3 chapters2,956 XPRobotics · Advanced+250 XP

0 of 7 done

Start the course freeMicrosteps: what one pulse is worthLesson plan for teachers
What you will build

3 projects, built step by step

7 lessons in 3 chapters, about 7 hours on a simulated Arduino Uno R3. Free, in your browser, every step checked by the simulator.

Chapter 1 project

AccelStepper: the ramp, done for you

The library most Arduino machines use: moveTo and run, the recurrence that times each step, where it starts braking, what stop() really does, and the step rate an Uno tops out at.

Open it in the simulator
Chapter 2 project

G-code parsing: words, modes and checksums

The plotter’s firmware reads G-code one line at a time. Split a line into words, set the position with G92, see modal motion and relative mode carry from line to line, and catch a corrupted line with a checksum.

Open it in the simulator
Chapter 3 project

Boss: a two-axis plotter

Put it all together on the G-code plotter: home it, drive the pen, draw a square line by line, read a ramp off every move, run a whole drawing, and make the machine faster by tuning its acceleration.

Open it in the simulator
The map

Chapter by chapter

Each lesson opens when the one before it is done, and each chapter ends in a project.

Chapter 1

One axis, done right

What a microstep is worth, ramps worked out and run, and the library that does it for you.

  1. Open326 XP

    Microsteps: what one pulse is worth

    An A4988 and a TMC2209 with their mode pins on the Uno. Send both the same pulses and they turn different amounts: read each chip’s table, set 1/16 and 1/64, move one microstep, and count the pulses a second each mode costs.

    0 of 7 steps

  2. Locked326 XP

    Acceleration ramps: trapezoids and S-curves

    Jump a NEMA 17 past its ceiling and watch it lose steps. Then work out a trapezoid, find when a move becomes a triangle, run a ramp one step at a time, and see what an S-curve costs.

    0 of 7 steps

  3. ProjectLocked576 XP

    AccelStepper: the ramp, done for you

    The library most Arduino machines use: moveTo and run, the recurrence that times each step, where it starts braking, what stop() really does, and the step rate an Uno tops out at.

    0 of 6 steps

5 questions, graded as you go.
Chapter 2

Two axes and a language

Bresenham keeps two motors on one line, and a parser turns G-code into moves.

  1. Locked288 XP

    Multi-axis sync: Bresenham

    Two motors, one straight line. Step both at one rate and see the dog leg, trace Bresenham by hand, draw the line within half a step, and turn a feed along the path into a step rate per axis, capped at the limit.

    0 of 6 steps

  2. ProjectLocked576 XP

    G-code parsing: words, modes and checksums

    The plotter’s firmware reads G-code one line at a time. Split a line into words, set the position with G92, see modal motion and relative mode carry from line to line, and catch a corrupted line with a checksum.

    0 of 6 steps

5 questions, graded as you go.
Chapter 3

A real machine

Homing that brakes and backs off, soft and hard limits, and the boss: a G-code plotter.

  1. Locked288 XP

    Limits and homing

    Home a two-axis machine the way Grbl does: seek fast, brake past the switch, back off, touch slowly, pull off. Then refuse a target off the bed, and stop dead when a switch trips mid-move.

    0 of 6 steps

  2. ProjectLocked576 XP

    Boss: a two-axis plotter

    Put it all together on the G-code plotter: home it, drive the pen, draw a square line by line, read a ramp off every move, run a whole drawing, and make the machine faster by tuning its acceleration.

    0 of 6 steps

4 questions, graded as you go.
Syllabus

Every lesson in the course

All 7 lessons, in order, each with what it covers. Any of them opens in the editor right away.

Chapter 1

One axis, done right

  1. Microsteps: what one pulse is worthAn A4988 and a TMC2209 with their mode pins on the Uno. Send both the same pulses and they turn different amounts: read each chip’s table, set 1/16 and 1/64, move one microstep, and count the pulses a second each mode costs.
  2. Acceleration ramps: trapezoids and S-curvesJump a NEMA 17 past its ceiling and watch it lose steps. Then work out a trapezoid, find when a move becomes a triangle, run a ramp one step at a time, and see what an S-curve costs.
  3. AccelStepper: the ramp, done for youThe library most Arduino machines use: moveTo and run, the recurrence that times each step, where it starts braking, what stop() really does, and the step rate an Uno tops out at.
Chapter 2

Two axes and a language

  1. Multi-axis sync: BresenhamTwo motors, one straight line. Step both at one rate and see the dog leg, trace Bresenham by hand, draw the line within half a step, and turn a feed along the path into a step rate per axis, capped at the limit.
  2. G-code parsing: words, modes and checksumsThe plotter’s firmware reads G-code one line at a time. Split a line into words, set the position with G92, see modal motion and relative mode carry from line to line, and catch a corrupted line with a checksum.
Chapter 3

A real machine

  1. Limits and homingHome a two-axis machine the way Grbl does: seek fast, brake past the switch, back off, touch slowly, pull off. Then refuse a target off the bed, and stop dead when a switch trips mid-move.
  2. Boss: a two-axis plotterPut it all together on the G-code plotter: home it, drive the pen, draw a square line by line, read a ramp off every move, run a whole drawing, and make the machine faster by tuning its acceleration.
Kits

Build it on your bench too

Every lesson runs in the simulator with nothing to buy. When you want the real thing, these kits have the parts.

Have a kit already?

Find your kit

Pick the starter kit you own and run every lesson in its manual with the same parts on the same pins.

See every kit
Questions

About Stepper motion planning

Is Stepper motion planning free?

Yes. All 7 lessons of Stepper motion planning are free and run in your browser, with nothing to install and no parts to buy before you start.

Do I need a real Arduino Uno R3?

No. Every lesson runs on a simulated Arduino Uno R3 with its parts on the canvas, and the simulator checks each step as you go. When you want to build it for real, the same wiring and code work on a real board.

How long does Stepper motion planning take?

About 7 hours: 7 lessons in 3 chapters, each one a few short steps. Your progress is kept, so you can stop after any lesson and pick up where you left off.

What will I build?

Each chapter ends in a project that puts it together: AccelStepper: the ramp, done for you, G-code parsing: words, modes and checksums and Boss: a two-axis plotter.

Where do I start?

With "Microsteps: what one pulse is worth", and each lesson builds on the one before it. New to circuits? Electronics basics is the course that starts from zero.