motor-control

Motor control algorithms and driver implementation

509 stars

Best use case

motor-control is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Motor control algorithms and driver implementation

Teams using motor-control should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/motor-control/SKILL.md --create-dirs "https://raw.githubusercontent.com/a5c-ai/babysitter/main/library/specializations/embedded-systems/skills/motor-control/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/motor-control/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How motor-control Compares

Feature / Agentmotor-controlStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Motor control algorithms and driver implementation

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 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

```c
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

```yaml
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
```

Related Skills

ros2_control Skill

509
from a5c-ai/babysitter

Hardware abstraction and controller management using ros2_control framework

MPC Controller Skill

509
from a5c-ai/babysitter

Expert skill for Model Predictive Control implementation and tuning

unreal-control-rig

509
from a5c-ai/babysitter

Unreal Engine Control Rig skill for procedural animation, IK chains, and runtime rig modifications.

touch-controls

509
from a5c-ai/babysitter

Touch input skill for virtual joysticks.

labview-instrument-controller

509
from a5c-ai/babysitter

LabVIEW instrument control skill for DAQ systems, hardware integration, and real-time data acquisition

epics-control-system

509
from a5c-ai/babysitter

EPICS control system skill for accelerator and beamline instrument control and monitoring

plasma-etch-controller

509
from a5c-ai/babysitter

Plasma etching skill for anisotropic nanostructure patterning with selectivity and profile control

nanoimprint-process-controller

509
from a5c-ai/babysitter

Nanoimprint Lithography skill for high-throughput nanopatterning with template management and demolding optimization

fib-mill-controller

509
from a5c-ai/babysitter

Focused Ion Beam milling skill for site-specific nanofabrication and cross-section preparation

ebl-process-controller

509
from a5c-ai/babysitter

Electron Beam Lithography skill for high-resolution nanopatterning with dose optimization and proximity effect correction

dsa-process-controller

509
from a5c-ai/babysitter

Directed Self-Assembly skill for block copolymer lithography and nanoparticle templating

cvd-pvd-process-controller

509
from a5c-ai/babysitter

Chemical/Physical Vapor Deposition skill for thin film and nanostructure deposition optimization