Skip to main content
Version: 3.0.x

Vehicle speed calculation

Lynx offers two possible methods for vehicle speed evaluation.

info

If Bafang display is used, then the system is sending to the display only information about one wheel revolution. Appropriate settings are made in the display then. (wheel diameter, units). ie. conversion from wheel revolutions to speed is done in the display.

Motor speed

Information from the driver is used for speed determining. It does not need to install any external sensor. But this option requires correctly set parameters of the drive train (motor pole pairs - driver/motor/pp, gear ratio - /gearthr and driver wheel size - /odothr).

  • /gearthr. Its value is in "motor shaft revolutions per one-wheel revolution".
  • /odothr. Its value is the number of wheel revolutions per kilometer.

If you set these parameters correctly, you can later set the speed limitation in km/h. The current speed reading is located in /speed state.

tip

If you leave /gearthr and /odothr in default values, the speed reading will be in [motor RPM]. This also means, that the speed limit kph in maps will be in [motor RPM].

tip

This solution is not working when a motor with a freewheel clutch is used. Then the external speed sensor is needed.

Speed limiter response tuning

It is necessary to tune these parameters. Wrong settings can cause oscillation or slow reaction. If you have oscillation, try to decrease the rdec parameter - i.e. slow limiter response. Or increase the rdec.

These values are good starting point for tuning:

"/driver/limiter/rdec" : "100.0" # '[RPM] speed limiter decrement rate'
"/driver/limiter/rgain" : "100.0" # 'speed limiter gain'

speed limiter

The rpos treshold is calculated from the map speed limit kph.

caution

The rpos, rdec are in [motor RPM]. The kph in maps is in [kph].

External speed sensor

Pulses from the external speed sensor are used for speed evaluation. All the necessary settings are made in Tachospeed block (output is wheel rotation speed). Vehicle speed is computed using wheel size information (odothr) then.

The external speed sensor is activated if in_speed is mapped to a valid physical input

Settings for external speed sensor are located in /tachospd folder. More about tacho block