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

Electric Motors and Controllers
cnrd   100 mW

100 mW
Posts: 36
Joined: Apr 12 2019 5:47am

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

Post by cnrd » Mar 31 2020 3:42am

I'm sorry this is a bit OT, but this seem to be the place to ask about KT hardware and software :wink:

Does anyone know what the 3 unmarked connectors on the left could be for (2 of them are connected in the picture)?
Image

obcd   100 W

100 W
Posts: 157
Joined: Jul 16 2019 3:45pm

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

Post by obcd » Mar 31 2020 9:15am

Some controllers have a 36V output for a headlight / backlight.
It's usually a small additional pcb in the controller that has the switching fet for that output.
Some controllers have an auto sensing of the hall sensor wires.
In such case you usually have to disconnect a link for the auto detect (learning) mode to become active.
It's also possible that the link is there to disable / enable the street legal speed limit.

Slipy   1 mW

1 mW
Posts: 11
Joined: Mar 19 2020 6:22pm

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

Post by Slipy » Apr 06 2020 9:38am

Hi, I started the controller but there was a problem, the motor does not stop, and it spins very slowly, when you press the brake, spin further, but does not respond to the throttle

obcd   100 W

100 W
Posts: 157
Joined: Jul 16 2019 3:45pm

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

Post by obcd » Apr 06 2020 11:06am

Disconnect the throttle plug and see if it behaves identical with the throttle disconnected.
Measure the voltage between the blue and black throttle wire with and without full throttle.
Check if there isn't a walk assist that somehow got enabled.

Slipy   1 mW

1 mW
Posts: 11
Joined: Mar 19 2020 6:22pm

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

Post by Slipy » Apr 06 2020 8:09pm

Nothing interesting, all ok, but problem is still

User avatar
stancecoke   100 kW

100 kW
Posts: 1202
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 07 2020 1:32am

Slipy wrote:
Mar 26 2020 9:11pm
Hi, i made own pcb using s06s KingQeen.
Slipy wrote:
Apr 06 2020 9:38am
Hi, I started the controller but there was a problem, the motor does not stop, and it spins very slowly, when you press the brake, spin further, but does not respond to the throttle
Are you still talking about your homebrewed controller?
Hm, a remote diagnosis is always difficult. Can you discribe your setup. Which components are connected, are you sure, that the componets are working in principle, which settings and which SDCC version are you using? ....

I recommend to flash the controller to diagnostics or OSEC mode and look at the raw values of the peripherals and the controller state variable.

regards
stancecoke

Slipy   1 mW

1 mW
Posts: 11
Joined: Mar 19 2020 6:22pm

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

Post by Slipy » Apr 10 2020 2:30pm

Which setting of timer for ir2101
Original :
TIM1_OCPOLARITY_HIGH,
TIM1_OCNPOLARITY_LOW,
TIM1_OCIDLESTATE_RESET,
TIM1_OCNIDLESTATE_SET)
I change
TIM1_OCPOLARITY_HIGH,
TIM1_OCNPOLARITY_HIGH,
TIM1_OCIDLESTATE_RESET,
TIM1_OCNIDLESTATE_RESET)

But I'm not sure about the TIM1_OCNIDLESTATE_RESET or SET
Should a motor without a throttle stick brake all the time? I apologize for the anxiety, I really want to do it, since it is very expensive to buy
THANK YOU!!

Sanyi1221   1 µW

1 µW
Posts: 2
Joined: Mar 21 2020 12:36pm

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

Post by Sanyi1221 » Apr 10 2020 4:58pm

Hi, I want to ask for a little help I have a controller, KT-lcd 8 display and 48v 1500w motor, the phenomenon that soon enough to disable the controller, I think the battery is weak I attach pictures, 48v 12ah battery
Thank you!
KT36/48 SVPRK-SLSO2G
battery :Ncr 18650B Panasonic 13s3p 48v /12ah
I would still be wondering how much voltage the controller 84 could withstand, it would definitely go much faster. Too bad there is no 3 speed function in it that could increase the speed by default. Can I really get a lot more out of the controller if I put the new software on it? Although it works very well with the kt lcd 8 display. Could the BMS function be turned off? I don't think it's a good idea to go as long as there are amps in the battery, don't turn it off ☺️😁🤪😃😛

Sanyi1221   1 µW

1 µW
Posts: 2
Joined: Mar 21 2020 12:36pm

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

Post by Sanyi1221 » Apr 12 2020 11:16am

cnrd wrote:
Mar 31 2020 3:42am
I'm sorry this is a bit OT, but this seem to be the place to ask about KT hardware and software :wink:

Does anyone know what the 3 unmarked connectors on the left could be for (2 of them are connected in the picture)?
Image
Hi what is plugged in is the cruise feature, I pulled it apart I don't use it. The other is lamp lighting

User avatar
Valopallo   10 W

10 W
Posts: 76
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 13 2020 9:06am

BluOSEC seems to act weird.
I changed my battery Voltage Min Value and it returns 0, not 116 what I intended. Also Battery Voltage Max changed on it's own to 0 because of this (from 153). I changed the battery voltage calibration to 70 (from 50) and added new values accordingly to min and max just to try it out but the same behaviour remains. Only Battery voltage calibration remains where I changed it(70) recently. Also DC static zero setting remains ON all the time(I haven't changed that at all). Do I have to flash again with javatool to be sure the values are correct? I guess it's not safe to drive like this, altough I cannot tell if the DC static zero has been like that all the time :shock:

EDIT: I went to take a test lap(even though it's not feasible to do so with DC static zero = ON) and I didn't notice anything funny even though battery voltage limits are both 0 and dc static zero is ON. There are also several other settings that do not react to whatever I try to do at BluOSEC. They are not greyed out but the switch slides to the left(OFF) but after a short while the slider moves back to right (ON). How can my bike still work normally? It seems the changes I try to make at bluOSEC has no effect and that's weird because I can still change some variables normally like the cadence and speedlimits etc... If I remember correctly I've had similar misbehavior from BluOSEC when some core settings have been wrong but this time I haven't set anything different than the battery voltage min value. It seems like the connection between controller and BluOSEC gets corrupted somehow and I believe I have to flash again to make it work. That would be a bummer because I just finished my casings and insulation work and I need to start all over from the start. Nothing new with my projects though
BluOSEC@36V|AWD|2xS06S|15A rear DD|10A front geared|Hardtail|Tunturi

davideserin   1 W

1 W
Posts: 62
Joined: Feb 01 2016 7:57am

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

Post by davideserin » Apr 14 2020 3:56am

Hi, i'm having an issue with my controller powering down randomly while in use. I'm using the x4throttle branch with a KT36ZWSRTB-SJT02LB controller.

Does anyone know if it's advisable to power my DCDC (used to power my Sempu torque sensor 12v and my BT module 5v) from the blue cable of the LCD display?

I've used this cable since I use the screen to turn on my controller and also because the screen automatically turns off after a short while. This prevents my battery from being drained by the controller or the DCDC i added.

I'm wondering if me drawing current from this blue cable is causing the issue. My next test is to use a transistor to open the gate and take the positive from a more direct source to the battery +ve.

If anyone has any other good ideas to power things like DCDC or lights from the controller that would be great (so they switch on/off with the controller). I've seen some controllers have dedicated light outputs, but mine is missing this.

Thanks,
David.

User avatar
Valopallo   10 W

10 W
Posts: 76
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 14 2020 5:17am

EDIT: Irrelevant to the matter
Last edited by Valopallo on Apr 14 2020 8:39am, edited 2 times in total.
BluOSEC@36V|AWD|2xS06S|15A rear DD|10A front geared|Hardtail|Tunturi

User avatar
Dani85   1 mW

1 mW
Posts: 18
Joined: Oct 23 2014 1:03pm

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

Post by Dani85 » Apr 14 2020 8:12am

Hi everyone and congratulations at casainho and stancecoke for the firmware development, you have shared an great job. :D
I tried to upload the fw on my s06s BL controller
I am using controller without display and I have also tried bluosec app but it crashes at every start (android 7) but this is not my main problem.
the main problem is when the motor stops the regen keeps always enable and if I start pedaling the controller regenerates without my input.(I tried also a directdrive hub)
The brake switch works properly.
the controller draws 120mA with the motor stopped. if I turn on the controller while the brake lever
is squeezed the current is around 0.05mA but this condition does not return if then I release the lever and sqeeze it again.
At the moment I am using 30v power supply, throttle , no display, no pas and disassembled bafang swxk motor (only stator and rotor to work on the table).
I also try analogic regeneration with another throttle to x4 pin input and work fine but the motor is everithing in regen status when is stopped (hard to rotate).
Where am I doing wrong?
These are my parameters;
Attachments
osec.JPG
osec.JPG (170.8 KiB) Viewed 636 times
hterm.JPG
hterm.JPG (100.46 KiB) Viewed 636 times

geofft   1 kW

1 kW
Posts: 354
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 14 2020 8:58am

Does anyone know if it's advisable to power my DCDC (used to power my Sempu torque sensor 12v and my BT module 5v) from the blue cable of the LCD display?
You'll find the Sempu tqsr's are fairly power hungry devices. I originally tried powering mine by tapping the 15v internal controller supply, this kinda worked but was giving random shutdowns and mosfet failures, usually when applying heavy pressure to the pedals.

Eventually I realised this was overloading the controller supply, so I then powered the Sempu from the main battery feed and the problems stopped. So it's probably fair to say that the Sempu draws a lot of current and you need a robust supply.
Last edited by geofft on Apr 14 2020 11:35am, edited 1 time in total.
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR, LCD3, 48v 12s lipo.

User avatar
stancecoke   100 kW

100 kW
Posts: 1202
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 14 2020 9:57am

Dani85 wrote:
Apr 14 2020 8:12am
but the motor is everithing in regen status when is stopped (hard to rotate)
First, welcome to the project :-)! Please do not test the standstill resistance with the motor on the desk (and a Lab supply, that doesn't allow negative currents). The power control needs to "see" a significant delta current to control the current to zero.
You will recognize the effect, if you push your bike with a direct drive. You will feel a small resistance at the start, then the control loop stars working and the resistance disappears.

regards
stancecoke.

User avatar
Dani85   1 mW

1 mW
Posts: 18
Joined: Oct 23 2014 1:03pm

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

Post by Dani85 » Apr 14 2020 2:21pm

stancecoke wrote:
Apr 14 2020 9:57am
Dani85 wrote:
Apr 14 2020 8:12am
but the motor is everithing in regen status when is stopped (hard to rotate)
First, welcome to the project :-)! Please do not test the standstill resistance with the motor on the desk (and a Lab supply, that doesn't allow negative currents). The power control needs to "see" a significant delta current to control the current to zero.
You will recognize the effect, if you push your bike with a direct drive. You will feel a small resistance at the start, then the control loop stars working and the resistance disappears.

regards
stancecoke.

Thanks to you stancecoke for the quick reply.
I tried to use the controller on the bike with 36v battery and it happens as you say. After a ride the resistance disappears.
Regard the current absorption of the controller, 120mA seems to me many when the motor is stopped.
R58 heats up a lot more than usual. It's normal?

Slipy   1 mW

1 mW
Posts: 11
Joined: Mar 19 2020 6:22pm

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

Post by Slipy » Apr 14 2020 7:29pm

R58 heats up a lot more than usual. It's normal?
if this resistor same as on KingQween scheme 3k i think you can to unsolder (i use without this resistor)

User avatar
stancecoke   100 kW

100 kW
Posts: 1202
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 15 2020 12:49am

Dani85 wrote:
Apr 14 2020 2:21pm
120mA seems to me many when the motor is stopped.
We never switch off the PWM, therefore the controller heats up a little more with the motor in standstill.
You can try the experimental setting "PWM off @ coast" but you have to adjust a motor specific parameter (flt_s_motor_constant) to avoid current peaks with a direct drive.

regards
stancecoke

User avatar
Dani85   1 mW

1 mW
Posts: 18
Joined: Oct 23 2014 1:03pm

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

Post by Dani85 » Apr 15 2020 4:42am

Slipy wrote:
Apr 14 2020 7:29pm
R58 heats up a lot more than usual. It's normal?
if this resistor same as on KingQween scheme 3k i think you can to unsolder (i use without this resistor)

I don't think they are the same.
R58 in my s06 controller is the big resistor before the lm317..

User avatar
Dani85   1 mW

1 mW
Posts: 18
Joined: Oct 23 2014 1:03pm

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

Post by Dani85 » Apr 15 2020 5:29am

stancecoke wrote:
Apr 15 2020 12:49am
Dani85 wrote:
Apr 14 2020 2:21pm
120mA seems to me many when the motor is stopped.
We never switch off the PWM, therefore the controller heats up a little more with the motor in standstill.
You can try the experimental setting "PWM off @ coast" but you have to adjust a motor specific parameter (flt_s_motor_constant) to avoid current peaks with a direct drive.

regards
stancecoke
I hadn't tried pwm off because on the wiki it says "not implemented"..
Now I have try this option and the draw current has dropped to 0.06mA and there is no friction ..
The important thing for me was to understand that there was no current draws by short circuit or another things.
Pwm on that's fine for me. Thank's Stancecoke for your help. :thumb:

AlexDaniel   1 µW

1 µW
Posts: 3
Joined: Oct 18 2019 8:37pm

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

Post by AlexDaniel » Apr 15 2020 1:57pm

Hello! I hope this is not too off-topic. Earlier in this thread there was a mention of a similar KZQW22A controller, which I also have. The most annoying thing about that controller is that there is a hard power cutoff after 25km/h which makes the riding experience horrible. That is, there's no PID or anything like that to keep the speed at 25km/h, it just stops assisting altogether once you reach the speed. Thanks to the help from Aleksandr Boldin we managed to reverse-engineer the firmware and remove the speed limit (in my country there's no speed limit for 250W bikes anyway). The bicycle didn't get significantly faster (it can only reach around 30km/h without the software limit), but the riding experience is much better now. I've been using it for a few months without any issues. :P

I'm attaching the modified firmware which you can flash if you have the same controller with the same firmware. Original firmware is also attached.

Here are some helpful notes:

Programming connector:

Code: Select all

black – GND
yellow – SWIM
blue – Reset
red – maybe VCC, you don't need it
To read data from the microcontroller (assuming you use stlink v2):

Code: Select all

./stm8flash -c stlinkv2 -p stm8s105s4t6c -s flash  -r KZQW22A-flash.bin
./stm8flash -c stlinkv2 -p stm8s105s4t6c -s eeprom -r KZQW22A-eeprom.bin
./stm8flash -c stlinkv2 -p stm8s105s4t6c -s opt    -r KZQW22A-opt.bin
To write the firmware:

Code: Select all

./stm8flash -c stlinkv2 -p stm8s105s4t6c -s flash -w KZQW22A-flash-hacked-double-speed-limit.bin
Good luck!
Attachments
KZQW22A-flash-hacked-double-speed-limit.zip
(11.86 KiB) Downloaded 4 times
Last edited by AlexDaniel on May 18 2020 7:23pm, edited 2 times in total.

User avatar
stancecoke   100 kW

100 kW
Posts: 1202
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 16 2020 1:20am

AlexDaniel wrote:
Apr 15 2020 1:57pm
we managed to reverse-engineer the firmware and remove the speed limit
congratulations :-)

So the speedlimit is really hardcoded and not an editable parameter in the EEPROM?!

regards
stancecoke

AlexDaniel   1 µW

1 µW
Posts: 3
Joined: Oct 18 2019 8:37pm

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

Post by AlexDaniel » Apr 16 2020 8:34am

stancecoke wrote:
Apr 16 2020 1:20am
AlexDaniel wrote:
Apr 15 2020 1:57pm
we managed to reverse-engineer the firmware and remove the speed limit
congratulations :-)

So the speedlimit is really hardcoded and not an editable parameter in the EEPROM?!

regards
stancecoke
Yes, the speed limit itself has nothing to do with EEPROM. It simply checks some variable (which we think represents speed) against a hardcoded value, and if it's larger it reduces the PWM duty cycle to either zero or some very low value (I don't remember now). We did look at the processing of EEPROM data for a bit, but we didn't get much further than the discussion earlier in this thread (or somewhere on this forum). Our goal was just to remove the speed limit, so we didn't see the need to investigate more into EEPROM processing.

Slipy   1 mW

1 mW
Posts: 11
Joined: Mar 19 2020 6:22pm

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

Post by Slipy » Apr 16 2020 5:04pm

Hi stancecoke :) I can't solve this problem, motor spin all time at very low speed [youtube]https://youtu.be/GVogCMfojdQ[/youtube] when i press brake, nothing, only regen work and still spin with low speed https://drive.google.com/file/d/1Z4qIos ... p=drivesdk my scheme
Best regards

User avatar
stancecoke   100 kW

100 kW
Posts: 1202
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 17 2020 1:21am

Slipy wrote:
Apr 16 2020 5:04pm
motor spin all time at very low speed
Nice to see the motor spinning, this is a great sucess already! Congratulations!

It seems that the battery-current measuring is not stable fast enough at startup. We already have build in a pause in the autozero procedure in the adc_init(void) function, but it seems to be too short.
You can try to increase the number of loop runs in the delay-loop, or just use a higher offset (e.g. 5 instead of 1) in line 79 of the adc.c

Code: Select all

ui16_current_cal_b -= 1;
regards
stancecoke

Post Reply