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

Electric Motors and Controllers
andrea_104kg   1 kW

1 kW
Posts: 333
Joined: Mar 05 2018 5:51pm

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

Post by andrea_104kg » Dec 28 2021 4:43pm

nothing good :-(
I have reduced the tq from 1550 to 70 and reduced the levels below 50 ... engine always at maximum ...
Out of curiosity I disconnected the white wire of the torque sensor that goes to x4, as I always supposed the same, even with the wire disconnected the motor starts at maximum, in practice it also goes only with the pas and goes at most over 1100w ... how possible?

geofft   1 kW

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

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

Post by geofft » Dec 28 2021 5:50pm

Out of curiosity I disconnected the white wire of the torque sensor that goes to x4, as I always supposed the same, even with the wire disconnected the motor starts at maximum, in practice it also goes only with the pas
When you disconnect the white wire what voltage are you seeing on the wire that connects to X4? It should be somewhere near zero volts.

EDIT: I don't think a faulty throttle input would give the symptoms you describe, but probably also worth checking that the throttle signal input is down near zero volts too.
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 6-fet, LCD3, 48v 12s lipo, Sempu T4 tqsr.

andrea_104kg   1 kW

1 kW
Posts: 333
Joined: Mar 05 2018 5:51pm

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

Post by andrea_104kg » Dec 28 2021 6:32pm

thanks, between the negative and the white wire that comes from the torque sensor (which connects to x4) there is a voltage of 1.5v, if I press my hand on the pedals it increases up to 2v, probably with the pressure of the feet it rises again )
I just can't understand why the motor starts with only the pas wire connected, the green ... and the motor obviously starts only by turning the pedals ... with the pedals stopped it does not turn. I don't think it's the fault of the accelerator because it doesn't work when the pedals are stopped, if it were short it should always turn ..

andrea_104kg   1 kW

1 kW
Posts: 333
Joined: Mar 05 2018 5:51pm

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

Post by andrea_104kg » Dec 28 2021 6:40pm

i have also reduced current to 15a on java programmer, but the motor start at 1100w... how it's possible?

andrea_104kg   1 kW

1 kW
Posts: 333
Joined: Mar 05 2018 5:51pm

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

Post by andrea_104kg » Dec 28 2021 6:49pm

i checked between x4 ad negative, there is 0,011v :( :( it's all ok, but why motor start only with pas???? :( :( :(

geofft   1 kW

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

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

Post by geofft » Dec 29 2021 3:54am

Ok, your X4 and tqsr voltages sound like they're correct.
I don't think it's the fault of the accelerator because it doesn't work when the pedals are stopped,
I think you're probably right about this, but just to be sure I suggest you check the throttle signal voltage (blue wire on connector?). If that's ok trying re-flashing the firmware, after that I've run out of ideas other than maybe a controller hardware fault.. :?
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 6-fet, LCD3, 48v 12s lipo, Sempu T4 tqsr.

User avatar
stancecoke   1 MW

1 MW
Posts: 1596
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 » Dec 29 2021 4:32am

andrea_104kg wrote:
Dec 28 2021 6:49pm
it's all ok, but why motor start only with pas
Please post the content of your config.h!

regards
stancecoke

andrea_104kg   1 kW

1 kW
Posts: 333
Joined: Mar 05 2018 5:51pm

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

Post by andrea_104kg » Dec 29 2021 8:59am

/*
* config.h
*
* Automatically created by OSEC Parameter Configurator
* Author: stancecoke
*/

#ifndef CONFIG_H_
#define CONFIG_H_

#define NUMBER_OF_PAS_MAGS 36
#define limit 25
#define timeout 3125
#define wheel_circumference 2130L
#define limit_without_pas 6
#define ADC_THROTTLE_MIN_VALUE 76
#define ADC_THROTTLE_MAX_VALUE 153
#define BATTERY_VOLTAGE_MIN_VALUE 142
#define BATTERY_CURRENT_MAX_VALUE 150L
#define PHASE_CURRENT_MAX_VALUE 500L
#define REGEN_CURRENT_MAX_VALUE 0L
#define MOTOR_ROTOR_DELTA_PHASE_ANGLE_RIGHT 237
#define current_cal_a 76
#define LEVEL_1 10
#define LEVEL_2 20
#define LEVEL_3 30
#define LEVEL_4 50
#define LEVEL_5 100
#define MORSE_TIME_1 50
#define MORSE_TIME_2 50
#define MORSE_TIME_3 50
#define RAMP_END 0
#define P_FACTOR 0.5
#define I_FACTOR 0.1
#define GEAR_RATIO 106L
#define PAS_THRESHOLD 1.9
#define RAMP_START 0
#define limit_with_throttle_override 45
#define CORRECTION_AT_ANGLE 127
#define DISPLAY_TYPE_KT_LCD3
#define ANGLE_4_0 1
#define ANGLE_6_60 43
#define ANGLE_2_120 86
#define ANGLE_3_180 128
#define ANGLE_1_240 171
#define ANGLE_5_300 213
#define TQS_CALIB 1000.0
#define ACA 6817
#define EEPROM_INIT_MAGIC_BYTE 3 // makes sure (chance of fail 1/255) eeprom is invalidated after flashing new config
#define ADC_BATTERY_VOLTAGE_K 69
#define ACA_EXPERIMENTAL 128
#define BATTERY_VOLTAGE_MAX_VALUE 208

#endif /* CONFIG_H_ */

The controller was new, and it worked very fine before flashing new firmware...

Vbruun   100 W

100 W
Posts: 253
Joined: Sep 26 2019 8:42am

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

Post by Vbruun » Dec 29 2021 10:33am

Do you use the UI to adjust your config?

Vbruun   100 W

100 W
Posts: 253
Joined: Sep 26 2019 8:42am

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

Post by Vbruun » Dec 29 2021 10:35am

Also, have you changed the min and Max values for x4?

andrea_104kg   1 kW

1 kW
Posts: 333
Joined: Mar 05 2018 5:51pm

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

Post by andrea_104kg » Dec 29 2021 11:21am

I use the java gui... i do not undestand min and max? i have posted a photo of my config yesterday

User avatar
stancecoke   1 MW

1 MW
Posts: 1596
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 » Dec 29 2021 1:51pm

andrea_104kg wrote:
Dec 29 2021 8:59am
#define TQS_CALIB 1000.0
Your value for TQ calib is still way to high. In the repo it is set to 80!
https://github.com/stancecoke/BMSBatter ... nfig.h#L48

Torque is read into an array at each PAS pulse:
https://github.com/stancecoke/BMSBatter ... ons.c#L259

The ADC value is mapped by the variables

Code: Select all

uint16_t ui16_X4_min_range = 500;
uint16_t ui16_X4_max_range = 900;
They are hardcoded in the ACAcontrollerState.c, you can't set them in the Java Tool.

https://github.com/stancecoke/BMSBatter ... c9e8992be8

The torque is averaged over one crank revolution:
https://github.com/stancecoke/BMSBatter ... ons.c#L205

the current target is calculated from average torque and the cadence:
https://github.com/stancecoke/BMSBatter ... int.c#L238
andrea_104kg wrote:
Dec 29 2021 8:59am
#define current_cal_a 76
76 sounds strange, please read the wiki carefully!
For a 6FET and 12FET controller the value has to be something around 100, for the 18FET about 50.
https://github.com/stancecoke/BMSBatter ... -Java-Tool

andrea_104kg   1 kW

1 kW
Posts: 333
Joined: Mar 05 2018 5:51pm

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

Post by andrea_104kg » Dec 29 2021 3:27pm

stancecoke wrote:
Dec 29 2021 1:51pm
andrea_104kg wrote:
Dec 29 2021 8:59am
#define TQS_CALIB 1000.0
Your value for TQ calib is still way to high. In the repo it is set to 80!
https://github.com/stancecoke/BMSBatter ... nfig.h#L48

Torque is read into an array at each PAS pulse:
https://github.com/stancecoke/BMSBatter ... ons.c#L259

The ADC value is mapped by the variables

Code: Select all

uint16_t ui16_X4_min_range = 500;
uint16_t ui16_X4_max_range = 900;
They are hardcoded in the ACAcontrollerState.c, you can't set them in the Java Tool.

https://github.com/stancecoke/BMSBatter ... c9e8992be8

The torque is averaged over one crank revolution:
https://github.com/stancecoke/BMSBatter ... ons.c#L205

the current target is calculated from average torque and the cadence:
https://github.com/stancecoke/BMSBatter ... int.c#L238
andrea_104kg wrote:
Dec 29 2021 8:59am
#define current_cal_a 76
76 sounds strange, please read the wiki carefully!
For a 6FET and 12FET controller the value has to be something around 100, for the 18FET about 50.
https://github.com/stancecoke/BMSBatter ... -Java-Tool
Thanks for the reply.
I also tried with a value of tq = 70 but nothing changes. 1000 is the default value that the java tool puts me when I select the torque sensor and I wanted to try that too but nothing ...
I thank you for the further clarifications but for me they are like Arabic or Egyptian hieroglyphs ... I am a poor accountant who barely knows the law of ohm and not even well ... :-(
I can only groped to use logic ... my ECU is a standard 6 fet ECU (pswpower kt 36 / 48svpr) it seems really strange to me that no one has detected an error in the code using this ECU ... even the torque sensor is one "standard" t9 therefore well known. I would like to understand (according to logic, not according to programming) how the pas is used in this firmware, if it is only a "switch" that gives consent to pin x4 where the torque is then detected or if it does something else. If it were just a "switch" that says "When the pas turns, you read the gate x4 and according to its voltage you give power to the motor (and according to the cadence it modulates the power of x4)" only with the pas attached the motor will not it should boot like it does to me.
Evidently the pas is not just a switch but also gives power to the engine, and I find this really strange.
One thing I'm not sure about is if my pas is 18 magnets or 36, but I've tried both values ​​and it doesn't change anything. :-(
I left the value 76 in "battery current cal a" because in one of the "settings" there was that value, I had read that it must be 100 for a 6 fet, I will try to change it, but I'm afraid it has nothing to do with it do with starting at most with only pas :-(
So not knowing the programming I can only start from the assumption that the firmware works on my control unit and with my torque sensor.
So the only value I haven't tried to change is 76 (and tq to 80) .
But if the assumption is not true I can spend years doing tests, it will never work ... :-(

andrea_104kg   1 kW

1 kW
Posts: 333
Joined: Mar 05 2018 5:51pm

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

Post by andrea_104kg » Dec 29 2021 5:49pm

I did some other tests but without result, same behavior:
- I set tq = 80 and "battery cal a" = 100
- measured the voltage on x4 when the motor starts (I turn the pedals) and remains on 0 (torque sensor disconnected, I thought it went up due to some contact or error)
- I tried to mount an accelerator and, with the pedals stopped, the accelerator works regularly, the wheel speed can be adjusted well. As soon as the pedals are turned, however, the wheel starts at full speed, much faster than the accelerator (but this I think is due to throttle v_max)
- I tried to load the "master" version, the bike no longer starts by turning the pedals, but it never starts, not even by connecting the white wire of the torsometer to the accelerator signal. But it was a quick test, I have to check the parameters better ...

Vbruun   100 W

100 W
Posts: 253
Joined: Sep 26 2019 8:42am

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

Post by Vbruun » Dec 30 2021 3:32am

andrea_104kg wrote:
Dec 29 2021 3:27pm
stancecoke wrote:
Dec 29 2021 1:51pm
andrea_104kg wrote:
Dec 29 2021 8:59am
#define TQS_CALIB 1000.0
Your value for TQ calib is still way to high. In the repo it is set to 80!
https://github.com/stancecoke/BMSBatter ... nfig.h#L48

Torque is read into an array at each PAS pulse:
https://github.com/stancecoke/BMSBatter ... ons.c#L259

The ADC value is mapped by the variables

Code: Select all

uint16_t ui16_X4_min_range = 500;
uint16_t ui16_X4_max_range = 900;
They are hardcoded in the ACAcontrollerState.c, you can't set them in the Java Tool.

https://github.com/stancecoke/BMSBatter ... c9e8992be8

The torque is averaged over one crank revolution:
https://github.com/stancecoke/BMSBatter ... ons.c#L205

the current target is calculated from average torque and the cadence:
https://github.com/stancecoke/BMSBatter ... int.c#L238
andrea_104kg wrote:
Dec 29 2021 8:59am
#define current_cal_a 76
76 sounds strange, please read the wiki carefully!
For a 6FET and 12FET controller the value has to be something around 100, for the 18FET about 50.
https://github.com/stancecoke/BMSBatter ... -Java-Tool
Thanks for the reply.
I also tried with a value of tq = 70 but nothing changes. 1000 is the default value that the java tool puts me when I select the torque sensor and I wanted to try that too but nothing ...
I thank you for the further clarifications but for me they are like Arabic or Egyptian hieroglyphs ... I am a poor accountant who barely knows the law of ohm and not even well ... :-(
I can only groped to use logic ... my ECU is a standard 6 fet ECU (pswpower kt 36 / 48svpr) it seems really strange to me that no one has detected an error in the code using this ECU ... even the torque sensor is one "standard" t9 therefore well known. I would like to understand (according to logic, not according to programming) how the pas is used in this firmware, if it is only a "switch" that gives consent to pin x4 where the torque is then detected or if it does something else. If it were just a "switch" that says "When the pas turns, you read the gate x4 and according to its voltage you give power to the motor (and according to the cadence it modulates the power of x4)" only with the pas attached the motor will not it should boot like it does to me.
Evidently the pas is not just a switch but also gives power to the engine, and I find this really strange.
One thing I'm not sure about is if my pas is 18 magnets or 36, but I've tried both values ​​and it doesn't change anything. :-(
I left the value 76 in "battery current cal a" because in one of the "settings" there was that value, I had read that it must be 100 for a 6 fet, I will try to change it, but I'm afraid it has nothing to do with it do with starting at most with only pas :-(
So not knowing the programming I can only start from the assumption that the firmware works on my control unit and with my torque sensor.
So the only value I haven't tried to change is 76 (and tq to 80) .
But if the assumption is not true I can spend years doing tests, it will never work ... :-(
Have you adjusted x4 min and Max range?

That needs to be done.


Vbruun   100 W

100 W
Posts: 253
Joined: Sep 26 2019 8:42am

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

Post by Vbruun » Dec 30 2021 3:56am

I am pretty sure that is the reason you have issues. I can explain it to you but so can the wiki. Please just try to do as we say if you want to have it work:)

andrea_104kg   1 kW

1 kW
Posts: 333
Joined: Mar 05 2018 5:51pm

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

Post by andrea_104kg » Dec 30 2021 4:03am

no, just a simple text editor is enough?
I'm not a programmer :-( howeverr the motor starts with the pas and with the x4 wire disconnected, so I think the values are completely irrelevant ..

Vbruun   100 W

100 W
Posts: 253
Joined: Sep 26 2019 8:42am

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

Post by Vbruun » Dec 30 2021 4:12am

If the value floats a little (which it might when not pulled down), that can happend easily. Reconnect the x4 and put the values correctly and retest.


geofft   1 kW

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

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

Post by geofft » Dec 30 2021 4:54am

@vbruun

Your comment about the X4 pin has got me thinking - I'm wondering if the removal of the X4 pullup should have been completed by the addition of an X4 pulldown resistor. Unfortunately the schematic I have doesn't show the X4 details, but if the X4 pin is simply floating without pullup or down it will be extremely vulnerable to noise spikes (not visible with a meter check) and maybe this is what is triggering the firmware.

I know from past experience with the external speed sensor that noise spikes can be very troublesome to the firmware. If what you have suggested with the max/min values doesn't work maybe he could try pulling down the X4 pin to ground with a 1k resistor and seeing if this has any effect on the issue.

Any thoughts on this...anybody...?
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 6-fet, LCD3, 48v 12s lipo, Sempu T4 tqsr.

Vbruun   100 W

100 W
Posts: 253
Joined: Sep 26 2019 8:42am

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

Post by Vbruun » Dec 30 2021 5:01am

Please just try to set Up correctly first and then we shall look to persisting issues if there are any.

andrea_104kg   1 kW

1 kW
Posts: 333
Joined: Mar 05 2018 5:51pm

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

Post by andrea_104kg » Dec 30 2021 5:14am

I open the file ACAcontrollerstate.c bat the values mix and max are already 500 and 900 what is the logic according to which I have to change them?
Geofft i tried with pulldown resistor, but this down the torque sensor to 0,2v :-(

Vbruun   100 W

100 W
Posts: 253
Joined: Sep 26 2019 8:42am

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

Post by Vbruun » Dec 30 2021 5:52am

The value goes Up to 1024 with 1024 representing 5v (or 3v?, Cant remember) and 0 representing 0v.

Just change min to correspond to slightly above resting voltage and max to 1024. That shoul work.

Did you ever repair the trace you cut?

andrea_104kg   1 kW

1 kW
Posts: 333
Joined: Mar 05 2018 5:51pm

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

Post by andrea_104kg » Dec 30 2021 5:58am

Vbruun wrote:
Dec 30 2021 5:52am
Did you ever repair the trace you cut?
i do not remember what... :(

Post Reply