Bafang error 21: Speed sensor error
Bafang BBS01/BBS02/BBSHD, M-series mid-drives and hub motors (UART & CAN displays)Fix at homeRide with caution
The controller does not receive a wheel speed signal. Typical symptoms: speed shows 0 while riding, assist cuts out after a few seconds, or assist is limited to walk-mode power. This is the most common Bafang code and almost always a sensor or magnet problem.
Likely causes
- Spoke magnet moved, fell off or sits too far from the sensor (gap should be 2-5 mm)
- Speed sensor cable damaged or pulled out of its connector
- Sensor knocked out of alignment by a chain, heel or a fall
- Water in the sensor connector
- Faulty speed sensor
- On CAN systems: sensor plugged into the wrong port after a rebuild
How to fix Bafang error 21
- Find the spoke magnet and align it with the sensor at a 2-5 mm gap; tighten it
- Check the sensor is fixed firmly and its cable runs undamaged to the connector
- Unplug the sensor connector, dry and clean it, plug back in; power cycle
- Spin the wheel with the display on: the speed reading should appear at the moment the magnet passes
- Replace the sensor and magnet (cheap, plug-and-play)
- If a new sensor changes nothing, have the harness and controller input tested
Go to a dealer if: Go to a shop if a new sensor and correctly placed magnet still give error 21; the fault is then in the harness or controller.
Warranty: Bafang parts are usually sold through dealers or online resellers; warranty is typically 1-2 years via the seller, and this code alone is rarely a warranty claim.
Typical cost: Sensor plus magnet EUR/USD 10-30; usually a free fix by realigning the magnet.
Warranty: Bafang parts are usually sold through dealers or online resellers; warranty is typically 1-2 years via the seller, and this code alone is rarely a warranty claim.
Typical cost: Sensor plus magnet EUR/USD 10-30; usually a free fix by realigning the magnet.
Still stuck? Take a photo of the display and show it to a local e-bike workshop. Bring the bike's system name (e.g. Bosch Performance Line CX) and the exact code; that saves diagnostic time and money.
Frequently asked
How do I reset Bafang error 21?
Fix the magnet gap and power cycle. The code clears as soon as the controller sees a speed pulse.
Can I keep riding with error 21?
Yes, safely, but assist will be limited or cut. Ride home and fix the magnet.
Is error 21 a warranty issue?
Rarely; a moved magnet is not a defect. A sensor that fails early can be replaced under seller warranty.
Related Bafang codes
Not an official Bafang document. Compiled from workshop experience and public service information; details can differ per system version and bike brand.