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

Electric Motors and Controllers
jm1090   100 µW

100 µW
Posts: 9
Joined: Dec 16 2021 10:13am

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

Post by jm1090 » Jan 22 2022 3:49am

jm1090 wrote:
Jan 20 2022 6:13am
Quick question... :)

I am trying to test the 72v controller (56-90VDC) flashed with the open firmware with a 48v battery, but nothing happens.

Still, in the parameter configurator, I put 0 and 255 for low and high voltage cutoffs, so I should not be bothered by any LVC...

Is there a hard LVC inside the controller that needs to be modified in order to use lower than 56V battery voltage ?

Thanks !!
Problem solved, I removed the two LVC resistors of the 72v controller (1.5k and 39k) and replaced them with the LVC resistors that are on the 48v controller (1.2k and 15k). See page 180 for pictures of LVC resistors of each version.

So, there is indeed a hard LVC that the low and high voltage parameters in the software cannot bypass.

Now that I have modified it for 48v battery, I may not be able to boot with 84v battery if these resistors also operate a high voltage cutoff...

iaval   10 mW

10 mW
Posts: 26
Joined: Nov 25 2019 12:19pm

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

Post by iaval » Jan 26 2022 11:13am

jm1090 wrote:
Jan 22 2022 3:49am
jm1090 wrote:
Jan 20 2022 6:13am
Quick question... :)

I am trying to test the 72v controller (56-90VDC) flashed with the open firmware with a 48v battery, but nothing happens.

Still, in the parameter configurator, I put 0 and 255 for low and high voltage cutoffs, so I should not be bothered by any LVC...

Is there a hard LVC inside the controller that needs to be modified in order to use lower than 56V battery voltage ?

Thanks !!
Problem solved, I removed the two LVC resistors of the 72v controller (1.5k and 39k) and replaced them with the LVC resistors that are on the 48v controller (1.2k and 15k). See page 180 for pictures of LVC resistors of each version.

So, there is indeed a hard LVC that the low and high voltage parameters in the software cannot bypass.

Now that I have modified it for 48v battery, I may not be able to boot with 84v battery if these resistors also operate a high voltage cutoff...
Yep, sorry I missed your comment. Maybe some sort of compromise would be possible with those values, by slightly decalibrating voltage reading, so that both systems are compatible?
Turns out I might be in the same bucket soon, the motor I got has very low Kv, I can only get decent speed by bumping the voltage to 72V through additional battery in series, but hard LVC would make the failover to 54V impossible

BTW open question, by raising Gain I, the throttle lag I was experiencing earlier can be almost entirely eliminated, but only at "high" values of 0.4-0.5. To prevent damage, what would be the recommended Gain P for that integral?

Admiralrofl   1 µW

1 µW
Posts: 1
Joined: Jan 26 2022 12:20am

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

Post by Admiralrofl » Jan 29 2022 12:33am

Hey everyone,

I'm finding myself a little stuck with this firmware. Not sure what i'm doing wrong at this point.

I have a kt48zws controller with a lcd3. Confirmed working before flashing. I finally got it to flash to the controller and I cannot get it to turn on now with the lcd3. I saw in the wiki about XOR checksums might be off. I have no idea how to check the lcd3 for these checksums. With running the wiki code here, do I need to connect the screen to my computer with a usb-uart device or is there some other process for checking the xor. Or is it something else I'm messing up on.

I've now tried to run diagnostics mode, which the utility says is flashing correctly onto the controller. I have a UART to usb connected correctly to the display but when I run Hterm I'm getting nothing when I connect. I have the drivers installed, its recognized as a device. I've set the the correct com port, and wired the TX,RX and GND pins from the display output on the KT to the UART and I've jumpered the other 2 pins on it. With all that connected and the battery plugged in, Its still not providing any data in Hterm. Is there something I'm missing? or is my controller just borked.

EDIT: Turns out the controller has a short somewhere that I can't identify. The second I connect power to the system my BMS goes into self protect because of it. There is continuity between the + and - leads but I can't see the source. But if anyone else has my issue that may be a source.

andrea_104kg   1 kW

1 kW
Posts: 333
Joined: Mar 05 2018 5:51pm

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

Post by andrea_104kg » Feb 06 2022 4:47pm

After burning the small hub in just over 2 hours of use I put in a much more solid bpm code 15. Completely satisfied, the bike has an exceptional response to the torque meter, hopefully it will last!
202225204126_bpmtorque.jpg
202225204126_bpmtorque.jpg (222.31 KiB) Viewed 702 times

Molten-Core   10 mW

10 mW
Posts: 28
Joined: May 22 2018 2:27pm

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

Post by Molten-Core » Feb 17 2022 6:42am

Hi, i would love to read your tutorial about this particular subjects:

Iambuilderman wrote:
Jun 13 2021 5:09am
....
- How to install buck converter
- How and when do you need to modify the LVC resistor
- How to convert 48v -> 72v
- How to calibrate voltage and current sensors and set up the parameters in the java configurator


...

Thank you!

Touffik   1 mW

1 mW
Posts: 11
Joined: Sep 05 2020 4:23am

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

Post by Touffik » Mar 06 2022 12:00pm

Hello guys, and thanks for this great thread and work for an open source firmware.
I am trying to build a new ebike with the following setup:
- Bafang TQ sensor SR PA231.32.ST
- Bafang autoshift 2 speed (but TBH I have no clue how to use that with the KT controller)
- Throttle for a lazy mode
- 18 Mosfet KT controller
- dual 15s batteries in parallel (Max 63v)
- KT LCD3
- I have replaced the 2 resistors and 2 LM by a 15v bucket

I'm using the Torque from X4 fork of the GitHub.

I have few questions I would like to check with you guys.
1) The first strange behavior with the LCD was probably linked to the XOR checksum : display was not providing any useful infos.
Yet, I provide here some hints for other users but let me know if I didn't get the point. So I sniffed the Tx line from the LCD and got the following packets: (I just supposed that 0x0E was the terminal byte like other screens but I'm not sure actually) : 0x12,0x05, 0xF4, 0x5C, 0x20,0x5C,0x18,0xEA,0x04,0x14,0x01,0x32,0x0E. I run the tool in the wiki and got the output attached to this post. I just supposed that I have to select the ui8_j value where (ui8_crc^ui8_j) and ui8_rx_buffer[5] matches, therefore 28 but actually I have no clue here. I then added ((ui8_crc ^ 28) == ui8_rx_buffer [5]) in the display.c file and actually LCD then begins displaying stuff. So I guess that's fine.

2) I noticed a second strange behavior with the LCD : every time I plug the battery, display turns on. When I want to turn it off, I can using the switch but then when I want to turn it on again it doesn't work. However I have noticed that the throttle can work when the display is off. Any advise here ?

3) I followed the mapping of this https://www-pedelecforum-de.translate.g ... r_pto=wapp even if my colours where differents I used the pint numbers. Then made this wiring:

BB TQsr >>>>>>> KT controller
Pin 1 : GND >>>>>> GND black wire from the PAS plug
Pin 5 : 5V+ >>>>>> +5V brown wire from the PAS plug (actually it's more 4.5v but anyway)
Pin 3 : Torque >>>> X4 wire from the PCB
Pin 4 : PAS >>>>>>> PAS Yellow wire from the PAS plug

not sure it's really working actually but still need to investigate the option of the OSEC configurator. It seems that the wheel (in the air) tries to keep the same speed even when I stop pedaling, but I don't feel the acceleration of the motor speeding up when I pedal faster. Yet the thumb throttle works. Any advise here too?
Attachments
output C tool.rtf
(760 Bytes) Downloaded 10 times

Ivan775   1 µW

1 µW
Posts: 4
Joined: Mar 07 2022 9:23am

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

Post by Ivan775 » Mar 07 2022 11:14am

Hello, I can’t connect BluOSEC hc-05, debugging works, but the application does not see the data, what should I do, maybe the logical levels do not match?

Ivan775   1 µW

1 µW
Posts: 4
Joined: Mar 07 2022 9:23am

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

Post by Ivan775 » Mar 07 2022 11:22am

I do not have a transistor near the UART bus, is it a logic inverter or a level converter?
Attachments
IMG_20220307_181617.jpg
IMG_20220307_181617.jpg (3.02 MiB) Viewed 480 times
IMG_20220307_181546.jpg
IMG_20220307_181546.jpg (3.66 MiB) Viewed 480 times

Ivan775   1 µW

1 µW
Posts: 4
Joined: Mar 07 2022 9:23am

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

Post by Ivan775 » Mar 07 2022 2:22pm

9600 is put in the terminal on android, I type text, Bluetooth via ftdi pc in the arduino console displays, sorry if the translation is wrong, I use a translator, I'm from Ukraine, and here is the war

Ivan775   1 µW

1 µW
Posts: 4
Joined: Mar 07 2022 9:23am

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

Post by Ivan775 » Mar 07 2022 2:31pm

BluOSEC mood controller, connect bluetooth hc-05 to rx tx and BluOSEC shows nothing and when I open bluterm this is what happens
Attachments
Screenshot_20220307_210430_es.pymasde.blueterm.jpg
Screenshot_20220307_210430_es.pymasde.blueterm.jpg (200.85 KiB) Viewed 467 times

glennb   100 µW

100 µW
Posts: 9
Joined: Dec 07 2010 7:56pm

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

Post by glennb » Mar 16 2022 8:46pm

Could someone please tell me whether engaging "offroad mode" disables the set speed limits for both PAS and throttle?

I know it disables the PAS speed limit, just couldn't see any mention of it also disabling the throttle limit.

(The regulations seem to force everyone into torque-based systems and/or handlebar displays, whereas all I want is a small hub motor on my single speed commuter bike to use on steep gradients, and the only way I can see to do that "legally" is with a throttle that reverts to 6km/h.)

geofft   1 kW

1 kW
Posts: 424
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 » Mar 17 2022 10:13am

glennb wrote:
Mar 16 2022 8:46pm
Could someone please tell me whether engaging "offroad mode" disables the set speed limits for both PAS and throttle?

I know it disables the PAS speed limit, just couldn't see any mention of it also disabling the throttle limit.
I can confirm that 'Offroad mode' disables the (Without PAS) 6kph throttle limit but not completely sure about the upper limit - I'll make a note to check this next time I'm out for a ride.

EDIT to add:
Bear in mind that the 6kph limit only applies if you're not pedalling - in most real life circumstances you will be pedalling so it won't apply...:-)
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 6-fet, LCD3, 48v 12s lipo, Sempu T4 tqsr.

OutsMarted   10 mW

10 mW
Posts: 21
Joined: Aug 14 2021 12:44pm

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

Post by OutsMarted » Mar 17 2022 1:00pm

geofft wrote:
Mar 17 2022 10:13am
glennb wrote:
Mar 16 2022 8:46pm
Could someone please tell me whether engaging "offroad mode" disables the set speed limits for both PAS and throttle?

I know it disables the PAS speed limit, just couldn't see any mention of it also disabling the throttle limit.
I can confirm that 'Offroad mode' disables the (Without PAS) 6kph throttle limit but not completely sure about the upper limit - I'll make a note to check this next time I'm out for a ride.

EDIT to add:
Bear in mind that the 6kph limit only applies if you're not pedalling - in most real life circumstances you will be pedalling so it won't apply...:-)
If offroad mode is enabled, the speedlimit is set to 80 kmh in the code. So I think the "Offroad" box in the Osec parameter configurator does nothing.

OutsMarted   10 mW

10 mW
Posts: 21
Joined: Aug 14 2021 12:44pm

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

Post by OutsMarted » Mar 17 2022 1:04pm

Ivan775 wrote:
Mar 07 2022 2:31pm
BluOSEC mood controller, connect bluetooth hc-05 to rx tx and BluOSEC shows nothing and when I open bluterm this is what happens
Did you fix yet?

geofft   1 kW

1 kW
Posts: 424
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 » Mar 17 2022 2:31pm

OutsMarted wrote:
Mar 17 2022 1:00pm
If offroad mode is enabled, the speedlimit is set to 80 kmh in the code. So I think the "Offroad" box in the Osec parameter configurator does nothing.
I'm actually referring to activating 'Offroad mode' by using the 'morse' code on the brake lever. This method is familiar to long term users of the firmware, but I realise it is not well documented and not all users may be aware of it. A search for 'Offroad' in this thread will bring up lots of results, Stancecoke also begins to describe the method back in the topic here:

viewtopic.php?f=30&t=87870&hilit=offroa ... 0#p1388176

This method of activating definitely switches off the 6kph limit as already mentioned, I'm fairly sure it also raises the upper throttle limit but I need to test this to be completely sure.

I'm not sure what the 'Offroad' tick box in the configurator does, but from your comments it sound like it simply maxes out all the speed limits.
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 6-fet, LCD3, 48v 12s lipo, Sempu T4 tqsr.

glennb   100 µW

100 µW
Posts: 9
Joined: Dec 07 2010 7:56pm

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

Post by glennb » Mar 17 2022 5:45pm

Thanks for the clarification.

Although, if I understood you correctly, with this firmware the throttle speed limit only applies when not pedalling?

That wouldn't comply in Australia, where the throttle must cut out at 6km/h regardless of pedalling. I thought Europe was the same.

OutsMarted   10 mW

10 mW
Posts: 21
Joined: Aug 14 2021 12:44pm

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

Post by OutsMarted » Mar 17 2022 6:00pm

glennb wrote:
Mar 17 2022 5:45pm
Thanks for the clarification.

Although, if I understood you correctly, with this firmware the throttle speed limit only applies when not pedalling?

That wouldn't comply in Australia, where the throttle must cut out at 6km/h regardless of pedalling. I thought Europe was the same.
When you are pedalling and in the legal/not the offroad mode, the throttle will not increase your speed, it will give maximum assistance when activated, but when the speed reaches the speedlimit, the power is dialed back.

glennb   100 µW

100 µW
Posts: 9
Joined: Dec 07 2010 7:56pm

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

Post by glennb » Mar 17 2022 6:27pm

Thanks, now I think I fully understand how the speed limits apply.

So, would have to set the universal non-off-road speed limit to 6km/h to make it "legal".

That's fine with me, except that if the bike was ever inspected for whatever reason, the setup would appear highly irregular to whoever tests it when they find that PAS cuts out at 6km/h.

OutsMarted   10 mW

10 mW
Posts: 21
Joined: Aug 14 2021 12:44pm

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

Post by OutsMarted » Mar 18 2022 1:40am

glennb wrote:
Mar 17 2022 6:27pm
Thanks, now I think I fully understand how the speed limits apply.

So, would have to set the universal non-off-road speed limit to 6km/h to make it "legal".

That's fine with me, except that if the bike was ever inspected for whatever reason, the setup would appear highly irregular to whoever tests it when they find that PAS cuts out at 6km/h.
No the speed limit when pedaling (25kmh) can be different from the speed limit when only using throttle (6kmh).
Its just like you want it to be, throttle only to 6kmh, pas to 25kmh

geofft   1 kW

1 kW
Posts: 424
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 » Mar 18 2022 3:57am

glennb wrote:
Mar 17 2022 5:45pm
Thanks for the clarification.

Although, if I understood you correctly, with this firmware the throttle speed limit only applies when not pedalling?

That wouldn't comply in Australia, where the throttle must cut out at 6km/h regardless of pedalling. I thought Europe was the same.
Current EU and UK law seems to be this:-

"From January 1 2016, the only throttles legal within the UK’s EAPC legislation are those that assist the rider without pedalling up to a maximum speed of 6 km/h (3.7 mph) – i.e. starting assistance only.

If the rider is rolling – but not pedalling – faster than 6km/h, the throttle cuts off. If the cyclist pedals at the same time then the throttle can still assist up to the general limit of 15.5mph."

...which is how this firmware currently operates. If this doesn't conform with Aussie regs I wouldn't think the code changes to achieve this would be too difficult. Unfortunately I'm no coder and Stancecoke is busy elsewhere and no longer supports this f/w. So, how are your coding skills..? :)
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 6-fet, LCD3, 48v 12s lipo, Sempu T4 tqsr.

glennb   100 µW

100 µW
Posts: 9
Joined: Dec 07 2010 7:56pm

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

Post by glennb » Mar 18 2022 8:27am

Yeah, possibly a simple code change. Not something I'd manage unassisted.

I still think the throttle should cut at 6km/h in on-road mode to be compliant, and it would be a worthwhile code change. There's plenty of webpages that explain the standard (EN 15194), but I can't find any that quote it, or any examples of commercial pedelecs from Europe that allow throttle beyond 6km/h. I think it's safer to assume that this is verboten.

It doesn't matter in the end, all DIY ebikes in Australia are non-compliant, because the limit on aftermarket motors here is 200w and there's no motors marked as 200w available for purchase. The best you can do is follow the spirit of the regulations by emulating a compliant European pedelec.

At least with this firmware it's possible to set the universal speed limit to 6km/h (for PAS and throttle) and override it with offroad mode. It'll be easier to explain to a police officer why the bike's PAS cuts out at 6km/h than why the throttle doesn't cut out at 6km/h, as in "Yeah, I tried making my own bike, but piece of crap chinese motor only goes 6km/h, I'm saving up to buy a proper ebike".

andrea_104kg   1 kW

1 kW
Posts: 333
Joined: Mar 05 2018 5:51pm

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

Post by andrea_104kg » Mar 19 2022 4:36am

Hi, a friend of mine is attempting to replicate my successful attempt to use the torsometer.
Only in his case the engine starts slowly even without pedaling. If the level on the display increases, the engine speed increases.
It uses a 12t mac engine and the same ECU that I use, a pswpower.
What can cause the engine to start idle?
I read about a bug in current_cal_b but I'm not a programmer ...
Thank you

Vbruun   100 W

100 W
Posts: 253
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 » Mar 19 2022 6:46am

Og he is using a geared hub motor, try using the pwm off@coast option. It worked for me to solve the issue.

andrea_104kg   1 kW

1 kW
Posts: 333
Joined: Mar 05 2018 5:51pm

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

Post by andrea_104kg » Mar 19 2022 2:36pm

unfortunately my friend does not live near me, I can only report what he tells me ...
Today he tried the bike on road, at level 1 no assistance, at level 2 it starts by herself almost to the maximum :-( we don't understand each other anymore ..

eLsc   100 µW

100 µW
Posts: 7
Joined: Jun 22 2020 1:20pm

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

Post by eLsc » Mar 20 2022 2:23pm

Hi, I’ve been using this firmware (x4 branch) for over a year now for my daily commute (~35km per day) and I have to say it runs great with my setup, Q100CST, S06S, 36V, BluOSEC, throttle, PAS and another throttle on x4 for Regen (that I never got working for some reason). On my last ride I noticed, that’s the speed limits were „missing“, something that seems to happen on my controller from time to time, so I prepared to flash my controller again and while I was at it replaced my old, only with duckt tape working PAS for a new one. After flashing the controller I couldn’t get the bike to use the PAS (functionality, pinout checked) and the BluOSEC app crashes upon establishing a connection, it seems similar to the problem Ivan described some posts prior. After flashing a few times the Debug and BluOSEC, now no communication can be made over the serial interface…

Now my question, are the STM8s real STs or cheaper fakes, as this is the only way I can explain myself having to reflash when for example the speed error occurs?

Restarting only helps sometimes, and my programming skills are definitely no at this level to understand C the way casahino, stancecocke and xnyle do :?

In any case, thanks for alle the nice rides I had so far and hopefully will have, if someone understands a bit more than i do and needs any information about what exactly is happening i can give them logs/ the exact ini I’m using

Post Reply