Skip to content

The Lishui Parameter Configuator

stancecoke edited this page Mar 17, 2021 · 21 revisions

Basic Settings

Basic Settings

Display settings

Several Display types are supported basically. For most displays only speed and power are displayed and the support level, push assist and light on/off function are sent to the controller. Further settings in the display are ignored.

J-LCD

Displays, that are using the Kingmeter J-LCD protocol

KM5S

Displays, that are using the Kingmeter KM5S protocol, the KM5S protocol uses an encrypted handshake on some OEM versions, so in some cases the lookup table has to be adapted to the certain display.

Bafang

Displays, that are using the Bafang protocol

Kunteng

Displays, that are using the Kunteng protocol. Here some more settings can be done in the display, they are stored in the controllers emulated EEPROM.

EBiCS-Flutter

This setting supports the EBiCS-Flutter app on android, see the EBiCS repo. The EBiCS Flutter protocol uses the ANT+LEV syntax. The autodetect routine can be started from the app.

Debug

In debug mode the controller sends UART data on the display connector. Use a UART-USB converter module or a HM-05 bluetooth module for logging the output. Set the module to 56000 BAUD
See the instruction in the Kunteng wiki, it's the same procedure.

PAS settings

The controller works in "torque simulation" mode, if the option "Torquesensor" is not activated. This chart shows the working principle:
torque simulation

Timeout

time until the motor stops, if no PAS pulse is detected. 8000 = 1s

Ramp end

the motor power increases with the crank speed in PAS mode. Ramp end defines the cadence where the battery current is reached, that is set for the chosen assist level.

Direction Detection enabled

This enables the direction detection for simple PAS models, that are carrying the direction information in the duty cycle of the PAS signal, middle row of the picture. This prevent the motor from starting, if you are pedaling backwards. PAS signals

Fraction upper limit

print out uint32_PAS_fraction in debug mode to find a proper value

Fraction lower limit

print out uint32_PAS_fraction in debug mode to find a proper value

Voltage settings

Voltage min

If the battery voltage drops under this limit, the motor stops working. ADC value, use the calibration value in the Advanced Settings tab for calculation the ADC value from the volts.

Voltage max

Regen is stopped, when the battery voltage gets too high. Be careful to set a proper value, if you are using regen! If the BMS of the battery suddenly cuts the battery from the controller due to overvoltage, you will get magic smoke from the controller!!!

Ride Mode

Torquesensor

if you want to use a torque sensor, connect the speed signal to the PAS wire and the torque signal to the throttle wire. In this mode, the motor power is calculated from the riders power. The assist level sets the amplification of the riders power. A torquesensor makes a much more natural "bicycle-feeling" than the torque simulation mode. All enhanced systems like Bosch, Yamaha, Panasonic, Brose, BionX... are using torque sensors. Only very cheap "discounter-bikes" or conversion-kits are using PAS with torque simulation.

Torque Signal on AD1

Some Lishui controllers are offered in a bundle with a suitable bottom bracket torquesensor. The torque signal is connected to the AD1-Pin on the PCB in this case.

TS coefficient

this value combines all calibration factors of the sensors. Just take a test ride and increase / decrease the value according to your wishes

throttle settings

Throttle offset

this is the ADC-value at closed throttle. Print out adcData[1] in debug mode, to see the value. Set Throttle offset to a little higher value to prevent the motor starting, if the value drifts a little with time or temperature. Read adcData[6] for the torque signal on AD1.

Throttle max

this is the ADC-value at full throttle. Set a little lower than the printed value to get the full current.

Motor direction Reverse

Enable this option, if the motor runs in the wrong direction after autodetect

Individual Profile

The assist level is scaled with the speed. Same idea as the indiviual ride modes in the Bosch Nyon. The profile is hardcoded at the moment.
individual mode

Throttle Override

The throttle overrides the PAS level, if the signal is higher. Same in Torquesensor mode, if the torque signal is higher, than the power proportional setpoint, the pure torque signal is used. Works as a "startup-boost".

Limit Throttle to 6 kph

Future option to make throttle legal in Europe. Not implemented yet.

Bike and Motor settings

Wheel circumference

in mm for correct speed calculation

Gear Ratio

ratio of mechanical gear * number of pole pairs (number of magnets / 2)

Speed Limit

in kph

Pulses per revolution

number of speed pulses per revolution, some hub motors have 6 magnets internally, some use single magnet in the spokes like a speedometer

Motor specific angle

Default value, if autodetect wasn't executed yet. It's strongly recommented to run autodetct once, when setting up the system.

Motorcurrent max

Maximum allowed motorcurrent as ADC value. Use the calibration value from the advanced settings tab for calculation from milliampere

Batterycurrent max

Maximum battery in mA. Caution! There is no temperature protection of motor or controller! Avoid long rides at high current!!! The Lishui 6 FET controllers are rated with 7 amps continous battery current normally. Short peaks of higher current are OK of course.

Regencurrent

Motor current ADC value at regen. Constant regen can be activated by the brake lever, linear regen can be used with a thumbthrottle on Pin AD2.

Regencurrent max

Maximum battery current at regen in mA

Push assist

Motor current ADC value for push assist function

Path settings

Path to eclipse

path to the eclipse.exe from your OpenSTM32 Workbench installation, see main wiki page

Path to the STM32 Utility

self explanatory

Advanced Settings Caution, wrong settings can destroy the controller!!!
Do not change values, if you are not sure what you are doing.

ADC Timing

Trigger offset ADC

offset for dynamic ADC trigger timing at high duty cycles.

Trigger default

trigger point at low duty cycles

Timer period

period defines the PWM frequency

Various settings

enable position PLL

if the motor runs noisy or with vibrations, the position PLL can be activated. The PLL must be tuned with the parameters PLL p-factor, PLL i-factor and speedshift.

PLL p-factor

defines the proportional right shift factor.

PLL i-factor

defines the integral right shift factor.

speedshift

if the motor runs properly at low speeds but looses syncronity at higher speed, the speedshift factor reduces the shiftfactors with the speed. Keep it at zero, if the motor runs well with zero setting.

throttle controls speed

normally the throttle controls the motor current in this firmware. You can switch to speed control, this option is not well tested and not recommented.

speed p-factor

proportional gain for speed control

speed i-factor

integral gain for speed control

linear regen on AD2

connect a throttle to pin AD2 on the PCB, the regen motor current is set by the throttle.

enable fast loop log

debug function for datalogging with pwm frequency. Assign interested paramters to variables temp1 to temp6. A PAS pulse triggers the printout of the values

disable dynamic ADC

disable the dynamic adaption of the ADC trigger for debugging. Be careful, ADC readings of phase current are not correct at high duty cycles in this case. This can cause burned mosfets!!!

use external speedsensor for speed limit

this option should be used for motors with freewheel to avoid the motor oszillating if you ride faster than the speedlimit.

speedfilter

number of measured speed values for filtering the speed signal

6-step-threshold

time between two hallsensor interrupts. Defines the speed, where the commutation switches from 6 step to FOC

enable autodetect in debug mode

if you choose debug as display type and enable autodetect, the autodetect routine is run every time you switch on the system. Starting the autodetect by brakelever + throttle is possible also, see main wiki page

PI control settings

the motor current iq and id (for more information see the links in the readme of the repo!)are controlled by a PI control. There is several literature about how to tune a PID control.
Example

Iq p-factor

gain for the proportional part

Iq i-factor

gain for the integral part

Id p-factor

gain for the proportional part

Id i-factor

gain for the integral part

Sensorless settings

the sensorless settings are not relvevant in the master branch, they are only used in the "sensorless VESC" branch. All parameters are not in physical units, but in scaled integer values due to the missing FPU in the STM32F103

Calibration

Battery voltage

calibration factor to get the battery voltage in mV from the ADC value

FOC Voltage

scaled calibration value for sensorless control, not used in the master branch

FOC Current

scaled calibration value for sensorless control, for calculation of ADC values use: Current(mA) = ADC value * FOC Current>>8

Battery settings

Bar x

for Bar graph for battery SOC in Kunteng display. Value in voltage (mV)