KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW)

stancecoke said:
qrisonline said:
Okay sorry for being slow. My state was 537

For your convenience I've built a little tool to translate the status:
https://github.com/stancecoke/BMSBattery_S_controllers_firmware/raw/Master/OSEC%20State%20Translator.jar

fetch.php


regards
stancecoke

Nice I will try this tomorrow. When I continue with my controller setup.

Greetings Michiel
 
FYI: I redefined motor angle and correction angle:

you have to change your motor angle +60° or +42 from what you have currently set up.
if it gets bigger than 255, subtract 256
you also have to set the correction angle to 180°, 127 instead of 85

Reason behind that change is so that the code is more easily understandable. Hall angle is now Phase B angle, correction and motor angles defaults are now 0° instead of -60°.
 
casainho said:
I am being thinking and listening other users, for TSDZ2 we may go with KT-LCD7 because it has Bluetooth, is cheap (26 euros), has USB charger and is low profile. We already have our own OpenSource firmware for KT-LCD3, should be fast to port/develop to KT-LCD7.
Buy here.

I was looking for Android apps and I found BluOSEC developed by Xnyle that is not OpenSource - I was expecting it was OpenSource and maybe we could cooperate and have a common Android app. Although we are using TSDZ2, we would use common technology from KT the KT-LCD7 and the Android app.

HTB1-Qnp-Ok-Ma-TBu-Nj-Sszfq6xgfp-Xa-K.png

Hi, just checked this out but the display at the seller was over 43 euro. Where did you find it for 26?

Also would the color display not be more interesting. You can then display whatever you need
 
Xnyle said:
FYI: I redefined motor angle and correction angle:

you have to change your motor angle +60° or +42 from what you have currently set up.
if it gets bigger than 255, subtract 256
you also have to set the correction angle to 180°, 127 instead of 85

Reason behind that change is so that the code is more easily understandable. Hall angle is now Phase B angle, correction and motor angles defaults are now 0° instead of -60°.

maybe we need to update the defaults in config.h ?

#define MOTOR_ROTOR_DELTA_PHASE_ANGLE_RIGHT 197 -> 239
#define CORRECTION_AT_ANGLE 85 -> 127
 
The default settings are adapted in the Java tool. The config.h is overwritten by the tool with clicking „Write Configuration“

regards
stancecoke
 
I think the best way would be to have config.h with descriptive comments of parameters and have the configuration tool to change only the defined values, not overwrite the whole file. I really like this project and will definitely contribute some of my free time :)

I really dislike the current build system and started implementing build using CMake on my branch https://github.com/walmis/BMSBattery_S_controllers_firmware/blob/cmake/CMakeLists.txt
my goal is to unify building on all platforms using the same toolset.

Also I think there is a bug in e3c239, it changed Hall angle 5 to 0 instead of motor specific angle.
 
You are welcome to help improving the project, please update the Wiki with explanations and tutorials if you add something new. I personally don‘t know what cmake is or does...

regards
stancecoke
 
While you are at it, you could also take a look at a free flash replacement:

https://github.com/vdudouyt/stm8flash

Goal would be to have all needed tools (sdcc/smt8flash/cmake) for all platforms(i686/x64, linux/windows) in the repo/zip so that "normal" users don't have to do anything than to clone the repo and start the java tool which then starts the right platform tools.

If you put all that stuff into a new build subfolder we could easily merge it later if it is working.
 
Hi, My state was 49
That means
- torquesimulation and pedaling slower than ramp end
- throttle / torquesensor factor is influenced by speed
- throttle / torquesensor currently overrides torque simulation / cadence

i have tried to change 'PAS TIMEOUT' and 'RAMP END',but still receive the "49".
i connected the pas but not rotate.when i use the throttle, the motor goes not smoothly with a spin speed up and down.
https://youtu.be/FXm6dFyo3hI
 

Attachments

  • QQ截图20181027000021.png
    QQ截图20181027000021.png
    35.9 KB · Views: 2,395
That's completely normal, as you have set the speedlimit without PAS to 6 kph. Set this limit to 99 e.g., then your motor will run up to it's top speed.
You have to check the gear ratio of your motor and adapt it in the tool, if necessary.

regards
stancecoke
 
I found a strange behaviour of my new Sempu T4 torque-sensor.
The PAS signal shows a pause in every crank revolution. The graph shows the number of PAS-pulses on the X-axis, the time-tics between two pulses on the Y-axis.

index.php


I don't know if it's a bug or a feature :?

regards
stancecoke
 
stancecoke said:
That's completely normal, as you have set the speedlimit without PAS to 6 kph. Set this limit to 99 e.g., then your motor will run up to it's top speed.
You have to check the gear ratio of your motor and adapt it in the tool, if necessary.

regards
stancecoke

i have set the speedlimit without PAS to 99 kph,the motor running smoothly. i test the least parameters “50”kph ,maybe 50kph is high speed,so should any parameters match with each other ?

does "gear ratio"=number of pole-pairs???
 
haiyi911 said:
does "gear ratio"=number of pole-pairs???

Yes for a direct drive, no for a geared motor. You can confirm the gear ratio by checking the speedlimits with a standard speedometer.

regards
stancecoke

p.s. the behaviour of the Sempu PAS-Signals was a bug, I solved it today.
 
Yes for a direct drive, no for a geared motor. You can confirm the gear ratio by checking the speedlimits with a standard speedometer.

thanks.i've bought one today.

so for a geared
ratio=(number of pole-pairs)*(reduction ratio) ????is right??

should the "36" be changed to "60"?
 

Attachments

  • 6666.png
    6666.png
    6.3 KB · Views: 2,281
I have no idea, what you are trying to do. That ratio is just scaled or optimized so that it uses the 16bit space without overflow for all possible motors. You just have to change your gear ratio, no need to change any code.
 
I know that you guys are going more to Bluetooth and mobile app, still I think LCDs can complement. This is an invitation if you guys would like to use Bafang 850C color LCD (I just got first firmware printing to LCD) with KT motor controllers.

Bafang 850C color LCD -- Flexible OpenSource firmware

casainho said:
Finally I got Bafang 850C color LCD working!!!

My plan is to make it working for the TSDZ2 mid drive motor running our flexible OpenSource firmware (see here), as I did for KT-LCD3. But I think would be great if other developers want to join and use this LCD for other motor controllers.

- firmware is here: https://github.com/OpenSource-EBike-firmware/Color_LCD/tree/master/Bafang_LCD_850C_firmware
- wiki page with tecnhical details: https://github.com/OpenSource-EBike-firmware/Color_LCD/wiki/Bafang-850C






By the way, I got the KT-LCD8 color LCD -- tech details here: https://github.com/OpenSource-EBike-firmware/Color_LCD/wiki/Kunteng-KT-LCD8H

Kunteng_KT-LCD8H-01.jpg


Kunteng_KT-LCD8H-02.jpg
 
hi all finally got a good setup running lower voltages but i'm curious what the option is above the pas setting on latest build.

battery voltage c...

I'm running 5s battery with setup but when system shuts down after set time it won't restart unless I recharge the battery above 75%
I've tried numerous values in the low voltage cutoff set at 55 not quite sure what the figure for above option should be set at for 5 s battery.

I'd ideally like to run battery down to 3.2v per cell to preserve life of battery. any guidance for setup would be appreciated.
 
reset said:
battery voltage c...

See chapter four of the tutorial:
Battery Voltage Calibration: Used for internal calculation of the voltage from the 8bit ADC value. Must only be changed if the calibration with the preset values obviously does not fit.
You can adjust the voltage that is shown in the BluOSEC app.

reset said:
I've tried numerous values in the low voltage cutoff set at 55 not quite sure what the figure for above option should be set at for 5 s battery.

There are 2Volts hysteresis hardcoded, so the voltage has to be 2V higher than defined by undervoltage limit to start the PWM.
Undervoltage limit: Undervoltage cutoff value. Calculation: Value in volts times 3.7. example: 34.3V * 3.7 = 127

Code:
			//enable PWM if disabled and voltage is 2V higher than min, some hysteresis
			if (!uint_PWM_Enable && ui8_BatteryVoltage > BATTERY_VOLTAGE_MIN_VALUE + 8) { 
				TIM1_CtrlPWMOutputs(ENABLE);
				uint_PWM_Enable = 1;

regards
stancecoke
 
reset said:
hi all finally got a good setup running lower voltages but i'm curious what the option is above the pas setting on latest build.

battery voltage c...

I'm running 5s battery with setup but when system shuts down after set time it won't restart unless I recharge the battery above 75%
I've tried numerous values in the low voltage cutoff set at 55 not quite sure what the figure for above option should be set at for 5 s battery.

I'd ideally like to run battery down to 3.2v per cell to preserve life of battery. any guidance for setup would be appreciated.

The battery will run the motor fine but the whole system won't restart if it is shut down or if it times out and voltage falls below 19v. The display still shows battery with a 3 or 4 bars static or 1 bar on display if under load. Any clues would be appreciated.
 
stancecoke said:
reset said:
battery voltage c...

See chapter four of the tutorial:
Battery Voltage Calibration: Used for internal calculation of the voltage from the 8bit ADC value. Must only be changed if the calibration with the preset values obviously does not fit.
You can adjust the voltage that is shown in the BluOSEC app.

reset said:
I've tried numerous values in the low voltage cutoff set at 55 not quite sure what the figure for above option should be set at for 5 s battery.

There are 2Volts hysteresis hardcoded, so the voltage has to be 2V higher than defined by undervoltage limit to start the PWM.
Undervoltage limit: Undervoltage cutoff value. Calculation: Value in volts times 3.7. example: 34.3V * 3.7 = 127

Code:
			//enable PWM if disabled and voltage is 2V higher than min, some hysteresis
			if (!uint_PWM_Enable && ui8_BatteryVoltage > BATTERY_VOLTAGE_MIN_VALUE + 8) { 
				TIM1_CtrlPWMOutputs(ENABLE);
				uint_PWM_Enable = 1;

regards
stancecoke

so for this setting if I want to run battery to 16v it should be 18 x 3.7 = 66.6
 
Back
Top