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

Electric Motors and Controllers
szkuba   10 mW

10 mW
Posts: 20
Joined: Nov 26 2018 2:56pm

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

Post by szkuba » Oct 06 2020 1:47am

stancecoke wrote:
Oct 03 2020 10:09am

No, just the direction detection via the PAS fraction is irrelvant.

Code: Select all

else { // torque sensor mode

			float_temp = (float) ui16_sum_torque;
			float_temp *= ((float) ui8_assist_percent_actual / 100.0);

			if (flt_torquesensorCalibration != 0.0) {
				
				float_temp *= flt_torquesensorCalibration / ((float) ui16_time_ticks_between_pas_interrupt_smoothed); // influence of cadence
				

			}
szkuba wrote:
Oct 03 2020 5:31am
so then i am looking for the reson why sometimes the motor does not star from idle.
Please log the output in debug mode, then we can see what happens.

regards
stancecoke
Okay so cadence does have proportional influence on the assist.
In regards to motor not starting i think it could be low voltage protection but also the use LCD4 display (need to test it more). During the testing i did not noticed how low is the battery and now on full charge and bluOSEC adapter there is no cut off on .

I do have similar question to what @Corrida victim has mention about power consumption. The current limits are:
Batt- 7A
Phase - 20A
Assit 1 - 20%
Dynamic assist - enabled
So how it is possible that on Assit1 the battery curent can go up 3-4A if this is 20%? Is the assist level based on Phase current then? Should i lower the Phase current to 10-15A to get best results with Batt current limit @ 7A?

User avatar
stancecoke   100 kW

100 kW
Posts: 1284
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 » Oct 06 2020 2:44am

szkuba wrote:
Oct 06 2020 1:47am
So how it is possible that on Assit1 the battery curent can go up 3-4A if this is 20%?
Please don't mix up torque-simulation mode and torquesensor-mode! In torque-simulation you define specific current steps with the assist level. In torquesensor-mode, you define the gain of your human power with the assist level. So even in level 1 you can reach the Battery Current max value if you are pedaling hard enough.

regards
stancecoke

szkuba   10 mW

10 mW
Posts: 20
Joined: Nov 26 2018 2:56pm

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

Post by szkuba » Oct 06 2020 3:47am

Okay that explains a lot! So it seems i need to fine tune the Torque miltiplier.

Corrida victim   10 mW

10 mW
Posts: 23
Joined: Feb 27 2020 8:45am

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

Post by Corrida victim » Oct 06 2020 6:02am

I seem to have a different sensor.
The markings I seem to spot are: A 750 1932 865A

For some reason I feel no difference when it comes to noise and power consumption when I disable "motor angle correction". Probably means FOC didnt work from the start, explaining my poor efficiency?
IMG_20201006_111936_compress60.jpg
IMG_20201006_111936_compress60.jpg (295.45 KiB) Viewed 479 times
Attachments
IMG_20201006_120924_compress59.jpg
IMG_20201006_120924_compress59.jpg (302.67 KiB) Viewed 479 times
IMG_20201006_111841_compress27.jpg
IMG_20201006_111841_compress27.jpg (318.41 KiB) Viewed 479 times

Vbruun   100 W

100 W
Posts: 111
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 » Oct 06 2020 10:14am

Hi guys

Today, I installed the custom firmware in my controller! It was pretty successful, I managed to get the firmware on the board and the app working.

However, I am using the potted 9-fet controller from topbikekit, so I was unable to access the backside og the board for soldering. Unfortunately, I destroyed one of the eyelets of the board when I tried to solder. I managed to get the firmware on there by just sticking in a Wire and and running the program, but I would like to repair it.

Dora anyone know how to repair such a board?


User avatar
stancecoke   100 kW

100 kW
Posts: 1284
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 » Oct 06 2020 11:52am

Corrida victim wrote:
Oct 06 2020 6:02am
I seem to have a different sensor.
The markings I seem to spot are: A 750 1932 865A
Yes, this seems to be an Allegro ACS72981 like sensor:

Image

You can try to desolder the 0.5 mOhm resistor (marked with "0m50"), then the ACS "sees" more current. But you have to consider the maxmium rating auf the ACS.

Have you looked at the waveform of the phase current in the BluOSEC-app?

regards
stancecoke

Corrida victim   10 mW

10 mW
Posts: 23
Joined: Feb 27 2020 8:45am

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

Post by Corrida victim » Oct 06 2020 1:11pm

stancecoke wrote:
Oct 06 2020 11:52am
You can try to desolder the 0.5 mOhm resistor (marked with "0m50"), then the ACS "sees" more current. But you have to consider the maxmium rating auf the ACS.
That's the brand indeed! Thanks for sending me in the right direction! I'll try finding the correct datasheet. But I'm afraid I'll have to leave the resistor as my phase current is currently set at 140amps.
stancecoke wrote:
Oct 06 2020 11:52am
Have you looked at the waveform of the phase current in the BluOSEC-app?
I did indeed! Sometimes there is a nice waveform, sometimes there isn't, not sure what to make out of it.

On a sidenote, sometimes my bike just accelerates forward without pedaling. Braking with the brake that's connected doesn't seem to have an effect for at least a couple seconds. Not sure if it's hardware or software related.
Attachments
Screenshot_20201006-164049.jpg
Screenshot_20201006-164049.jpg (372.05 KiB) Viewed 445 times
Screenshot_20201006-164009.jpg
Screenshot_20201006-164009.jpg (394.35 KiB) Viewed 445 times

User avatar
stancecoke   100 kW

100 kW
Posts: 1284
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 » Oct 07 2020 12:43am

Corrida victim wrote:
Oct 06 2020 1:11pm
Sometimes there is a nice waveform, sometimes there isn't, not sure what to make out of it.
The waveform looks good and the correction value is varying with speed and load. That seems to be OK.

Have you checked the battery consumption with a powermeter? Perhaps just the current calibration is not correct.
Corrida victim wrote:
Oct 06 2020 1:11pm
On a sidenote, sometimes my bike just accelerates forward without pedaling
It is known, that the firmware freezes sometimes with BluOsec. In the branch "Torque from X4" we have replaced the computationally intensive float operations with integer arithmetic and shifts. This solves the problem, but we have never merged it to the master...

regards
stancecoke

Corrida victim   10 mW

10 mW
Posts: 23
Joined: Feb 27 2020 8:45am

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

Post by Corrida victim » Oct 07 2020 3:08am

stancecoke wrote:
Oct 07 2020 12:43am
Have you checked the battery consumption with a powermeter? Perhaps just the current calibration is not correct.

Happy to hear FOC seems to work :)
My bms has a calibrated ammeter which unfortunately reports values ±50% higher than the controller reports.
I'll map some values on my ride to school today. Aside from the high consumption, it's an excellent commuter!
stancecoke wrote:
Oct 07 2020 12:43am
It is known, that the firmware freezes sometimes with BluOsec.
Good to hear. At least my hardware is fine ;)

Vbruun   100 W

100 W
Posts: 111
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 » Oct 08 2020 8:54am

Hi yesterday I installed the open source firmware on my controller

It seems to run fine, but I can't make the motor spin from PAS sensor.

I took some screendumps to show you what is Up.

I get pas fraction of 2,7 when pedaling forwards and 0 when pedaling backwards.
I have tried PAS thresholds from 1 to 2,9 in 0,2 increments.

As far as I can ser, the halls are correct and if I spin the motor backwards by hans, I can see a sine wave back EMF.

What to do now?



Image
Image
Image

- Victor

Vbruun   100 W

100 W
Posts: 111
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 » Oct 08 2020 3:46pm

Success! I found out what was wrong. I had "enable power assist" ticked. When I unticked that, it started working.
I must say that the simplified FOC makes the bike feel stronger at higher speeds. It felt like a rocketship!

I had three issues though. Maybe some og you cam help me fix them?
From a standstill, the acceleration was a bit jerky. I tried messing with the PID parameters and I think it helped. Does anyone mind sharing their settings?

Also, the current read high in the app compared to actual draw. To change this, should I change current cal A?

And finally, when I stopped pedaling and applied the brakes (No brakes sensors), the bike would still pull slightly and draw ~ 1,5 amps until I lifted the rear wheel and it spun for a second and then stopped.

geofft   1 kW

1 kW
Posts: 365
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 » Oct 09 2020 7:46am

Vbruun wrote:
Oct 08 2020 3:46pm
I had three issues though. Maybe some og you cam help me fix them?
From a standstill, the acceleration was a bit jerky. I tried messing with the PID parameters and I think it helped. Does anyone mind sharing their settings?
I find having Gain I too high can cause this - I usually reduce Gain I to 0.1, your setup may be different though..
And finally, when I stopped pedaling and applied the brakes (No brakes sensors), the bike would still pull slightly and draw ~ 1,5 amps until I lifted the rear wheel and it spun for a second and then stopped.
Find this line of code (adc.c about halfway down):-

ui16_current_cal_b -= 1;

...and try changing the '1' at the end to '2'. This was a fix given to me by Stancecoke for this problem some while back, seems that it alters the zero point and works for me every time :wink:
Last edited by geofft on Oct 09 2020 1:58pm, edited 1 time in total.
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 6-fet, LCD3, 48v 12s lipo.

Vbruun   100 W

100 W
Posts: 111
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 » Oct 09 2020 11:53am

Hey man, thanks! I Will try that ASAP.

I see you run the q128 as well. How much current (phase and batt) do you run in it?

geofft   1 kW

1 kW
Posts: 365
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 » Oct 09 2020 1:55pm

I see you run the q128 as well. How much current (phase and batt) do you run in it?
I'm using configurator values of 150/500 for battery and phase current max. These settings seem to draw around 800-900 watts max from the battery (measured with inline ammeter), seems about right for this motor. In fact the motor never gets any more than barely lukewarm so it could probably handle a bit more if the plastic gears would stand it.

Runs up to about 20-21mph on the road, enough for me these days and has good torque for such a physically small motor. Serious off-roaders and speed freaks would probably be a bit underwhelmed though.. :)
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 6-fet, LCD3, 48v 12s lipo.

Vbruun   100 W

100 W
Posts: 111
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 » Oct 10 2020 12:18am

Do you use the 6- or 9-fet controller?

For me the motor is also plenty powerful. I am making a bike, afterall ;)

geofft   1 kW

1 kW
Posts: 365
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 » Oct 10 2020 2:50am

Vbruun wrote:
Oct 10 2020 12:18am
Do you use the 6- or 9-fet controller?
I'm using the 6-fet. One minor downside of the o/s firmware is that the controller runs a bit hotter than stock and doesn't like being enclosed in a saddlebag. The small size of the 6-fet means I can mount it under the rear rack, here it's hidden from sight but has sufficient airflow to stay reasonably cool.
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 6-fet, LCD3, 48v 12s lipo.

Vbruun   100 W

100 W
Posts: 111
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 » Oct 10 2020 2:54am

Alright. Awesome!

I am running the 9-fet for the hailong case, so I might have to experiment a bit even with your values.

Vbruun   100 W

100 W
Posts: 111
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 » Oct 17 2020 10:05am

Just posting here to say massively thank you to stancecoke, casainho and everyone else who have contributed to this awesome firmware.

I just installed a torque sensor in my setup yesterday and finally, the bike feels like it is complete. To be able to get this kind of feel with cheap generic KT hardware (and an expensive torque sensor) is absolutely amazing. Thank you All.

geofft   1 kW

1 kW
Posts: 365
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 » Oct 18 2020 2:59am

Well done! It sometimes takes a bit of patience and experiment to get it to run how you want, but it's worth the effort in the end.
Like you say the feel of a torquesensor bike is quite special, getting back on my BBS02 equipped bike just doesn't feel the same any more.... :(
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 6-fet, LCD3, 48v 12s lipo.

User avatar
Camis   1 µW

1 µW
Posts: 1
Joined: Oct 29 2018 4:55pm
Location: Lodz / Poland
Contact:

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

Post by Camis » Oct 18 2020 4:06am

Hi all!

Is KT 60V 45A is now supported?.

tenten8401   1 mW

1 mW
Posts: 14
Joined: Aug 23 2020 12:45am

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

Post by tenten8401 » Oct 23 2020 11:36pm

Got a bit of a weird issue.. So I ended up settling on a 1500W Voilamart kit and then swapped the controller for the KT one from my old kit so I could run this firmware as well as soldering up the 50A bidirectional phase current sensor for sine wave functionality.

My issue is that it makes this weird grinding noise on startup that only this controller does, the one included with the kit starts completely silently and runs well. Is this a hall angle issue with this motor? Anyone know what I can adjust to fix it?

I Messed with the per motor angle and went from 0-250 in increments of 10 with nothing seeming to help and sometimes reversing or not running at all. Also tried all 6 hall sensor cable combos and it didn't help either.

Here's a short video of the noise it's making: https://streamable.com/1qcwwk (the noise at the end is me hitting a box)
It mostly runs fine but sometimes it'll desync going up a hill.

If anyone has any suggestions or known good Voilamart 1500w rear hub settings it'd be greatly appreciated :)

User avatar
Valopallo   10 W

10 W
Posts: 77
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 » Oct 25 2020 8:56am

Hello. It's been a while. I made a mistake with my 2wd setup(2X KT S06S). I connected the e-brake connections of both controllers parallel to the same e-brake sensor and realized a second too late that I should have not done that. The throttle signal was also shared between the controllers(powered by the rear engines controller), but now neither of the controllers don't seem to react to throttle at all. PAS does work normally though so the damage might not be at the 5V rail. The rear motor/controller's Bluosec shows full 15A draw when the throttle is connected, but the wheel does not spin nor react to throttle movement whatsoever. The front motor does not have this max amp draw behaviour but does not react to throttle pull either. I have tested this with two different throttles. I then flashed both of the controllers with diagnostics setting and ran BlueTerm with this line added to row 193 of main.c:

Code: Select all

printf("%u,%u, %u, %u, %u, %u\r\n", ui16_control_state, ui16_setpoint, ui16_motor_speed_erps, ui16_BatteryCurrent, (uint16_t) uint32_current_target, ui16_momentary_throttle);


The output of BlueTerm app:

Front motor:
1.0.0.324.322.0 (no reaction to throttle)
Rear motor:
1.0.0.316.314.0 (no reaction to throttle)

How to troubleshoot if these are any good before spending 70€ for new ones?
BluOSEC@36V|AWD|2xS06S|15A rear DD|10A front geared|Hardtail|Tunturi

User avatar
stancecoke   100 kW

100 kW
Posts: 1284
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 » Oct 25 2020 10:22am

tenten8401 wrote:
Oct 23 2020 11:36pm
If anyone has any suggestions or known good Voilamart 1500w rear hub settings it'd be greatly appreciated
It is well known, that the Kunteng Controllers have bad resonances with the cheap china directdrives. That's a hardware issue, you can't fix it with software settings.
Valopallo wrote:
Oct 25 2020 8:56am
How to troubleshoot if these are any good before spending 70€ for new ones?
Have you checked the output of throttle singal wire, is it 0.8 ... 4.2 V?
If yes, it seems you have killed the ADC-Input pin for the throttle. You could try, if the ADC input on X4 still works. Simply connect the throttle signal wire to X4 and add ui16_adc_read_x4_value() to the print line to see if somethings alive on x4.

regards
stancecoke

tenten8401   1 mW

1 mW
Posts: 14
Joined: Aug 23 2020 12:45am

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

Post by tenten8401 » Oct 25 2020 11:34am

stancecoke wrote:
Oct 25 2020 10:22am
It is well known, that the Kunteng Controllers have bad resonances with the cheap china directdrives. That's a hardware issue, you can't fix it with software settings.
That sucks.. wish I had known before I spent so many hours messing with it to try to get it to go away :P

Think it'd be a pain to get this firmware running on the Voilamart controller, or has it already been done? It doesn't do any stutter and seems like a more high quality product (silicone wires, nicer looking PCB & manufactured recently). It's got a Generalplus GPM8F3132C 8-bit processor in it and judging by the fact I've never heard of it it sounds like it might be a pain to figure out.. Just want to adjust the pedal assist strength :/

I get the feeling my best option may just be to buy a VESC and link it to an ESP32 board and write the code myself for pedal assist and some others..

Post Reply