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

Electric Motors and Controllers
casainho   100 MW

100 MW
Posts: 2664
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Apr 02 2018 8:07am

stancecoke wrote:
Apr 02 2018 8:00am
edit:
casainho wrote:
Apr 02 2018 7:50am
Try to comment the code on ebike_app_state_machine() to see the result.
which line do you mean?!
The full code.

For how many seconds the motor run before stop?
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, you can 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: 2664
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Apr 02 2018 8:53am

So, after changing MOTOR_ROTOR_ERPS_START_INTERPOLATION_60_DEGREES to 10, I almost don't feel the any vibrations. Then, I wanted to look to FOC working while regen, as Stancecoke told it doesn't work well for regen.

I took a log and saw that "angle_correction" keeps decreasing and even underflows from 0 to 255 while regen, which is really bad -- see green bottom line, that keeps decreasing while "adc_battery_current" < 80 (regen):
Image

Then I went and limited the max and min possible values of "angle_correction" to +- 15 and also avoided decreasing during regen - the output is now what I expected and I can fell it working well on a real ride:
Image

Final code:

Code: Select all

  // make sure we just execute one time per ERPS, so use the flag ui8_flag_foc_read_id_current
  if ((ui8_motor_rotor_angle >= ((uint8_t) FOC_READ_ID_CURRENT_ANGLE_ADJUST)) && (ui8_flag_foc_read_id_current))
  {
    ui8_flag_foc_read_id_current = 0;

    // minimum speed to do FOC
    if (ui16_motor_speed_erps > MOTOR_ROTOR_ERPS_START_INTERPOLATION_60_DEGREES)
    {
      // read here the phase B current: FOC Id current
      ui8_adc_id_current = UI8_ADC_MOTOR_PHASE_B_CURRENT;
      if (ui8_adc_id_current > ADC_PHASE_B_CURRENT_ZERO_AMPS_FOC_MAX)
      {
	// limit max ui8_angle_correction value (127 + 15)
	if ((ui8_angle_correction+1) < 143) { ui8_angle_correction++; }
      }
      else if (ui8_adc_id_current < ADC_PHASE_B_CURRENT_ZERO_AMPS_FOC_MIN)
      {
	// limit min ui8_angle_correction value (127 - 15)
	if ((ui8_angle_correction-1) > 112)
	{
	  // decrease only when not regen!! other way ui8_angle_correction will always decrease... CAN WE IMPROVE THIS??
	  if (UI8_ADC_BATTERY_CURRENT > (ui8_adc_battery_current_offset+2)) { ui8_angle_correction--; }
	}
      }
    }
  }
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, you can 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: 896
Joined: Aug 02 2017 2:56pm

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

Post by stancecoke » Apr 02 2018 10:18am

casainho wrote:
Apr 02 2018 8:07am
For how many seconds the motor run before stop?
about 6 seconds

I commented out the whole state machine now, but the problem is still the same. :cry:

Do you have a suggestion which parameters we should print out to the BT-Module for debugging?

(I don't know how much patience I have left, as the high speed motor branch works really good for me :wink: )

regards
stancecoke

casainho   100 MW

100 MW
Posts: 2664
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Apr 02 2018 11:25am

stancecoke wrote:
Apr 02 2018 10:18am
casainho wrote:
Apr 02 2018 8:07am
For how many seconds the motor run before stop?
about 6 seconds

I commented out the whole state machine now, but the problem is still the same. :cry:

Do you have a suggestion which parameters we should print out to the BT-Module for debugging?
So about 5 seconds:

Code: Select all

void read_torque_sensor_throttle (void)
{

...
    // now count 5 seconds
    case 1:
    if (ui8_rtst_counter++ > 50) // 5 seconds
    {
I guess your issue is with PAS:

Code: Select all

  // if user doesn't pedal, disable throttle signal
  if ((ui8_startup_phase == 0) && (ui8_pas1_cadence_rpm == 0))
  {
    ui8_throttle_value_filtered = 0;
Log this values:
ui8_adc_throttle_value -- is the raw value
ui8_throttle_value_filtered -- is processed value, I think the issue is on processing
just compared that both variables on serial

My most recent code that improves and is easier to read that piece of code is on this branch, I am being improving because of troque sensor: improving_for_direct_drive_motor
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, you can 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: 2664
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Apr 02 2018 11:38am

So, I just broke my bottom bracket torque sensor, while I was doing a lot of force at a hill -- now I remember this already happened to me once some years ago.

Image

But before it broke, I was able to ride and test the battery current controller, torque sensor filtering and battery regen current that is setup by pedaling backwards - the code is on this branch "improving_for_direct_drive_motor".
Much more happy with the results with my direct drive motor Q11, as now it almost doesn't vibrate:
Image
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, you can 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: 896
Joined: Aug 02 2017 2:56pm

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

Post by stancecoke » Apr 02 2018 12:18pm

Oh, I hope you weren't injured when the crank broke off....

I found a bug now: In the main.h you define

Code: Select all

// *************************************************************************** //
// Throotle and PAS

#define EBIKE_THROTTLE_TYPE_THROTTLE_PAS		1
#define EBIKE_THROTTLE_TYPE_TORQUE_SENSOR		2
// *************************************************************************** //
with this, the #if statements in the ebike_app.c don't work properly....
I commented out these entries in the main.h, now the right #if statements are active in eclipse (not greyed in the code).

I chose #define EBIKE_THROTTLE_TYPE EBIKE_THROTTLE_TYPE_THROTTLE_PAS now and with throttle and

-with #define EBIKE_THROTTLE_TYPE_THROTTLE_PAS_PWM_DUTY_CYCLE the motor runs only very slowly now,
-with #define EBIKE_THROTTLE_TYPE_THROTTLE_PAS_CURRENT_SPEED, the motor runs well, as expected...

So next step is to improve the PAS code, as obiously this part still doesn't work...

regards
stancecoke
Last edited by stancecoke on Apr 02 2018 2:07pm, edited 1 time in total.

casainho   100 MW

100 MW
Posts: 2664
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Apr 02 2018 12:48pm

stancecoke wrote:
Apr 02 2018 12:18pm
So next step is to improve the PAS code, as obiously this part still doesn't work...
No, all is ok but is dangerous that situation. Thanks.
Thanks for the bug, I will look at it later.

So, which part of PAS code doesn't work? direction detection?
For direction detection, maybe we can do as you advice before, look at the ratio of ui16_pas1_on_time_counter over ui16_pas1_off_time_counter, make a division on read_pas_cadence_and_direction() that runs every 100ms. PWM interrupt just needs to deal with ui16_pas1_on_time_counter and ui16_pas1_off_time_counter.
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, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

geofft   1 kW

1 kW
Posts: 319
Joined: Nov 09 2012 9:41am
Location: Berkshire UK

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

Post by geofft » Apr 02 2018 1:00pm

casainho wrote:
Apr 02 2018 11:38am
So, I just broke my bottom bracket torque sensor, while I was doing a lot of force at a hill -- now I remember this already happened to me once some years ago.
....I'd be interested to know which type of torque sensor (type/supplier) this was.. :shock:
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

casainho   100 MW

100 MW
Posts: 2664
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Apr 02 2018 1:13pm

geofft wrote:
Apr 02 2018 1:00pm
casainho wrote:
Apr 02 2018 11:38am
So, I just broke my bottom bracket torque sensor, while I was doing a lot of force at a hill -- now I remember this already happened to me once some years ago.
....I'd be interested to know which type of torque sensor (type/supplier) this was.. :shock:
BMSBattery B.B. torque sensor.
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, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

geofft   1 kW

1 kW
Posts: 319
Joined: Nov 09 2012 9:41am
Location: Berkshire UK

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

Post by geofft » Apr 02 2018 2:04pm

casainho wrote:
Apr 02 2018 1:13pm
geofft wrote:
Apr 02 2018 1:00pm
casainho wrote:
Apr 02 2018 11:38am
So, I just broke my bottom bracket torque sensor, while I was doing a lot of force at a hill -- now I remember this already happened to me once some years ago.
....I'd be interested to know which type of torque sensor (type/supplier) this was.. :shock:
BMSBattery B.B. torque sensor.
Thanks. I'm still thinking about trying a torque sensor, will probably give the BMS one a miss on this evidence.

Thought I might try one of these (T2 version):-
https://www.aliexpress.com/item/torque- ... 93999.html
...anybody have any thoughts/comments/experiences with these?
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

casainho   100 MW

100 MW
Posts: 2664
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Apr 02 2018 2:08pm

I just bought 2 units of BMSBattery torque sensors :-)
They work well but now I know I can't put my 100kg + some more acceleration on them.
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, you can 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: 896
Joined: Aug 02 2017 2:56pm

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

Post by stancecoke » Apr 02 2018 2:15pm

geofft wrote:
Apr 02 2018 2:04pm
Thought I might try one of these (T2 version):-
https://www.aliexpress.com/item/torque- ... 93999.html
...anybody have any thoughts/comments/experiences with these?
Yes, I've tested the first and the second generation of these Sempu sensors myself, and there's experience with the third generation in the german forum also.
I can recommend this product, but it needs higher supply voltage, you can't use the 5V from the throttle connector. The third generation works with battery volatage directly.
casainho wrote:
Apr 02 2018 12:48pm
So, which part of PAS code doesn't work? direction detection?
I think so, as the difference between pedaling forward and pedaling reverse is not big with my modded torquesensor, as already shown some pages before, see the orange graph...

Image

regards
stancecoke

casainho   100 MW

100 MW
Posts: 2664
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Apr 02 2018 3:31pm

stancecoke wrote:
Apr 02 2018 2:15pm
I think so, as the difference between pedaling forward and pedaling reverse is not big with my modded torquesensor, as already shown some pages before, see the orange graph...
Can you please provide a patch against master, would be easier for me to review the code.

I suggest you to use ton/toff from PWM interrupt, on ebike_app.c and make the division and other slow operations if needed, there.
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, you can 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: 896
Joined: Aug 02 2017 2:56pm

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

Post by stancecoke » Apr 03 2018 2:36am

casainho wrote:
Apr 02 2018 3:31pm
I suggest you to use ton/toff from PWM interrupt, on ebike_app.c and make the division and other slow operations if needed, there.
I will try to use your code structure as far as possible, but we have to do floatingpoint operations and we can't do it at the ebike_app.c as it runs only every 100ms, that's too slow for PAS Sensors with a high number of magnets...
I will put the code for direction detection in the main.c and run it only on a rising edge detected in the motor.c (the same way I do it in the HighSpeedMotor branch). I know, you don't like "interrupt-like" actions (for whatever reason :-)), but that's the strait forward way.

regards
stancecoke

casainho   100 MW

100 MW
Posts: 2664
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Apr 03 2018 2:38am

FOC for regen
I tried a few things like inverting the, instead of increasing, decreasing and vice-versa the adjust angle value. The actual solution is to not change the adjust angle value while regen and unlike when accelerating, I feel vibrations on my direct motor drive which makes me feel is not working as it should.

What I remember to see on oscilloscope was the phase B signal to get invert 180º, like the positive part of sinewave got negative and vice-versa...

If someone has ideas on how to solve this......
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, you can 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: 2664
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Apr 03 2018 2:51am

stancecoke wrote:
Apr 03 2018 2:36am
casainho wrote:
Apr 02 2018 3:31pm
I suggest you to use ton/toff from PWM interrupt, on ebike_app.c and make the division and other slow operations if needed, there.
I will try to use your code structure as far as possible, but we have to do floatingpoint operations and we can't do it at the ebike_app.c as it runs only every 100ms, that's too slow for PAS Sensors with a high number of magnets...
I will put the code for direction detection in the main.c and run it only on a rising edge detected in the motor.c (the same way I do it in the HighSpeedMotor branch). I know, you don't like "interrupt-like" actions (for whatever reason :-)), but that's the strait forward way.
Look, the output value of PAS is currently only used on ebike_app_controller() and if you process it faster, will be useless.
Even current code can be improved, I think. I would say that on PWM interrupt code, we just need to keep update the ui16_pas1_on_time_counter and ui16_pas1_off_time_counter and after on ebike_app.c file, read_pas_cadence_and_direction(), we can look at that on/off values and calculate PAS_cadence and PAS_direction as we don't need them calculated with higher frequency.
For what I could understood from the Arduino code you did show before, to calculate PAS_cadence and PAS_direction, we just need as input the values of on/off (can be expressed in PWM cycle ticks).
What do you think of this idea?
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, you can 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: 896
Joined: Aug 02 2017 2:56pm

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

Post by stancecoke » Apr 03 2018 3:54am

casainho wrote:
Apr 03 2018 2:51am
I would say that on PWM interrupt code, we just need to keep update the ui16_pas1_on_time_counter and ui16_pas1_off_time_counter
We will still need the rising edge detection and the reset of the counters in the interrupt code and have to store ui16_pas1_counter (already stored to ui16_pas1_pwm_cycles_ticks) and ui16_pas1_on_time_counter to global variables to process them in the ebike_app.c, With this, you are right, we don't need to do the dircetion detection in the main.c. We don't need ui16_pas1_off_time_counter.

Where is the PAS timeout detection for the motor stop in PAS mode located in the master branch?! Is it this part? So you just set the throttle value to zero?! Why do you set the counters to zero at this point?!

Code: Select all

// limit min PAS cadence
  if (ui16_pas1_counter > ((uint16_t) PAS_ABSOLUTE_MIN_CADENCE_PWM_CYCLE_TICKS))
  {
    ui16_pas1_pwm_cycles_ticks = (uint16_t) PAS_ABSOLUTE_MIN_CADENCE_PWM_CYCLE_TICKS;
    ui16_pas1_counter = 0;
    ui16_pas1_on_time_counter = 0;
    ui16_pas1_off_time_counter = 0;
    ui8_pas1_direction = 1;
    ui8_torque_sensor_throttle_processed_value = 0;
  }
regards
stancecoke

casainho   100 MW

100 MW
Posts: 2664
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Apr 03 2018 4:16am

stancecoke wrote:
Apr 03 2018 3:54am
Where is the PAS timeout detection for the motor stop in PAS mode located in the master branch?!
Here, motor.c:

Code: Select all

  // limit min PAS cadence
  if (ui16_pas1_counter > ((uint16_t) PAS_ABSOLUTE_MIN_CADENCE_PWM_CYCLE_TICKS))
  {
    ui16_pas1_pwm_cycles_ticks = (uint16_t) PAS_ABSOLUTE_MIN_CADENCE_PWM_CYCLE_TICKS;
    ui16_pas1_counter = 0;
    ui16_pas1_on_time_counter = 0;
    ui16_pas1_off_time_counter = 0;
    ui8_pas1_direction = 1;
#if (EBIKE_THROTTLE_TYPE == EBIKE_THROTTLE_TYPE_TORQUE_SENSOR)
    ui8_torque_sensor_throttle_processed_value = 0;
#endif
  }
And in ebike_app.c:

Code: Select all

  // cadence in RPM =  60 / (ui16_pas_timer2_ticks * PAS_NUMBER_MAGNETS * 0.000064)
  if (ui16_pas1_pwm_cycles_ticks >= ((uint16_t) PAS_ABSOLUTE_MIN_CADENCE_PWM_CYCLE_TICKS)) { ui8_pas1_cadence_rpm = 0; }
Please note that PAS value is multiplied by LCD assist level...!! Since you are not using the LCD, see if your assist level is higher than 0:

Code: Select all

  f_temp = (float) (((float) ui8_temp) * f_get_assist_level ());
Please update your master branch as I just update it with my most recent 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, you can 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: 2664
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Apr 03 2018 4:23am

stancecoke wrote:
Apr 03 2018 3:54am
Where is the PAS timeout detection for the motor stop in PAS mode located in the master branch?! Is it this part? So you just set the throttle value to zero?! Why do you set the counters to zero at this point?!

Code: Select all

// limit min PAS cadence
  if (ui16_pas1_counter > ((uint16_t) PAS_ABSOLUTE_MIN_CADENCE_PWM_CYCLE_TICKS))
  {
    ui16_pas1_pwm_cycles_ticks = (uint16_t) PAS_ABSOLUTE_MIN_CADENCE_PWM_CYCLE_TICKS;
    ui16_pas1_counter = 0;
    ui16_pas1_on_time_counter = 0;
    ui16_pas1_off_time_counter = 0;
    ui8_pas1_direction = 1;
    ui8_torque_sensor_throttle_processed_value = 0;
  }
My idea is to reset everything at that point. If you want to use the on/off counters outside, please use a temporary/internal to that code and external one that you can use on ebike_app.c, just like I did for the external speed sensor:

Code: Select all

ui16_wheel_speed_sensor_pwm_cycles_ticks = ui16_wheel_speed_sensor_counter;

  if (ui16_wheel_speed_sensor_counter > ((uint16_t) WHEEL_SPEED_SENSOR_MIN_PWM_CYCLE_TICKS))
  {
    ui16_wheel_speed_sensor_pwm_cycles_ticks = (uint16_t) WHEEL_SPEED_SENSOR_MIN_PWM_CYCLE_TICKS;
I think is a good idea to use internal ones that will be incremented every signal change and the other ones that keep the value of every 1 rotation. Wheel rotation/speed seem similar than PAS, on PAS we also need direction...
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, you can 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: 896
Joined: Aug 02 2017 2:56pm

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

Post by stancecoke » Apr 03 2018 5:17am

I just saw, that you are using PAS2 = Pad X4 for regen?! Why that, as you get the pedal direction from PAS1 already?!

regards
stancecoke

casainho   100 MW

100 MW
Posts: 2664
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Apr 03 2018 5:20am

stancecoke wrote:
Apr 03 2018 5:17am
I just saw, that you are using PAS2 = Pad X4 for regen?! Why that, as you get the pedal direction from PAS1 already?!
My implementation was for this, and works well. I just use torque sensor on my ebikes: https://opensourceebikefirmware.bitbuck ... rakes.html
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, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

geofft   1 kW

1 kW
Posts: 319
Joined: Nov 09 2012 9:41am
Location: Berkshire UK

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

Post by geofft » Apr 03 2018 6:22am

stancecoke wrote:
Apr 02 2018 2:15pm
geofft wrote:
Apr 02 2018 2:04pm
Thought I might try one of these (T2 version):-
https://www.aliexpress.com/item/torque- ... 93999.html
...anybody have any thoughts/comments/experiences with these?
Yes, I've tested the first and the second generation of these Sempu sensors myself, and there's experience with the third generation in the german forum also.
I can recommend this product, but it needs higher supply voltage, you can't use the 5V from the throttle connector. The third generation works with battery volatage directly.
Sorry to drag you guys away from the current discussion, but just a quick question about the Sempu torque sensors. I notice the later generation of these are 'middle wire', where the connector exits from the centre of the sensor body. I'm a bit confused as to how this exits the bottom bracket - do you have to drill a hole in the bottom bracket tube to bring this out - or am I missing something here..?
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

User avatar
stancecoke   10 kW

10 kW
Posts: 896
Joined: Aug 02 2017 2:56pm

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

Post by stancecoke » Apr 03 2018 7:06am

geofft wrote:
Apr 03 2018 6:22am
do you have to drill a hole in the bottom bracket tube to bring this out - or am I missing something here..?
Yes, you have to drill a hole with a diameter of 12mm, see the Installation Manual.
casainho wrote:
Apr 03 2018 5:20am
My implementation was for this, and works well. I just use torque sensor on my ebikes:
Hmm, this is very special, I think we should implement the "coast brake regen" in a way any user with an normal PAS can use it...

regards
stancecoke

casainho   100 MW

100 MW
Posts: 2664
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Apr 03 2018 7:30am

stancecoke wrote:
Apr 03 2018 7:06am
Hmm, this is very special, I think we should implement the "coast brake regen" in a way any user with an normal PAS can use it...
If someone does the code (in the form of a patch against master branch) and testing, for me ok. I personally don't use PAS so I will not do it.

I want to focus on FOC working well for regen also. Also, coasting the motor that isn't possible right 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, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

geofft   1 kW

1 kW
Posts: 319
Joined: Nov 09 2012 9:41am
Location: Berkshire UK

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

Post by geofft » Apr 03 2018 7:43am

stancecoke wrote:
Apr 03 2018 7:06am
geofft wrote:
Apr 03 2018 6:22am
do you have to drill a hole in the bottom bracket tube to bring this out - or am I missing something here..?
Yes, you have to drill a hole with a diameter of 12mm, see the Installation Manual.
Thanks Stancecoke, that's useful info. I've no objection to drilling the frame, just wondered how the cabling was routed. I'm about to order one of these, so expect some more dumb questions in a few weeks time. I'd like to retain a throttle with the torquesensor, not sure how that's gonna work out though....
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

Post Reply