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

Can you describe the meaning of „cogging“ or even better post a video?

regards
stancecoke
 
Well, I think it is that it gets out of synk. It is like the motor does not pull forward all the time, some times it pulls backwards. Or like if the engine in a car stops, but you don´t release the clutch. When the car stops you feel every compression stroke. That is how I can describe it I think.
It happens as soon as I give it some trottle at low speed.If I am very gentle on the throttle it can be ok. At higher speed it seems to be ok, or nearly so.
 
OK. Do you have the phase current sensor installed and working?
The advice of apple2 is exactly right. Disable the automatic angle correction and try to find the correct motor specific angle. Swap Hall and motor wires, if you can‘t find a satisfying angle setting.

regards
stancecoke
 
j bjork said:
But the only ting working on the lcd3 is battery voltage, no speed, no symbols for braking, no battery indicator.
It also seems like changing assist level has no effect. I havent tested on the road, but it works on assist 0 with the wheel in the air.
And it has a delay when I release the trottle before it stops pulling.

I can solve the problem with the help from stancecoke in the german forum.
The Problem was the checksum from the UART messages to the display

You must edit the display.c.
At the moment i don't know which value ist the correct one, because i change yesterday all 5 to 5 new at one step.
One of them solve the problem. ;)

Code:
// see if CRC is ok
        if (((ui8_crc ^ 10) == ui8_rx_buffer [5]) || // some versions of CRC LCD5 (??)
                ((ui8_crc ^ 5) == ui8_rx_buffer [5]) || // CRC LCD3 (tested with KT36/48SVPR, from PSWpower)
                ((ui8_crc ^ 9) == ui8_rx_buffer [5]) || // CRC LCD5
                ((ui8_crc ^ 3) == ui8_rx_buffer [5]) || // CRC LCD5 Added display 5 Romanta
                ((ui8_crc ^ 2) == ui8_rx_buffer [5])) // CRC LCD3
        {
i change 10 to 1| 5 to 4 | 9 to 6 | 3 to 7 and 2 to 8.
Code:
// see if CRC is ok
        if (((ui8_crc ^ 1) == ui8_rx_buffer [5]) || // some versions of CRC LCD5 (??)
                ((ui8_crc ^ 4) == ui8_rx_buffer [5]) || // CRC LCD3 (tested with KT36/48SVPR, from PSWpower)
                ((ui8_crc ^ 6) == ui8_rx_buffer [5]) || // CRC LCD5
                ((ui8_crc ^ 7) == ui8_rx_buffer [5]) || // CRC LCD5 Added display 5 Romanta
                ((ui8_crc ^ 8) == ui8_rx_buffer [5])) // CRC LCD3
        {
Today or tomorow i will test which one was the correct one and come back to you.

Now I can dedicate myself to the unround engine run.
I have disable the rotor angle correction and increase the motor spec. angel from 0 to 213 like in the screenshot.
But now, the motor is breaking all the time. When i try to turn it without the pas, it turns like a brake is closed.

When the bike hanging, it will run without any problem with the throttle. But when i load it with my weight, is it juddering.
Maybe the Phase Current max: and Battery Current max: is to low.

Sunny greeting from Germany
Sascha
 
Thank you for your feedback! I've just updated the master branch at github, all numbers from 1 - 10 are checked now in the checksum procedere.

For your troubleshooting: I think most problems are reported with 12 and 18 FET controllers with high amps settings. Please start with a battery current limit of 10 Amps and a phase current limit of 20 Amps.
Increase / decrease the motor specific angle from zero in both directions in steps of 5. (0, 5, 10, 15 etc. and 0, 250, 245, 240 etc.)
If you found a satisfiying motor specific angle, you can increase the currents step by step (keep the ratio of battery and phase current limits) and adapt (decrease) the values of gain_I and gain_P, if the motor starts juddering.

regards
stancecoke
 
I did not understand how to get only the display c file, so I downloaded the whole thing. I unzipped and replaced only the display c file, and wrote the firmware again with the tool. But still nothing on the display, did I do something wrong?

I disabled the angle correction and lowered batt and phase amps. I tried a bunch of angles, and settled on 247. As long as I don´t go over 150 in batt amps, and 250 in phase amps it is fine. As soon as I go over (I only tried to change 50 at a time) the violent cogging is back. It dosen´t seem to make much differens if I enable angle correction or not. I also tried lowering both gain I and P, but I have not played around with them. But so far not really any obvious differens.

Is it a good idea to try to mount pull down resistors on the hall signal wires? 1k ohm or something? I mean, if it is interferens from the magnetic field in the phase windings.

The strange trottle behavior is still there, even at lower amp settings. Sometimes it does not react to throttle, or with a big delay. And sometimes it does not react when i release throttle, and sometimes it keeps pulling even after I have stopped it with the brakes.
 
It sounds to me you are always testing with full throttle?
When you say if you increase the batt current by 50 the coggng is back, are you testing with full throttle? Maybe its a good test to try a smooth slow application of the throttle so you don't actually hit the limit?
Also did you lower the undervoltage protection so that when you apply full throttle it doesn't hit it and suddenly disable pwm...
I doubt pull down resistors will have any effect. I am also pretty sure your phase and hall combinations are spot on otherwise it wouldn't move at all.

I have seen some strange throttle behavior, though. Sometimes if you apply throttle to move a few feet and release shortly after, it doesn't stop instantly but continues applying torque for a while...
Another time it just decides to keep duty cycle at 20-30 for no reason.

Does the app logging feature work and how?
 
apple2 said:
Does the app logging feature work and how?
In the BluOSEC app, the logging works, but the created file is not easy to analyse, as the infos are at different time bases and you have to sort everything first.
For debugging you better use the diagnostics mode.

regards
stancecoke
 
It is kind of working now :D

It seems like it was the undervoltige protection. I lowered it to 50, then this violent cogging stopped. I tested to raise my batt amps to 500 and phase amps to 1200 again, now it works, but i get small vibrations and humming when pulling hard at low speed. I will test some more with the gain P and I, and see if that will help.

I don´t think it should reach undervoltage limit yet. My battery is getting low, but at full throttle it reads 41.5V now after some more riding and pulling more amps then I did when I had that problem.
Is that how the undervoltige protection is supposed to work? It seems very violent, I thout I was going to blow some mosfets or something sometimes. And I did blew 40A fuses with maby 20A settings.

Thank you for your help so far :thumb:
 
j bjork said:
And I did blew 40A fuses with maby 20A settings.

I guess your problem with undervoltage protection and blown fuses is caused by overshoots of the PI-Control. You get very short high amps peaks and voltage drops. You have to decrease Gain_I and Gain_P to avoid this. Try 0.01 or even 0.001 and see what happens. You have to find a compromise of satisfying response time and acceptable overshoots. Perhaps for that high currents the implementation of casainho with a pure I-fraction control in the fast loop is better.

regards
stancecoke


PID_varyingP.jpg

Change_with_Ki.png
 
stancecoke said:
Perhaps for that high currents the implementation of casainho with a pure I-fraction control in the fast loop is better.
Yes, I remember to read in a few sources that current controller is done on PWM fast loop (with PI controllers but in our case we do not have processing power for that) and speed controller (an others like torque sensor, throttle, etc) is done on outer loop, slower, like at 10ms.

My code is better developed on TSDZ2 mid drive firmware, that has now much more users than the firmware for KT (it is being used also on a OEM/commercial company) and everyone is happy -- although the currents are much lower, like 20 battery amps.

Please note that KT controllers has specific hardware to control phase current separated from battery current (unlike TSDZ2 motor controller) and my code does that but not the implementation of Stancecoke. I think for big controllers and such big currents, controlling well the phase current should be important to avoid damage of the mosfets and maybe even the motor coils.
I did read that powerful low inductance motors can easily burn mosfets because then can pull fast and very high phase currents peaks.
 
j bjork said:
I did not understand how to get only the display c file, so I downloaded the whole thing. I unzipped and replaced only the display c file, and wrote the firmware again with the tool. But still nothing on the display, did I do something wrong?

I have tested the new display.c file with the values 1-10with sucess.
So for me it is working.
But maybe your Display has an other cecksum value? You can try to change the values 1-10 to 11-20.


j bjork said:
It is kind of working now :D

It seems like it was the undervoltige protection. I lowered it to 50, then this violent cogging stopped. I tested to raise my batt amps to 500 and phase amps to 1200 again, now it works, but i get small vibrations and humming when pulling hard at low speed. I will test some more with the gain P and I, and see if that will help.

It's working for me,too. I have decrease the undervoltige protection to 50 and now it stop cogging.
Thank you

But what i noticed is that Assist level 0 doesn't switch off the engine, but probably corresponds to level 1.
Maybe there is some false allocation inside the source?

The second problem is the pulling down of the voltage during the startup and acceleration.
The controller ist getting warm after a one minute ride.
Probably i have to reduce the values gain P and gain I. At the moment i'm at 0.1 and 0.4.
I think the current is to high and that is the reason why the undervoltage protection started before a decrease the value.

best regards
Sascha
 
I still don´t have any functions on the display, and I have´nt got rid of the humming and smaller vibrations at accelaration. I tried to change the whole folder of files, not just the display c, but it did´nt make any differens.

I tried a tool in casainos fork that did´nt work, but then I found another that did. With that fw i have the display working, but some other strange behaviors. The motor is pulling of it´s own if I don´t pull the brake or pedal a little backwords. When riding it brakes of its own when I let go of the trottle.
I only seem to get 300w on the display, but I would guess about 600w in reality. I doubled the amp, but it seems like it did´nt make any differens. Then I started doing other things and haven´t looked at the bike since then.
 
j bjork said:
I still don´t have any functions on the display,... I tried to change the whole folder of files, not just the display c, but it did´nt make any differens.

Please follow the suggestion of sascha121985 and try the numbers from 11 - 20 in the display.c. See the code snippet here. You can use any texteditor to do the changes.

regards
stancecoke
 
Must I reduce gain P and I at the same time and the same value? So when I go to 0.01 the other value must be 0.04?

And again, do you have any idea why assist level 0 at the lcd3 corresponds to level 1 at the java tool?

Greeting from the lovely Germany ;).
Sascha
 
sascha121985 said:
Must I reduce gain P and I at the same time and the same value? So when I go to 0.01 the other value must be 0.04?
Gain_I and Gain_P are completely independent. Just play around with both. (You should have in mind, how a PI-Control works...)

sascha121985 said:
And again, do you have any idea why assist level 0 at the lcd3 corresponds to level 1 at the java tool?

As I don't use any display I can't confirm nor contradict your finding. The code seems to be OK.

Code:
// convert static defines to volatile vars
	ui8_a_s_assistlevels[0] =0;
	ui8_a_s_assistlevels[1] =LEVEL_1;
	ui8_a_s_assistlevels[2] =LEVEL_2;
	ui8_a_s_assistlevels[3] =LEVEL_3;
	ui8_a_s_assistlevels[4] =LEVEL_4;
	ui8_a_s_assistlevels[5] =LEVEL_5;

But I must confess that I don't really understand what XNYLE does with his percent_wanted/smoothed assist levels...

Code:
// >=8 means levels are switched of, use wanted percentage directly instead
	ui16_assist_percent_smoothed -= ui16_assist_percent_smoothed >> 4;
	if ((ui8_assistlevel_global & 15) < 8) {
		ui16_assist_percent_smoothed += ui8_a_s_assistlevels[ui8_assistlevel_global & 15];
	} else {
		ui16_assist_percent_smoothed += ui8_assist_percent_wanted;
	}
	ui8_assist_percent_actual = ui16_assist_percent_smoothed >> 4;

regards
stancecoke
 
kkm said:
j bjork said:
A question, how is the trottle response compeared to the standard fw? I think it is a bit slow on the kt fw.
Almosty all “factory” firmware (including KT original fw) uses “speed (rpm) control”, and not “torque (current) control” for the throttle. That is, by shifting the knob on 2-3 mm, the motor (unloaded wheel) turns will be 5-10 rpm, moving another 1 mm - 30-50 rpm, etc.
This behavior allows you to stably maintain the desired speed, especially at low speeds (5-8 km / h), the current speed depends little on small changes in the terrain, it is stable.
And yes, this mode feels like a "quick response" knob.
Unfortunately, this firmware uses a "dumb" throttle control method - "Torgue (current)". An unloaded wheel immediately starts at full speed, driving at low speeds is difficult and unstable, the throttle response is perceived as "viscous", and the acceleration speed and speed change is unpredictable even with slight inclines/rises of 0.5-1 degrees.

Unfortunately, this is the only reason why I cannot use this excellent firmware.

on the road when i turn the throttle to the end,the motor may take a 3-4 seconds and increase slowly to the max speed,not a quick response.do you?
 
Hi ,stancecoke
Phase Asv =(phase a - voff + amplitude)/2*1.155-20
do you konw how to derive the formula,why it should be + amplitude)/2 and -20 ?
 

Attachments

  • asv.jpg
    asv.jpg
    13.2 KB · Views: 3,005
hello, it is possible to make bluetooth dongle for kt foc controller? or i must buy orginal bl, if yes where i can buy it ?
 
Hi
How to check supports stock controller sensor temperature of the motor?
Perhaps you have a stock controller circuit supporting a motor temperature sensor?
 
haiyi911 said:
do you konw how to derive the formula
sorry, I don't know this excel-sheet. I think Casainho took the SVM-lookup-table somewhere from the internet. But you can easily calculate the duty cycles for the three phases from the rotor angle, there are many examples in the internet. You can look at my recent Lishui project at github, there are all necessary calculations for FOC implemented.

Blik86 said:
How to check supports stock controller sensor temperature of the motor?
I don't know, how the stock firmware implements temperature sensing. We do it with the analog input on connector X4.

florkk said:
hello, it is possible to make bluetooth dongle for kt foc controller
For use with our open source firmware it is described in the wiki. For use with the original KT-App, I don't know. I only know, that the KT-App is really poor.

regards
stancecoke
 
haiyi911 said:
on the road when i turn the throttle to the end,the motor may take a 3-4 seconds and increase slowly to the max speed,not a quick response.do you?

No, throttle "reaction rate" of this firmware is quite acceptable, although it is worse than the stock one. I talked about the throttle control mode. IMHO - Current/Torque mode It is good for the PAS only mode, but for "throttle only" is absolutely unsuitable (in my case). The last argument was a recent incident, when I was driving at a speed of 8 km/h over the stretch of ice, and my wheel suddenly spun up to the maximum rpm, losing traction. I had to install back a controller with stock firmware, where the control and algorithm of the throttle is implemented perfectly and correctly.And the stock algorithm is a bit like a “manual cruise mode” when you don't have to twist the throttle endlessly, compensating for changes in speed, from the slightest gust of wind in your face, or a change in terrain / road surface. It's great.
 
Hi everybody!
I have an electric wheelchair handbike which has got KT controller (model: Thunder). I disassembled for make some pic, attached below. Sorry, but I can't make photos from top side of pcb, because cables are too short and I don't want to break the solderings.
My question is how many chance I have to use open firmware on this device. As I see it's similar to s06s (6 FETs)
 
wrobi said:
I disassembled for make some pic, attached below.

No attachment?!
Can you identify the label on the mikrocontroller? Is it the STM8S105C6T6?

regards
stancecoke
 
Sorry! I had to reduce the image size.
I can't see the MCU because short cables. I will try it with an endoscope camera.
I have two more question:
1. If KT-LCD5 maximum gear level is 3 then it's limited by controller firmware or display firmware. This is a special edition for wheelchairs, because it have "-1" gear level for reverse. My problem is the maximum speed which is limited 20km/h. I tried to change P and C parameters, but doesn't help.

2. It looks like it have a BLE module, but very difficult to connect, and nothing data traffic. Tried original KT app, and some BLE terminal. is it possible to use it only for factory setting?
 
Back
Top