# BLDC Machine (`bldc`)

> A brushless DC motor with a trapezoidal back-EMF and built-in Hall outputs.

![bldc](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/img/bldc.svg)

[Component reference](https://voltecx-web.nguyenvanqui291.workers.dev/docs/reference/) · [繁體中文](https://voltecx-web.nguyenvanqui291.workers.dev/zh/docs/reference/machines/bldc/)

**Group:** Machines · **Kind:** `{"kind":"machine","model":"bldc"}`

## When to use it

Use it for six-step drives that commutate from the Hall signals. Use Surface PMSM when the back-EMF is sinusoidal and the drive is field-oriented.

## Pins

| Pin | Domain | Meaning |
|---|---|---|
| `a` | electrical | Stator phase a, current enters when motoring |
| `b` | electrical | Stator phase b, current enters when motoring |
| `c` | electrical | Stator phase c, current enters when motoring |
| `n` | electrical | Star point, optional |
| `shaft` | mechanical | Mechanical shaft, speed in rad/s |
| `ha` | signal | Hall signal a, 0 or 1 |
| `hb` | signal | Hall signal b, 120 degrees after a |
| `hc` | signal | Hall signal c, 240 degrees after a |

## Common parameters

- `ke`: Voltage made per unit of speed (Default: 0.05)
- `rs`: Stator winding resistance per phase (Default: 0.3)
- `ls`: Inductance of each phase (Default: 1m)
- `poles`: Number of poles of the machine (Default: 8)
- `j`: How strongly the rotor resists speeding up (Default: 1m)

## Parameters

| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
| `rs` | Ω | 0.3 |  | Stator winding resistance per phase |
| `ls` | H | 1m |  | Inductance of each phase |
| `ke` | V·s/rad | 0.05 |  | Voltage made per unit of speed |
| `flat` | ° | 120 |  | Width of the flat part of the voltage |
| `poles` | — | 8 |  | Number of poles of the machine |
| `j` | kg·m² | 1m |  | How strongly the rotor resists speeding up |
| `b` | N·m·s/rad | 0 |  | Friction that grows with speed |
| `w0` | rad/s | 0 |  | Shaft speed at the start |
| `theta0` | rad | 0 |  | Rotor position at the start |
| `hall0` | rad | 0.5236 |  | Angle where the first Hall signal rises |

_Parameter descriptions are in English in both languages._

## Model

Each phase follows v = rs·i + ls·di/dt + e, where e = ke·f(θe - k·120 degrees)·ωm, and the torque is Te = ke times the sum of f(θe - k·120 degrees)·ik. The function f is a unit trapezoid whose flat top is flat electrical degrees wide, and the phases do not couple. With two phases carrying I on their flat tops, Te = 2·ke·I. Hall signal ha is high for 180 electrical degrees from hall0, and hb and hc follow 120 and 240 degrees later. Rotating forward, ha hb hc read 101, 100, 110, 010, 011, 001. The machine never commutates by itself, so the inverter must switch the phases.

## Common mistakes

- ke is the flat-top back-EMF of one phase against the neutral, per mechanical rad/s. A line-to-line constant from a datasheet is twice that, so halve it, and note that two conducting phases give a torque constant of 2·ke.
- A fixed three-phase sine source does not commutate. Pick the conducting pair from ha, hb and hc with control blocks, and keep hall0 at its default of 30 degrees so the Hall edges fall at the commutation instants.
- ha, hb and hc are 0 or 1 signals, not voltages, and poles is a pole count, not pole pairs. A phase that is not conducting needs a freewheeling path in the inverter, such as the MOSFET body diode.

## Datasheet and sources

Take rs and ls as half the line-to-line resistance and inductance, and ke as half the line-to-line back-EMF constant in V·s/rad, which is half the torque constant in N·m/A with two phases conducting. Take poles and j from the datasheet and hall0 from the Hall phasing diagram.

## Example

Open the example with the command `file.openExample` and the name `demo:bldc`.

---
Generated by `cargo xtask reference` from the usage texts and parameter specs. Do not edit by hand.
