Independent technical referenceOfficial site
  • Electric mobility
  • Electric bicycle

Error 21

Bafang Error 21 on electric bicycle: speed sensor fault

Verified with sources2 sourcesReviewed Oct 18, 2026
Technician coming? See the 2 steps they must show you
Electric bicycle with mid-drive motor and integrated battery
SängerCC BY-SA 4.0Image source

Risk level

Medium

Proceed carefully and stop if the check is unclear.

Urgency

Medium

Quick answer

On Bafang displays such as the DP C241, Error 21 means a speed sensor fault and stops motor assistance; restart the system and check that the spoke magnet aligns with the sensor at a 10 to 20 mm clearance. If it stays on after checking the connector, visit a dealer with the BESST tool.

Safety first

Stop and check this first

  • Never reposition the spoke magnet to bypass or alter speed readings, and never open the motor or controller housing; keep the magnet aligned at the specified 10 to 20 mm distance.
  • Always turn the pedelec off before reaching near the rear wheel spokes or unplugging the speed sensor connector.

Safe checks you can perform

  • Restart the pedelec and confirm error code 21 on the display
  • Check magnet alignment and the 10 to 20 mm clearance at the rear wheel
  • Inspect the speed sensor connector and cable for visible damage

Leave these tasks to a qualified professional

  • Do not attempt this professional task: Speed sensor signal test and controller update with the Bafang BESST tool
  • Do not attempt this professional task: Harness repair or replacement of the speed sensor or motor

What a technician must be able to justify

Technician visit

These are the steps they must carry out and show you. Tick them as they work: if steps are skipped, do not accept a part swap.

These are not instructions for opening or handling the equipment yourself. They are the checks that should support a technical conclusion.

  1. Speed sensor signal test and controller update with the Bafang BESST tool

    What they doThe authorized technician connects the pedelec to Bafang's BESST diagnostic tool to test the live speed sensor signal and update the controller firmware.

    They must show youthe BESST speed sensor signal status and the controller firmware version after updating.

    In writingthe BESST diagnostic result and the controller update performed.

  2. Harness repair or replacement of the speed sensor or motor

    What they doIf the connector is damaged or BESST confirms the fault remains after a controller update, the workshop repairs the plug or replaces the speed sensor (step 6) or motor (step 7).

    They must show youthe old part replaced and the display powered on with error code 21 inactive.

    In writingwhich component was repaired or replaced (connector, speed sensor or motor) and the warranty terms.

Before accepting a part or repair

Nothing has been shown yet. Do not accept a part swap based on the code alone.

Follow these steps

Note: Follow the documented order. An error code identifies the affected system, but it does not prove by itself which part has failed.

  1. Restart the pedelec and confirm error code 21 on the display

    No special tools

    Who:
    you, with the e-bike stationary on flat ground.
    How:
    switch the system off at the handlebar display, wait a few seconds and power it back on as instructed in step 1 of the Bafang code 21 guide and the DP C241 manual. On the DP C241 unit, you can also open Information > Error Code to inspect the last ten stored faults (E-Code00 to E-Code09).
    Result that matters:
    verifying whether continuous diagnostics clear the alert after a clean reboot.
    If code 21 disappears and motor assistance works normally:
    the fault has cleared.
    If code 21 remains active and the motor does not assist:
    proceed to the magnet clearance check.
    Evidence to keep:
    photo of the display showing code 21 or the E-Code history screen.

    Evidence: Bafang DP C241 Display User Manual (BF-UM-C-DP C241-EN) · Bafang Error Code 21 Speed Sensor Fault Troubleshooting Guide

  2. Check magnet alignment and the 10 to 20 mm clearance at the rear wheel

    No special tools

    Who:
    you, with the system switched off and the rear wheel free to rotate.
    How:
    locate the speed sensor mounted on the left-hand rear frame stay and the magnet attached to the back wheel spoke. Check that the magnet passes directly in line with the sensor and that the clearance between magnet and sensor is between 10 mm and 20 mm; adjust the spoke magnet if it has shifted.
    Result that matters:
    ensuring the spoke magnet triggers a clean speed pulse on each wheel rotation.
    If the gap was outside 10 to 20 mm and resetting it clears code 21 on startup:
    repair complete.
    If the magnet is aligned at 10 to 20 mm and code 21 persists:
    inspect the sensor connector.
    Evidence to keep:
    photo of the spoke magnet alignment and gap next to the left rear stay sensor.

    Evidence: Bafang DP C241 Display User Manual (BF-UM-C-DP C241-EN) · Bafang Error Code 21 Speed Sensor Fault Troubleshooting Guide

  3. Inspect the speed sensor connector and cable for visible damage

    No special tools

    Who:
    you, with the pedelec turned off.
    How:
    examine the speed sensor cable and plug for the six conditions listed in Bafang step 3: a loose connector, corroded pins, bent or broken pins, dirt or debris in or on the pins, damaged wire insulation, or a broken connector shell.
    Result that matters:
    ruling out a loose or contaminated harness connection without opening sealed parts.
    If cleaning dirt and firmly reconnecting a loose plug makes code 21 inactive:
    normal riding can resume.
    If pins are bent or corroded, insulation is torn, or code 21 stays active:
    book retailer service.
    Evidence to keep:
    close-up photo of the speed sensor connector pins and cable outer sheath.

    Evidence: Bafang DP C241 Display User Manual (BF-UM-C-DP C241-EN) · Bafang Error Code 21 Speed Sensor Fault Troubleshooting Guide

Still not solved

If the error persists, stop here. See what the technician must do and show you.

Where this code applies

A code is meaningful only inside the right product and version context.

Primary scope

System
Electric mobility
Brand
Bafang
Product type
Electric bicycle

Known code variants

  • 21
  • Bafang 21
  • Bafang DP C241 error 21
  • Bafang e-bike error 21
  • Bafang E-Code 21
  • Bafang error 21
  • Bafang speed sensor fault 21
  • bicicleta eléctrica Bafang error 21
  • Charging Base blocked by surrounding obstacles
  • código 21 Bafang
  • E-Code 21 Bafang
  • error 21
  • Error 21 height sensor
  • error code 21 Bafang
  • eufy Error 21
  • eufy RoboVac Error 21
  • fallo sensor velocidad Bafang
  • Height sensor has been pressed
  • iPhone error 21
  • iTunes error 21
  • Mi Electric Scooter error 21
  • Ninebot codigo 21
  • Ninebot error 21
  • patinete Segway error 21
  • patinete Xiaomi error 21
  • Roborock Error 21
  • RoboVac Error 21
  • Segway error 21
  • Segway Ninebot E2 Pro error 21
  • Segway Ninebot error code 21
  • Xiaomi bateria error 21
  • Xiaomi error 21
  • Xiaomi error 21 6 km/h
  • Xiaomi scooter error 21

What it means

Bafang's official troubleshooting guide for error code 21 and the DP C241 display user manual define code 21 as a fault in the speed sensor mounted on the left rear frame stay. Continuous diagnostics run whenever the pedelec is switched on; when a fault is flagged, the screen displays 21 (also logged under Information > Error Code from E-Code00 to E-Code09) and the motor cannot work. Seeing code 21 alone never proves the sensor or drive unit is permanently broken: realigning the spoke magnet to a 10 to 20 mm gap or seating a loose plug often clears it. On other Bafang display families or bus versions, error numbering can differ.

Warnings and stop conditions

  • Higheditorial warning

    Never reposition the spoke magnet to bypass or alter speed readings, and never open the motor or controller housing; keep the magnet aligned at the specified 10 to 20 mm distance.

    Evidence: Bafang DP C241 Display User Manual (BF-UM-C-DP C241-EN) · Bafang Error Code 21 Speed Sensor Fault Troubleshooting Guide

  • Mediumeditorial warning

    Always turn the pedelec off before reaching near the rear wheel spokes or unplugging the speed sensor connector.

    Evidence: Bafang DP C241 Display User Manual (BF-UM-C-DP C241-EN) · Bafang Error Code 21 Speed Sensor Fault Troubleshooting Guide

Symptoms and causes

Probable causes · in order

  • Spoke magnet misaligned or outside the 10 to 20 mm clearance windowCommon

    Both the DP C241 manual and the Bafang code 21 service sheet point first to a rear spoke magnet that is not aligned with the sensor or sits outside the 10 to 20 mm gap specification.

    Evidence: Bafang DP C241 Display User Manual (BF-UM-C-DP C241-EN) · Bafang Error Code 21 Speed Sensor Fault Troubleshooting Guide

  • Loose, dirty, corroded or damaged speed sensor cable and connectorPossible

    Bafang's step 3 inspection lists a loose connector, corroded, bent or broken pins, dirt or debris inside the plug, damaged wire insulation or a cracked connector shell.

    Evidence: Bafang DP C241 Display User Manual (BF-UM-C-DP C241-EN) · Bafang Error Code 21 Speed Sensor Fault Troubleshooting Guide

  • Missing speed signal requiring a BESST controller update, new sensor or motorLess common

    When the magnet gap and wiring harness pass inspection but the controller still fails to read the speed signal, Bafang specifies updating the controller via BESST, replacing the sensor or replacing the motor.

    Evidence: Bafang Error Code 21 Speed Sensor Fault Troubleshooting Guide

Virtual technician

Does Error 21 still appear after these checks?

Answer a few questions to narrow down the likely cause and the safest next action. Guidance only - it never replaces a professional.

Sources and technical references

  1. 1

    Bafang DP C241 Display User Manual (BF-UM-C-DP C241-EN)

    Bafang Electric (Suzhou) Co. Ltd. · 2019 · manual

  2. 2

    Bafang Error Code 21 Speed Sensor Fault Troubleshooting Guide

    Bafang Electric (Suzhou) Co. Ltd. · 2022 · official_doc

Sources: Bafang DP C241 Display User Manual (BF-UM-C-DP C241-EN) · Bafang Error Code 21 Speed Sensor Fault Troubleshooting Guidereviewed 2026-10-18 · verified

Was this entry useful?