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

Electric Motors and Controllers
User avatar
stancecoke   100 kW

100 kW
Posts: 1003
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 » Mar 26 2019 10:34am

casainho wrote:
Mar 26 2019 9:48am
Don't you guys want to help develop the firmware for SW102 Bluetooth graphic LCD
I still admire your ambition when it comes to displays. I just find it boring, I don't want to have any frills on the handlebars. :-)
Perhaps, Xnyle is interested...

regards
stancecoke

casainho   1.21 GW

1.21 GW
Posts: 3518
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 » Mar 26 2019 10:53am

stancecoke wrote:
Mar 26 2019 10:34am
casainho wrote:
Mar 26 2019 9:48am
Don't you guys want to help develop the firmware for SW102 Bluetooth graphic LCD
I still admire your ambition when it comes to displays. I just find it boring, I don't want to have any frills on the handlebars. :-)
Perhaps, Xnyle is interested...
That one is ver small and has the Bluetooth. With the Bluetooth chip it has, should be able to communicate wit mobile app AND the smart bms that also has Bluetooth, so we could integrate the bms on the system.
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, please 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
Xnyle   10 W

10 W
Posts: 73
Joined: Sep 03 2018 1:05pm

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

Post by Xnyle » Mar 29 2019 4:35pm

There are some new features in development / beta:

The first is a new option:
Idle disables offroad (60s)

Function should be clear, disables after 60 sec without wheel rotation!

The second feature is a passcode:

There is a new virtual switch in the controller. This switch can currently only be seen in the app in the left-hand debug panel, it's called lockStatus. 255 is the value when the controller is locked, the actual function - to prevent power output - is still disconnected, as long as the feature is in beta. Not that anyone gets stranded.

It works like this:

In the app you can set a 4 digit passcode.
1000 means that the protection is off, that is the default value.
Every other value is written to the EEPROM
Every now and then the app sends this value to the controller.
If the controller has not heard anything in 60 seconds -> lockStatus 255, controller locked.

Of course, you can only change the value if the app has previously sent the correct value and therefore has unlocked the controller, so you have to set the old value correctly in the app, wait a bit, then you can change it (because then the controller is unlocked ofc)

If you have forgotten the code, you can only flash again and wipe the eeprom (checkbox in the Java Tool)

This is of course not cryptographically hardened, you can also hack and try all 9k combinations.

The third feature is a GPS based Hill Climb Assist:

Can be set in the app (Hill climb assist factor).
Of course, GPS must be enabled (another app setting)
The value is +% / dm / s.
Meaning the app adds X% additional power per dm / s vertical speed (positive)
Of course, 100% is the maximum, it won't fly ;-)
Since GPS is pretty noisy for altitude determination, the value is slightly smoothed, so it takes a couple of meters to kick in.

gutyex   1 mW

1 mW
Posts: 15
Joined: Sep 16 2015 8:49am

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

Post by gutyex » Mar 30 2019 10:51am

I have an S06S flashed with this firmware, and when I turn on the kit, the motor starts going at a moderate speed and doesn't stop until it's turned off again. I have attached the settings file that I'm using.

The attached hardware is:
KT-LCD1
PAS Sensor
Q100H Motor

The display works fine, but no setting I change on it has any effect on the behaviour of the kit.
Attachments
20190330-142101GMT.ini
(262 Bytes) Downloaded 26 times

User avatar
Xnyle   10 W

10 W
Posts: 73
Joined: Sep 03 2018 1:05pm

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

Post by Xnyle » Apr 01 2019 4:44am

I hope you do not seriously expect anyone to do the debugging for you.

You can use the app or diagnostics mode to see what's going on.

Read the Wiki about that (mode) and probably throttle calibration, if that doesn't help, show at least some effort and write us what the PAS is doing, what the current calibration is, the current target, setpoint state and so on.

Sorry for being that harsh (or rather not :), but this is a hobbyists and not a commercial project where you just shout "doesn't work" at some poor customer support representative.

gutyex   1 mW

1 mW
Posts: 15
Joined: Sep 16 2015 8:49am

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

Post by gutyex » Apr 01 2019 12:53pm

Xnyle wrote:
Apr 01 2019 4:44am
I hope you do not seriously expect anyone to do the debugging for you.
Hardly, and I think it's an unreasonable leap to make that assumption from my post.

I've run into an issue that I couldn't find a previous example of when searching the thread, so I posted basic information about my setup to see if anyone could point me in the direction of where to look next.

If people are going to jump down the throat of anyone who needs help but doesn't know where to start trying to help themselves, perhaps a stickied post setting out the minimum information level required for effective troubleshooting could save everyone's blood pressure. The documentation for this being spread across at least 3 different places doesn't help matters much, either.

I'll dig out the necessary hardware and see if I can get the diagnostic output from the controller.

User avatar
stancecoke   100 kW

100 kW
Posts: 1003
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 » Apr 02 2019 2:24am

gutyex wrote:
Apr 01 2019 12:53pm
I'll dig out the necessary hardware and see if I can get the diagnostic output from the controller.
I try to add all issues, that are reported more than one time, to the FAQs at github.
You can add your findings there, too. Everybody with a github-account can edit the Wiki.

regards
stancecoke

casainho   1.21 GW

1.21 GW
Posts: 3518
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 » Apr 02 2019 2:48am

stancecoke wrote:
Apr 02 2019 2:24am
gutyex wrote:
Apr 01 2019 12:53pm
I'll dig out the necessary hardware and see if I can get the diagnostic output from the controller.
I try to add all issues, that are reported more than one time, to the FAQs at github.
You can add your findings there, too. Everybody with a github-account can edit the Wiki.
I understand the reaction of Xnyle. I also feel like that and I usually simple do not answer because I do not feel the obligation to do it. I think users should help themselves.

And I try to do the same Stancecoke says, update the wiki.
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, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

vulcanears   1 mW

1 mW
Posts: 18
Joined: Mar 01 2019 4:11am

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

Post by vulcanears » Apr 04 2019 5:16pm

How loud is a motor with the custom firmware FOC, compared to decent commercial options like Lishui or Phaserunner? Are they comparable?

User avatar
Xnyle   10 W

10 W
Posts: 73
Joined: Sep 03 2018 1:05pm

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

Post by Xnyle » Apr 05 2019 3:43pm

@everyone who is using this FW:

It would be nice if you could send me your proven settings based on the current version of the Java tool so that I can add them to the repo.

Please select a filename that contains controller type, system voltage, wheelsize and motortype

You can also add a pull request on github ofc.

Thanks!

geofft   1 kW

1 kW
Posts: 346
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 » Apr 06 2019 6:42am

Xnyle wrote:
Apr 05 2019 3:43pm
@everyone who is using this FW:

It would be nice if you could send me your proven settings based on the current version of the Java tool so that I can add them to the repo.

Please select a filename that contains controller type, system voltage, wheelsize and motortype

You can also add a pull request on github ofc.

Thanks!
Current torquesensor settings:-
TQSR,KT36-48svpr,12s,26inch,Q128h.ini
(259 Bytes) Downloaded 24 times
....I also set 'TQ calib' to 1500. For some reason this doesn't seem to restore from the .ini file and defaults to 1000.

My previous THR-PAS settings:-
THR-PAS,KT36-48svpr,12s,26inch,Q128h.ini
(264 Bytes) Downloaded 36 times
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR, LCD3, 48v 12s lipo.

kkm   1 mW

1 mW
Posts: 10
Joined: Sep 27 2018 3:22pm

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

Post by kkm » Apr 06 2019 12:40pm

gutyex wrote:
Mar 30 2019 10:51am
I have an S06S flashed with this firmware, and when I turn on the kit, the motor starts going at a moderate speed and doesn't stop until it's turned off again.
I finished my experiments with the firmware because of the behavior of the thumb throttle that does not suit me, as I wrote above, and returned to the stock firmware (on another controller).
But today my friend got the built-in (for hailong battery case) controller board KTE-9S5-J5 from ebikekit.kom, and asked me to solder the connector for programming.
IMG_0053.JPG
Waterproof compound is very soft, and the contacts are easily released from it with an ordinary wooden toothpick.
The good news is that the firmware has been launched and is working on this controller. The power supply of the throttle hall sensor on this controller is higher than usual (4.9 volts) and the desired "Throttle min" value is 47-49, otherwise the motor slowly rotates when power on. This is normal and logical.
The bad news is that even with the “Throttle min” 100-180, the motor starts to rotate when turned on and makes 0.5 turns without load, or more than 30 on load, ( if you hold the motor with your hand when turned on). I am at a loss - why turn on PWM, if the value of "trottle min" guaranteed below the minimum?! Checked twice... No PAS or TQS connected - only thumb throttle (without throttle - same behavior). MXUS XF15 gear motor.
This happened on the latest firmware (masher branch).
Fortunately, I had in the archive firmware from October last year with the last commit "Added Tool for State translation stancecoke committed Oct 23, 2018" - and with this firmware, the motor makes only 1/16 turn at a very low power, then stop (or slightly hold it with your hand and the motor will not start to rotate) and does not rotate on an ebike installed in the wheel.
As I know - on the forum there are users of such controllers on the factory firmware, pay attention to this problem.
By the way, the correct value of the "Battery current Cal a" is 100 for this controller, as well as for 6Fet controllers.

geofft   1 kW

1 kW
Posts: 346
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 » Apr 06 2019 2:27pm

kkm wrote:
Apr 06 2019 12:40pm
gutyex wrote:
Mar 30 2019 10:51am
I have an S06S flashed with this firmware, and when I turn on the kit, the motor starts going at a moderate speed and doesn't stop until it's turned off again.
Whenever I've had this issue I've usually managed to fix it by making an adjustment to the zero point - this was using stancecoke's advice, I think there may be some reference to it many pages back in this topic.

About halfway down the file adc.c you'll find the line:-

ui16_current_cal_b -= 1;

...try changing the '1' at the end to a higher number maybe 2-4 or possibly even higher. This has always done the trick for me, your problem may be elsewhere of course, but possibly worth a try...
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR, LCD3, 48v 12s lipo.

User avatar
Xnyle   10 W

10 W
Posts: 73
Joined: Sep 03 2018 1:05pm

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

Post by Xnyle » Apr 06 2019 3:56pm

....I also set 'TQ calib' to 1500. For some reason this doesn't seem to restore from the .ini file and defaults to 1000.
Fixed.
...throttle - same behavior). MXUS XF15 gear motor.
XF15 probably not the problem, working fine with current FW and a 12FET controller (yes I know total overkill but it's what I had lying around :)
ui16_current_cal_b -= 1;
If this turns out to be the problem on 6FET controllers I should make that a configurable option as well.

Valopallo   100 mW

100 mW
Posts: 40
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 » Apr 09 2019 2:08am

I'm building a 2wd e-bike. For the rear motor I have S06S and for the front motor I have KT36ZWS. Both systems have individual batteries(36V) but share the signals of throttle, PAS and brakes. I'm using either two individual HC-05 bluetooth modules or just a single one with a manual dipswitch to change the RX and TX terminals of the module when needed and don't want to use any LCDs. This way I can operate both controllers by BluOSEC -app.

I also need to shut down the system's both controllers to reset the offroad mode fast and would like to use only one switch for both. I have already mounted the main switch that connects the blue and red of the s06s to the body of my battery holder and now I'm wondering could I use the same switch to power on/off both of the controllers?

TL;DR: Can I safely connect both reds and both blues of the controllers to the same manual switch or am I definitely going to burn something up if I do this?

Another question: KT36ZWS has this unknown red and black wire. If it has 5V output, could I use that safely to power the HC-05 module or should the power come always from the red terminal of the main harness with a DC-DC reg?

User avatar
Xnyle   10 W

10 W
Posts: 73
Joined: Sep 03 2018 1:05pm

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

Post by Xnyle » Apr 09 2019 5:02pm

No, please don't do that. It's clearly stated in the wiki as well. For every additional watt you pull out of the 5V rail the linear voltage regulator inside the controller has to !burn! ~5 watts (depending what kind of resistor the poor chinese guy had at hand botching together your very controller :) On top of that there is also a high chance you get all sorts of weird bugs because of voltage drops (I tried to isolate software bugs last year which turned out to be hardware bugs because I connected the BT module where it wasn't supposed to be connected.

Use a cheap xl7015 based buck converter and everything will be fine.

Valopallo   100 mW

100 mW
Posts: 40
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 » Apr 10 2019 10:54pm

Xnyle wrote:
Apr 09 2019 5:02pm
No, please don't do that. It's clearly stated in the wiki as well. For every additional watt you pull out of the 5V rail the linear voltage regulator inside the controller has to !burn! ~5 watts (depending what kind of resistor the poor chinese guy had at hand botching together your very controller :) On top of that there is also a high chance you get all sorts of weird bugs because of voltage drops (I tried to isolate software bugs last year which turned out to be hardware bugs because I connected the BT module where it wasn't supposed to be connected.

Use a cheap xl7015 based buck converter and everything will be fine.
Ok. I have a spare LM2596 module laying around for the bluetooth so that's not a big problem. How about my other question; is it ok to connect the reds and blues of both controllers to the same on/off switch? Would that mean that the red 36V rails become parallel and don't add up the voltage or do they? And if the blue wires are only getting the 36V signal it would not matter where it comes from, right?

Valopallo   100 mW

100 mW
Posts: 40
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 » Apr 11 2019 1:54am

How can I set throttle to 0km/h when NOT in Offroad -mode? The bluosec -app's minimum is 1km/h. Update maybe?

User avatar
Xnyle   10 W

10 W
Posts: 73
Joined: Sep 03 2018 1:05pm

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

Post by Xnyle » Apr 11 2019 3:19am

No update, technical restriction on how "not set" == 0 is handled in eeprom settings. I see no practical use case where 1km/h is a problem that would justify a complete refactoring.

.. although 255 == "not set" might have been a better choice, but as written, no incentive to change that now that everything is working.
Last edited by Xnyle on Apr 11 2019 4:01am, edited 2 times in total.

Valopallo   100 mW

100 mW
Posts: 40
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 » Apr 11 2019 3:24am

Xnyle wrote:
Apr 11 2019 3:19am
No update, technical restriction on how "not set" == 0 is handled in eeprom settings. I see no practical use case where 1km/h is a problem that would justify a complete refactoring.
So I have to use the Java tool and put 0 to the "Without PAS" -section, flash again and I'm set?

vulcanears   1 mW

1 mW
Posts: 18
Joined: Mar 01 2019 4:11am

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

Post by vulcanears » Apr 11 2019 3:44am

So which one of the torque sensors on Aliexpress would you recommend for use with the Open Source controller? The Sempu T4? The Eunorau type?

thx in advance

User avatar
Xnyle   10 W

10 W
Posts: 73
Joined: Sep 03 2018 1:05pm

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

Post by Xnyle » Apr 11 2019 3:56am

BTW in Torquesensor mode 0 will cause a division by zero, as the Java tool doesn't check anything anyway, it's your responsibility not to enter 0 there :)

Code: Select all

float_temp *= (1 - (float) ui16_virtual_erps_speed / 2 / (float) (ui16_speed_kph_to_erps_ratio * ((float) ui8_speedlimit_kph))); //ramp down linear with speed. Risk: Value is getting negative if speed>2*speedlimit
Apart from that It currently doesn't really matter anyway, as power gets cut off only after you reach the limit, so power is applied at first anyway.

See latest commit for a workaround

geofft   1 kW

1 kW
Posts: 346
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 » Apr 11 2019 10:07am

vulcanears wrote:
Apr 11 2019 3:44am
So which one of the torque sensors on Aliexpress would you recommend for use with the Open Source controller? The Sempu T4? The Eunorau type?

thx in advance
I'm using the Sempu T4 with stancecoke's firmware, this works just fine for me. Don't bother with the T2 type, these give an output with any pressure on the pedals, this gets to be annoying very quickly.... :shock:
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR, LCD3, 48v 12s lipo.

User avatar
stancecoke   100 kW

100 kW
Posts: 1003
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 » Apr 11 2019 10:20am

Yes, the Sempu T4 is the better choice. My experience with the Bafang sensor (eunorau) is very bad, see the german forum:

https://www.pedelecforum.de/forum/index ... sor.56636/

regards
stancecoke

geofft   1 kW

1 kW
Posts: 346
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 » Apr 13 2019 1:43pm

I've just tried out the current github download, maybe I should mention that there seems to be some problem.

Some of the 'Proven settings' seem to build and flash ok, others don't. Neither of the proven settings provided by myself will flash and there appears to be an error during the build that will make more sense to you than it does to me... :wink:

I've attached the cmd dump.

Edit to add: I'm using SDCC3.7.2 - I can see there is a newer version, maybe this is my problem?
Attachments
cmd dump 13-4-19.txt
(5.29 KiB) Downloaded 23 times
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR, LCD3, 48v 12s lipo.

Post Reply