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

Electric Motors and Controllers
honya96   1 kW

1 kW
Posts: 328
Joined: Mar 05 2015 9:38am
Location: Czech Republic

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

Post by honya96 » Jul 19 2018 6:14am

stancecoke wrote:
Jul 19 2018 1:51am
I'll add the hint to check the path to the FAQs.

For us, dump users.. you can note the exact version which we have to download, with a screenshot and arrow :lol: in the instructions.

but anyway, its still not working

Thanks for your help :wink:

User avatar
stancecoke   10 kW

10 kW
Posts: 896
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 » Jul 19 2018 6:35am

Ah, I see, there is a bug in the constant naming in the config.h created by the java tool, I just fixed it at github.

The working SDCC archive is this:
https://sourceforge.net/projects/stm8-b ... z/download

regards
stancecoke

geofft   1 kW

1 kW
Posts: 318
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 » Jul 19 2018 7:33am

stancecoke wrote:
Jul 19 2018 6:35am
Ah, I see, there is a bug in the constant naming in the config.h created by the java tool, I just fixed it at github.

The working SDCC archive is this:
https://sourceforge.net/projects/stm8-b ... z/download

regards
stancecoke
Success.. now flashes just fine... :D

A quick test seems to show I have no motor response to throttle or pas input, tried all four ride modes. Not sure if my config.h is good, have attached below.
Attachments
config.h 190718.txt
(1.11 KiB) Downloaded 29 times
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

honya96   1 kW

1 kW
Posts: 328
Joined: Mar 05 2015 9:38am
Location: Czech Republic

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

Post by honya96 » Jul 19 2018 8:02am

It works!

https://drive.google.com/file/d/1i8cYBS ... p=drivesdk

Tested with pot. I don't have the 6.6k resistor but by my rough calculation it may be showing correctly....

I like the flashing when too high, but I'll apreciate more then 127 positive, negative can be way less.

But I don't know the problematics behind it.

Haven't tested anything else, I have to solder in some mosfets first :lol:

User avatar
stancecoke   10 kW

10 kW
Posts: 896
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 » Jul 19 2018 10:11am

geofft wrote:
Jul 19 2018 7:33am
Success.. now flashes just fine... :D
fine! :D
geofft wrote:
Jul 19 2018 7:33am
A quick test seems to show I have no motor response to throttle or pas input, tried all four ride modes.
The config.h seems to be OK, make sure that your battery has more then 42,5V.

To be near my default debug settings, that are proofed to be working, please try with settings "external speed sensor" and "throttle" and set the "motor specific angle" to 214. The 238 are specific for the BionX IGH3.

If all of this doesn't lead to success, I fear, you have to swap the phase- and hall-wires by trial and error, it might be different to casainhos fork.

It would be great, if you could use a bluetooth module or USB-UART converter to plot the data in diagnostics mode, it would be much easier to find the fault then. :shock:

honya96 wrote:
Jul 19 2018 8:02am
It works!
8)

regards
stancecoke

geofft   1 kW

1 kW
Posts: 318
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 » Jul 19 2018 11:42am

stancecoke wrote:
Jul 19 2018 10:11am


The config.h seems to be OK, make sure that your battery has more then 42,5V.

To be near my default debug settings, that are proofed to be working, please try with settings "external speed sensor" and "throttle" and set the "motor specific angle" to 214. The 238 are specific for the BionX IGH3.

If all of this doesn't lead to success, I fear, you have to swap the phase- and hall-wires by trial and error, it might be different to casainhos fork.

None of those things seem to work.
I don't think it's motor or hall phase, there's not even a kick or any sign of activity from the motor...
I'm noticing that the 'build' phase of the flash proceedure is now very short, just a few seconds - doesn't look right. Take a look below, see what you think...
Attachments
cmd dump 190718(2).txt
(2.76 KiB) Downloaded 22 times
config.h
(1.1 KiB) Downloaded 25 times
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.


geofft   1 kW

1 kW
Posts: 318
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 » Jul 19 2018 12:31pm

stancecoke wrote:
Jul 19 2018 12:04pm
please rename the firmware folder and avoid parenthesize! See here:
https://www.avrfreaks.net/forum/make-in ... 000fd-addr

regards
stancecoke
Guessed I was probably doing something dumb, just too many traps for numpties like me.

Will try again tomorrow... :?
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

geofft   1 kW

1 kW
Posts: 318
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 » Jul 20 2018 7:07am

geofft wrote:
Jul 19 2018 12:31pm
stancecoke wrote:
Jul 19 2018 12:04pm
please rename the firmware folder and avoid parenthesize! See here:
https://www.avrfreaks.net/forum/make-in ... 000fd-addr

regards
stancecoke
Guessed I was probably doing something dumb, just too many traps for numpties like me.

Will try again tomorrow... :?
Success! Things are now starting to work... :)

I'm not sure how much time or effort you're planning to put into developing this code, but I've put some feedback below in case it's of any interest.

1) Throttle only mode. Works ok. Was very jerky at first but increasing the 'Phase current max' (500 to 800) greatly improved this and the motor feels smooth and quiet.

2) Throttle and PAS. No response to throttle or PAS.

3) Torquesensor. Not tested.

4) Torque simulation. PAS works ok, maybe a little oscillation during acceleration but otherwise feels smooth, progressive and natural. No throttle response.

Wattmeter readout looks accurate.

Battery bars reading 1 (maybe 2) bars too high. (With my controller, may be ok with others...)

...so generally pretty good. Phase current limiting is obviously working but is rather on/off in its action, maybe a little smoothing required here.
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

User avatar
stancecoke   10 kW

10 kW
Posts: 896
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 » Jul 20 2018 7:29am

geofft wrote:
Jul 20 2018 7:07am
Success! Things are now starting to work... :)
Nice to hear! Thank you for testing! 8)
geofft wrote:
Jul 20 2018 7:07am
2) Throttle and PAS. No response to throttle or PAS.
Be aware, this is throttle and PAS mode. In this mode you have to use the throttle, but it works only, if pedals are turning. In this way, the use of the throttle is legal in Germany...

regards
stancecoke

geofft   1 kW

1 kW
Posts: 318
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 » Jul 20 2018 7:56am

stancecoke wrote:
Jul 20 2018 7:29am

2) Throttle and PAS. No response to throttle or PAS.

Be aware, this is throttle and PAS mode. In this mode you have to use the throttle, but it works only, if pedals are turning. In this way, the use of the throttle is legal in Germany...

regards
stancecoke
Ah..ok, didn't know that.

Have just retested this, but still no response when both operated together.
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

User avatar
stancecoke   10 kW

10 kW
Posts: 896
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 » Jul 20 2018 9:13am

geofft wrote:
Jul 20 2018 7:56am
Have just retested this, but still no response when both operated together.
Ah, you are right, I never updated the enhanced direction detection for this mode. I've fixed it on github. I have not tried it in hardware, but it should work now.

Please, can you tell us which motor you are using and upload your working settings.ini? So we can collect proven setups and new users can use them, if the have a similar constellation. :)

regards
stancecoke
Last edited by stancecoke on Jul 20 2018 12:31pm, edited 3 times in total.

casainho   100 MW

100 MW
Posts: 2661
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 » Jul 20 2018 9:18am

Stancecoke, maybe you can start thinking in using LCD3 with KT firmware. The current firmware uses only about half of the total available flash memory but the firmware is almost finished for TSDZ2. It can be easily expanded with new configurations menus (because the structure is already implemented), I can imagine a more generic KT firmware where most options are configured on LCD3 and not on config.h of the firmware.

I just implemented 2 popular requested features: configure on the LCD the battery max current and battery max power.

In the following video you can see this new features working very well, when my ebike is on a training roller. After testing outside on a ride I can say they work very well just like on the video.

I wrote a wiki page with all the features/menus of the OpenSource firmwares for TSDZ2 and KT-LCD3: https://github.com/OpenSource-EBike-fir ... d-features

Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

If you like my work, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

User avatar
stancecoke   10 kW

10 kW
Posts: 896
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 » Jul 20 2018 9:40am

casainho wrote:
Jul 20 2018 9:18am
Stancecoke, maybe you can start thinking in using LCD3 with KT firmware.
Sorry, no interest. As you know, I don't like any display at my handlebar. :wink:

regards
stancecoke

casainho   100 MW

100 MW
Posts: 2661
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 » Jul 20 2018 10:23am

stancecoke wrote:
Jul 20 2018 9:40am
casainho wrote:
Jul 20 2018 9:18am
Stancecoke, maybe you can start thinking in using LCD3 with KT firmware.
Sorry, no interest. As you know, I don't like any display at my handlebar. :wink:
I understand.

I think our firmware for LCD3 and motor controllers bring a good value, some like cycle analyst. Let's see if other developers can join to help.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

If you like my work, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

geofft   1 kW

1 kW
Posts: 318
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 » Jul 20 2018 10:29am

stancecoke wrote:
Jul 20 2018 9:13am
geofft wrote:
Jul 20 2018 7:56am
Have just retested this, but still no response when both operated together.
Ah, you are right, I never updated the enhanced direction detection for this mode. I've fixed it on github. I have not tried it in hardware, but it should work now.
Yes, that now works (in German legal manner... :( ). There is some fairly severe oscillation or 'pulsing' of the drive though. Is the throttle being scaled by pas cadence - maybe that limiting needs smoothing out?
Please, can you tell us which motor you are using and upload your working settings.ini? So we can collect proofed setups and new users can use them, if the have a similar constellation. :)

regards
stancecoke
You'll find my running configuration in the bottom signature line of my posts (Q128, etc)
I've attached my current settings.ini. This may change a little, I haven't got around to playing with all config settings as yet.
Attachments
settings.ini
(235 Bytes) Downloaded 19 times
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

User avatar
stancecoke   10 kW

10 kW
Posts: 896
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 » Jul 20 2018 12:24pm

geofft wrote:
Jul 20 2018 10:29am
Yes, that now works (in German legal manner... :( ). There is some fairly severe oscillation or 'pulsing' of the drive though. Is the throttle being scaled by pas cadence - maybe that limiting needs smoothing out?
No, the throttle value is used for the target current in the same way as in throttle-mode. Perhaps you should increase the value of "PAS timeout" to avoid hickups.

To avoid oszillation, you can reduce the values of Gain P (and Gain I), but be aware that the response to the throttle signal will get slower.
geofft wrote:
Jul 20 2018 10:29am
You'll find my running configuration in the bottom signature line of my posts (Q128, etc)
Thank you. So we can find the settings for a Q128 and for a Bionx IGH3 in the "proven setting" folder of the firmware now. :D

regards
stancecoke

honya96   1 kW

1 kW
Posts: 328
Joined: Mar 05 2015 9:38am
Location: Czech Republic

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

Post by honya96 » Jul 20 2018 6:56pm

stancecoke wrote:
Jul 20 2018 12:24pm
Thank you. So we can find the settings for a Q128 and for a Bionx IGH3 in the "proven setting" folder of the firmware now. :D
I hope I'll share "proven setting" for 18FET and 48v 1000w hallomotor soon. :D

geofft   1 kW

1 kW
Posts: 318
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 » Jul 21 2018 5:53am

stancecoke wrote:
Jul 20 2018 12:24pm
geofft wrote:
Jul 20 2018 10:29am
Yes, that now works (in German legal manner... :( ). There is some fairly severe oscillation or 'pulsing' of the drive though. Is the throttle being scaled by pas cadence - maybe that limiting needs smoothing out?
No, the throttle value is used for the target current in the same way as in throttle-mode. Perhaps you should increase the value of "PAS timeout" to avoid hickups.

To avoid oszillation, you can reduce the values of Gain P (and Gain I), but be aware that the response to the throttle signal will get slower.
Gain I has proved to be the key parameter for me - reducing this to 0.1 has removed all the oscillation issues in all modes. Throttle response seems perfectly ok at this setting and everything now works very well, motor smooth and quiet - well done!

It's just a shame for me that there is no unrestricted throttle/pas mode. This for me (and many others I suspect) is a major drawback and would mean that I would probably not be able to use this code... :(

So how about an unrestricted throttle pas mode (and/or add a throttle option to torque simulation..?) That would be very nice.... :roll:

Updated settings.ini below.
Attachments
settings.ini
(236 Bytes) Downloaded 19 times
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

honya96   1 kW

1 kW
Posts: 328
Joined: Mar 05 2015 9:38am
Location: Czech Republic

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

Post by honya96 » Jul 21 2018 6:19am

geofft wrote:
Jul 21 2018 5:53am
stancecoke wrote:
Jul 20 2018 12:24pm
geofft wrote:
Jul 20 2018 10:29am
Yes, that now works (in German legal manner... :( ). There is some fairly severe oscillation or 'pulsing' of the drive though. Is the throttle being scaled by pas cadence - maybe that limiting needs smoothing out?
No, the throttle value is used for the target current in the same way as in throttle-mode. Perhaps you should increase the value of "PAS timeout" to avoid hickups.

To avoid oszillation, you can reduce the values of Gain P (and Gain I), but be aware that the response to the throttle signal will get slower.
Gain I has proved to be the key parameter for me - reducing this to 0.1 has removed all the oscillation issues in all modes. Throttle response seems perfectly ok at this setting and everything now works very well, motor smooth and quiet - well done!

It's just a shame for me that there is no unrestricted throttle/pas mode. This for me (and many others I suspect) is a major drawback and would mean that I would probably not be able to use this code... :(

So how about an unrestricted throttle pas mode (and/or add a throttle option to torque simulation..?) That would be very nice.... :roll:

Updated settings.ini below.
Or the "secret" switching from throttle active when PAS (to 25km/h?) to throttle always active (to full speed)

User avatar
stancecoke   10 kW

10 kW
Posts: 896
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 » Jul 21 2018 7:52am

geofft wrote:
Jul 21 2018 5:53am
Gain I has proved to be the key parameter for me - reducing this to 0.1 has removed all the oscillation issues in all modes. Throttle response seems perfectly ok at this setting and everything now works very well, motor smooth and quiet - well done!
Great! thank you for tuning the parameters!
geofft wrote:
Jul 21 2018 5:53am
So how about an unrestricted throttle pas mode (and/or add a throttle option to torque simulation..?) That would be very nice.... :roll:
Does that mean, that you want to override torque-simulation-mode with the throttle and the throttle should have no speed limit?!
A throttle override would be easy to implement, but not legal. I could implement it this way: :wink:
Throttle overrides torque-simulation-mode with speed limit, if pedals are turning. That's legal.

When activating the "offroad" mode, the throttle overrides even with pedals at standstill. The speed limit can be disabled by the morse code already.

regards
stancecoke

geofft   1 kW

1 kW
Posts: 318
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 » Jul 21 2018 8:44am

stancecoke wrote:
Jul 21 2018 7:52am


Does that mean, that you want to override torque-simulation-mode with the throttle and the throttle should have no speed limit?!
A throttle override would be easy to implement, but not legal. I could implement it this way: :wink:
Throttle overrides torque-simulation-mode with speed limit, if pedals are turning. That's legal.

When activating the "offroad" mode, the throttle overrides even with pedals at standstill. The speed limit can be disabled by the morse code already.

regards
stancecoke
'Yes' to all those suggestions would be fine for me. The throttle option doesn't necessarily have to be added to 'Torque Simulation' mode, it could be added to the existing 'Throttle/pas' mode - or both these modes.
Maybe good to wait for input from honya (and any others) to see if they agree...
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

User avatar
stancecoke   10 kW

10 kW
Posts: 896
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 » Jul 21 2018 9:01am

geofft wrote:
Jul 21 2018 8:44am
The throttle option doesn't necessarily have to be added to 'Torque Simulation' mode, it could be added to the existing 'Throttle/pas' mode - or both these modes.
??? In "Throttle and PAS" mode it should already work as you want?!
I think the "Torque-Simulation" mode will be the most used mode, here it makes most sense to have a throttle override.

I strongly recomment to try a ride with a torque-sensor-supported bike, you won't miss a throttle in any second, as you legs are operating the "throttle" 8)

regards
stancecoke

geofft   1 kW

1 kW
Posts: 318
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 » Jul 21 2018 9:26am

stancecoke wrote:
Jul 21 2018 9:01am
geofft wrote:
Jul 21 2018 8:44am
The throttle option doesn't necessarily have to be added to 'Torque Simulation' mode, it could be added to the existing 'Throttle/pas' mode - or both these modes.
??? In "Throttle and PAS" mode it should already work as you want?!
Sometimes, maybe when crossing a busy road junction, it's good to be able to just hit the throttle and go - with the 'throttle and pas' mode you have to wait for pas to trigger which can take a second or so and makes things more difficult. Not a big deal though, if added only to 'torque simulation' mode then that is perfectly ok.
I think the "Torque-Simulation" mode will be the most used mode, here it makes most sense to have a throttle override.
Yes, as stated, fine for me.
I strongly recomment to try a ride with a torque-sensor-supported bike, you won't miss a throttle in any second, as you legs are operating the "throttle" 8)
My replacement controller arrived this morning and is being wired for torquesensor operation right now.... :)
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

geofft   1 kW

1 kW
Posts: 318
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 » Jul 21 2018 10:15am

My replacement controller arrived this morning and is being wired for torquesensor operation right now.... :)
torquesensor(3).jpg
torquesensor(4).jpg
Thought I'd finished, but looking at the second photo I've just realised I haven't fitted the ST-link connector.... :(
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

Post Reply