Motor Control Implementation

VerifiedSafe

Implements motor control algorithms and driver software for DC, BLDC, stepper, and AC induction motors. Includes field-oriented control (FOC), PWM generation, position/speed feedback handling, current sensing, and protection features. Useful when developing motor drivers, tuning control loops, or integrating sensor feedback for embedded systems.

Sby Skills Guide Bot
DevelopmentAdvanced
3/4/2026
Claude CodeCursorCodex
#motor-control#embedded#foc#pwm#firmware

Recommended for

Automated summary

This skill provides motor control algorithm and driver development expertise for embedded systems driving DC, BLDC, stepper, PMSM and AC induction motors.

Strengths

  • Spans the whole chain: PWM/SVPWM generation, Clarke/Park transforms, and current, speed and position loops
  • Covers multiple position feedback options (encoder, Hall, resolver, back-EMF sensorless) plus shunt-based current sensing
  • Addresses easily overlooked areas: parameter auto-identification, anti-windup, protection features and STO
  • Ships a concrete C example of an FOC current loop and a YAML configuration sketch

Limitations

  • Largely a capability catalog: little complete code for sensorless startup, observers or DTC
  • No detailed gain-tuning procedure or MCU-specific hardware calibration steps
  • Depends on third-party libraries (ST MC SDK, TI MotorWare) and measurement hardware it does not describe
When to use it

Use it to design or review an embedded motor driver, implement FOC, or structure real-time control loops.

When not to use it

Avoid it when you need flash-ready code for a specific board or a step-by-step hardware bring-up procedure.

Security analysis

Safe
Quality score78/100

This is a documentation/reference skill describing motor control algorithms and driver development for embedded systems. It contains no destructive commands, no network calls, no credential/secret handling, no obfuscated payloads, and no attempts to disable safety mechanisms. The declared tools (Bash, Read, Write, Edit, Glob, Grep) are standard for code development and are used here only in a legitimate context (writing/editing firmware source, searching code). The one code snippet is benign FOC control-loop pseudocode. No meaningful execution risk.

No concerns found

How this analysis is made

Examples

FOC current loop
Implement a field-oriented control current loop in C for a PMSM with a quadrature encoder, including Clarke/Park transforms, PI controllers with anti-windup, and SVPWM output at 20 kHz.
Sensorless BLDC bring-up
Design a sensorless six-step commutation scheme for a BLDC motor using back-EMF zero-crossing detection, and explain how to handle startup and low-speed operation.
Current sensing setup
Help me configure shunt-based phase current sensing synchronized with center-aligned PWM, including ADC sampling timing, DC offset compensation and phase reconstruction.

name: motor-control description: Motor control algorithms and driver implementation category: Application-Specific allowed-tools:

  • Bash
  • Read
  • Write
  • Edit
  • Glob
  • Grep

Motor Control Skill

Overview

This skill provides motor control algorithm implementation and driver development expertise for embedded systems controlling DC, BLDC, stepper, and AC induction motors.

Capabilities

PWM Generation

  • Center-aligned PWM configuration
  • Dead-time insertion
  • Complementary output setup
  • PWM frequency selection
  • Duty cycle modulation
  • SVPWM (Space Vector PWM)

Control Algorithms

  • FOC (Field-Oriented Control)
  • Scalar V/f control
  • Six-step commutation
  • Sinusoidal commutation
  • DTC (Direct Torque Control)
  • Model predictive control

Position/Speed Feedback

  • Encoder interface (quadrature)
  • Hall sensor configuration
  • Resolver interface
  • Sensorless algorithms
  • Back-EMF zero-crossing
  • Observer-based estimation

Current Sensing

  • Shunt resistor configuration
  • Current amplifier setup
  • ADC synchronization with PWM
  • Oversampling strategies
  • DC offset compensation
  • Phase reconstruction

Control Loops

  • Current loop (torque control)
  • Speed loop (velocity control)
  • Position loop (servo control)
  • Anti-windup strategies
  • Feed-forward compensation
  • Gain tuning methods

Motor Identification

  • Parameter measurement
  • Auto-tuning procedures
  • Resistance/inductance measurement
  • Back-EMF constant
  • Inertia estimation

Protection Features

  • Overcurrent protection
  • Overvoltage protection
  • Overtemperature monitoring
  • Stall detection
  • Safe torque off (STO)

Target Processes

  • device-driver-development.js - Motor driver implementation
  • real-time-architecture-design.js - Real-time control design
  • isr-design.js - Control loop ISR design

Dependencies

  • Motor control libraries (ST MC SDK, TI MotorWare)
  • DSP libraries for fixed-point math
  • Encoder/Hall sensor hardware

Usage Context

This skill is invoked when tasks require:

  • Motor driver development
  • FOC algorithm implementation
  • Position/speed control
  • Motor parameter tuning
  • Protection circuit design

Motor Types Supported

| Type | Control Method | Feedback | |------|---------------|----------| | Brushed DC | PWM duty cycle | Encoder optional | | BLDC | Six-step, FOC | Hall, encoder, sensorless | | PMSM | FOC | Encoder, resolver, sensorless | | Stepper | Step/direction, microstepping | Open-loop, encoder | | AC Induction | V/f, FOC | Encoder, sensorless |

FOC Implementation Example

typedef struct {
    float i_alpha, i_beta;    // Clarke transform output
    float i_d, i_q;           // Park transform output
    float v_d, v_q;           // Voltage commands
    float v_alpha, v_beta;    // Inverse Park output
    float theta;              // Rotor angle
    float speed;              // Rotor speed
} foc_state_t;

void foc_current_loop(foc_state_t* state, float i_a, float i_b, float i_c) {
    // Clarke transform
    clarke_transform(i_a, i_b, i_c, &state->i_alpha, &state->i_beta);

    // Park transform
    park_transform(state->i_alpha, state->i_beta, state->theta,
                   &state->i_d, &state->i_q);

    // PI controllers
    state->v_d = pi_controller(&pid_d, state->i_d_ref - state->i_d);
    state->v_q = pi_controller(&pid_q, state->i_q_ref - state->i_q);

    // Inverse Park
    inv_park_transform(state->v_d, state->v_q, state->theta,
                       &state->v_alpha, &state->v_beta);

    // SVPWM
    svpwm_generate(state->v_alpha, state->v_beta, pwm_duties);
}

Configuration

motor_control:
  motor_type: bldc | pmsm | stepper | induction
  control_method: foc | six_step | vf | step_dir
  pwm_frequency: 20000  # Hz
  current_loop_rate: 20000  # Hz
  speed_loop_rate: 1000  # Hz
  feedback: encoder | hall | sensorless

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/motor-control-implementation-mmbizk68/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/motor-control-implementation-mmbizk68' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/motor-control-implementation-mmbizk68/download' --output '.skill-downloads/motor-control-implementation-mmbizk68/SKILL.md.part' && mv '.skill-downloads/motor-control-implementation-mmbizk68/SKILL.md.part' '.skill-downloads/motor-control-implementation-mmbizk68/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Original excerpt: Dependencies
  • Motor control libraries (ST MC SDK, TI MotorWare)
  • DSP libraries for fixed-point math
  • Encoder/Hall sensor hardware

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/motor-control-implementation-mmbizk68/SKILL.md' && test -s '.skill-downloads/motor-control-implementation-mmbizk68/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/motor-control' && cp -R '.skill-downloads/motor-control-implementation-mmbizk68' '.claude/skills/motor-control'

Cursor
test -f '.skill-downloads/motor-control-implementation-mmbizk68/SKILL.md' && test -s '.skill-downloads/motor-control-implementation-mmbizk68/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/motor-control' && cp -R '.skill-downloads/motor-control-implementation-mmbizk68' '.cursor/skills/motor-control'

Codex
test -f '.skill-downloads/motor-control-implementation-mmbizk68/SKILL.md' && test -s '.skill-downloads/motor-control-implementation-mmbizk68/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/motor-control' && cp -R '.skill-downloads/motor-control-implementation-mmbizk68' '.agents/skills/motor-control'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/motor-control-implementation-mmbizk68'

openskills read 'motor-control-implementation-mmbizk68'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/motor-control-implementation-mmbizk68/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills