Article

⚠️ Error 21 — Speed Sensor Error

Error 21 means the controller isn't reading your speed sensor — almost always a spoke magnet that's out of alignment. It's one of the most fixable codes, and here's how.

July 12, 20262 min read

⚠️ Error 21 — Speed Sensor Error

What it means: The controller isn't reading your speed sensor. A mid-drive relies on the speed sensor + spoke magnet to know how fast you are going, so it limits or cuts power when this signal is missing. This is one of the most common and most fixable codes — it is almost always the magnet.

For the full context on where the speed sensor and magnet mount during a build, see our Step-by-Step Bafang Mid-Drive BBS02 & BBSHD Installation video.

How to fix it:
  • Check the magnet-to-sensor gap. The spoke magnet should pass within about 5–10mm of the speed sensor as the wheel turns. If the gap is too large the sensor can't read it. Slide the magnet or sensor so they pass close together, then confirm the wheel still spins freely without the two touching.
Speed Sensor Step 1 Speed Sensor Step 2 Diagram
  • Check the alignment. The magnet must pass directly across the face of the sensor, moving perpendicular to it — not off to one side. Mounting the sensor and magnet farther out toward the rim (rather than near the hub) makes it easier to get clean, square passes.
Speed Sensor and Magnet

Note Bafang's updated speed-sensor magnet, which clips onto a spoke rather than mounting to the disc rotor:

Updated speed sensor magnet Updated speed sensor magnet detail
  • Inspect the sensor cable. Speed sensor cables are relatively fragile and run along the chainstay where they can get snagged. Make sure the cable hasn't been yanked loose from the controller or chafed through by the chainstay.
Bike Chainstay
  • Replace the sensor. If the magnet gap and alignment are correct and the cable is intact but the error persists, the speed sensor has likely failed and needs replacing. If you have a multimeter, you can confirm a dead sensor with a voltage test at the connector first:
Speed Sensor Voltage Test
Was this article helpful?

Related Articles