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

Electric Motors and Controllers
fp23   1 µW

1 µW
Posts: 2
Joined: Nov 14 2020 6:35pm

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

Post by fp23 » Dec 02 2020 2:08pm

Do you have any idea, what this thing is doing? :-)
No, it seems to go to the connector for the display, but that wouldn't make sense does it?
There is no alternative on the PCB for an analog input. Only if you solder a wire directly to the last free processor pin, see this post:viewtopic.php?f=30&t=87870&p=1355574&hi ... n#p1355574
Thanks for that hint. My Hand is nowhere near steady enough to soldier directly to the cpu pin :)

I am happy to buy another controller to try your setup. Ist this the one you are working on? https://bmsbattery.com/home/1026-s12sn- ... ller-.html

Big thanks for keeping this alive. regards, fp

hyper93   10 µW

10 µW
Posts: 5
Joined: Nov 12 2020 11:44am

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

Post by hyper93 » Dec 05 2020 7:10pm

Looking to upgrade my controller to a KT. Is there a recommended place to buy from? I see bmsbattery linked. Are there other places as well?

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 » Dec 06 2020 4:55am

hyper93 wrote:
Dec 05 2020 7:10pm
Looking to upgrade my controller to a KT. Is there a recommended place to buy from? I see bmsbattery linked. Are there other places as well?
For 6-fet versions (and other accessories) I've also used PSWpower:-

http://www.pswpower.com/ven.php?cargo-s220052

...they've been a reliable supplier for me so far. They've also got a shop on Aliexpress, shipping from there may be a little cheaper if you can wait longer for it.
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 6-fet, LCD3, 48v 12s lipo.

kaliandg   1 µW

1 µW
Posts: 4
Joined: Dec 06 2020 11:20pm

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

Post by kaliandg » Dec 16 2020 5:00pm

Hi, may be somebody more knowledgeable can help me out with my issue:
I have S06 18FET controller, direct drive motor 1.5Kw, throttle, PAS sensor, hall sensors in the wheel. No torque or FOC sensors. Opensource firmware works great, except for one thing – sometimes, when I’m trying to stop, motor will not stop for some amount of time even if bike is stopped with the brakes. so I have to keep brakes pressed in order to stall the motor. If I release the brakes, motor will turn for may be 30-45deg, and stops. I can’t figure out why it behaves like this. Will really appreciate your ideas.

Regards,

User avatar
stancecoke   100 kW

100 kW
Posts: 1381
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 » Dec 17 2020 5:13am

kaliandg wrote:
Dec 16 2020 5:00pm
motor will not stop for some amount of time
Are you using the master branch with the BluOSEC app? It's known that it freezes sometimes. A bugfix is implemented in the branch Torque from X4. It can be applied to the master also: Avoid float operations and divisions....

https://github.com/stancecoke/BMSBatter ... 10caecbee0

regards
stancecoke

kaliandg   1 µW

1 µW
Posts: 4
Joined: Dec 06 2020 11:20pm

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

Post by kaliandg » Dec 17 2020 10:35am

Thank you Stancecoke for your answer,

Yes i used the main branch. I've just soldered in ACS758LCB-100B FOC sensor, will re-adjust settings and try to use the branch,

Regards,

User avatar
stancecoke   100 kW

100 kW
Posts: 1381
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 » Dec 17 2020 11:07am

kaliandg wrote:
Dec 17 2020 10:35am
and try to use the branch,
It's only fixed for torquesensor mode with torque signal on pad X4.

regards
stancecoke

endlessolli   10 mW

10 mW
Posts: 22
Joined: Jul 31 2020 11:55am

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

Post by endlessolli » Dec 17 2020 12:01pm

stancecoke wrote:
Dec 17 2020 5:13am
kaliandg wrote:
Dec 16 2020 5:00pm
motor will not stop for some amount of time
Are you using the master branch with the BluOSEC app? It's known that it freezes sometimes. A bugfix is implemented in the branch Torque from X4. It can be applied to the master also: Avoid float operations and divisions....

https://github.com/stancecoke/BMSBatter ... 10caecbee0

regards
stancecoke
@stancecoke: Would it be possible that you backport that fix to the master-branch?

Also: Is this known freezing problem only happening when one actively uses the BluOSEC app (i.e. while there is a Bluetooth connection)?
I want to use the App only for setup and then run the controller completely without any display. So, when freezing happens only while using the App, this would be only a minor problem for my use case
And I am asking, since I can not test for myself, as I am still waiting for my controller to arrive....

User avatar
stancecoke   100 kW

100 kW
Posts: 1381
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 » Dec 17 2020 12:30pm

endlessolli wrote:
Dec 17 2020 12:01pm
Also: Is this known freezing problem only happening when one actively uses the BluOSEC app (i.e. while there is a Bluetooth connection)?
I don't know, as I'm not using the BluOSEC app. Perhaps users of BluOSEC can report their experience...

regards
stancecoke

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 » Dec 17 2020 3:37pm

Also: Is this known freezing problem only happening when one actively uses the BluOSEC app (i.e. while there is a Bluetooth connection)?
I was getting what I think was the freezing problem when using Xnyle's 'x4throttle' branch. This was with the lcd3 display i.e. not using the BluOSEC app.

The motor would occasionally completely lose drive for a couple of seconds, then the display would re-initialise and the motor would come back to life. It was almost like the controller battery supply had been momentarily cut, but I could find no cause for this.

Eventually I changed the firmware to Stancecoke's 'Torque from X4' branch and the problem has never happened since... :)
Last edited by geofft on Dec 29 2020 3:08pm, edited 1 time in total.
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 6-fet, LCD3, 48v 12s lipo.

Vbruun   100 W

100 W
Posts: 139
Joined: Sep 26 2019 8:42am

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

Post by Vbruun » Dec 19 2020 2:33am

How does the torque from x4 branch work differently? I can't really find any documentation on it.

I run the a torque sensor, so by the sound of things I could use it.

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 » Dec 19 2020 3:57am

Vbruun wrote:
Dec 19 2020 2:33am
How does the torque from x4 branch work differently? I can't really find any documentation on it.

I run the a torque sensor, so by the sound of things I could use it.
The 'torque from x4' branch allows you to run both throttle and torque sensor together by connecting the throttle as normal and the tqsr input to the x4 pad. This branch also has stancecoke's code optimisation to alleviate the 'freezing' issue that some folks were having, mainly when using the BluOsec app with this branch.

If you don't have a need for a throttle and you're not getting any freezing issues then you probably don't need it... :wink:
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 6-fet, LCD3, 48v 12s lipo.

Vbruun   100 W

100 W
Posts: 139
Joined: Sep 26 2019 8:42am

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

Post by Vbruun » Dec 19 2020 8:20am

True, but I do get the freezing issues. I just redid the wiring so I do not get power for the torque sensor through the display cable and that has fixed the issue so far, but I am not sure yet

kaliandg   1 µW

1 µW
Posts: 4
Joined: Dec 06 2020 11:20pm

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

Post by kaliandg » Dec 23 2020 11:56pm

Newly soldered FOC sensor works great. I did not explain the issue correctly in my previous post – when I apply the brakes wheel try to continue spinning up until current drops to 0 (magenta current scale above speed scale on Bluosec application). Same happens with the LCD. Not sure if this is done intentionally – I guess if current cut off abruptly after brakes are applied, collapsing magnetic field will create huge current spike, that’s why firmware dose not cut the current abruptly? How original firmware handles brakes?
Just in case attaching the log file - trying to brake and after brake is released speed jumps, and wheel continue speening up untill current drops to 0

REgards,
Attachments
2312-2202-BluOsec.log
(18.8 KiB) Downloaded 7 times

kaliandg   1 µW

1 µW
Posts: 4
Joined: Dec 06 2020 11:20pm

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

Post by kaliandg » Dec 29 2020 1:32pm

Tried to use main branch with the LCD, and delays with the brakes are gone.

endlessolli   10 mW

10 mW
Posts: 22
Joined: Jul 31 2020 11:55am

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

Post by endlessolli » Dec 30 2020 12:11pm

endlessolli wrote:
Dec 17 2020 12:01pm
....
And I am asking, since I can not test for myself, as I am still waiting for my controller to arrive....
Finally, my controller arrived!
I am currently reading through the wiki and am about to do my 1st flash...
I have question wrt the java tool settings:
@stancecoke:
1) The Ride Option 'Power Based Control'
(Switches from current regulation control to power regulation (the lower voltage the more current you get for the same assist)
-> Does that also influence throttle behavior similarly? I.e. a certain throttle position gains a certain power (instead of a certain current)?
2) If I use only the throttle - do Gain P and Gain have any meaning?

Update: 1st Flash seemed to have worked (red LED flashing in the STLink-V2). BUT: Motor does not turn at all (tested via throttle). Nothing happens :-(
Need to start trouble-shooting....

Vbruun   100 W

100 W
Posts: 139
Joined: Sep 26 2019 8:42am

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

Post by Vbruun » Dec 30 2020 1:22pm

Did you apply the power based assist option?

I had to disable it because the firmware didn't work for me as Long as IT was ticked.
So try to disable that :)

Maybe someone who knows how can remove the option from the firmware since it is broken

endlessolli   10 mW

10 mW
Posts: 22
Joined: Jul 31 2020 11:55am

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

Post by endlessolli » Dec 30 2020 5:20pm

Vbruun wrote:
Dec 30 2020 1:22pm
Did you apply the power based assist option?

I had to disable it because the firmware didn't work for me as Long as IT was ticked.
So try to disable that :)

Maybe someone who knows how can remove the option from the firmware since it is broken
Thanks for the feedback!
It's still not doing what its supposed to be doing, but the motor now turns - in spurts.
The problem was either the 'power based assist'-option you suggested, or I miscalculated the undervoltage 1st.

I guess, I need to play a bit with the parameters and understand better what the are doing.

I'll report my progress.

Thanks again to stancecoke and his predecessors for making this open firmware available!

Vbruun   100 W

100 W
Posts: 139
Joined: Sep 26 2019 8:42am

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

Post by Vbruun » Dec 31 2020 2:09am

Have you adjusted the PID settings yet?

Turn KD and kp down to 0.05 and try again. The stock settings are very janky.

Also, did you have the wheel in the air? It works alot Better under load

endlessolli   10 mW

10 mW
Posts: 22
Joined: Jul 31 2020 11:55am

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

Post by endlessolli » Dec 31 2020 6:30am

Vbruun wrote:
Dec 31 2020 2:09am
Have you adjusted the PID settings yet?

Turn KD and kp down to 0.05 and try again. The stock settings are very janky.

Also, did you have the wheel in the air? It works alot Better under load
Thanks again for the help.

Can you clarify where I can set KD and kp parameters?
In my Java Tool Version, I have 'Gain P' and 'Gain I' Parameters for the PI controller.
Is this what you are referring to, or do I need to look somewhere else to adjust the ones you quoted?

P.S. I tried with the wheel in the air - braking with my hands... ouch (But even with braking; i get the spin-bursts.
Will try your setting adjustments and will report back - probably next year, though :wink:

Vbruun   100 W

100 W
Posts: 139
Joined: Sep 26 2019 8:42am

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

Post by Vbruun » Dec 31 2020 7:58am

Those are the ones. I just remembered the names incorrectly

endlessolli   10 mW

10 mW
Posts: 22
Joined: Jul 31 2020 11:55am

KT motor controllers - it's alive!

Post by endlessolli » Jan 02 2021 11:48am

Thanks for the help & input.
I have it running now! My initial problems were:
- when it didn't run, it was caused by setting a too high min voltage (Doh!)

- when it ran 'in spurts' it was caused by a massively off 'Motor specific angle' setting: I started at '0' as per wiki, but ended up at '230' for smoothest run @ highest rpm for a given throttle for my motor (from a cheap 'Voilamart' E Bike Conversion Kit geared hubmotor 36V 250W) -> Does anyone have a recommendation based on what to optimize this setting? (i.e. which output parameter to optimize?)

- when it ran too slow, had to adjust the 'Gear ratio' (I tried random numbers, as I have no data from my motor...). with '70' it ran very slow, with '44' I reach similar speed as with std. firmware. (This influence surprised me, as I thought this setting only calibrates the *displayed* speed.)

All was tested using 'throttle' only (a linear 10kOhm poti) and wheel without load (testing on the workbench, as it is too cold for test-drives....)

Finally, today I also got the Bluetooth module connected and BluOSEC App running.

Now I need to test it in real live and potentially tweak PI parameters*
Again: Thank you for all involved, esp Stancecoke!!

Great Project!
I only wish, I would understand the parameters a bit better. Also after reading the wiki many times, I am unsure how some of the parameters interact with the controller/motor behavior.

* Does anyone have a recommendation for these parameter settings, if I only want to use the throttle and I want immediate/very quick reponse to it?

mehmetoz1980   1 µW

1 µW
Posts: 4
Joined: Nov 23 2020 5:17pm

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

Post by mehmetoz1980 » Jan 03 2021 1:21pm

HELLO THERE

new my controler has arrived. https://files.fm/f/ew7zjkph8

12s kt controller.

please
how use stm8-stvd software? for flash to opensource software

I guess it must have hex file for software installation.

I guess it must have hex file for software installation. https://files.fm/u/f68kujxxb#/view/jwp8ckeuh

https://files.fm/thumb_show.php?i=hz6aqfkyu how to use this zip file?

endlessolli   10 mW

10 mW
Posts: 22
Joined: Jul 31 2020 11:55am

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

Post by endlessolli » Jan 04 2021 5:01pm

Hi all;
got the firmware flashed and motor running (as stated earlier) with rotor angle correction enabled (controller KT SVP 24V/36V 15A).
However, I am still at a loss on how to optimize parameter settings.

I am currently testing a setup with Bafang (8FUN) SWXK 36V 250W front wheel motor.
I am trying to find good parameter settings and I am focussing mainly on Motor Specific Angle (and 'Gear ratio' )
(I am not yet optimizing the PI controller, I just try to achieve a smooth, efficient running motor for a static throttle setting)

My question / problem:
Based on what output parameter do I adjust the settings of these parameters?

Esp for the angle, I can go from 1 to 255 and I find multiple 'maxima' settings where the motor sounds smooth and fast running (all tested w/o load -> wheel in the air).
However, at the fasted & smoothest setting (around a value of '15'), the current draw (as per BluOSEC App) goes unproportionally high (from 0.7A to multiple Amps) - and the motor (and controller) get pretty hot (again: tested w/ wheel in the air).
With the std. firmware, I did not notice any heating-up in this test setup.

Also for the Gear ratio, I can find multiple motor rpm maxima when dialling through the values.
(Unfortunately, I don't know the gear ratio of my motor,....)

@stancecoke, all:
Do you have any recommendation on how to approach parameter optimization?
(What to do 1st, which Parameter-interactions (i.e. to take into account, aso)

geofft   1 kW

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

Re: Still some help needed -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to

Post by geofft » Jan 05 2021 5:33am

endlessolli wrote:
Jan 04 2021 5:01pm

Esp for the angle, I can go from 1 to 255 and I find multiple 'maxima' settings where the motor sounds smooth and fast running (all tested w/o load -> wheel in the air).
However, at the fasted & smoothest setting (around a value of '15'), the current draw (as per BluOSEC App) goes unproportionally high (from 0.7A to multiple Amps) - and the motor (and controller) get pretty hot (again: tested w/ wheel in the air).
You will struggle to get any useful or meaningful results with the wheel in the air, unloaded. I suggest you repeat the test under normal road conditions and find the angle that gives a smooth, even acceleration from rest. I have played with the 'motor specific angle' in the past (Q128h geared hub motor) but found I couldn't improve on the default setting (237 ?).

I realise this may be difficult under current lockdown conditions, but even a short test on a garden path, driveway etc, will be more useful than 'wheel in the air' testing... :wink:
Last edited by geofft on Jan 05 2021 12:14pm, edited 1 time in total.
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 6-fet, LCD3, 48v 12s lipo.

Post Reply