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

Electric Motors and Controllers
Valopallo   10 mW

10 mW
Posts: 29
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 » Nov 10 2018 5:36pm

Aye! <3 Finally, everything works, except I cannot reverse PAS direction neither I can't turn ON the offroad mode... Would it be cool to have offroad enabled from the BluOSEC app somehow? Is there?

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 » Nov 11 2018 2:30pm

Valopallo wrote:
Nov 10 2018 5:36pm
Aye! <3 Finally, everything works, except I cannot reverse PAS direction neither I can't turn ON the offroad mode... Would it be cool to have offroad enabled from the BluOSEC app somehow? Is there?
I've just added some more information how to determine the right value for PAS threshold in the wiki page:
PAS threshold: Threshold for direction detection from the PAS signal. The value should be the arithmetic mean of the reciprocal of the duty cycle of the PAS-signal during forward and reverse rotation. The appropriate value can be determined by trial and error or by looking at the displayed values at turning the pedals forwards and backwards in "Diagnostics" mode, or look at the value of PAS fraction in the BluOSEC app. Set PAS threshold to a value somewhere in the middle between the value at pedaling forwards and the value at pedaling in reverse. The preset 1.7 was determined for a simple PAS with 8 magnets.
If you found the right value for PAS threshold, the function PAS inverted will work properly.

For activating the offroad mode, use the break lever. You have to find the right rythm according to your settings. This needs some training.

regards
stancecoke

tomtom50   10 W

10 W
Posts: 99
Joined: Jun 18 2018 10:09am

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

Post by tomtom50 » Nov 12 2018 12:29am

Xnyle wrote:
Nov 10 2018 11:04am
Should I expect the KT open source firmware will work with these controllers?
Second one yes, first one, I doubt it, don't see a STM8 on there.

Edit: Second one only limited support for the ZWS type, @see FAQ here:
https://github.com/stancecoke/BMSBatter ... mware/wiki
Thanks.
Looking at PSWPower (they list model numbers) SVP correlates to sine wave, ZWS correlates to square wave. So maybe the integrated controlled isn't sine even though it is labeled that way...

I guess I will see when it arrives. Then I can take a better photo.

j bjork   10 mW

10 mW
Posts: 25
Joined: Aug 31 2018 3:01pm

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

Post by j bjork » Nov 13 2018 2:50am

Hi, thank you so much for sharing your work like this :)
I have read the entire thread, but it has been a while since then.

I have a KT36/48SVPRK-SLS02G (18fet controller)and a LCD3 display. I have just started using it, so I am not sure if I have found all the functions yet.

The question is if I should change to your fw instead this winter. I don´t have any programming skills, so I won´t be able to make changes to fit my needs.

I have not really understood what works and what does´nt work on the LCD3?
Do I get all the speed, distance, W, V etc.?

As I have understood the lcd will not be able to change settings in the controller. You have the app instead. Will I be able to have both the bluetooth module and the LCD3 connected at the same time?

How about cruise control, is that still precent? Ither from LCD3 or hard wired on the controller?

And light switch, when I turn on the lights on the LCD3 I get a signal from the controller for the lights on the bike. Is that still there?

I have a bunch of questions, but I think I will stop here for now :wink:

j bjork   10 mW

10 mW
Posts: 25
Joined: Aug 31 2018 3:01pm

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

Post by j bjork » Nov 13 2018 3:07am

I really like the possibility to program current and everything on your fw.

The regen is something I am after too.

And the legal mode, I only have offroad mode now..

It seems like you have better efficiency too? With FOC

I thought I should list some of the things that make me want to use your fw too :wink:

User avatar
Xnyle   10 mW

10 mW
Posts: 31
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 » Nov 13 2018 4:58am

As I have understood the lcd will not be able to change settings in the controller.
I already implemented everything so that all p and c parameters could be mapped to some setting. Except for speed limit nothing is wired atm though. You would have to get involved yourself.
You have the app instead. Will I be able to have both the bluetooth module and the LCD3 connected at the same time?
No. But you could just throw away the LCD ;-)
How about cruise control, is that still precent? Ither from LCD3 or hard wired on the controller?
Its there somewhere in the code, but currently no way to enable/configure it on the fly (i guess)
And light switch, when I turn on the lights on the LCD3 I get a signal from the controller for the lights on the bike. Is that still there?
Same.

All the points you mention would result in relatively small changes/completions to the app or lcd communication but if you don't want to complete that yourself,...

j bjork   10 mW

10 mW
Posts: 25
Joined: Aug 31 2018 3:01pm

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

Post by j bjork » Nov 13 2018 6:08am

Alright, thank you.

So as I understand it, everything on the display works. Exept P and C settings, but as I can program them with computer or phone they are not needed.

Wait, change assist level. Does that work?

I like the simplicity of the display, it is there and works when I turn on the bike. If I want to make some changes, or
fault finding the bluetooth app will be very suitable.

To loose cruise control and light control would be bad though.

I think my chances to change/write code to make it work is low. I tried to program an arduino ones, but gave up.

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 » Nov 14 2018 12:09pm

j bjork wrote:
Nov 13 2018 6:08am
Wait, change assist level. Does that work?
Yes, that works.
j bjork wrote:
Nov 13 2018 6:08am
To loose cruise control and light control would be bad though.
both features only need very little changes in the code.

regards
stancecoke

j bjork   10 mW

10 mW
Posts: 25
Joined: Aug 31 2018 3:01pm

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

Post by j bjork » Nov 16 2018 2:38pm

I am still very interested in trying the fw, especially the cruise control would be nice to have though. The app looks nice, I hope I can get an old phone working and try to use it on.
I have to get the parts to be able to program before I can get much furter though.

I know there was some talk about getting the controller to run on higher voltage earlier, but I don´t know if it was settled what can be done. In the fw it seems possible to set any number of serial sells I want, or is there any limitations there?

I guess I should be able to at least run 14s with the controller with stock hardware?
It would be nice to be able to modify it to run 20s, but maby it is easier to get a controller for 20s in that case..

Another thing, I saw that I can use x4 for variable regen, that sounds nice. But it also says the same x4 for temp sensor in the motor. But I think there is already a wire for temp sensor, there is an extra wire in the harness for the hall sensors.

I liked the possibility to have regen when pedaling backwards, but that maby was in casinos fw?

tomtom50   10 W

10 W
Posts: 99
Joined: Jun 18 2018 10:09am

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

Post by tomtom50 » Nov 20 2018 1:19am

Integrated 9 mosfet KT sine controller.

I bought it from topbikekit.com

http://www.topbikekit.com/kt-36v48v-9mo ... p-712.html

They said it was for big Hailong case 65 cells, I took a risk, bought it, and it perfectly fits the 52 cell Hailong case UPP battery I have.

Board is marked KTE-9S5-J5
KTE-9S5-J5.jpg
STM8 needs a different angle to see
STM8.jpg
Since it is labeled 9S I think it probably is sine wave, but I personally cannot tell from the chips. I recall sine controllers have phase current sensors? Can anyone tell?

From what I am seeing KT does make 9 mosfet sine controllers, although they seem uncommon.

The packaging is great. Waterproof connectors, disappears inside the battery, board seems well sealed, cooling should be very good with the heatsink in the wind and frame attached.
New Generation of Battery Base.jpg

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 » Nov 20 2018 4:37am

tomtom50 wrote:
Nov 20 2018 1:19am
Since it is labeled 9S I think it probably is sine wave, but I personally cannot tell from the chips. I recall sine controllers have phase current sensors? Can anyone tell?
There is the phase B current sensor, right next to the green phase wire. You can't do classical FOC with this controller, but sinusodial SVM with a simplified advance angle adjustment is possible.

The circuit seems to be a little different to the known 6/12/18 FET controllers, as there is 14 pin IC on the board, that I have not seen before. Can you identify it? Is the label readable? I guess it's a op-amp?!

regards
stancecoke

tomtom50   10 W

10 W
Posts: 99
Joined: Jun 18 2018 10:09am

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

Post by tomtom50 » Nov 20 2018 10:27am

The board is gooped with water sealant. I can't read anything on the 14-pin IC
14-pin IC cropped.jpg

Blik86   10 µW

10 µW
Posts: 5
Joined: Aug 06 2018 12:03pm

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

Post by Blik86 » Nov 20 2018 10:39am

tomtom50 wrote:
Nov 20 2018 10:27am
14-pin IC
Attachments
14-pin IC.jpg

tomtom50   10 W

10 W
Posts: 99
Joined: Jun 18 2018 10:09am

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

Post by tomtom50 » Nov 20 2018 12:06pm

With a flashlight and just the right angle I can read the IC tags. Let me know if you want me to take another look.
I'm not an EE or electronics tech so I don't know that well what to look for.
KTE-9S5-J5 ANNOTATED.jpg
I'm interested in your thoughts. Do you know the function of the 78MOS or the 14-pin IC?
Is the X4 socket what would be used for an analog input for a torque cell?

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 » Nov 20 2018 12:45pm

tomtom50 wrote:
Nov 20 2018 12:06pm
I'm interested in your thoughts. Do you know the function of the 78MOS or the 14-pin IC?
The 78M05 is the 5V regulator and the 324 is as guessed a four channel op-amp. But I don't know, why there are 4 op-amps needed :confused:
tomtom50 wrote:
Nov 20 2018 12:06pm
Is the X4 socket what would be used for an analog input for a torque cell?
There are different possibilities. If X4 has 5V by default, then it's for a motor temperature sensor. If it has 0V then it might be usable for a torque sensor.

In our open firmware the torque sensor has to be connected to the throttle input by default, but it can be mapped to X4 quite easily.

regards
stancecoke

User avatar
Xnyle   10 mW

10 mW
Posts: 31
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 » Nov 21 2018 6:04am

Wow, this thing really has a STM8 on it and also a flash connector.

Thats actually a very good alternative to the bulky Controllers that need an extra bag. Cooling should be decent as well as the airflow directly hits the underside.

If this can output ~20A over a longer period of time without blowing up those tiny fets... might buy one as well.

Blik86   10 µW

10 µW
Posts: 5
Joined: Aug 06 2018 12:03pm

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

Post by Blik86 » Nov 21 2018 11:04am

Xnyle wrote:
Nov 21 2018 6:04am
If this can output ~20A over a longer period of time without blowing up those tiny fets...
I have a similar controller with 9 * K150e09NE. At the start, turns off the motor when the battery current is 20A. In motion with a battery current of approximately 25A.
Phase currents up to 80A.
10mV =1A
Attachments
battery blocked wheel.jpg
battery blocked wheel.jpg (92.14 KiB) Viewed 407 times
phase blocked wheel.jpg
phase blocked wheel.jpg (86.54 KiB) Viewed 407 times
battary run wheel.jpg
battary run wheel.jpg (94.42 KiB) Viewed 407 times
phase run wheel.jpg
phase run wheel.jpg (93.89 KiB) Viewed 407 times

Nixunen   100 µW

100 µW
Posts: 9
Joined: Aug 27 2018 11:54am

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

Post by Nixunen » Nov 21 2018 12:06pm

Is there any possibility to add field weakening in kt controllers, using OpenSource firmware ? Or are s/kt controller even capable of such thing, or is there missing some important hw parts etc?

Valopallo   10 mW

10 mW
Posts: 29
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 » Nov 21 2018 2:21pm

stancecoke wrote:
Nov 11 2018 2:30pm
Valopallo wrote:
Nov 10 2018 5:36pm
Aye! <3 Finally, everything works, except I cannot reverse PAS direction neither I can't turn ON the offroad mode... Would it be cool to have offroad enabled from the BluOSEC app somehow? Is there?
I've just added some more information how to determine the right value for PAS threshold in the wiki page:
PAS threshold: Threshold for direction detection from the PAS signal. The value should be the arithmetic mean of the reciprocal of the duty cycle of the PAS-signal during forward and reverse rotation. The appropriate value can be determined by trial and error or by looking at the displayed values at turning the pedals forwards and backwards in "Diagnostics" mode, or look at the value of PAS fraction in the BluOSEC app. Set PAS threshold to a value somewhere in the middle between the value at pedaling forwards and the value at pedaling in reverse. The preset 1.7 was determined for a simple PAS with 8 magnets.
If you found the right value for PAS threshold, the function PAS inverted will work properly.
regards
stancecoke
If the PAS inverted function is set as OFF and I pedal backwards, I get some PAS fraction values in BluOSEC app between 7.7-9.5 but I haven't been able to get forward pedaling PAS fraction values yet. So, should I continue to try every possible PAS threshold value one by one, because that surely means I need to remember to switch the PAS inverted function as ON. :P

tomtom50   10 W

10 W
Posts: 99
Joined: Jun 18 2018 10:09am

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

Post by tomtom50 » Nov 22 2018 12:10am

Xnyle wrote:
Nov 21 2018 6:04am
Wow, this thing really has a STM8 on it and also a flash connector.

Thats actually a very good alternative to the bulky Controllers that need an extra bag. Cooling should be decent as well as the airflow directly hits the underside.

If this can output ~20A over a longer period of time without blowing up those tiny fets... might buy one as well.
It has a flat mounting surface that is bolted down. That gives the option of using aluminum "U" channel as a heat sink (the U straddles the frame tube. With all that in the wind it should cool very well, and perhaps could be pushed hard.

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 » Nov 23 2018 12:39pm

Nixunen wrote:
Nov 21 2018 12:06pm
Is there any possibility to add field weakening in kt controllers, using OpenSource firmware ? Or are s/kt controller even capable of such thing, or is there missing some important hw parts etc?
That's very easy, you just have to choose a higher advance angle... :shock:

regards
stancecoke

Valopallo   10 mW

10 mW
Posts: 29
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 » Nov 25 2018 5:26am

stancecoke wrote:
Nov 11 2018 2:30pm

PAS threshold: Threshold for direction detection from the PAS signal. The value should be the arithmetic mean of the reciprocal of the duty cycle of the PAS-signal during forward and reverse rotation. The appropriate value can be determined by trial and error or by looking at the displayed values at turning the pedals forwards and backwards in "Diagnostics" mode, or look at the value of PAS fraction in the BluOSEC app. Set PAS threshold to a value somewhere in the middle between the value at pedaling forwards and the value at pedaling in reverse. The preset 1.7 was determined for a simple PAS with 8 magnets.
If you found the right value for PAS threshold, the function PAS inverted will work properly.
regards
stancecoke
I literally tried every possible PAS threshold setting at the BluOSEC app with PAS inverted function set as ON. The wheel does not spin with any of them.

When the PAS inverted function is set as OFF, in most PAS threshold settings the wheel spins when I rotate the PAS backwards and I also get a reading at PAS fraction.

There's no PAS fraction readings when I rotate the crank forwards as I want it to be.

I don't know if this is relevant but the BluOSEC app shuts down the settings with some PAS threshold values and I needed to flash OSEC firmware to be able to change PAS threshold once again.


Then, I changed the firmware to diagnostics mode and edited the main.c. I just pasted the line in the tutorial to the main.c file and saved the file. I tried flashing, but the ST-link V2 lights didn't blink and also some errors of missing files ends the flashing process. So I guess no success.

I tried the BlueTerm app but there are no readings at all even though it's connected correctly to HC-05.

What can I do? Could you help me to edit the main.c correctly to get to flash the firmware with diagnostics and to get readings for further examination. Or can some other incorrect settings in OSEC affect the PAS fraction values not showing up?

System info:
36V. 10S. 10.4Ah Battery. 20A limit
S06S controller
Direct drive rear hub motor. 46 poles.
BluOSEC app
HC-05 with DC-DC reg.
Brake
Throttle
PAS

gutyex   1 µW

1 µW
Posts: 3
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 » Nov 25 2018 9:12am

I've got an old S06S Controller which I want to test this firmware on.
I ordered an ST-Link V2 clone from e-bay, but the labelling on the pins is different to what I see in the instructions online.
The pins I have are:
GND | TCK
RXD | RST
TXD | 3V3
5V0 | N.C.
3V3 | N.C.

GND, RST, and 5V0 are all fairly obvious to match, but which one should I use for SWIM?
Or have I got the wrong thing?

This is the listing I bought from:
https://www.ebay.co.uk/itm/STC-microcon ... 2761388689

The first picture of 6 different coloured sticks shows what I thought I was getting, the rest of the pictures show what I actually got.

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 » Nov 25 2018 10:30am

Valopallo wrote:
Nov 25 2018 5:26am

What can I do?
It is obvious that you are using a PAS with an internal direction detection. PAS pulses are only generated, when the pedals are turning in the right direction.
Just turn your PAS disc on the bottom bracket shaft, so that the arrow on it points to the opposite spin direction. Then it will work. :wink:
gutyex wrote:
Nov 25 2018 9:12am
I ordered an ST-Link V2 clone from e-bay, but the labelling on the pins is different to what I see in the instructions online
This is not a STLink, even if the first picture of the offer shows a bundle of STLinks.
Your item in an USB to TLL converter.
FAKE_ST-LINK.JPG
FAKE_ST-LINK.JPG (15.9 KiB) Viewed 256 times

regards
stancecoke

Valopallo   10 mW

10 mW
Posts: 29
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 » Nov 25 2018 12:15pm

stancecoke wrote:
Nov 25 2018 10:30am
Valopallo wrote:
Nov 25 2018 5:26am

What can I do?
It is obvious that you are using a PAS with an internal direction detection. PAS pulses are only generated, when the pedals are turning in the right direction.
Just turn your PAS disc on the bottom bracket shaft, so that the arrow on it points to the opposite spin direction. Then it will work. :wink:
Ok. I flipped the disk, but the situation remains the same :(
The little red led at the PAS signal sensor is blinking only when rotating backwards and also BluOSEC's pasActive and pasFraction gives readings only when rotating backwards. When PAS Inverted function is switched ON, only backward rotation gives reading on PAS fraction but then there's no pasActive reading anymore. And still, there's no activity on either of those when rotating forwards.

This is the PAS I'm using;
s-l300.png
s-l300.png (32.25 KiB) Viewed 248 times
I guess I have to make an inverted clone of the metal part that holds the sensor unit, so that I can flip it, but I think this problem might occur with somebody else's setup so it would be important to figure this out in BluOSEC if possible.

Post Reply