Motor detection in FOC mode using the VESC Tool, step-by-step
Motor detection is the step that allows a VESC controller to properly control your motor. The VESC Tool measures its electrical characteristics, identifies its sensors, and then calculates the internal settings for vector control. When done correctly, it results in a smooth, quiet, and efficient motor. When done incorrectly, it can cause the motor to jerk, overheat, or stall.
This guide assumes that VESC Tool is installed and connected: see installing VESC Tool and connecting your controller.
The essentials
- The detection process is performed with the wheel raised, so that nothing touches the wheel, allowing for free rotation.
- It measures the motor's resistance, inductance, and flux, and then identifies the Hall sensors if they are present.
- The assistant first asks for the motor and battery size: these answers establish conservative starting parameters.
- An inconsistent result is unacceptable: we investigate the cause and start again.
What the detection process measures:
Vector control (FOC) continuously calculates the rotor's position and the current to be sent to each phase. To do this, it requires a model of the motor, which consists of three values.
| Size | What it is: | How is it measured? |
|---|---|---|
| Resistance | The electrical resistance of the windings is very low: less than one ohm | Motor stopped, with DC current |
| Inductance | The way in which the windings resist changes in current | With the motor stopped, but with a rapidly changing current, you can hear a whistling sound |
| Magnetic flux | The voltage produced by the motor when it is rotating at a given speed | The motor spins on its own for a few seconds |
Based on these three values, the VESC Tool automatically adjusts the current loop (the speed at which the controller corrects the current) and the observer, which is the calculation that estimates the motor's position without using sensors.
Preparing for motor detection
- Removing the wheel: The scooter is placed on a kickstand or support, allowing the drive wheel to rotate freely in both directions.
- Freeing the drivetrain: On a motor with a chain or belt, it's best to remove it so that the motor can spin freely.
- Battery charged: A nearly empty battery can provide inaccurate readings and may cause the system to shut down while in use.
- Save the current configuration if you haven't already.
- Clear the area: During the flux measurement, the wheel spins on its own, sometimes quite fast.
Start the motor configuration wizard
The VESC Tool offers a motor configuration assistant for FOC (Field-Oriented Control) operation. The screens may vary depending on the version, but the questions remain the same.
The type and size of the motor
The assistant asks you to specify which type of motor you have (small external motor, bicycle or scooter hub motor, large motor, etc.). This choice determines the currents and power used *during the measurement*, not the operating limits. Choosing a value that is too high can overload a small motor, while choosing a value that is too low may prevent the measurement from completing successfully on a large motor.
The battery
Cell type, number of cells in series, and capacity. The VESC Tool automatically calculates the battery voltage thresholds and current limits based on these values. These values are conservative and will be adjusted later.
The drivetrain and wheel
Hub motor (without reduction) or with reduction, wheel diameter, and motor pole count. This data is not used for motor control, but rather for calculating and displaying speed and distance.
The actual detection process
During the resistance and inductance measurement, the motor emits a whistling sound, then spins on its own during the flux measurement. If the motor has Hall sensors, the VESC Tool will detect them and choose to take them into account during startup. On a scooter with two controllers connected, the assistant can detect both motors sequentially.
Read the results
Finally, the VESC Tool displays the measured values. Here are a few guidelines to help you assess their consistency:
- Two identical motors should produce very similar readings; a significant difference between the two indicates a problem with the cable, connector, or winding
- An abnormally high resistance reading suggests a problem with a phase connector
- If the wheel rotated in the wrong direction, you can reverse the direction in the motor settings without touching the wires
- If the Hall sensor is not recognized even though the motor has one, check the sensor connector (see our guide on motors that jerk or stutter).
When the detection fails
- The motor does not turn during the flux measurement: This could be due to the wheel rubbing, a locked brake, a transmission that is too stiff, or a motor size that is too small.
- The motor is running erratically: A phase may be faulty; check the connectors before restarting.
- Battery or controller cutoff: This indicates that the current being measured is too high for the battery, or that the battery is too discharged.
- Values that vary significantly from one test to another: Intermittent connection, which should be investigated before making any adjustments.
Workshop tip
After the detection process, perform an initial test by lifting the wheel slightly and applying gentle acceleration, followed by a short distance at low speed. Monitor the motor temperature using the VESC Tool. A properly detected motor should start smoothly, without any unusual noises or jerks.
And then what?
The detection process indicates a motor that is functioning correctly, with conservative limits. You still need to adjust the motor and battery current limits to suit your specific machine, followed by the throttle and brake settings. Do not simply copy the values from another machine, as they depend on your battery, your motor, and their cooling system.
Frequently Asked Questions
Is it possible to perform wheel ground detection?
No. During the flux measurement, the motor spins on its own and sometimes quite quickly. If the scooter were on the ground, it would likely start moving, and the load would distort the measurement. The wheel must be raised and free to rotate.
Why does the motor make a whistling sound during the detection process?
To measure the inductance, the controller rapidly varies the current in the windings without causing the motor to spin. These variations produce a high-pitched whistling sound, which is perfectly normal.
Is it necessary to re-run the motor detection process after changing the battery?
The motor's specifications remain the same, but the voltage thresholds and battery current limits must be adjusted to match the new battery. After changing the motor, phase cables, or controller, it is necessary to re-perform the motor detection process.
My motor has Hall sensors; should I use them?
For electric scooters, generally speaking: the sensors provide a smooth start from a standstill. The VESC Tool utilizes these sensors at low speeds, and then switches to sensorless operation, which is more accurate at higher speeds.