Skip to main content
emobility.academy
M.TechMotor drivesAdvanced About 9 weeksMATLAB & Simulink

Sensorless PMSM Control with a Sliding-Mode Observer

Replace the position sensor in a PMSM FOC drive with a sliding-mode observer that estimates back-EMF and rotor angle, with an open-loop start-up and handover. Measure angle error, speed error and stability across speed and load, and find the lowest usable speed.

Tools: Simulink · Motor Control Blockset

Sensorless PMSM Control with a Sliding-Mode Observer: Students handling a two-wheeler BLDC hub motor at DIYguru
Representative photo from DIYguru's EV lab, not of this specific project.

The problem

Position sensors add cost, wiring and a failure point to EV drives, and sensorless control is used in pumps, fans, compressors and as a fallback in traction inverters. Back-EMF observers work well at medium and high speed but fail near standstill. Quantifying where an observer works and how it fails is essential before relying on it.

Objectives

  • Design a sliding-mode observer in the stationary frame for a PMSM.
  • Extract rotor angle and speed from estimated back-EMF with a PLL.
  • Implement an open-loop start-up and a smooth handover to sensorless control.
  • Measure angle error and stability over speed and load.
  • Study sensitivity to resistance and inductance errors.

What you need

Tools and toolboxes

  • Simulink — Observer, PLL, start-up state logic and test harness.
  • Motor Control Blockset — Sliding Mode Observer and FOC building blocks; the observer can also be written as a MATLAB Function block.
  • Simscape Electrical — PMSM and inverter plant with a true rotor angle for comparison.
  • Stateflow — Optional: start-up, alignment, open-loop ramp and handover sequencing. A simple Simulink switch logic also works.

Software

  • MATLAB R2023b or later
  • Simulink
  • Simscape Electrical
  • Motor Control Blockset

Extra parts and data

None beyond the software above.

Key concepts

Back-EMF in the αβ frame
For a surface PMSM, eα = −ωe·ψm·sinθ and eβ = ωe·ψm·cosθ, so the rotor angle is contained in the back-EMF, but its amplitude falls to zero at standstill.
Sliding-mode observer
A current model of the motor driven by a switching (sign or saturated) correction term; when estimated current tracks measured current, the filtered correction equals the back-EMF.
Phase-locked loop
A PI loop that adjusts an estimated angle until it aligns with the back-EMF vector, giving smoother angle and speed than a direct arctangent.
Low-speed limit
Below a certain speed the back-EMF is too small relative to noise and parameter errors to give a reliable angle, so sensorless drives start open loop.

Step-by-step guide

  1. 1

    Start from a sensored FOC model

    Use a working PMSM FOC model with an example parameter set, for example a 48 V, 4 pole pair surface PMSM with Rs = 0.05 ohm, L = 0.2 mH and ψm = 0.012 Wb, current loops at 10 kHz and a speed loop at 1 kHz. Keep the true rotor angle from the Simscape Electrical PMSM block as the reference for all error measurements.

    Checkpoint: The sensored drive tracks speed steps with the expected current and speed response.

  2. 2

    Design the observer

    Write the current model di/dt = (v − R·i − z)/L in the αβ frame, where z = k·sat(î − i) is the sliding correction. Choose k larger than the maximum back-EMF magnitude so sliding is maintained. Low-pass filter z to get back-EMF estimates, with a cut-off chosen relative to the electrical frequency. Implement it at the 10 kHz current loop rate.

    Checkpoint: Running the observer alongside the sensored drive, estimated currents track measured currents within a small band.

  3. 3

    Extract angle and speed

    First compute angle with atan2(−êα, êβ) and compensate the phase lag of the low-pass filter, which grows with speed. Then implement a PLL whose output angle and speed are used instead. Compare raw arctangent and PLL outputs against the true angle while still controlling with the sensor. Plot angle error against time for both methods; the arctangent output shows chattering that the PLL smooths, and the remaining offset tells you whether the lag compensation is correct.

    Checkpoint: At 50 per cent of rated speed, PLL angle error stays within a few electrical degrees after lag compensation.

  4. 4

    Close the loop on the estimate

    Switch the Park transforms and speed feedback to the estimated angle and speed at constant medium speed and observe whether control remains stable. Apply load torque steps and speed ramps, and log angle error, iq, id and speed error in Simulation Data Inspector. Start with gentle tests and only then try faster ramps, because an unstable observer can drive the simulation into runaway currents; add a current limit that stops the run if it is exceeded.

    Checkpoint: Sensorless control holds speed through rated load steps at medium speed with bounded angle error.

  5. 5

    Add start-up and handover

    Implement start-up as states: align the rotor with a DC current vector, ramp an open-loop current vector (I/f) up in frequency while the observer runs in parallel, then hand over when estimated speed is above a threshold and close to the commanded value. Blend the angle over a few milliseconds instead of switching abruptly. Test the sequence at no load and at a modest load, since start-up under load is harder.

    Checkpoint: From standstill the motor starts, hands over and reaches target speed with no current spike larger than a stated bound.

  6. 6

    Find the low-speed limit

    Script a sweep of speed downwards in sensorless mode with sim() and record angle error and whether control stays stable. Add realistic current measurement noise and an ADC offset to make the result meaningful. Identify the speed below which angle error exceeds a chosen threshold, such as 15 electrical degrees. Repeat the sweep with two noise levels to show how strongly the limit depends on measurement quality, which matters when choosing current sensors.

    Checkpoint: A plot of angle error against speed with the minimum usable speed marked.

  7. 7

    Test parameter sensitivity

    Change plant resistance by ±30 per cent (representing temperature change) and inductance by ±20 per cent while keeping observer parameters fixed. Repeat speed and load tests and record angle error and stability. Explain which parameter matters most at low speed and which at high speed. Use the same sweep script as in the low-speed study so that results are directly comparable, and present the worst cases with their angle-error traces, not only the summary numbers.

    Checkpoint: A sensitivity table with angle error for each case at low, medium and high speed.

  8. 8

    Compare with an alternative observer

    Implement a second method, for example a flux observer or an extended back-EMF Luenberger observer, with the same PLL and start-up. Compare angle error, chattering, low-speed limit and computation per step. Present the trade-off fairly with both tuned to the best you can achieve. Count the arithmetic operations of each observer per step as a simple proxy for computation, since this matters when the code is later run on a microcontroller.

    Checkpoint: Side-by-side results for both observers across the same test set.

  9. 9

    Report and conclude

    Document the observer design, gain choice, lag compensation, start-up logic, low-speed limit and sensitivity study. State model limits, for example ideal current sensing apart from added noise and no magnetic saliency. Explain what would be needed to operate down to standstill, such as high-frequency injection. Present the low-speed limit with the noise level used, because the number is meaningless without it, and include the start-up sequence as a state diagram.

    Checkpoint: A report where angle-error and sensitivity plots are reproducible from one script.

Testing & validation

  • Estimated currents track measured currents in sliding mode.
  • Angle error against the true angle across speed.
  • Stable sensorless operation through load steps.
  • Repeatable start-up and handover from standstill.
  • Low-speed limit and parameter sensitivity quantified.

Expected results

A sensorless PMSM drive model with a sliding-mode observer, PLL and start-up sequence, with measured angle error, low-speed limit and parameter sensitivity, and a comparison against a second observer.

Research angle for your M.Tech thesis

Research questions: what is the lowest reliable speed for a sliding-mode observer under realistic noise and parameter drift, and how does it compare with alternative observers in accuracy, chattering and computational cost? Metrics: angle error over speed, minimum stable speed, recovery after load steps and operations per step. Baselines: a sensored drive and a standard flux or Luenberger observer. A publishable contribution could be an improved switching function or adaptive gain, validated against noise and drift with released models and, ideally, a low-power hardware test.

Take it further

  • Add high-frequency injection for standstill operation in a salient motor.
  • Adapt the observer's resistance estimate online.
  • Generate code for a microcontroller and check execution time.
  • Test fault detection by comparing sensored and sensorless angles.

Viva and review questions

Why does a back-EMF observer fail at low speed?

Back-EMF amplitude is proportional to speed, so near standstill it becomes small compared with current noise, sensor offsets and resistance error, and the estimated angle becomes unreliable.

Why do you need to compensate the low-pass filter lag?

The filter used to remove chattering delays the back-EMF estimate by a phase that grows with frequency, so without compensation the angle error rises with speed.

How did you choose the sliding gain?

It must exceed the largest back-EMF magnitude so the sliding condition holds, but not by much, since a larger gain increases chattering.

Learn it at DIYguru

These DIYguru courses and programmes teach what this project needs.

Related EV projects

All 100 MATLAB & Simulink EV projects