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

Also: Is this known freezing problem only happening when one actively uses the BluOSEC app (i.e. while there is a Bluetooth connection)?

I was getting what I think was the freezing problem when using Xnyle's 'x4throttle' branch. This was with the lcd3 display i.e. not using the BluOSEC app.

The motor would occasionally completely lose drive for a couple of seconds, then the display would re-initialise and the motor would come back to life. It was almost like the controller battery supply had been momentarily cut, but I could find no cause for this.

Eventually I changed the firmware to Stancecoke's 'Torque from X4' branch and the problem has never happened since... :)
 
How does the torque from x4 branch work differently? I can't really find any documentation on it.

I run the a torque sensor, so by the sound of things I could use it.
 
Vbruun said:
How does the torque from x4 branch work differently? I can't really find any documentation on it.

I run the a torque sensor, so by the sound of things I could use it.

The 'torque from x4' branch allows you to run both throttle and torque sensor together by connecting the throttle as normal and the tqsr input to the x4 pad. This branch also has stancecoke's code optimisation to alleviate the 'freezing' issue that some folks were having, mainly when using the BluOsec app with this branch.

If you don't have a need for a throttle and you're not getting any freezing issues then you probably don't need it... :wink:
 
True, but I do get the freezing issues. I just redid the wiring so I do not get power for the torque sensor through the display cable and that has fixed the issue so far, but I am not sure yet
 
Newly soldered FOC sensor works great. I did not explain the issue correctly in my previous post – when I apply the brakes wheel try to continue spinning up until current drops to 0 (magenta current scale above speed scale on Bluosec application). Same happens with the LCD. Not sure if this is done intentionally – I guess if current cut off abruptly after brakes are applied, collapsing magnetic field will create huge current spike, that’s why firmware dose not cut the current abruptly? How original firmware handles brakes?
Just in case attaching the log file - trying to brake and after brake is released speed jumps, and wheel continue speening up untill current drops to 0

REgards,
 

Attachments

  • 2312-2202-BluOsec.log
    18.8 KB · Views: 27
endlessolli said:
....
And I am asking, since I can not test for myself, as I am still waiting for my controller to arrive....
Finally, my controller arrived!
I am currently reading through the wiki and am about to do my 1st flash...
I have question wrt the java tool settings:
@stancecoke:
1) The Ride Option 'Power Based Control'
(Switches from current regulation control to power regulation (the lower voltage the more current you get for the same assist)
-> Does that also influence throttle behavior similarly? I.e. a certain throttle position gains a certain power (instead of a certain current)?
2) If I use only the throttle - do Gain P and Gain have any meaning?

Update: 1st Flash seemed to have worked (red LED flashing in the STLink-V2). BUT: Motor does not turn at all (tested via throttle). Nothing happens :-(
Need to start trouble-shooting....
 
Did you apply the power based assist option?

I had to disable it because the firmware didn't work for me as Long as IT was ticked.
So try to disable that :)

Maybe someone who knows how can remove the option from the firmware since it is broken
 
Vbruun said:
Did you apply the power based assist option?

I had to disable it because the firmware didn't work for me as Long as IT was ticked.
So try to disable that :)

Maybe someone who knows how can remove the option from the firmware since it is broken

Thanks for the feedback!
It's still not doing what its supposed to be doing, but the motor now turns - in spurts.
The problem was either the 'power based assist'-option you suggested, or I miscalculated the undervoltage 1st.

I guess, I need to play a bit with the parameters and understand better what the are doing.

I'll report my progress.

Thanks again to stancecoke and his predecessors for making this open firmware available!
 
Have you adjusted the PID settings yet?

Turn KD and kp down to 0.05 and try again. The stock settings are very janky.

Also, did you have the wheel in the air? It works alot Better under load
 
Vbruun said:
Have you adjusted the PID settings yet?

Turn KD and kp down to 0.05 and try again. The stock settings are very janky.

Also, did you have the wheel in the air? It works alot Better under load

Thanks again for the help.

Can you clarify where I can set KD and kp parameters?
In my Java Tool Version, I have 'Gain P' and 'Gain I' Parameters for the PI controller.
Is this what you are referring to, or do I need to look somewhere else to adjust the ones you quoted?

P.S. I tried with the wheel in the air - braking with my hands... ouch (But even with braking; i get the spin-bursts.
Will try your setting adjustments and will report back - probably next year, though :wink:
 
Thanks for the help & input.
I have it running now! My initial problems were:
- when it didn't run, it was caused by setting a too high min voltage (Doh!)

- when it ran 'in spurts' it was caused by a massively off 'Motor specific angle' setting: I started at '0' as per wiki, but ended up at '230' for smoothest run @ highest rpm for a given throttle for my motor (from a cheap 'Voilamart' E Bike Conversion Kit geared hubmotor 36V 250W) -> Does anyone have a recommendation based on what to optimize this setting? (i.e. which output parameter to optimize?)

- when it ran too slow, had to adjust the 'Gear ratio' (I tried random numbers, as I have no data from my motor...). with '70' it ran very slow, with '44' I reach similar speed as with std. firmware. (This influence surprised me, as I thought this setting only calibrates the *displayed* speed.)

All was tested using 'throttle' only (a linear 10kOhm poti) and wheel without load (testing on the workbench, as it is too cold for test-drives....)

Finally, today I also got the Bluetooth module connected and BluOSEC App running.

Now I need to test it in real live and potentially tweak PI parameters*
Again: Thank you for all involved, esp Stancecoke!!

Great Project!
I only wish, I would understand the parameters a bit better. Also after reading the wiki many times, I am unsure how some of the parameters interact with the controller/motor behavior.

* Does anyone have a recommendation for these parameter settings, if I only want to use the throttle and I want immediate/very quick reponse to it?
 
HELLO THERE

new my controler has arrived. https://files.fm/f/ew7zjkph8

12s kt controller.

please
how use stm8-stvd software? for flash to opensource software

I guess it must have hex file for software installation.

I guess it must have hex file for software installation. https://files.fm/u/f68kujxxb#/view/jwp8ckeuh

https://files.fm/thumb_show.php?i=hz6aqfkyu how to use this zip file?
 
Hi all;
got the firmware flashed and motor running (as stated earlier) with rotor angle correction enabled (controller KT SVP 24V/36V 15A).
However, I am still at a loss on how to optimize parameter settings.

I am currently testing a setup with Bafang (8FUN) SWXK 36V 250W front wheel motor.
I am trying to find good parameter settings and I am focussing mainly on Motor Specific Angle (and 'Gear ratio' )
(I am not yet optimizing the PI controller, I just try to achieve a smooth, efficient running motor for a static throttle setting)

My question / problem:
Based on what output parameter do I adjust the settings of these parameters?

Esp for the angle, I can go from 1 to 255 and I find multiple 'maxima' settings where the motor sounds smooth and fast running (all tested w/o load -> wheel in the air).
However, at the fasted & smoothest setting (around a value of '15'), the current draw (as per BluOSEC App) goes unproportionally high (from 0.7A to multiple Amps) - and the motor (and controller) get pretty hot (again: tested w/ wheel in the air).
With the std. firmware, I did not notice any heating-up in this test setup.

Also for the Gear ratio, I can find multiple motor rpm maxima when dialling through the values.
(Unfortunately, I don't know the gear ratio of my motor,....)

@stancecoke, all:
Do you have any recommendation on how to approach parameter optimization?
(What to do 1st, which Parameter-interactions (i.e. to take into account, aso)
 
endlessolli said:
Esp for the angle, I can go from 1 to 255 and I find multiple 'maxima' settings where the motor sounds smooth and fast running (all tested w/o load -> wheel in the air).
However, at the fasted & smoothest setting (around a value of '15'), the current draw (as per BluOSEC App) goes unproportionally high (from 0.7A to multiple Amps) - and the motor (and controller) get pretty hot (again: tested w/ wheel in the air).

You will struggle to get any useful or meaningful results with the wheel in the air, unloaded. I suggest you repeat the test under normal road conditions and find the angle that gives a smooth, even acceleration from rest. I have played with the 'motor specific angle' in the past (Q128h geared hub motor) but found I couldn't improve on the default setting (237 ?).

I realise this may be difficult under current lockdown conditions, but even a short test on a garden path, driveway etc, will be more useful than 'wheel in the air' testing... :wink:
 
mehmetoz1980 said:
how use stm8-stvd software?
See the "how to" in the link of my signature. Read carefully, if needed two or three times.

endlessolli said:
Based on what output parameter do I adjust the settings of these parameters?

To find the right motor specific angle: Set all speed limits to 100, set Gear Ratio to 100. This makes sure, that no speedlimit cuts the power at high rpms.

Than change the motor specific angle in steps of 5 in both directions starting from zero (0, 5, 10 .... 255, 250, 245) until 20 and 235.
Look at the current draw with wheel in the air at full throttle. The setting with the lowest current is the best. If you found the optimum, you can finetune with steps of 1.

The gear ratio has no effect on the commutation, it only defines the threshold where the motor cuts the power due to the speedlimit. So just check the speed where the motor cuts the power with a normal speedometer, when you set the speedlimits to e.g.25 kmph. Then adjust the gear ration and the wheel circumference.

regards
stancecoke
 
stancecoke said:
endlessolli said:
Based on what output parameter do I adjust the settings of these parameters?

To find the right motor specific angle: Set all speed limits to 100, set Gear Ratio to 100. This makes sure, that no speedlimit cuts the power at high rpms.

Than change the motor specific angle in steps of 5 in both directions starting from zero (0, 5, 10 .... 255, 250, 245) until 20 and 235.
Look at the current draw with wheel in the air at full throttle. The setting with the lowest current is the best. If you found the optimum, you can finetune with steps of 1.

The gear ratio has no effect on the commutation, it only defines the threshold where the motor cuts the power due to the speedlimit. So just check the speed where the motor cuts the power with a normal speedometer, when you set the speedlimits to e.g.25 kmph. Then adjust the gear ration and the wheel circumference.

regards
stancecoke
Thank you soo much, @stancecoke!! That really helped me a lot.

@geofft: Funny thing: I ended up with almost the default setting, as you recommended. :)
'239' brought me down to minimum measured current (1.3A)

P.S. Would that 'how to' be a good addition for the Wiki?
It could probably help more people like me, who can not 'read' / understand the code ....
 
endlessolli said:
Thank you soo much, @stancecoke!! That really helped me a lot.

@geofft: Funny thing: I ended up with almost the default setting, as you recommended. :)
'239' brought me down to minimum measured current (1.3A)

.....thought I'd give stancecoke's wheel-in-the-air-current-measurement method a try, had an interesting result.

Found that values around my existing 237 deg gave lowest current but noticed a sharply defined peak in unloaded top speed at 239 deg. Got 22.6mph at this setting but moving just 1deg either side (to 238,240) caused a 1.3mph reduction in speed to 21.3mph. This was a firm and repeatable result.

Not sure if this will translate to any difference in performance out on the road, but at this setting it seemed to pull very strongly from rest across the length of my garage, so if nothing else an interesting diversion from lockdown boredom..... :)
 
geofft said:
.....thought I'd give stancecoke's wheel-in-the-air-current-measurement method a try, had an interesting result.

Found that values around my existing 237 deg gave lowest current but noticed a sharply defined peak in unloaded top speed at 239 deg. Got 22.6mph at this setting but moving just 1deg either side (to 238,240) caused a 1.3mph reduction in speed to 21.3mph. This was a firm and repeatable result.

Not sure if this will translate to any difference in performance out on the road, but at this setting it seemed to pull very strongly from rest across the length of my garage, so if nothing else an interesting diversion from lockdown boredom..... :)

If I optimize for speed I get a different setting from what I stated earlier ('5' instead of '297') - but in that value-area, the current quickly increases drastically and the motor gets pretty hot (wheel-in-the-air setup). So, I stayd at 297.
But I am happy now with my 'lowest current' optimum: Motor starts reliably, runs smooth and is responsive to the throttle.

Now a different question:
I am using the excellent BluOSEC App to do parameter optimization.

@Xnyle, @stancecoke: Is there anywere more detailed explanation for this App than in https://github.com/stancecoke/BMSBattery_S_controllers_firmware/wiki/05-The-BluOSEC-Android-App?
I.e:
- What is the meaning of the different 'State Symbols'?
- What is the meaning of the ifferent wave tables? (Mid Clamp, Nip&Tuck, ....?)
- When I look at the Phase B current diagram: I can make the curve flatter by slight adjustments of the 6 Hall-Angle values (in std. riding mode, not in 'DC static Zero'). Is this the right approach to fine-tune the angles?

Thanks again for all the work you guys did here!
 
stancecoke said:
endlessolli said:
Based on what output parameter do I adjust the settings of these parameters?

To find the right motor specific angle: Set all speed limits to 100, set Gear Ratio to 100. This makes sure, that no speedlimit cuts the power at high rpms.

Than change the motor specific angle in steps of 5 in both directions starting from zero (0, 5, 10 .... 255, 250, 245) until 20 and 235.
Look at the current draw with wheel in the air at full throttle. The setting with the lowest current is the best. If you found the optimum, you can finetune with steps of 1.

The gear ratio has no effect on the commutation, it only defines the threshold where the motor cuts the power due to the speedlimit. So just check the speed where the motor cuts the power with a normal speedometer, when you set the speedlimits to e.g.25 kmph. Then adjust the gear ration and the wheel circumference.

regards
stancecoke

I added that information in the bottom of 04 The Java Tool chapter in the Wiki.
https://github.com/stancecoke/BMSBattery_S_controllers_firmware/wiki/04-The-Java-Tool
I hope, thats ok
 
endlessolli said:
I hope, thats ok

of course, thank you very much! :thumb:


endlessolli said:
If I optimize for speed

with a too large advance angle, you'll get flux weakening. The motor spins faster but with high losses which lead to heat...

regards
stancecoke
 
I do have Bafang motor with 6 magnets for speed reading. How to setup this properly so i can get real time speed read? Shall i select "external" speed sensor? How about defining six magnets? Appreciate any response.
 
szkuba said:
I do have Bafang motor with 6 magnets for speed reading. How to setup this properly so i can get real time speed read? Shall i select "external" speed sensor? How about defining six magnets? Appreciate any response.

I think if you select 'External speed sensor' and then divide your wheel circumference figure by 6 (in the configurator) it may work.

I say 'may' work, but there might be a problem. Your speed pulses will be arriving at the controller at 6 times the usual rate and they may get blocked by the firmware low pass filter at a fairly low road speed. If that proves to be the case it may be easiest to buy an external single magnet speed sensor and use that instead.
 
geofft said:
I think if you select 'External speed sensor' and then divide your wheel circumference figure by 6 (in the configurator) it may work.

I say 'may' work, but there might be a problem. Your speed pulses will be arriving at the controller at 6 times the usual rate and they may get blocked by the firmware low pass filter at a fairly low road speed. If that proves to be the case it may easiest to buy an external single magnet speed sensor and use that instead.
Thanks
Just had run a test with the wheel in the air. My impression is: i can confirm speed readout overflow with real max speed of 33km/h the readout was 54km/h :? (should be 33 x 6 => 198 :roll: ) . From the other side i heard some poeple remove the excessive (five) speed magnets from the motor and then it works.
 
Back
Top