Skip to content

This topic sits right at the core of Domain 1 — Machine Control & Motion Systems (specifically “Motion Hardware Basics”) and is one of the biggest mindset shifts from enterprise software → machine software .

Let’s build this in a way that maps directly to how you will design software against real hardware, not just understand terminology.


=== PART 1 — BIG PICTURE: WHAT SOFTWARE IS CONTROLLING ===

What a motion system physically looks like

At runtime, your software is interacting with a stack like this:

+---------------------------+
|     Application (C#)      |
|  Workflow / UI / Logic    |
+------------+--------------+
             |
             v
+---------------------------+
|   Motion Controller / API |
|   (vendor SDK / driver)   |
+------------+--------------+
             |
             v
+---------------------------+
|   Motor Driver / Amplifier|
+------------+--------------+
             |
             v
+---------------------------+
|         Motor             |
|  (Servo / Stepper)        |
+------------+--------------+
             |
             v
+---------------------------+
|    Mechanical System      |
|  (stage, gantry, robot)   |
+------------+--------------+
             ^
             |
+---------------------------+
|         Encoder           |
|   (position feedback)     |
+---------------------------+

Key insight

👉 Software does NOT control the motor directly

Instead:

  • You send commands like:

    • “Move to X = 100 mm”
    • “Move at velocity 200 mm/s”
  • The motion controller + driver translates that into electrical signals

  • The motor moves

  • The encoder reports what actually happened


Mental model

Think of it like:

Software = “intent” Hardware = “execution” Encoder = “truth”

This gap between intent vs reality is where most bugs live.


=== PART 2 — SERVO VS STEPPER MOTORS ===

Stepper Motors (simpler, but risky)

Behavior

  • Moves in discrete steps

  • Typically open-loop (no feedback)

  • You assume:

    “If I send 1000 steps → it moved 1000 steps”

Problem

👉 That assumption can be WRONG

  • missed steps (load too high)
  • vibration
  • mechanical resistance

Result

  • software thinks position = X
  • real position = somewhere else

Servo Motors (industrial standard)

Behavior

  • Always closed-loop
  • Uses encoder feedback continuously
  • Controller constantly adjusts motor to match target

Result

  • higher accuracy
  • detects errors
  • corrects deviation in real time

Comparison (software perspective)

AspectStepperServo
ControlOpen-loopClosed-loop
FeedbackUsually noneContinuous encoder feedback
ReliabilityCan silently failDetects and reacts to errors
ComplexitySimpleMore complex
CostLowerHigher

Practical takeaway

👉 As a software engineer:

  • Stepper:

    • you must assume possible drift
    • add periodic re-homing or checks
  • Servo:

    • you must monitor feedback and errors
    • handle faults (following error, etc.)

=== PART 3 — ENCODERS & POSITION FEEDBACK ===

What an encoder does

An encoder answers:

“Where is the axis ACTUALLY right now?”


Types (keep it practical)

  • Incremental → counts movement
  • Absolute → gives exact position immediately

(You don’t need deeper physics right now.)


Command vs Reality

   Command Path                    Feedback Path

   Software
      |
      v
+-------------+        +------------------+
| Controller  | -----> | Motor Movement   |
+-------------+        +------------------+
                             |
                             v
                      +--------------+
                      |  Encoder     |
                      +--------------+
                             |
                             v
                      +--------------+
                      | Controller   |
                      +--------------+
                             |
                             v
                         Software

Key concept

👉 There are ALWAYS two positions:

  • Commanded position
  • Actual position (from encoder)

They are not guaranteed to match


Why software depends on this

You never do:

csharp
await MoveTo(100);
Console.WriteLine("We are at 100"); // WRONG assumption

Instead:

csharp
await MoveTo(100);
await WaitUntilPositionReached(100, tolerance: 0.01);

=== PART 4 — COMMAND VS ACTUAL BEHAVIOR ===

Reality of motion

Even with servo systems:

  • motion is NOT instant
  • system has physics

Typical deviations

1. Lag

  • motor is still catching up

2. Overshoot

  • goes past target, then corrects

3. Drift

  • position slowly shifts over time

Critical insight

👉 Motion is a continuous process, not a discrete event

Software must treat it like:

  • a state evolving over time
  • not a function call

=== PART 5 — REAL-WORLD HARDWARE LIMITATIONS ===

What hardware cannot do

1. Speed limits

  • max velocity

2. Acceleration limits

  • cannot jump to full speed instantly

3. Inertia

  • heavier systems respond slower

4. Vibration & settling

  • even after reaching target, system may still shake

What this means for software

👉 You cannot assume:

csharp
MoveTo(100);
// immediately safe to take image ❌

You must:

csharp
await MoveTo(100);
await WaitForSettling();

Why this matters in real machines

Example:

  • wafer stage moves
  • camera captures image too early → blurry image → false defect detection

=== PART 6 — FAILURE SCENARIOS ===

1. Lost steps (stepper)

  • motor didn’t move as expected
  • software still believes it did

👉 Detection:

  • periodic homing
  • external sensors

2. Encoder failure

  • no feedback or wrong feedback

👉 Software sees:

  • position frozen or jumping

3. Following error (servo)

  • actual position deviates too much from command

👉 Controller raises fault


4. Motor stall

  • motor cannot move due to load

👉 Software sees:

  • no progress despite command

5. Thermal / protection shutdown

  • driver disables motor

👉 Software sees:

  • axis suddenly stops responding

Pattern across all failures

👉 Software must:

  • detect abnormal state
  • stop motion safely
  • raise alarm

=== PART 7 — SOFTWARE DESIGN IMPLICATIONS ===

1. Never trust commands blindly

Bad:

csharp
MoveTo(100);
// assume success ❌

Good:

csharp
MoveTo(100);
await WaitForCompletion();
ValidatePosition();

2. Always monitor feedback

  • position
  • velocity
  • error conditions

3. Explicit completion model

You need concepts like:

  • InMotion
  • Settling
  • Completed
  • Faulted

4. Fault-aware design

Motion APIs should expose:

  • status
  • error codes
  • alarms

5. Time matters

Everything is:

  • asynchronous
  • time-dependent

=== PART 8 — INTERVIEW / REAL-WORLD TALKING POINTS ===

1. How to explain servo vs stepper

“Stepper motors are typically open-loop — you assume they moved. Servo motors are closed-loop — they continuously verify and correct motion using feedback. From a software perspective, servos allow reliable validation, while steppers require additional safeguards.”


2. Why feedback matters

“In industrial systems, commanded motion and actual motion are different realities. Software must always rely on feedback (encoder data) to validate execution, not on the command itself.”


3. What software engineers must understand

  • Motion is asynchronous and physical
  • Hardware introduces uncertainty
  • Feedback is the source of truth
  • Safety requires validation, not assumption

Final mental model (most important)

Software Intent  --->  Controller  --->  Physical Motion
       ^                                      |
       |                                      v
       +----------- Encoder Feedback <---------+

👉 If you remember one thing:

You are not controlling motion — you are managing the gap between intention and reality.


If you want, next we can go deeper into “Axis abstraction”, where this hardware gets wrapped into clean software models (Axis, MoveCommand, Status, etc.) — that’s where your .NET architecture skills really start to shine.

Docs-first project memory for AI-assisted implementation.