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

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?
 
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.
 
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 ..
 
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.. :?
 
/*
* 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...
 
andrea_104kg said:
#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/BMSBattery_S_controllers_firmware/blob/a370abc9e0f2c1ab7552eafefeacfe8db04c547d/config.h#L48

Torque is read into an array at each PAS pulse:
https://github.com/stancecoke/BMSBattery_S_controllers_firmware/blob/a370abc9e0f2c1ab7552eafefeacfe8db04c547d/ACAcommons.c#L259

The ADC value is mapped by the variables
Code:
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/BMSBattery_S_controllers_firmware/commit/7480ba0cc40cc6bfb8e83f330472ddc9e8992be8

The torque is averaged over one crank revolution:
https://github.com/stancecoke/BMSBattery_S_controllers_firmware/blob/a370abc9e0f2c1ab7552eafefeacfe8db04c547d/ACAcommons.c#L205

the current target is calculated from average torque and the cadence:
https://github.com/stancecoke/BMSBattery_S_controllers_firmware/blob/a370abc9e0f2c1ab7552eafefeacfe8db04c547d/ACAsetPoint.c#L238

andrea_104kg said:
#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/BMSBattery_S_controllers_firmware/wiki/04-The-Java-Tool
 
stancecoke said:
andrea_104kg said:
#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/BMSBattery_S_controllers_firmware/blob/a370abc9e0f2c1ab7552eafefeacfe8db04c547d/config.h#L48

Torque is read into an array at each PAS pulse:
https://github.com/stancecoke/BMSBattery_S_controllers_firmware/blob/a370abc9e0f2c1ab7552eafefeacfe8db04c547d/ACAcommons.c#L259

The ADC value is mapped by the variables
Code:
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/BMSBattery_S_controllers_firmware/commit/7480ba0cc40cc6bfb8e83f330472ddc9e8992be8

The torque is averaged over one crank revolution:
https://github.com/stancecoke/BMSBattery_S_controllers_firmware/blob/a370abc9e0f2c1ab7552eafefeacfe8db04c547d/ACAcommons.c#L205

the current target is calculated from average torque and the cadence:
https://github.com/stancecoke/BMSBattery_S_controllers_firmware/blob/a370abc9e0f2c1ab7552eafefeacfe8db04c547d/ACAsetPoint.c#L238

andrea_104kg said:
#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/BMSBattery_S_controllers_firmware/wiki/04-The-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 ... :-(
 
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 ...
 
andrea_104kg said:
stancecoke said:
andrea_104kg said:
#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/BMSBattery_S_controllers_firmware/blob/a370abc9e0f2c1ab7552eafefeacfe8db04c547d/config.h#L48

Torque is read into an array at each PAS pulse:
https://github.com/stancecoke/BMSBattery_S_controllers_firmware/blob/a370abc9e0f2c1ab7552eafefeacfe8db04c547d/ACAcommons.c#L259

The ADC value is mapped by the variables
Code:
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/BMSBattery_S_controllers_firmware/commit/7480ba0cc40cc6bfb8e83f330472ddc9e8992be8

The torque is averaged over one crank revolution:
https://github.com/stancecoke/BMSBattery_S_controllers_firmware/blob/a370abc9e0f2c1ab7552eafefeacfe8db04c547d/ACAcommons.c#L205

the current target is calculated from average torque and the cadence:
https://github.com/stancecoke/BMSBattery_S_controllers_firmware/blob/a370abc9e0f2c1ab7552eafefeacfe8db04c547d/ACAsetPoint.c#L238

andrea_104kg said:
#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/BMSBattery_S_controllers_firmware/wiki/04-The-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.
 
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:)
 
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 ..
 
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.
 
@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...?
 
Please just try to set Up correctly first and then we shall look to persisting issues if there are any.
 
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 :-(
 
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?
 
Back
Top