3dSynth

Tutorials / Custom G-code

Open in the interactive tutorials reader

---
title: Tutorial 10 Speed & Acceleration Basics
description: Understanding how machines gain and lose momentum.
---

Tutorial 10 Speed & Acceleration Basics

1. Lesson Header

2. Concept Introduction

It's not just about Top Speed.

In Lesson 3, we learned about Feedrate (F). If you tell a car to go 100mph, it doesn't happen instantly. It takes time to speed up.
The same applies to printers.
- Feedrate (Speed): How fast you want to go (mm/s or mm/min).
- Acceleration: How fast you get to that speed (mm/s²).

If you have a short line (e.g., 5mm) and a high speed (100mm/s), the printer might never reach the top speed because it spends the first half accelerating and the second half decelerating.

3. Machine State Explanation

Inertia is the Enemy.
Your print head has mass. Moving it requires force. Stopping it requires force.
- High Acceleration: Snappy movement, sharp corners, but causes vibration ("Ringing" or "Ghosting") and mechanical stress.
- Low Acceleration: Smooth movement, less vibration, but rounded corners and slower print times.

4. Command Breakdown

Set Acceleration (M204)

Tells the firmware how aggressively to change speed. - Syntax: M204 S[value] (Legacy/Universal) or M204 P[print] T[travel] (Marlin 2.0+). - Standard Value: M204 S500 (Conservative) to M204 S3000 (Aggressive). - Units: Millimeters per Second Squared (mm/s²).

Set Jerk / Junction Deviation (Advanced)

We won't cover the command (M205) in depth yet, but know that "Jerk" is the minimum speed the printer snaps to instantly at a corner.

5. Minimal Working Example

Let's print two lines: one with low acceleration (smooth), one with high acceleration (jerky).

; Lesson 10 - Acceleration Test
G21
G90
G28

; Low Acceleration (Smooth)
M204 S500
G1 X10 Y10 F3000 ; Move to start
G1 X100 Y10      ; Move Right (Takes time to speed up)

; High Acceleration (Aggressive)
M204 S3000
G1 X100 Y20      ; Move Back
G1 X10 Y20       ; Move Left (Bang-Bang movement)

6. Visual Representation

Interactive preview is available in the interactive reader.

7. Build Exercise

Task: Create a "Ghosting Test" cube.
1. Print a square outer wall.
2. Set Acceleration to 500.
3. Print the next layer.
4. Set Acceleration to 3000.
5. Print the next layer.

Observe the noise difference.

...

Solution:

G28
G1 Z0.3

; Layer 1 - Low Accel
M204 S500
G1 X50 Y50 F3000
G1 X100 Y50 E5
G1 X100 Y100 E5
G1 X50 Y100 E5
G1 X50 Y50 E5

; Layer 2 - High Accel
G1 Z0.6
M204 S3000
G1 X50 Y50
G1 X100 Y50 E5
G1 X100 Y100 E5
G1 X50 Y100 E5
G1 X50 Y50 E5

8. Deep Insight Section

The "Short Move" Trap
If you command G1 X1 F6000 (Move 1mm at 100mm/s), the printer will physically fail to reach that speed.
Math: $Distance = 0.5 a t^2$.
To reach 100mm/s at 1000mm/s² acceleration takes 0.1 seconds and requires 5mm of distance.
So for any move under 10mm (5mm accel + 5mm decel), you are acceleration limited, not speed limited.

9. Common Failure Modes

  1. Layer Shift: If Acceleration is too high (e.g., M204 S10000), the motor tries to move faster than the magnetic field can pull it. The motor "skips" steps. The printer thinks it is at X=100, but it is physically at X=80. The rest of the print is ruined (shifted).
  2. Rattling: High acceleration shakes the frame. Screws can loosen over time.

10. Real-World Application

Outer Wall vs. Infill
Slicers use this to save time.
- Outer Wall: Low Acceleration (e.g., 500) for good surface finish.
- Infill: High Acceleration (e.g., 3000) because nobody sees it.
- Travel: Max Acceleration (e.g., 5000) to minimalize oozing time.

11. Final Clean Version

Save this as lesson10.gcode.

; Lesson 10 - The Speed Ramp
; Setup
G21
G90
M83
G28

; Heat (Manual)

; Position
G0 Z0.3
G0 X10 Y10

; --- Slow Acceleration ---
M204 S500    ; Set Accel to 500 mm/s^2
G1 F6000     ; Set Speed to 100 mm/s
G1 X110 Y10 E5 ; Long move (Has time to reach speed)

; --- Fast Acceleration ---
M204 S3000   ; Set Accel to 3000 mm/s^2
G1 X110 Y20  ; Shift
G1 X10 Y20 E5 ; Zip back (High mechanical stress)

; --- Impossible Speed (Short Move) ---
G1 X10 Y30
G1 X20 Y30 E0.5 ; Only moves 10mm. Won't reach F6000.

; Finish
M204 S1000   ; Restore reasonable default
G0 X0 Y200

12. Stretch Challenge

Challenge: Write a script that increases acceleration every 10mm segment along a 100mm line.
Start at 500, end at 5000.

Answer Key:

G1 X10 M204 S500
G1 X20 M204 S1000
G1 X30 M204 S1500
G1 X40 M204 S2000
; ... and so on