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

Electric Motors and Controllers
casainho   100 MW

100 MW
Posts: 2738
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 » Dec 14 2018 11:23am

haiyi911 wrote:
Dec 14 2018 10:23am
Hi,stancecoke
whats the following lines meaning? calculate average? and how to calculate it?
in ACAsetPoint.c
“”ui32_erps_accumulated -= ui32_erps_accumulated >> 3;
ui32_erps_accumulated += ui16_motor_speed_erps;
ui32_erps_filtered = ui32_erps_accumulated >> 3;“”
I did that code and I can explain:
1. ui32_erps_accumulated = ui32_erps_accumulated - (ui32_erps_accumulated / 8 );
2. ui32_erps_accumulated = ui32_erps_accumulated + ui16_motor_speed_erps;
3. ui32_erps_filtered = ui32_erps_accumulated / 8;

Yes, it is the average using fast shifting register operations -- you know, it is very important to save the very limited processor time.

First we remove 1/8 of the accumulator and then we add our new value, finally the average value is 1/8 of the accumulator.
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.

haiyi911   100 mW

100 mW
Posts: 36
Joined: Oct 13 2017 5:35am

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

Post by haiyi911 » Dec 14 2018 11:55am

casainho wrote:
Dec 14 2018 11:23am
haiyi911 wrote:
Dec 14 2018 10:23am
First we remove 1/8 of the accumulator and then we add our new value, finally the average value is 1/8 of the accumulator.
this is what i cannot understand.
1:why is 1/8?why not 1/16?
2:
a. ui32_erps_accumulated = ui32_erps_accumulated - (ui32_erps_accumulated / 8 )=ui32_erps_accumulated*7/8
b. ui32_erps_accumulated = ui32_erps_accumulated + ui16_motor_speed_erps;
c. ui32_erps_filtered = ui32_erps_accumulated / 8=ui32_erps_accumulated*7/64 + ui16_motor_speed_erps/8
i still couldnot understand how to find out the average when ui32_erps_accumulated is not equal to 0. :(

haiyi911   100 mW

100 mW
Posts: 36
Joined: Oct 13 2017 5:35am

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

Post by haiyi911 » Dec 16 2018 5:51am

Hi,
the motor didnot run smoothly when the motor was overspeed.[youtube]https://youtu.be/FXm6dFyo3hI[/youtube]
maybe it is strange when i ride the bicycle. so i want to keep the speed(the limit speed) as the default speed ,when the motor is overspeed,the speed is still keep as the limit speed.
which code should i do some change? Thanks!

geofft   1 kW

1 kW
Posts: 323
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 16 2018 6:21am

haiyi911 wrote:
Dec 16 2018 5:51am
Hi,
the motor didnot run smoothly when the motor was overspeed.[youtube]https://youtu.be/FXm6dFyo3hI[/youtube]
maybe it is strange when i ride the bicycle. so i want to keep the speed(the limit speed) as the default speed ,when the motor is overspeed,the speed is still keep as the limit speed.
which code should i do some change? Thanks!
Running the motor in the test stand, completely unloaded, will not give you any useful or meaningful results. I suggest that you get the motor installed into a wheel and repeat your tests on the road. You'll find the results will then be completely different and will probably work as you expect. :wink:
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR, LCD3, 48v 12s lipo.

haiyi911   100 mW

100 mW
Posts: 36
Joined: Oct 13 2017 5:35am

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

Post by haiyi911 » Dec 16 2018 11:18pm

Hahahaha....Thanks, geofft! Its a good suggestion,the motor kept running smoothly :D :D

j bjork   100 mW

100 mW
Posts: 40
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 » Jan 05 2019 4:56pm

Hi, it has been a bit silent in this tread for a while :wink:
Has there been any progress?

A question, how is the trottle response compeared to the standard fw? I think it is a bit slow on the kt fw.
I have got the most parts for a conversion, but it seems i have bought a bluetooth module without the blutooth bord..
It is still winter with snow and ice here, and I want to try the controller a bit more before changing fw, so it has been slow at my end.

haiyi911   100 mW

100 mW
Posts: 36
Joined: Oct 13 2017 5:35am

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

Post by haiyi911 » Jan 06 2019 9:41am

Hi,stancecoke.
Did you drive by direct drive motor ?when i started the motor,there were some noise and the motor was shaking . then i changed the "motor special angle " as "160"(the best number),but i could still feel that the motor is shaking.are there any parameters to adjust? :D

geofft   1 kW

1 kW
Posts: 323
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 » Jan 07 2019 3:59am

j bjork wrote:
Jan 05 2019 4:56pm
Hi, it has been a bit silent in this tread for a while :wink:
Has there been any progress?

A question, how is the trottle response compeared to the standard fw? I think it is a bit slow on the kt fw.
I have got the most parts for a conversion, but it seems i have bought a bluetooth module without the blutooth bord..
It is still winter with snow and ice here, and I want to try the controller a bit more before changing fw, so it has been slow at my end.
From my experience the throttle (with both Casainho's and Stancecoke's fw) works well with smooth and progressive response. I seem to remember stock fw throttle was rather jerky? The open source fw is a great improvement on this.

I don't think there has been any further progress lately, but both Casainho's and Stancecoke's fw work very well in thr/pas mode and could probably be perceived as 'finished' products. I'm currently running a Sempu T4 torquesensor using Stancecoke's fw in tqsr mode and this also works extremely well, pretty much faultless in fact.

Please bear in mind that my comments only apply to my gearmotor setup, I have no experience with direct drive motors.
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR, LCD3, 48v 12s lipo.

User avatar
stancecoke   10 kW

10 kW
Posts: 904
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 » Jan 07 2019 11:13am

haiyi911 wrote:
Jan 06 2019 9:41am
Did you drive by direct drive motor ?when i started the motor,there were some noise and the motor was shaking . then i changed the "motor special angle " as "160"(the best number),but i could still feel that the motor is shaking.are there any parameters to adjust?
I'm using the BionX IGH3 with our firmware. It's completely quiet except small resonance vibrations in the range of 12-14 km/h.
You can finetune the angles corresponding to the hall events. Xnyle has done this successfully, he implemented a function to show the details in BluOsec.
If there is massive noise, please swap the hall-sensor / phase wires to find the correct scheme.
geofft wrote:
Jan 07 2019 3:59am
I'm currently running a Sempu T4 torquesensor using Stancecoke's fw in tqsr mode and this also works extremely well, pretty much faultless in fact.
Nice to hear you finally got it going! :D

regards
stancecoke
Last edited by stancecoke on Jan 07 2019 1:37pm, edited 1 time in total.

j bjork   100 mW

100 mW
Posts: 40
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 » Jan 07 2019 12:32pm

Thank you, I have not noticed any jerkyness in the throttle. But I have not tried very much. What I mean is more the power from standstill. Even if I hold brake and full throttle, and relese the brake I think it is a little slow the first meter or so. I don`t know, maby that is how it always is. It is my first e-bike, so I don´t really have anything to compare to. I have a dd hub and 18fet controller.

geofft   1 kW

1 kW
Posts: 323
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 » Jan 08 2019 5:10am

j bjork wrote:
Jan 07 2019 12:32pm
Thank you, I have not noticed any jerkyness in the throttle. But I have not tried very much. What I mean is more the power from standstill. Even if I hold brake and full throttle, and relese the brake I think it is a little slow the first meter or so. I don`t know, maby that is how it always is. It is my first e-bike, so I don´t really have anything to compare to. I have a dd hub and 18fet controller.
This sounds like you may not be getting a full throttle signal - I think most of these controllers require around 4v on the thr signal line to achieve somewhere near full throttle. I guess you may have already checked this, but if not maybe worth doing a quick meter check on your full throttle voltage?

geofft wrote:
Jan 07 2019 3:59am
I'm currently running a Sempu T4 torquesensor using Stancecoke's fw in tqsr mode and this also works extremely well, pretty much faultless in fact.
Nice to hear you finally got it going! :D

Yeah, I gave up with the T2 type. Although I got it working ok I just didn't like the fact that just resting your feet on the pedals would propel you up the road, so I went for the T4. This gives a much nicer riding experience and they aren't much more expensive than the T2 really...
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR, LCD3, 48v 12s lipo.

glebor   1 µW

1 µW
Posts: 2
Joined: Feb 07 2018 4:41pm

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

Post by glebor » Jan 08 2019 5:08pm

Hi. Which line of code to remove if you want to program the ZWS controller to work properly?

haiyi911   100 mW

100 mW
Posts: 36
Joined: Oct 13 2017 5:35am

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

Post by haiyi911 » Jan 09 2019 12:35am

thanks ,stancecoke.

Hi,Xnyle
i want to aviod the motor startup noise,so i follow "Diagnosing motor startup problems using the app”step,
is my motor angle 105-180=-75??
and how to adapt the number -->Hall Angle 4,Hall Angle6.....Hall Angle5 with different motor?
Attachments
20190109131920.png
20190109131920.png (6.66 KiB) Viewed 164 times
20190109131845.jpg

User avatar
stancecoke   10 kW

10 kW
Posts: 904
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 » Jan 09 2019 2:43am

glebor wrote:
Jan 08 2019 5:08pm
Hi. Which line of code to remove if you want to program the ZWS controller to work properly?
Just disable the option "Enable rotor angle correction" in the Java tool.

regards
stancecoke

geofft   1 kW

1 kW
Posts: 323
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 » Jan 09 2019 4:37am

i want to aviod the motor startup noise,so i follow "Diagnosing motor startup problems using the app”step,
is my motor angle 105-180=-75??
I think (with angular measurement) -75deg equates to +285deg? I'm sure someone will correct me if I'm wrong.. :wink:
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR, LCD3, 48v 12s lipo.

haiyi911   100 mW

100 mW
Posts: 36
Joined: Oct 13 2017 5:35am

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

Post by haiyi911 » Jan 13 2019 8:03am

geofft wrote:
Jan 09 2019 4:37am
i want to aviod the motor startup noise,so i follow "Diagnosing motor startup problems using the app”step,
is my motor angle 105-180=-75??
I think (with angular measurement) -75deg equates to +285deg? I'm sure someone will correct me if I'm wrong.. :wink:
:bigthumb: Thanks,you are right!

User avatar
Xnyle   10 mW

10 mW
Posts: 32
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 » Jan 13 2019 7:11pm

Erm, your hall order goes in the wrong direction, as if you are pedaling backwards. Order has to be clockwise. I'm not quite able to spontaneously wrap my head around that, I guess in this case you have to look at the rising edge.

As your Sinus curve also looks like shit :) I'd say maybe 250°, so motor angle ~175? Id suggest you first fix the order and then look at the diagram.

haiyi911   100 mW

100 mW
Posts: 36
Joined: Oct 13 2017 5:35am

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

Post by haiyi911 » Jan 16 2019 7:42am

Maybe my direct motor hall order is counterclockwise .when the order was clockwise on app,the motor run reverse even though exchange the phase wrie or “motor.c"--hall order.

User avatar
stancecoke   10 kW

10 kW
Posts: 904
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 » Jan 17 2019 12:15pm

haiyi911 wrote:
Jan 16 2019 7:42am
Maybe my direct motor hall order is counterclockwise
Don't give up. Try to find the right wire combination, otherwise the firmware can't work properly. (No firmware can work properly, if the wires aren't connected in the right order...)

regards
stancecoke

Post Reply