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

casainho said:
On this table, https://endless-sphere.com/forums/viewtopic.php?t=16114, 1356 RPMs would be 154km/h!!! So you are not hitting the MOTOR_OVER_SPEED_ERPS of 520.

The speed shown was real (like full throttle on original fw), but much higher than full throttle on this fw (I cant get rid of 35-37km/h limit.)

P1 - 46 P3 - 1
12 magnets max cadence 20
Stock assist levels etc.
14s batt.
214 angle
137 angle
Stock pwm rise
No file edited (config.h, main) all stock

Battery at 57V (doing this I wanted to discharge my battery a bit, cause I have blown 2 mosfets and then seen they are 60v (others have 68v or 80v) only so not enough margin for 14s.)
Bike on stand, throttle fixed manually to stay same, was running 37km /h then 35 for a while and then started doing what I explained. Anything else you need to know? I am going to test it more now

@Geofft - so its working with no need you to edit config.h? now I realize maybe maybe it worked for me to with germotor bike (and other kt-lcd3)

Maybe its "all" caused by lcd? The wrong speed, etc
 
tried the other display, and throttle is 100% at pas 0! (?), blown mosfets again when turning off the lcd. weird.
First blown was mosfet 1 and 4 now its 1 and 2 counting from shunt side.
 
honya96 said:
tried the other display, and throttle is 100% at pas 0! (?), blown mosfets again when turning off the lcd. weird.
First blown was mosfet 1 and 4 now its 1 and 2 counting from shunt side.
You can try without LCD and define your own default variabke valies that LCD define, they are on main.h. They are the EEPROM variables. Please erase first the firmware writing the option bytes, to nake sure EEPROM is also erased.

Also maybe I can make a firmware with speed controller disable, so you can try with juat direct throttle value to be dutycyle.

I am not at home so I can't help more until today.
 
When first run of firmware and without an LCD connected, the default values are this, defined 9n main.h. This values are after saved on persistent memory of STM8, everytime the LCD change their correspondonding values.

So, If you think your LCD can be source of problems, don't use it amd instead change this default values for your needs:

Code:
// *************************************************************************** //
// EEPROM memory variables default values
#define DEFAULT_VALUE_ASSIST_LEVEL 		2
#define DEFAULT_VALUE_MOTOR_CHARACTARISTIC 	202 // for Q85 motor (12.6 * 16)
#define DEFAULT_VALUE_WHEEL_SIZE	 	20 // 26''
#define DEFAULT_VALUE_MAX_SPEED	 		25
#define DEFAULT_VALUE_POWER_ASSIST_CONTROL_MODE 1
#define DEFAULT_VALUE_CONTROLLER_MAX_CURRENT	10
// *************************************************************************** //
 
thanks, but I dont want to use without lcd. I am just pointing out things which dont work as they should.. the other lcd is running at 42km/h while its like walking speed with gear motor, now running on table, waiting if it fails again.

So its the communication between lcd and controller, limiting the speed.

@geofft you can test by setting P1 at like 20 so display shows 42 and you get walking speed and no way to go faster if I am right.
btw whats your board model number (like KTE-SVP5-A..)

Even my gearmotor bike at 1kw is going 60 downhill so it will be a problem for more people

@Casainho, just seen your last post. I allready tried changing "#define DEFAULT_VALUE_MAX_SPEED" to 72 but looks like lcd overrides it with "its own" 72 which means 42 or 37 on the two lcds :roll:
 
honya96 said:
@Casainho, just seen your last post. I allready tried changing "#define DEFAULT_VALUE_MAX_SPEED" to 72 but looks like lcd overrides it with "its own" 72 which means 42 or 37 on the two lcds :roll:
To make sure it is the LCD: do the same test but never connect the LCD and please tell us of the results.
 
I can say for sure that some other options than P1 P3 and C5 do some changes. I restored original values, put those 3 back as they was, and now I get no throttle at PAS 0 and much higher motor speed while still showing max 35.

Edit: Tried hard but found no specific value causing this, maybe C3 or C4, but after changing them back to stock throttle stays active at PAS:0

so, If anyone wants Throttle still 100%, change a lot randomly :D .
If throttle scaling with PAS, restore original settings by C10
 
So, good to know that LCD is not limiting the speed.
Tomorrow I can change the firmware to disable speed and current controllers, then you can put directly PWM dutycyle on the motor, using the throttle -- can't be more direct.
 
casainho said:
So, good to know that LCD is not limiting the speed.
Tomorrow I can change the firmware to disable speed and current controllers, then you can put directly PWM dutycyle on the motor, using the throttle -- can't be more direct.

I think it is limiting the speed somehow, when I set P1 to higher value I get higher rpm on motor but same speed reading. Without display I cant set the P1

Disabling current control is a big step back, thats the main feature I like.
 
@geofft you can test by setting P1 at like 20 so display shows 42 and you get walking speed and no way to go faster if I am right.
btw whats your board model number (like KTE-SVP5-A..)

Didn't realise that the P1 setting was still active - my setting for this was 211 (16 magnets x 13.2 gear ratio). I'll try your numbers and let you know if I find anything that may help you.

My controller is a KT36/48SVPR, board number KTE-SVP5-A.

Edit to add: My P3 is set to 1, if set to 0 found it applied some restrictions to speed or throttle, can't remember exactly what they were.
My speed is set to max in display (72kph?) but my setup can only achieve about 33kph. I think this is probably the limit for a 201 rpm motor at 48v.
 
geofft said:
@geofft you can test by setting P1 at like 20 so display shows 42 and you get walking speed and no way to go faster if I am right.
btw whats your board model number (like KTE-SVP5-A..)

Didn't realise that the P1 setting was still active - my setting for this was 211 (16 magnets x 13.2 gear ratio). I'll try your numbers and let you know if I find anything that may help you.

My controller is a KT36/48SVPR, board number KTE-SVP5-A.

Edit to add: My P3 is set to 1, if set to 0 found it applied some restrictions to speed or throttle, can't remember exactly what they were.
My speed is set to max in display (72kph?) but my setup can only achieve about 33kph. I think this is probably the limit for a 201 rpm motor at 48v.

Great, so you have the same controller. Please test the low P1 value so you get much higher speed reading than reality, and see if it will go up to 72 or more like 35-42 while not full rpm at motor. Thanks :wink:
 
honya96 said:
casainho said:
So, good to know that LCD is not limiting the speed.
Tomorrow I can change the firmware to disable speed and current controllers, then you can put directly PWM dutycyle on the motor, using the throttle -- can't be more direct.

I think it is limiting the speed somehow, when I set P1 to higher value I get higher rpm on motor but same speed reading. Without display I cant set the P1

Disabling current control is a big step back, thats the main feature I like.
P1 is the DEFAULT_VALUE_MOTOR_CHARACTARISTIC!! So ypu can change it without the LCD!!

The idea to disable current and speed controllers was jist for you to make a test and see if you can run your motor at max speed, without any limitation.
 
honya96 said:
@Stancecoke - Thanks but I will stick with main branch, can test the value if you want, but I am not intersted because it does not work with lcd3.
mtdr has sent a LCD3 to me, so I have now implemented basic functions for the LCD3 in my fork. I added the option of using a higher PWM frequency, also. See the new branch HighSpeedMotors.
The java tool is not updated yet. So you have to edit the config.h manually and doubleclick on Start_Compiling.bat at the moment.

regards
stancecoke

index.php
 
honya96 said:
Great, so you have the same controller. Please test the low P1 value so you get much higher speed reading than reality, and see if it will go up to 72 or more like 35-42 while not full rpm at motor. Thanks :wink:

Found that reducing the P1 number caused a reduction in both displayed and actual wheel speed. At P1=40 was getting a max speed (wheel and display) of just 8-9kph. BTW, my speed detection is via the motor signal (white wire on hall plug), I don't have an external speed sensor. Seemed to get the best result (speed and torque) around the 'correct' setting for my motor, 211.

Not sure if this of any help, or how much these results relate to the rather different characteristics of your motor - but if you need any more tests done then just let me know.. :)
 
Bought one of these just recently:-


bike tester.jpg

Lots of these for sale quite cheap on ebay and great for controlled load testing, especially with weather like the UK today... :wink:
 
geofft said:
Not sure if this of any help, or how much these results relate to the rather different characteristics of your motor - but if you need any more tests done then just let me know.. :)

Thanks, I think it confirms my problem.. for Casainho so he knows there is a bug. :wink:

@Casainho - no need to hurry with this issue, I can get the speed I want by setting wrong P1, then just the displayed speed is wrong.
 
@honya96: I disabled the speed and current controller and also the protection for motor stall, on the new testing branch "direct_throttle". Please download and test, you should be able to get your motor max speed: https://github.com/OpenSource-EBike-firmware/BMSBattery_S_controllers_firmware/tree/direct_throttle

The motor controller is now simple as this (no speed and current controllers):
Code:
void do_motor_controller_mode (void)
{
  // set PWM duty_cycle target value only if we are not braking
  if (!motor_controller_state_is_set (MOTOR_CONTROLLER_STATE_BRAKE))
  {
    motor_set_pwm_duty_cycle_target (ui8_throttle_value_filtered);
  }
}

@geofft: nice that you got the training bike roller, would be great if you could put a constant speed and adjust the value for FOC_READ_ID_CURRENT_ANGLE_ADJUST. Can you please share with us how was the process and the final value for your motor?

@stancecoke: great that HighSpeedMotors, would be great to have feedback from users!!
 
honya96 said:
geofft said:
Not sure if this of any help, or how much these results relate to the rather different characteristics of your motor - but if you need any more tests done then just let me know.. :)

Thanks, I think it confirms my problem.. for Casainho so he knows there is a bug. :wink:

@Casainho - no need to hurry with this issue, I can get the speed I want by setting wrong P1, then just the displayed speed is wrong.
I am lost here: can you please resume?
I understand that your motor is direct drive, with 46 magnets and you set P1 = 46, which is ok.
 
honya96 said:
I am going to try it right now.
I've just updated the java tool, so you can use it.
The displayed power won't be correct, until we found the right value for Battery Current cal a for your controller.
In the recent code the correct power is only displayed for Battery Current cal a = 10, but's no problem to improve the code to show the right power for any Battery Current cal a value.
I found, that the LCD3 has a very low resolution for the current, just 0.5 A. So, for 2.01 and 2.5 A, the same power will be displayed, for example...

The speed display only works with an external sensor at the moment...
And the direction detection is not implemented yet, so the motor will start, if you are pulling the bike in reverse in the torquesimulation mode.

regards
stancecoke
 
casainho said:
honya96 said:
geofft said:
Not sure if this of any help, or how much these results relate to the rather different characteristics of your motor - but if you need any more tests done then just let me know.. :)

Thanks, I think it confirms my problem.. for Casainho so he knows there is a bug. :wink:

@Casainho - no need to hurry with this issue, I can get the speed I want by setting wrong P1, then just the displayed speed is wrong.
I am lost here: can you please resume?
I understand that your motor is direct drive, with 46 magnets and you set P1 = 46, which is ok.

simply said, if you set low P1 value you dont get full motor rpm. even when display is set at 72 you get less.

no one will notice with gear motor but direct has lower P1 so you dont get full motor rpm until you set P1 higher, then you get full rpm range but wrong speed reading
 
honya96 said:
simply said, if you set low P1 value you dont get full motor rpm. even when display is set at 72 you get less.

no one will notice with gear motor but direct has lower P1 so you dont get full motor rpm until you set P1 higher, then you get full rpm range but wrong speed reading
Ok, now I understand. And the code that uses P1 value and sets the max speed for motor conttoller, may have a bug and here is the code -- I need to think about it:
Code:
  // (ui8_max_speed * 1000 * (ui8_motor_characteristic / 2)) / (3600 * f_wheel_size)
  ui32_temp = ((uint32_t) lcd_configuration_variables->ui8_max_speed) * 1000; // in meters/hour
  ui32_temp *= ((uint32_t) (lcd_configuration_variables->ui8_motor_characteristic >> 1));
  f_temp = 3600.0 * f_wheel_perimeter;
  f_temp = ((float) ui32_temp) / f_temp;
  motor_controller_set_speed_erps_max ((uint16_t) f_temp);
I think that code works well.
For a 46 magnets motor like yours, for a wheel of 26'' and wheel speed of 25km/h, the max erps will be: 77.
For a Q85 geared motor, for a wheel of 26'' and wheel speed of 25km/h, the max erps will be: 343.
That is a big difference... and that value will set the variable ui16_target_erps and on the speed controller MOTOR_SPEED_CONTROLLER_KP:
Code:
  i16_error = ui16_target_erps - i16_motor_speed_erps;
  i16_output = i16_error * MOTOR_SPEED_CONTROLLER_KP;
the i16_error in speed will be multiplied for the constant K MOTOR_SPEED_CONTROLLER_KP. A geared motor will always a bigger output value on that calculation...
The ratio is: 343 / 77 = 4.54. So, you can edit on main.h file and change from 2 to 9 or maybe even a little higher value:
Code:
#define MOTOR_SPEED_CONTROLLER_KP 2 // x << 5
 
Back
Top