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

stancecoke said:
?! But you have modded the Torquesensor with a "normal" PAS to use regen like coast brakes?

Code:
#define EBIKE_REGEN_EBRAKE_LIKE_COAST_BRAKES
Yes, I am being riding with torque sensor + EBIKE_REGEN_EBRAKE_LIKE_COAST_BRAKES.
 
stancecoke said:
casainho said:
Yes, I am being riding with torque sensor

With a modded torquesensor and your modding is different to mine...
Yes. And I am not being using "human power", so, the following code may not working as it depends on PAS1 reading but I never tested it with torque sensor PAS signal, only with PAS signal:
Code:
#if defined (EBIKE_THROTTLE_TYPE_TORQUE_SENSOR_HUMAN_POWER)
  // calc humam power on the crank using as input the pedal torque sensor value and pedal cadence
  ui16_temp = (uint16_t) (f_temp * ((float) ((float) ui8_pas1_cadence_rpm / ((float) PAS_MAX_CADENCE_RPM))));
#else

Please test without "human power" and if it works, so the issue is with human power because of dependence with PAS1 reading.
 
casainho said:
as it depends on PAS1 reading but I never tested it

I never understood, why you use PAD X4 for PAS1 .... :). I thougt you would use it for reading a quadrature signal of two PAS-Halls like the thun torque sensor delivers....

regards
stancecoke
 
stancecoke said:
casainho said:
as it depends on PAS1 reading but I never tested it
I never understood, why you use PAD X4 for PAS1 .... :). I thougt you would use it for reading a quadrature signal of two PAS-Halls like the thun torque sensor delivers....
Code:
#define PAS1__PIN                 GPIO_PIN_0
#define PAS1__PORT                GPIOD

#define PAS2__PIN                 GPIO_PIN_7
#define PAS2__PORT                GPIOB

What I decided was to use PAS1 (the same connection of regular PAS) for connect PAS signal from torque sensor. Also use regular throttle connection for torque sensor throttle signal. This makes regular S06S to be able to work with torque sensor, without user need to solder any extra wires to the controller. Yes, is lost the possibility to have torque sensor + throttle, but I think a user want to have that both options, may be remote.

PAS2 to be used, a wire need to be soldered to PAD X4, that is why I decided to use for my mod that needs a secondary PAS - I think that only advanced users may want to use this mod and so they will be bale to solder the wire.
 
OK, I struggled with PAS1 and PAS2 naming...

I wonder, why Kunteng puts the Pullup/Pulldown resistors to pad X4/PB7, as it is an ADC input line...

regards
stancecoke
 
stancecoke said:
OK, I struggled with PAS1 and PAS2 naming...

I wonder, why Kunteng puts the Pullup/Pulldown resistors to pad X4/PB7, as it is an ADC input line...
Maybe because they want to use it instead as a digital pin. Do you know what is typical usage of this pin?
 
casainho said:
Maybe because they want to use it instead as a digital pin. Do you know what is typical usage of this pin?
I know that some of that free pins may be used for:
- turn on/off power board that controlls external lamps
- torque sensor version of S06S
- Bluetooth module control
 
I just got a heap of multistars form the sale
went with 18s because it made the most sens.
Id love to run kunteng controllers, but I can only find 48v, 60v, 72v.

If I go the 60 or the 72v what will I need to do, just change the LVC and HVC resistor?
 
chilltrout said:
I just got a heap of multistars form the sale
went with 18s because it made the most sens.
Id love to run kunteng controllers, but I can only find 48v, 60v, 72v.

If I go the 60 or the 72v what will I need to do, just change the LVC and HVC resistor?
Each hardware may work well only on a specific range of input voltage, firmware can't extend that range.

You should not need to change any resistor on hardware but instead measure with multimeter what is the input value on microcontroller pin that measures battery voltage, for a specific input voltage. There is an attenuation factor for the input voltage because the microcontroller can measure only up to 5v.
Go to file main.h to see that value we found for S06S and S12S of 24V, 36vV amd 48V controllers - it is the same value for them.
 
Ok im following, do you think 18s will work on either 60v or 72v?
whats doing the conditioning to the MCUs ADC? Is it not possible to mess with?
Im guessing 60v might be a better option then 72v because of the LVC?
 
chilltrout said:
Ok im following, do you think 18s will work on either 60v or 72v?
whats doing the conditioning to the MCUs ADC? Is it not possible to mess with?
Im guessing 60v might be a better option then 72v because of the LVC?
I would go also with 60V version.
Look at schematic of S06S, should be similar schematic. It think the issue can be the circuit for mosfets that can limit. For MCU, it is only a voltage divider.
 
casainho said:
chilltrout said:
Ok im following, do you think 18s will work on either 60v or 72v?
whats doing the conditioning to the MCUs ADC? Is it not possible to mess with?
Im guessing 60v might be a better option then 72v because of the LVC?
I would go also with 60V version.
Look at schematic of S06S, should be similar schematic. It think the issue can be the circuit for mosfets that can limit. For MCU, it is only a voltage divider.

Wilco! I can do some basic math and smd resistors, I guess :p
What about LCD3 wise, there seems to be a 36/48v, 60v and 72v variant?
Is there anything to worry about input voltage wise or not sure?
 
My LCDs says the input voltage range they can operate, like 24-36V - you should look for that, to your case.
 
chilltrout said:
Ok im following, do you think 18s will work on either 60v or 72v?
whats doing the conditioning to the MCUs ADC? Is it not possible to mess with?
Im guessing 60v might be a better option then 72v because of the LVC?

You need 100v mosfets and capacitors.. not sure if 60v version has them..so I would go with 72V version.. with stock fw its easy to change LVC resistor, so theres no need to buy 60v.

But lcd3 72v cant work under 50v
 
You will have to replace the controller power supply LM317 with something that can take your 120V down to 15V without overheating, i.e. some kind of step-down converter.

Next replace the MOSFETs with beefier ones that can handle your voltage.

Modify the voltage divider that feeds battery voltage into the microcontroller (pin 24 iirc).

Lastly, reduce the voltage sent to the LCD. Either pin 1 (VBAT+) or pin 2 (VIN), I'm not entirely sure about the difference between these two.

Anything I missed?
 
DC-DC converter
https://rover.ebay.com/rover/0/0/0?mpre=https%3A%2F%2Fwww.ebay.com%2Fulk%2Fitm%2F112634082572

18fet 100v mod
https://drive.google.com/file/d/1ZYZQLLNsMb31ZCvtUd0TWQtc2Stz3m5U/view?usp=drivesdk
 
Hi Casainho,

Do you know what the current Code size is? i.e how much of the 32kB is in use. i was looking at the controller used on the TSDZ2 controller and it has the 16kB variant. MCU PN ends in x4 instead of x6 like the KT controllers.

at least that is what i saw when i looked through all of the 60 pages of the TSDZ2 thread LOL
 
nieles said:
Hi Casainho,

Do you know what the current Code size is? i.e how much of the 32kB is in use. i was looking at the controller used on the TSDZ2 controller and it has the 16kB variant. MCU PN ends in x4 instead of x6 like the KT controllers.

at least that is what i saw when i looked through all of the 60 pages of the TSDZ2 thread LOL
Good that you could get that information. Than I would say the controller just implements 6 steps/block commutation. Since it has hall sensors cables, I would say maybe it will not even look at BEMF like sensorless ones does and so the efficiency may not be good at some point of speed or/and current -- for what I know, the higher motor speeds or/and currents, the lower the efficiency will be and loosing potential to have more torque!

Current code uses about 25kbytes of flash memory:
Code:
stm8-size main.elf -A.
main.elf  :
section             size    addr
DATA                 119       1
INITIALIZED          335     120
SSEG                   3     455
HOME                 131   32768
GSINIT                30   32899
GSFINAL                3   32929
CODE               25395   32932
INITIALIZER          335   58327
.debug_line        26833       0
.debug_loc          6600       0
.debug_abbrev       2681       0
.debug_info        31311       0
.debug_pubnames    11697       0
.debug_frame         432       0
Total             105905
With --opt-code-size flag but never tested, the current code may not even work with this flag:
Code:
main.elf  :
section            size    addr
DATA                119       1
INITIALIZED         335     120
SSEG                  3     455
HOME                131   32768
GSINIT               30   32899
GSFINAL               3   32929
CODE              19740   32932
INITIALIZER         335   52672
.debug_line        3903       0
.debug_loc          680       0
.debug_abbrev       311       0
.debug_info        5015       0
.debug_pubnames    2618       0
.debug_frame         36       0
Total             33259
 
Can someone please say what is the max TSDZ2 motor internal RPM on normal usage (like running the ebike at 45km/h??)? and how many poles the motor has?? -- I want to calc the max ERPM speed the motor needs to run and so understand the min need PWM frequency...
 
if the current code doesn't fit, then we might want to rethink this whole idea and go for an external controller. or do you also already have code for 6 step commutation?
 
Back
Top