Skip to content

The Lishui Parameter Configuator

stancecoke edited this page Mar 14, 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 make 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 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.

to be continued

lines, that are not described here don't have to be adjusted

#define DISPLAY_TYPE DISPLAY_TYPE_KINGMETER_901U //copy the right display type here.

#define wheel_circumference 2202 //wheel circumference in mm

#define THROTTE_OFFSET 1210 //ADC-value at closed throttle

#define TS_COEF 2000 //coefficient for torque-sensor-mode

#define TS_MODE //Torquesensor-Mode, comment out this line, if you want to use current levels.

#define PAS_TIMEOUT 12000 //time tics @ 16kHz untils motor stops

#define RAMP_END 4000 //time tics @ 16kHz where motor reaches full level power

#define PH_CURRENT_MAX 300 //iq value (phase current in rotating frame), not calibrated yet

#define P_FACTOR_I_Q 1L //proportional factor for PI control of iq

#define I_FACTOR_I_Q 0.1F //integral factor for PI control of iq

#define P_FACTOR_I_D 1L //proportional factor for PI control of id

#define I_FACTOR_I_D 1L //integral factor for PI control of id

#define SPEC_ANGLE -357913941L //motor specific angle, refer to chapter 8.3.3 maped to 2^31

#define CAL_V 7LL // 1V / 40 digits ADC, *1/Sqrt(3) /2048 max DutyCycle

#define CAL_I 5LL // 1A / 20 digits ADC

//Constants for Motor model of observer

#define INDUCTANCE 12LL // 10^4 0.0012 //H = Vs/A

#define RESISTANCE 3500LL // *10^4 0.35 //Ohm = V/A