Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/vedderb/bldc/llms.txt

Use this file to discover all available pages before exploring further.

All default motor configuration values are defined in motor/mcconf_default.h. Every value can be overridden per hardware target via #define in the hardware header before including mcconf_default.h.

Current limits

Current limits protect the motor and controller from damage. The firmware enforces these limits continuously.
ParameterDefaultDescription
MCCONF_L_CURRENT_MAX60.0 AMaximum motor current (motoring)
MCCONF_L_CURRENT_MIN-60.0 AMaximum motor current (braking / regeneration)
MCCONF_L_IN_CURRENT_MAX99.0 AMaximum battery/input current (discharge)
MCCONF_L_IN_CURRENT_MIN-60.0 AMaximum battery/input current (charge / regen)
MCCONF_L_MAX_ABS_CURRENT130.0 AAbsolute instantaneous current above which FAULT_CODE_ABS_OVER_CURRENT is triggered
MCCONF_L_CURRENT_MAX_SCALE1.0Scale factor applied to MCCONF_L_CURRENT_MAX
MCCONF_L_CURRENT_MIN_SCALE1.0Scale factor applied to MCCONF_L_CURRENT_MIN

Input current mapping

ParameterDefaultDescription
MCCONF_L_IN_CURRENT_MAP_START1.0 AInput current at which the q-axis current limit mapping begins
MCCONF_L_IN_CURRENT_MAP_FILTER0.005Low-pass filter constant for the mapped input current limit
The absolute current limit (MCCONF_L_MAX_ABS_CURRENT) applies to the unfiltered peak current. If MCCONF_L_SLOW_ABS_OVERCURRENT is true (default: false), the filtered current is used instead, which is slower to react.

Voltage limits

ParameterDefaultDescription
MCCONF_L_MIN_VOLTAGE8.0 VMinimum input voltage; triggers FAULT_CODE_UNDER_VOLTAGE below this
MCCONF_L_MAX_VOLTAGE57.0 VMaximum input voltage; triggers FAULT_CODE_OVER_VOLTAGE above this

Battery cutoff

As battery voltage drops, the firmware gradually reduces positive current to protect the battery:
ParameterDefaultDescription
MCCONF_L_BATTERY_CUT_START10.0 VStart reducing positive current output at this voltage
MCCONF_L_BATTERY_CUT_END8.0 VPositive current is fully blocked at or below this voltage
MCCONF_L_BATTERY_REGEN_CUT_START1000.0 VStart reducing regenerative current at this voltage (effectively disabled by default)
MCCONF_L_BATTERY_REGEN_CUT_END1100.0 VRegenerative current is fully blocked above this voltage (effectively disabled by default)
The regenerative cut defaults are intentionally set far above any realistic battery voltage, meaning regenerative braking is not voltage-limited by default. Set these to meaningful values (e.g., 4.1 V × cells) to protect lithium cells from overcharge during braking.

Temperature limits

The firmware monitors both MOSFET (FET) and motor temperatures. When temperature exceeds the start threshold, current is linearly reduced. At the end threshold, the output is shut off entirely.

MOSFET temperature

ParameterDefaultDescription
MCCONF_L_LIM_TEMP_FET_START85.0 °CBegin current limiting at this FET temperature
MCCONF_L_LIM_TEMP_FET_END100.0 °CShut off all output at this FET temperature; triggers FAULT_CODE_OVER_TEMP_FET

Motor temperature

ParameterDefaultDescription
MCCONF_L_LIM_TEMP_MOTOR_START85.0 °CBegin current limiting at this motor temperature
MCCONF_L_LIM_TEMP_MOTOR_END100.0 °CShut off all output at this motor temperature; triggers FAULT_CODE_OVER_TEMP_MOTOR

Acceleration thermal derating

ParameterDefaultDescription
MCCONF_L_LIM_TEMP_ACCEL_DEC0.15Decrease temperature thresholds by this fraction during acceleration to provide extra headroom

Motor temperature sensor

ParameterDefaultDescription
MCCONF_M_MOTOR_TEMP_SENS_TYPETEMP_SENSOR_NTC_10K_25CMotor temperature sensor type
MCCONF_M_NTC_MOTOR_BETA3380.0Beta coefficient for NTC thermistor
MCCONF_M_PTC_MOTOR_COEFF0.61 %/KTemperature coefficient for PTC sensors
MCCONF_M_NTCX_PTCX_RES10000 ΩReference resistance for custom NTC/PTC sensors
MCCONF_M_NTCX_PTCX_BASE_TEMP25.0 °CReference temperature for custom NTC/PTC sensors
Supported sensor types (temp_sensor_type):
typedef enum {
    TEMP_SENSOR_NTC_10K_25C = 0,
    TEMP_SENSOR_PTC_1K_100C,
    TEMP_SENSOR_KTY83_122,
    TEMP_SENSOR_NTC_100K_25C,
    TEMP_SENSOR_KTY84_130,
    TEMP_SENSOR_NTCX,
    TEMP_SENSOR_PTCX,
    TEMP_SENSOR_PT1000,
    TEMP_SENSOR_DISABLED
} temp_sensor_type;

Speed limits

ParameterDefaultDescription
MCCONF_L_RPM_MAX100000 ERPMMaximum electrical RPM (upper)
MCCONF_L_RPM_MIN-100000 ERPMMaximum electrical RPM (lower)
MCCONF_L_RPM_START0.8Fraction of maximum RPM at which RPM-based current limiting begins

Duty cycle limits

ParameterDefaultDescription
MCCONF_L_MIN_DUTY0.005Minimum duty cycle (avoids discontinuous conduction)
MCCONF_L_MAX_DUTY0.95Maximum duty cycle
MCCONF_L_DUTY_START1.0Duty cycle fraction at which current limiting is applied (1.0 = disabled)

Brake limits

ParameterDefaultDescription
MCCONF_L_CURR_MAX_RPM_FBRAKE300 ERPMMaximum ERPM at which full brake (all-low-side) is applied
MCCONF_L_CURR_MAX_RPM_FBRAKE_CC1500 ERPMMaximum ERPM at which full brake is applied in current control mode

Power limits

ParameterDefaultDescription
MCCONF_L_WATT_MAX1500000 WMaximum output power
MCCONF_L_WATT_MIN-1500000 WMaximum braking power (negative = regen)
The default power limits are set to very high values (1.5 MW) and are effectively unlimited for all practical VESC hardware. Set these to realistic values to prevent battery over-discharge or motor overheating.

Speed PID parameters

ParameterDefaultDescription
MCCONF_S_PID_KP0.004Proportional gain
MCCONF_S_PID_KI0.004Integral gain
MCCONF_S_PID_KD0.0001Derivative gain
MCCONF_S_PID_KD_FILTER0.2Derivative term low-pass filter coefficient
MCCONF_S_PID_MIN_RPM900.0 ERPMMinimum RPM setpoint in speed control mode
MCCONF_S_PID_ALLOW_BRAKINGtrueAllow the speed PID to apply braking current
MCCONF_S_PID_RAMP_ERPMS_S25000 ERPM/sInput speed ramp rate
MCCONF_SP_PID_LOOP_RATEPID_RATE_1000_HZPID loop execution rate

Position PID parameters

ParameterDefaultDescription
MCCONF_P_PID_KP0.025Proportional gain
MCCONF_P_PID_KI0.0Integral gain
MCCONF_P_PID_KD0.00000Derivative gain
MCCONF_P_PID_KD_PROC0.00035Derivative gain applied to the process variable
MCCONF_P_PID_KD_FILTER0.2Derivative term low-pass filter coefficient
MCCONF_P_PID_ANG_DIV1.0Divide the angle by this factor before the PID input
MCCONF_P_PID_GAIN_DEC_ANGLE0.0Reduce PID gains when the error is below this angle (degrees)
MCCONF_P_PID_OFFSET0.0Angle offset applied to the position setpoint

Ramping

ParameterDefaultDescription
MCCONF_M_RAMP_STEP0.02Maximum duty cycle ramp step per millisecond at full duty cycle
MCCONF_M_CURRENT_BACKOFF_GAIN0.5Error gain for the current limiting backoff algorithm

Fault behavior

ParameterDefaultDescription
MCCONF_M_FAULT_STOP_TIME500 msDuration during which commands are ignored after a fault
MCCONF_L_SLOW_ABS_OVERCURRENTfalseUse the filtered current for absolute overcurrent detection

Encoder configuration

ParameterDefaultDescription
MCCONF_M_ENCODER_COUNTS8192Encoder counts per revolution
MCCONF_M_ENCODER_SIN_AMP1.0Sin/cos encoder sine channel amplitude
MCCONF_M_ENCODER_SIN_OFFSET1.65 VSin/cos encoder sine channel offset
MCCONF_M_ENCODER_COS_AMP1.0Sin/cos encoder cosine channel amplitude
MCCONF_M_ENCODER_COS_OFFSET1.65 VSin/cos encoder cosine channel offset
MCCONF_M_ENCODER_SINCOS_FILTER0.5Signal filter constant for sin/cos encoder
MCCONF_M_ENCODER_SINCOS_PHASE0.0°Phase correction for sin/cos encoder
MCCONF_M_SENSOR_PORT_MODESENSOR_PORT_MODE_HALLMode of the hall/encoder port

Setup info

Setup parameters are used to convert electrical measurements (ERPM, amp-hours) to mechanical units (m/s, km):
ParameterDefaultDescription
MCCONF_SI_MOTOR_POLES14Number of motor poles (electrical cycles per mechanical revolution × 2)
MCCONF_SI_GEAR_RATIO3Drive gear ratio (motor revs per wheel rev)
MCCONF_SI_WHEEL_DIAMETER0.083 mWheel or drum diameter
MCCONF_SI_BATTERY_TYPEBATTERY_TYPE_LIION_3_0__4_2Battery chemistry
MCCONF_SI_BATTERY_CELLS3Number of cells in series
MCCONF_SI_BATTERY_AH6.0 AhBattery capacity
MCCONF_SI_MOTOR_NL_CURRENT1.0 AMotor no-load current (used in efficiency calculations)

Miscellaneous

ParameterDefaultDescription
MCCONF_M_INVERT_DIRECTIONfalseInvert the motor direction
MCCONF_M_DRV8301_OC_MODEDRV8301_OC_LIMITDRV8301 over-current protection mode
MCCONF_M_DRV8301_OC_ADJ16DRV8301 over-current threshold adjustment
MCCONF_M_HALL_EXTRA_SAMPLES3Extra ADC samples for hall sensor filtering
MCCONF_M_BATT_FILTER_CONST45Battery voltage level filter time constant
MCCONF_M_OUT_AUX_MODEOUT_AUX_MODE_OFFAuxiliary output mode
Changing current limits, voltage limits, or temperature limits outside the rated range of your hardware can cause permanent damage to the MOSFET bridge, motor, or battery. Always verify your hardware’s ratings before adjusting defaults.