The PAS (Pedal Assist System) application is designed for e-bikes. It reads a crank rotation sensor and scales motor current proportionally to pedaling cadence or torque, providing assistance that feels natural under pedaling effort.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.
Sensor types
The firmware currently supports one sensor type:Control types
| Type | Description |
|---|---|
CADENCE | Motor current scales with pedal RPM between pedal_rpm_start and pedal_rpm_end. |
TORQUE | Motor current scales with measured crank torque. |
TORQUE_WITH_CADENCE_TIMEOUT | Torque mode, but output cuts if cadence drops to zero for more than MAX_MS_WITHOUT_CADENCE (1000 ms). |
Configuration struct
Key parameters
| Field | Default | Description |
|---|---|---|
pedal_rpm_start | 10 RPM | Cadence at which assist begins. |
pedal_rpm_end | 180 RPM | Cadence at which assist reaches maximum. |
current_scaling | 0.1 | Fraction of maximum motor current applied at full assist. |
magnets | 24 | Number of magnet pulses per crank revolution on the sensor. |
invert_pedal_direction | false | Swap forward/reverse pedaling direction detection. |
use_filter | true | Smooths cadence measurement with a moving-average filter. |
safe_start | true | Requires pedaling to stop and restart before assist is allowed after power-on. |
ramp_time_pos | 0.6 s | Ramp time for increasing assist. |
ramp_time_neg | 0.3 s | Ramp time for decreasing assist. |
update_rate_hz | 500 Hz | Control loop rate. |
Timing constants
Defined inapp_pas.c:
PEDAL_INPUT_TIMEOUT (0.2 s), the pedal RPM reading is treated as zero. If cadence is absent for longer than MAX_MS_WITHOUT_CADENCE_OR_TORQUE (5 s), motor output stops entirely.
Wiring
Connect the PAS sensor to the expansion connector pins designated for quadrature input on your VESC hardware variant. The sensor requires:- Signal A and Signal B pulse outputs (open-drain or push-pull, 3.3 V compatible)
- 5 V or 3.3 V supply
- Common ground
Combining with ADC throttle
SelectAPP_ADC_PAS to run both the ADC throttle application and PAS simultaneously. In this mode the ADC throttle acts as an override: if the rider applies the throttle lever, ADC output takes precedence over pedal assist.
Runtime API
app_pas_set_current_sub_scaling lets another module (such as a throttle override) reduce the PAS output current without modifying the stored configuration.