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

Electric Motors and Controllers
User avatar
stancecoke   10 kW

10 kW
Posts: 903
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 » Jun 13 2018 8:26am

casainho wrote:
Jun 13 2018 7:32am
It is on the issue list with that name, discussed and defined ready to be implemented. I wish more developers could join.
It is already implemented in my fork (as a "morse-code" with the break lever), so it's only copy-paste...
Using the brake lever is better I think, as we don't need to use a custom LCD firmware. In the stock display firmware, the only implemented long press function, that sets a bit in the communication protocol, is the light switch, I think. And the brake lever works for people who don't want to use a display also.

regards
stancecoke

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 » Jun 13 2018 8:32am

stancecoke wrote:
Jun 13 2018 8:26am
casainho wrote:
Jun 13 2018 7:32am
It is on the issue list with that name, discussed and defined ready to be implemented. I wish more developers could join.
It is already implemented in my fork (as a "morse-code" with the break lever), so it's only copy-paste...
It needs more work than that:
1. understand current firmware structure and implement for that structure
2. testing and then debugging, as hardly everything works at first time

Copy-past would make the firmware a mess. There are states that need to keep working because they implement some protections and most of the time, any addition will need to be done with care other way will brake that states.
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.

honya96   1 kW

1 kW
Posts: 328
Joined: Mar 05 2015 9:38am
Location: Czech Republic

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

Post by honya96 » Jun 13 2018 8:48am

geofft wrote:
Jun 13 2018 7:26am
A very kind feature would be, to enable/disable the 25 km/h limit with long pressing the up/down keys. Might this be implementable?
And show brake symbol or something after the hold period so we know its active and disapear after releasing

User avatar
stancecoke   10 kW

10 kW
Posts: 903
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 » Jun 13 2018 9:01am

casainho wrote:
Jun 13 2018 8:32am
Copy-past would make the firmware a mess.
Copy-Paste of the improved direction detection for PAS took me just one or two hours of work. But of course you are right, most of the time I had to spend to understand how you solved things in your code. If you don't like a "quick-and-dirty"-solution, you can take the principle from the other fork and have to implement it yourself. I think you are the only one in the world, who understands the whole firmware structure :shock: I lost track of things one day :-(.

regards
stancecoke

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 » Jun 14 2018 2:13am

stancecoke wrote:
Jun 13 2018 9:01am
casainho wrote:
Jun 13 2018 8:32am
Copy-past would make the firmware a mess.
Copy-Paste of the improved direction detection for PAS took me just one or two hours of work. But of course you are right, most of the time I had to spend to understand how you solved things in your code. If you don't like a "quick-and-dirty"-solution, you can take the principle from the other fork and have to implement it yourself. I think you are the only one in the world, who understands the whole firmware structure :shock: I lost track of things one day :-(.
I suggest you to make a branch or fork so you can add it and we can discuss here the structure and where it makes morr sense to add the code.
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.

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 » Jun 14 2018 7:26am

LCD3: I implemented the configuration of wheel max speed, wheel size and units of Km/h or MPh (for TSDZ2 motor).
Let's see if anyone is interested to implement the version for our firmware for KT motor controllers. The structure of the configuration menus is there and working so should be simple to expand to add custom configuration menus:

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.

User avatar
stancecoke   10 kW

10 kW
Posts: 903
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 » Jun 14 2018 12:30pm

casainho wrote:
Jun 14 2018 2:13am
I suggest you to make a branch or fork so you can add it and we can discuss here the structure and where it makes morr sense to add the code.
Hm, I just had a short look at the recent code. The speed limit is already enabled/disabled by the display via parameter P3. The speed control is not just a cut off at the speed limit, but a speed control according to the throttle position (or PAS state).

edit: ah, now I found the cut off code :-), but I can't find any call of the function set_speed_erps_max_to_motor_controller?!
And the definition of the default values :-)

I think the wanted function is an enabled speed limit by default, when switching on the system, for legality issues, and a hidden function to disable the limit until the system is switched off again.

Is that right?

I've added a first try to a new branch at github, it's not tested in hardware yet.
The speed limit is disabled by sending the "code" by the brake lever as described in the tab "alternative fork" of the windows tutorial. The cheat step duration is defined in the main.h to one second each at the moment, to avoid the need of updating the java tool. The slow loop runs at 10Hz at casainhos master, in my fork it runs at 50Hz.
The cheat works like this: Hold the brake lever for cheat time 1, then release it for the duration of cheat time 2, then pull it again for cheat time 3, then release it again. For step 1 with a value of 10, the release of the brake lever is recognized as valid for a period of 1 to 1.5 seconds after pulling and continues with step 2. If the lever is released too early or too late, the whole procedure is reset and you have to start all over again. Currently the user does not get any feedback on whether the cheat has been activated.
regards
stancecoke

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 » Jun 14 2018 5:14pm

I really don't like the wording "cheat" as it depreciates the project. Look at this reality: I have an ebike, in this case BTT bike with a powerful mid drive motor of 800W and that can achive 45km/h - I will drive 10km on road until I arrive at montains were I will do a sport ride with other friends. In the end I will be back to home again that 10km on the road -- so, current tecnhology is very flexible and is desirable to be like that, the same ebike we can be used offroad without speed, power and throttle usage imposed limits while just after when commuting on the road, it must need to be limited. That is not a cheat but instead, flexibility.
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.

User avatar
stancecoke   10 kW

10 kW
Posts: 903
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 » Jun 15 2018 1:25am

:D you can call it whatever you want :D

Please, can you confirm: The function for cutting the power at the speed limit is prepared in the code but it's not used actually?!

Code: Select all

volatile uint16_t ui16_target_erps_max = MOTOR_OVER_SPEED_ERPS;

...

void motor_controller_set_speed_erps_max (uint16_t ui16_erps)
{
  ui16_target_erps_max = ui16_erps;
}

regards
stancecoke

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 » Jun 15 2018 1:36am

stancecoke wrote:
Jun 15 2018 1:25am
:D you can call it whatever you want :D

Please, can you confirm: The function for cutting the power at the speed limit is prepared in the code but it's not used actually?!

Code: Select all

volatile uint16_t ui16_target_erps_max = MOTOR_OVER_SPEED_ERPS;

...

void motor_controller_set_speed_erps_max (uint16_t ui16_erps)
{
  ui16_target_erps_max = ui16_erps;
}
I am remaming the variables and simplifing a bit the code. Should commit today.

Yes, I think it is not used right now.

Without PI controller, it can be implemented on fast loop. I just did that for TSDZ2 and found issues on the code that I can correct for KT. But the cut in speed is kind of fast, may be ok for max erps but not for user speed limit. Anyway, we can start like that for now.

Street mode should impose a 25km/h limit or the limit value that is configured by user on the LCD?
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.

User avatar
stancecoke   10 kW

10 kW
Posts: 903
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 » Jun 15 2018 1:55am

casainho wrote:
Jun 15 2018 1:36am
But the cut in speed is kind of fast, may be ok for max erps but not for user speed limit. Anyway, we can start like that for now.
Yes, I think we should ramp down the power slowly within a range of 2 km/h. It's solved that way in the "Forumscontroller" and in my fork. But it has to be placed in the slow loop, I think.

Code: Select all

uint32_t CheckSpeed (uint16_t current_target, uint16_t speed)
{

  //ramp down motor power if you are riding too fast and speed liming is active
  if (speed>limit*1000 && ui8_cheat_state!=4){
      //printf("Vor %d, %d\r\n", current_target-ui16_current_cal_b, speed);
	if (speed>(limit+2)*1000){ //if you are riding much too fast, stop motor immediately
	    current_target=ui16_current_cal_b;
	   //printf("Speed much too high! %d, %d\r\n", current_target, speed);
	}
	else {

	    ui32_temp=((current_target-ui16_current_cal_b));
	    //printf("Substraktion %d, %lu\r\n", current_target, ui32_temp) ;
	    ui32_temp *=((limit+2)*1000-speed);
	    //printf("Mal %d, %lu\r\n", current_target, ui32_temp) ;
	    current_target=(uint16_t)(ui32_temp/2000+ui16_current_cal_b); 	//ramp down the motor power within 2 km/h, if you are riding too fast
	    //printf("Speed too high!\r\n");
	    //printf("Nach %d, %lu\r\n", current_target, ui32_temp) ;
	}
  }
    return ((uint32_t)current_target);
  }
casainho wrote:
Jun 15 2018 1:36am
Street mode should impose a 25km/h limit or the limit value that is configured by user on the LCD?
We should use the value that's defined by the user on the LCD. I think in US the legal limit is 20mph (32km/h).

regards
stancecoke

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 » Jun 15 2018 2:52am

Offroad mode code is on this branch: https://github.com/OpenSource-EBike-fir ... froad_mode

The code is untested as now I don't have have ready hardware to test it.

offroad_mode (); is now called inside ebike_app ();
The output is the ui8_offroad_mode = 1 if offroad mode is enable, otherwise will be zero.
stancecoke wrote:
Jun 15 2018 1:55am
casainho wrote:
Jun 15 2018 1:36am
But the cut in speed is kind of fast, may be ok for max erps but not for user speed limit. Anyway, we can start like that for now.
Yes, I think we should ramp down the power slowly within a range of 2 km/h. It's solved that way in the "Forumscontroller" and in my fork. But it has to be placed in the slow loop, I think.
Maybe you can reuse map function.
Inputs: delta speed (max speed - 2)
Range input: 0 to 2
Range output: 0 to max battery current
Output: ui8_adc_target_battery_current_max
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.

User avatar
stancecoke   10 kW

10 kW
Posts: 903
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 » Jun 15 2018 3:28am

casainho wrote:
Jun 15 2018 2:52am
The code is untested as now I don't have have ready hardware to test it.
Hm, I don't understand your code, I think it can't work. The if condition will never get true, so the switch structure will never be called....

Code: Select all

if (ui8_offroad_state == 3)
Another bug in my code: the 25 has to be 5. The 25 represents half a second at 50 Hz. At 10Hz it has to be 5. I had changed the 25 to 5 only at state 3...

regards
stancecoke

Basia   10 W

10 W
Posts: 69
Joined: Nov 10 2017 4:17am
Location: Wilmington

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

Post by Basia » Jun 15 2018 3:37am

stancecoke wrote:
Jun 12 2018 11:01pm

Code: Select all

#define ADC_MOTOR_CURRENT_MAX	43 // each unit = 0.35A; 43 = 15A
regards
stancecoke
After attempts to configure PWM_DUTY_CYCLE_AMP
the controller burned out. The wheel began to spin and stop very choppy. I did not press Throttle!
Last edited by Basia on Jun 15 2018 3:52am, edited 1 time in total.

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 » Jun 15 2018 3:46am

stancecoke wrote:
Jun 15 2018 3:28am
casainho wrote:
Jun 15 2018 2:52am
The code is untested as now I don't have have ready hardware to test it.
Hm, I don't understand your code, I think it can't work. The if condition will never get true, so the switch structure will never be called....

Code: Select all

if (ui8_offroad_state == 3)
Another bug in my code: the 25 has to be 5. The 25 represents half a second at 50 Hz. At 10Hz it has to be 5. I had changed the 25 to 5 only at state 3...
You are right. I just changed that, please review now.
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.

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 » Jun 15 2018 3:50am

Basia wrote:
Jun 15 2018 3:37am
stancecoke wrote:
Jun 12 2018 11:01pm

Code: Select all

#define ADC_MOTOR_CURRENT_MAX	43 // each unit = 0.35A; 43 = 15A
regards
stancecoke
Фfter attempts to configure PWM_DUTY_CYCLE_AMP
the controller burned out. The wheel began to spin and stop very choppy. I did not press Throttle!
I was to say that small motor using 1.5 amps at max speed, seems a bit high to me. I would say something more like 0.5 amps.

Sorry to know that controller did burn. At least this controllers relatively cheap to replace.
I always use a car fuse of 10 amps to try protect from that situation.
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.

Basia   10 W

10 W
Posts: 69
Joined: Nov 10 2017 4:17am
Location: Wilmington

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

Post by Basia » Jun 15 2018 3:58am

casainho wrote:
Jun 15 2018 3:50am
Basia wrote:
Jun 15 2018 3:37am
stancecoke wrote:
Jun 12 2018 11:01pm

Code: Select all

#define ADC_MOTOR_CURRENT_MAX	43 // each unit = 0.35A; 43 = 15A
regards
stancecoke
Фfter attempts to configure PWM_DUTY_CYCLE_AMP
the controller burned out. The wheel began to spin and stop very choppy. I did not press Throttle!
I was to say that small motor using 1.5 amps at max speed, seems a bit high to me. I would say something more like 0.5 amps.

Sorry to know that controller did burn. At least this controllers relatively cheap to replace.
I always use a car fuse of 10 amps to try protect from that situation.
I ordered a new controller ;). How to set up PWM_DUTY_CYCLE_AMP correctly? My battery is 48V.

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 » Jun 15 2018 4:03am

Basia wrote:
Jun 15 2018 3:58am
I ordered a new controller ;). How to set up PWM_DUTY_CYCLE_AMP correctly? My battery is 48V.
PWM_DUTY_CYCLE_AMP ??
And buy and use a fuse in series with the battery positive/red wire, of 10 amps or even less.
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.

Basia   10 W

10 W
Posts: 69
Joined: Nov 10 2017 4:17am
Location: Wilmington

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

Post by Basia » Jun 15 2018 4:05am

casainho wrote:
Jun 15 2018 4:03am
Basia wrote:
Jun 15 2018 3:58am
I ordered a new controller ;). How to set up PWM_DUTY_CYCLE_AMP correctly? My battery is 48V.
PWM_DUTY_CYCLE_AMP ??
And buy and use a fuse in series with the battery positive/red wire, of 10 amps or even less.
Sorry )
config.h
#define PWM_DUTY_CYCLE_RAMP_UP_INVERSE_STEP 35
#define PWM_DUTY_CYCLE_RAMP_DOWN_INVERSE_STEP 35

User avatar
stancecoke   10 kW

10 kW
Posts: 903
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 » Jun 15 2018 4:07am

casainho wrote:
Jun 15 2018 3:46am
You are right. I just changed that, please review now.
Hm, with OFFROAD_STATE_END 4, you will disable the routine with the first time you are using the brake lever. You have to reset the state to zero, if you are just using the break lever for breaking, or if you failed to find the right rythm of the morse-code.

OFFROAD_STATE_END 0 should work. I can try it in hardware during the weekend...

regards
stancecoke

Basia   10 W

10 W
Posts: 69
Joined: Nov 10 2017 4:17am
Location: Wilmington

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

Post by Basia » Jun 15 2018 4:30am

Basia wrote:
Jun 15 2018 4:05am
casainho wrote:
Jun 15 2018 4:03am
Basia wrote:
Jun 15 2018 3:58am
I ordered a new controller ;). How to set up PWM_DUTY_CYCLE_AMP correctly? My battery is 48V.
PWM_DUTY_CYCLE_AMP ??
And buy and use a fuse in series with the battery positive/red wire, of 10 amps or even less.
Sorry )
config.h
#define PWM_DUTY_CYCLE_RAMP_UP_INVERSE_STEP 35
#define PWM_DUTY_CYCLE_RAMP_DOWN_INVERSE_STEP 35
I do not understand how this works. Is it possible to disable PWM? Is it possible to disconnect all PAS sensors from the settings? I have only a throttle.

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 » Jun 15 2018 4:48am

stancecoke wrote:
Jun 15 2018 4:07am
casainho wrote:
Jun 15 2018 3:46am
You are right. I just changed that, please review now.
Hm, with OFFROAD_STATE_END 4, you will disable the routine with the first time you are using the brake lever. You have to reset the state to zero, if you are just using the break lever for breaking, or if you failed to find the right rythm of the morse-code.

OFFROAD_STATE_END 0 should work. I can try it in hardware during the weekend...
I see. I implemented thinking that user can do it only once when system boots up.

Also added option to config.h so user can enable always offroad mode.
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.

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 » Jun 15 2018 4:53am

Basia wrote:
Jun 15 2018 4:30am
Basia wrote:
Jun 15 2018 4:05am
casainho wrote:
Jun 15 2018 4:03am
Basia wrote:
Jun 15 2018 3:58am
I ordered a new controller ;). How to set up PWM_DUTY_CYCLE_AMP correctly? My battery is 48V.
PWM_DUTY_CYCLE_AMP ??
And buy and use a fuse in series with the battery positive/red wire, of 10 amps or even less.
Sorry )
config.h
#define PWM_DUTY_CYCLE_RAMP_UP_INVERSE_STEP 35
#define PWM_DUTY_CYCLE_RAMP_DOWN_INVERSE_STEP 35
I do not understand how this works. Is it possible to disable PWM? Is it possible to disconnect all PAS sensors from the settings? I have only a throttle.
PAS settings must be there but you can ignore the values/PAS options.

Should be this for a throttle:
// choose between throttle and/or pas or torque sensor
#define EBIKE_THROTTLE_TYPE EBIKE_THROTTLE_TYPE_THROTTLE_PAS
//#define EBIKE_THROTTLE_TYPE EBIKE_THROTTLE_TYPE_TORQUE_SENSOR

// next, choose one of the both (only apply to throttle and/or PAS)
//#define EBIKE_THROTTLE_TYPE_THROTTLE_PAS_PWM_DUTY_CYCLE // direct PWM duty_cycle control
#define EBIKE_THROTTLE_TYPE_THROTTLE_PAS_CURRENT_SPEED // control using motor current/torque and/or wheel speed

Don't change this, a smaller value of 35 can help burn the power mosfets of the controller. But you can try increase the value to get a slower response and even have the mosfets with lower phase currents, so will be better for them.

#define PWM_DUTY_CYCLE_RAMP_UP_INVERSE_STEP 35
#define PWM_DUTY_CYCLE_RAMP_DOWN_INVERSE_STEP 35
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.

Basia   10 W

10 W
Posts: 69
Joined: Nov 10 2017 4:17am
Location: Wilmington

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

Post by Basia » Jun 15 2018 5:26am

casainho wrote:
Jun 15 2018 4:53am
Basia wrote:
Jun 15 2018 4:30am
Basia wrote:
Jun 15 2018 4:05am
casainho wrote:
Jun 15 2018 4:03am

PWM_DUTY_CYCLE_AMP ??
And buy and use a fuse in series with the battery positive/red wire, of 10 amps or even less.
Sorry )
config.h
#define PWM_DUTY_CYCLE_RAMP_UP_INVERSE_STEP 35
#define PWM_DUTY_CYCLE_RAMP_DOWN_INVERSE_STEP 35
I do not understand how this works. Is it possible to disable PWM? Is it possible to disconnect all PAS sensors from the settings? I have only a throttle.
PAS settings must be there but you can ignore the values/PAS options.

Should be this for a throttle:
// choose between throttle and/or pas or torque sensor
#define EBIKE_THROTTLE_TYPE EBIKE_THROTTLE_TYPE_THROTTLE_PAS
//#define EBIKE_THROTTLE_TYPE EBIKE_THROTTLE_TYPE_TORQUE_SENSOR

// next, choose one of the both (only apply to throttle and/or PAS)
//#define EBIKE_THROTTLE_TYPE_THROTTLE_PAS_PWM_DUTY_CYCLE // direct PWM duty_cycle control
#define EBIKE_THROTTLE_TYPE_THROTTLE_PAS_CURRENT_SPEED // control using motor current/torque and/or wheel speed

Don't change this, a smaller value of 35 can help burn the power mosfets of the controller. But you can try increase the value to get a slower response and even have the mosfets with lower phase currents, so will be better for them.

#define PWM_DUTY_CYCLE_RAMP_UP_INVERSE_STEP 35
#define PWM_DUTY_CYCLE_RAMP_DOWN_INVERSE_STEP 35
Please see my config.
Attachments
config.h
(1.35 KiB) Downloaded 36 times

User avatar
stancecoke   10 kW

10 kW
Posts: 903
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 » Jun 15 2018 5:55am

casainho wrote:
Jun 15 2018 4:48am

I see. I implemented thinking that user can do it only once when system boots up.
Hmm, still you have no chance for a second try or to put in the code after first braking. You have to switch off/on the system each time, for a new try :-(
Why do you use all the constants?! The simple numbering was much easier to follow....

regards
stancecoke

Post Reply