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

Electric Motors and Controllers
vex_zg   100 W

100 W
Posts: 178
Joined: Mar 06 2016 6:07pm

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

Post by vex_zg » Jun 03 2018 8:28am

honya96 wrote:
Jun 03 2018 4:55am
1N4001 wrote:
Jun 03 2018 4:47am
dr_lulz wrote:
Jun 02 2018 5:58pm
using 18x IRFB4110
Why? Grab some CSD19536KCS instead, reduce RDSon by over a third. Might allow you to stick to 12 FETs too.
With both of these mosfets, use 20s li-ion max.

I tried 18fet swap to CSD mosfets and a 10A breaker trips when switching on the controller. (Without motor)

12fet stock fw and I think also this fw worked with these

I think that mosfet drivers may be too slow to sink the gate at 3 paralell (3x6), but I havent looked at it more.

If you plan to modify the drivers, please share.

You have 50A version of the current sensor, I think it will work up to 200A ok but there is 100,150, and 200A version too.
honya96,

I have the same CSD mosfets I bought a while ago planning to replace them in the KT12 mosfet controller to get lower heating and higher power, on the paper CSD mosfets looked much better. Also I had thoughts of doubling them up to 24 MOSFET somehow, in the same controller. For this I guess gate resistor and gate sink resistors would need to be changed, providing that whatever is the gate driver can turn them on fast enough.

How is your 4110->CSD MOSFET swap going? I read few months ago it was not running well when you just swapped to CSD. Can you update?

dr_lulz   100 mW

100 mW
Posts: 44
Joined: Jan 28 2013 5:05pm

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

Post by dr_lulz » Jun 04 2018 2:57pm

1N4001 wrote:
Jun 03 2018 4:47am
dr_lulz wrote:
Jun 02 2018 5:58pm
using 18x IRFB4110
Why? Grab some CSD19536KCS instead, reduce RDSon by over a third. Might allow you to stick to 12 FETs too.

Or AOT290L. The 4110 are a pretty bad choice nowadays.
well ... good point. I think i will go for the 12x CSD19536KCS. Much easier!

Basia   10 W

10 W
Posts: 69
Joined: Nov 10 2017 4:17am
Location: Wilmington

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

Post by Basia » Jun 04 2018 3:34pm

Who ever recorded the video process of the firmware on Windows 10? I can not install the firmware (((. direct drive motor.


Basia   10 W

10 W
Posts: 69
Joined: Nov 10 2017 4:17am
Location: Wilmington

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

Post by Basia » Jun 04 2018 3:59pm

stancecoke wrote:
Jun 04 2018 3:40pm
just follow the tutorial that's linked in my signature!

regards
stancecoke
it's not very clear. works or not.
how do I find firmware version?
https://opensourceebikefirmware.bitbuck ... ndex5.html

User avatar
stancecoke   100 kW

100 kW
Posts: 1375
Joined: Aug 02 2017 2:56pm

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

Post by stancecoke » Jun 05 2018 1:38am

You have to follow chapter 3 for the software installation. There are all necessary links.

I don't know, if the Java Tool works recently at casainhos master branch. If it doesn't work, please restore the config.h from the zip and just double-click on Start_Compiling.bat in the "firmware" folder.

https://github.com/OpenSource-EBike-fir ... master.zip

regards
stancecoke

Basia   10 W

10 W
Posts: 69
Joined: Nov 10 2017 4:17am
Location: Wilmington

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

Post by Basia » Jun 05 2018 4:05am

How to correctly configure the FOC ?
Motor - https://www.alibaba.com/product-detail/ ... 22e68xXYRY

casainho   10 GW

10 GW
Posts: 4997
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Jun 05 2018 4:12am

Basia wrote:
Jun 05 2018 4:05am
How to correctly configure the FOC ?
Motor - https://www.alibaba.com/product-detail/ ... 22e68xXYRY
Read config-example.h file.
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

Basia   10 W

10 W
Posts: 69
Joined: Nov 10 2017 4:17am
Location: Wilmington

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

Post by Basia » Jun 05 2018 5:53am

casainho wrote:
Jun 05 2018 4:12am
Basia wrote:
Jun 05 2018 4:05am
How to correctly configure the FOC ?
Motor - https://www.alibaba.com/product-detail/ ... 22e68xXYRY
Read config-example.h file.
Can I program the FOC with the battery and motor connected?

User avatar
Valopallo   10 W

10 W
Posts: 86
Joined: May 29 2018 1:37pm

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

Post by Valopallo » Jun 05 2018 6:04am

Hello.

This is my first post here, so I'm going to explain my first electric bike project with some detailed info. I received this badly beaten bike without the original LCD(Bafang C965 -clone, 800U) and e-brakes. Apparently those were stolen from the previous owner. All that was left for me to begin my project with were the motor, PAS, controller(36V, 15A) and the battery. The original bike was 28" and I'm installing these parts to my 26" mtb, so I need to buy shorter spokes etc... I want to keep the bling bling low as to prevent it from stolen that easily and thus I would like to have my bike so that I'ts not controlled by LCD and buttons. I'm also trying to save money here and I have understood that it is possible to reprogram bafang controllers to bypass LCD so that option is my route to go if it would be possible with this project. I also want a throttle with full power when needed. Optionally I would like to have a cheat mode so that I can change the motor performance at flight in case of inspection(only PAS and 25kph allowed here in Finland). In that case cruise mode at the throttle would be cool too when the "legality cheat" is activated.

My motor is this Shengyi Hybrid rear hub motor: http://www.syimotor.com/productDe_5.html
Battery is this 36V 10ah Li-ion: https://www.verkkokauppa.com/fi/product ... a-UTB-akku

The original bike didn't have a throttle, so I ordered an universal one from Aliexpress and I'm currently waiting it to arrive. In the meantime I was studying the endless river of controllers with similarity to mine and came accross this project to find out that my controller looks very much like the BMSBattery/Kunteng KT -controllers. So, long story short. I ordered my ST-LinkV2 from ebay and also soldered the male pins to the pcb. If this controller is not fit for this project for some reason I can also buy a suitable one somewhere.

I need your help here. First of all some basic stuff;
1. Can you tell from my pictures is my controller suitable for this firmware?
2. When connecting the ST-Link v2 to my computer should the controller be powered by my e bike battery?
3. How can I tell what my controller's firmware is to get the original backup file? Can I somehow read it with the ST-Linkv2 connection?
4. Are my connections to ST-link v2 right? The arrangement of wires seems a bit different than what the project page picture shows.
5. When my throttle arrives. Where should I solder it to my pcb leads?
6. What are those two insulated black lumps of wires inside the controller case?
7. There was one lead coming out from the controller that had red and brown wires attached to a plug. I thought this is main power plug so I soldered a switch to the ends to act like one. If this is wrong. Please correct me.

Since this post has some offtopics like the throttle installation questions, I'm more than happy to start a new thread for my project if it seems fit. Thank you so much from this hard work you have already done to help me dive in to this whole e bike controller swamp I cannot seem to get up on my own ever again. :)

Here are some pictures. Feel free to ask for more in-depth ones if needed to help answering my questions.
Image
Image
Image
Image
Image

all above pictures at: https://imgur.com/a/9FbEq3I

casainho   10 GW

10 GW
Posts: 4997
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Jun 05 2018 6:23am

Basia wrote:
Jun 05 2018 5:53am
casainho wrote:
Jun 05 2018 4:12am
Basia wrote:
Jun 05 2018 4:05am
How to correctly configure the FOC ?
Motor - https://www.alibaba.com/product-detail/ ... 22e68xXYRY
Read config-example.h file.
Can I program the FOC with the battery and motor connected?
Don't know if you mean FOC as the firmware.
I program the firmware with battery and motor connected. But my 5V wire of STLinkV2 is not connected to the board. Also my battery has a BMS for protection in case something goes wrong. Also the ebike wheel is on the air, because for some fail, motor can start.
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

casainho   10 GW

10 GW
Posts: 4997
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Jun 05 2018 6:27am

Valopallo wrote:
Jun 05 2018 6:04am
Hello.
This thread is for KT/BMSBattery motor controllers only.
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

User avatar
Valopallo   10 W

10 W
Posts: 86
Joined: May 29 2018 1:37pm

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

Post by Valopallo » Jun 05 2018 7:14am

casainho wrote:
Jun 05 2018 6:27am
Valopallo wrote:
Jun 05 2018 6:04am
Hello.
This thread is for KT/BMSBattery motor controllers only.
Ok. So the controller that I have is not KT nor BMSBattery even though it's very similar looking?
How do I know can this one be programmed?


For the other assembly questions I will start my own thread. ;)

geofft   1 kW

1 kW
Posts: 375
Joined: Nov 09 2012 9:41am
Location: Berkshire UK

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

Post by geofft » Jun 05 2018 9:47am

Valopallo wrote:
Jun 05 2018 6:04am

I need your help here. First of all some basic stuff;
1. Can you tell from my pictures is my controller suitable for this firmware?
2. When connecting the ST-Link v2 to my computer should the controller be powered by my e bike battery?
3. How can I tell what my controller's firmware is to get the original backup file? Can I somehow read it with the ST-Linkv2 connection?
4. Are my connections to ST-link v2 right? The arrangement of wires seems a bit different than what the project page picture shows.
5. When my throttle arrives. Where should I solder it to my pcb leads?
6. What are those two insulated black lumps of wires inside the controller case?
7. There was one lead coming out from the controller that had red and brown wires attached to a plug. I thought this is main power plug so I soldered a switch to the ends to act like one. If this is wrong. Please correct me.

Hi Valopallo, I'm not a developer or an expert on this stuff, but I'll try to help with your questions where I can.

1. This firmware will only work with the Kunteng sine wave controllers (S06S or S12S from BMS battery, or the equivalents from PSWpower). You would be best to start with one of these, then you would have all the connection diagrams you need.

2. When flashing the firmware you can power from the STlink if you have connected the +5v wire, otherwise you can use the controller main battery power.

3. You won't be able to read the original Kunteng firmware and this will be lost once you re-flash the new firmware. Probably best if you get it all working and prove your hardware is ok with the stock firmware before you try the new.

4,5,6,7...will all be easy if you get the Kunteng controller.
Last edited by geofft on Jun 05 2018 2:50pm, edited 1 time in total.
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 6-fet, LCD3, 48v 12s lipo.

Basia   10 W

10 W
Posts: 69
Joined: Nov 10 2017 4:17am
Location: Wilmington

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

Post by Basia » Jun 05 2018 2:06pm

The firmware is not installed (
Attachments
Result.log
(679 Bytes) Downloaded 28 times

User avatar
stancecoke   100 kW

100 kW
Posts: 1375
Joined: Aug 02 2017 2:56pm

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

Post by stancecoke » Jun 05 2018 2:20pm

Hm, new findings about regen.
I tried to improve the algorithm for Advance Angle adjustion at regen, but it seems the value ui8_position_correction_value has almost no influence on the zero crossing of the phase current.
In the naming of the graphs in the pictures mean
ui8_position_correction_value - ui16_BatteryCurrent - dutycycle- ui16_motor_speed_erps

maybe this is because the quite low dutycycle...
It is interesting, that the phase current is higher at lower erps, but a guy at the pedelecforum reported the same behaviour.

regards
stancecoke
Phase current at different advance angles.PNG
Phase current at different advance angles.PNG (15.19 KiB) Viewed 1479 times
Last edited by stancecoke on Jun 05 2018 2:34pm, edited 1 time in total.

User avatar
stancecoke   100 kW

100 kW
Posts: 1375
Joined: Aug 02 2017 2:56pm

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

Post by stancecoke » Jun 05 2018 2:32pm

Basia wrote:
Jun 05 2018 2:06pm
The firmware is not installed (
you have to show us the output of the cmd-window, otherwise we can't help you....

regards
stancecoke

casainho   10 GW

10 GW
Posts: 4997
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Jun 05 2018 3:06pm

stancecoke wrote:
Jun 05 2018 2:20pm
Hm, new findings about regen.
I tried to improve the algorithm for Advance Angle adjustion at regen, but it seems the value ui8_position_correction_value has almost no influence on the zero crossing of the phase current.
Today I also tried my direct drive motor and regen. It doesn't work well...
ui8_position_correction_value has almost no influence on the zero crossing of the phase current
You mean in regen mode, right? If so, do you have an idea what we should do?
stancecoke wrote:
Jun 05 2018 2:20pm
In the naming of the graphs in the pictures mean
ui8_position_correction_value - ui16_BatteryCurrent - dutycycle- ui16_motor_speed_erps
I would like to understand you graphs and experience. Can you please explain?
stancecoke wrote:
Jun 05 2018 2:20pm
maybe this is because the quite low dutycycle...
It is interesting, that the phase current is higher at lower erps, but a guy at the pedelecforum reported the same behaviour.
You mean at regen or motor mode?
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

Basia   10 W

10 W
Posts: 69
Joined: Nov 10 2017 4:17am
Location: Wilmington

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

Post by Basia » Jun 05 2018 3:52pm

stancecoke wrote:
Jun 05 2018 2:32pm
Basia wrote:
Jun 05 2018 2:06pm
The firmware is not installed (
you have to show us the output of the cmd-window, otherwise we can't help you....

regards
stancecoke
New file. Log from eclipse
Attachments
Result.log
(8 KiB) Downloaded 18 times

User avatar
stancecoke   100 kW

100 kW
Posts: 1375
Joined: Aug 02 2017 2:56pm

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

Post by stancecoke » Jun 06 2018 12:20am

Code: Select all

motor.c:560: warning 94: comparison is always false due to limited range of data type
motor.c:601: error 20: Undefined identifier 'LI_ION_CELL_VOLTS_0'
motor.c:608: error 20: Undefined identifier 'LI_ION_CELL_VOLTS_MAX'
make sure, that LI_ION_CELL_VOLTS_0 and LI_ION_CELL_VOLTS_MAX are defined in the config.h
Don't use the Java-Tool, it's not up to date. Extract the zip file again and have a new try!

Why do you use eclipse?! Do you want to implement new features to the firmware?

regards
stancecoke

Basia   10 W

10 W
Posts: 69
Joined: Nov 10 2017 4:17am
Location: Wilmington

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

Post by Basia » Jun 06 2018 1:07am

stancecoke wrote:
Jun 06 2018 12:20am

Code: Select all

motor.c:560: warning 94: comparison is always false due to limited range of data type
motor.c:601: error 20: Undefined identifier 'LI_ION_CELL_VOLTS_0'
motor.c:608: error 20: Undefined identifier 'LI_ION_CELL_VOLTS_MAX'
make sure, that LI_ION_CELL_VOLTS_0 and LI_ION_CELL_VOLTS_MAX are defined in the config.h
Don't use the Java-Tool, it's not up to date. Extract the zip file again and have a new try!

Why do you use eclipse?! Do you want to implement new features to the firmware?

regards
stancecoke
Extract zip archive and run start_compiling.bat and writeoptionbytes.bat? Java-tool only for configuration?

User avatar
stancecoke   100 kW

100 kW
Posts: 1375
Joined: Aug 02 2017 2:56pm

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

Post by stancecoke » Jun 06 2018 2:02am

Basia wrote:
Jun 06 2018 1:07am
Extract zip archive and run start_compiling.bat and writeoptionbytes.bat? Java-tool only for configuration?
All user relevant parameters are defined in the config.h. You have to modify the config.h according to your system, e.g. the battery setup.
You can use any text editor to edit the config.h, with eclipse it's quite comfortable. The meaning of each parameter is decribed in chapter 4. DESCRIPTION OF THE GUI of the tutorial (not up to date) and in the config-example.h (up to date)

The Java-Tool is just another way to modify the config.h It overwrites the existing config.h with the settings of the GUI. As casainhos latest changes of relevant parameters are not implemented in the Java-Tool yet, compiling doesn't work with the config.h that's created by the Java tool at the moment, I will update the Tool soon.

The writeoptionbytes.bat has to be run only once to remove the write protection, this works with the Java Tool, too.

The start_compiling.bat has to be run every time you want to flash changed parameters to the controller.

regards
stancecoke

User avatar
stancecoke   100 kW

100 kW
Posts: 1375
Joined: Aug 02 2017 2:56pm

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

Post by stancecoke » Jun 06 2018 2:17am

casainho wrote:
Jun 05 2018 3:06pm
ui8_position_correction_value has almost no influence on the zero crossing of the phase current
You mean in regen mode, right? If so, do you have an idea what we should do?
The whole post is about regen mode. I have no idea what to do at the moment. I will do some further test on my testbench. The shown data in the graph is from a real test ride.
casainho wrote:
Jun 05 2018 3:06pm
I would like to understand you graphs and experience. Can you please explain?
89-289-33-20 in the graph means
ui8_position_correction_value = 89
ui16_BatteryCurrent = 289
dutycycle = 33
ui16_motor_speed_erps = 20

The data is from a single regen braking from appr. 20km/h to 0 km/h (see decreasing erps)

regards
stancecoke

casainho   10 GW

10 GW
Posts: 4997
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Jun 06 2018 2:49am

stancecoke wrote:
Jun 06 2018 2:17am
casainho wrote:
Jun 05 2018 3:06pm
ui8_position_correction_value has almost no influence on the zero crossing of the phase current
You mean in regen mode, right? If so, do you have an idea what we should do?
The whole post is about regen mode. I have no idea what to do at the moment. I will do some further test on my testbench. The shown data in the graph is from a real test ride.
casainho wrote:
Jun 05 2018 3:06pm
I would like to understand you graphs and experience. Can you please explain?
89-289-33-20 in the graph means
ui8_position_correction_value = 89
ui16_BatteryCurrent = 289
dutycycle = 33
ui16_motor_speed_erps = 20

The data is from a single regen braking from appr. 20km/h to 0 km/h (see decreasing erps)
I would like to understand why there are 4 sinewaves on the graph...
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

User avatar
stancecoke   100 kW

100 kW
Posts: 1375
Joined: Aug 02 2017 2:56pm

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

Post by stancecoke » Jun 06 2018 3:26am

casainho wrote:
Jun 06 2018 2:49am
I would like to understand why there are 4 sinewaves on the graph...
It's to show, that there is no difference in phase shift for different values of the advance angle (correction value)
x-axis: rotor position
y-axis: phase B current

regards
stancecoke

Post Reply