# Hall Sensors (`hall`)

> Makes three Hall signals from the shaft angle, 120 degrees apart.

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

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

**Group:** Mechanical · **Kind:** `{"element":"hall","kind":"mechanical"}`

## When to use it

Use it for six-step drives of a machine with no Hall outputs, such as Surface PMSM. BLDC Machine already has them built in.

## Pins

| Pin | Domain | Meaning |
|---|---|---|
| `shaft` | mechanical | Shaft terminal, it reads speed and loads nothing |
| `ha` | signal | Hall signal a, 0 or 1 |
| `hb` | signal | Same as ha, 120 degrees later |
| `hc` | signal | Same as ha, 240 degrees later |

## Common parameters

- `poles`: Number of poles of the machine (Default: 2)
- `hall0`: Angle where the first Hall signal rises (Default: 0.5236)
- `theta0`: Shaft angle at the start (Default: 0)

## Parameters

| Key | Unit | Default | Typical range | Description |
|---|---|---|---|---|
| `poles` | — | 2 |  | Number of poles of the machine |
| `theta0` | rad | 0 |  | Shaft angle at the start |
| `hall0` | rad | 0.5236 |  | Angle where the first Hall signal rises |

_Parameter descriptions are in English in both languages._

## Model

The sensor integrates the shaft speed into a mechanical angle starting at theta0 and forms the electrical angle (poles/2)·angle. The output ha is 1 for an electrical angle in [hall0, hall0 + π), and hb and hc repeat the same pattern 120 and 240 electrical degrees later. Rotating forward, ha hb hc read 101, 100, 110, 010, 011, 001, with a change every 60 electrical degrees. The sensor is ideal, with no delay or noise.

## Common mistakes

- theta0 is a mechanical angle, so for a machine with an electrical start angle set it to the machine theta0 divided by the pole pairs. Otherwise the Hall edges are shifted from the back-EMF and the commutation is wrong.
- poles is the pole count of the machine, not its pole pairs, and must be even or the run is refused. Do not add this sensor to a BLDC Machine and expect it to replace the built-in outputs, which come from the machine itself.
- The default hall0 of 0.5236 rad (30 degrees) puts the edges at the commutation instants of 120 degree conduction. Any other hall0 advances or retards the commutation and lowers the torque per ampere.

Problems rules: `compile.error`

## Datasheet and sources

poles is the pole count of the motor, and theta0 is the starting rotor angle in mechanical radians. hall0 is the electrical angle where Hall signal ha rises, read from the sensor phasing diagram of the motor datasheet.

## Example

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

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