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

geofft said:
That works ok now, I find I can trigger the code at virtually every attempt.

Great! Thank you for testing!


DarkDD said:
Ended up using a snapshot version of their executable.

Does that mean the linked release did not work for you?!

DarkDD said:
Fiddling around with the settings now trying to get the motor to turn! I'm using just a throttle...

Have you checked the hall-sensor and motorphase wiring combination? Had you checked, that the motor runs properly with the stock firmware with that wiring?

regards
stancecoke
 
-dg said:
then have a script to generate config.h from the file as part of the build process.

This is exactly the job of the Java-tool, just with a graphic interface. Perhaps we should add the possibility to write the settings to a file and read it in again, to avoid to edit all the individual settings again, if you start the tool... But this needs a rainy day with nothing better to do :D

regards
stancecoke
 
stancecoke said:
This is exactly the job of the Java-tool, just with a graphic interface. Perhaps we should add the possibility to write the settings to a file and read it in again, to avoid to edit all the individual settings again, if you start the tool...

Well, I had in mind something different. The formatted text file would be the source of truth. Editing it would be the normal way to do configuration. The config.h generator script would merge the items from the file with a template config.h to create the actual header file. Tools that could read and write this file would be free to have special rules to do error checking, automation, layout etc, but should also be able to handle new keys sensibly by default. That is, it should not require a change to the generator script or the GUI to add an item for testing etc. This might make it easier for new people to try things.

I have some other ideas too. Of course in open source projects ideas are free and it is always easiest to ask the project maintainers to do the work ;). I have just received a few STM8S Discovery boards with ST-Link2 and some minimal STM8 breakout boards and have a few KT controllers on the way as well as displays LED 3 and LED 5. Should arrive in a couple weeks. Once I have that all in hand I'll see if I can help out a bit.

One more idea: since the LCD display talks over a serial link, move some/all of the configuration to variables and have a simple protocol to read/write the config via the LCD cable instead of re-flashing the device. To keep the onboard code simple the config data would still be parsed and validated on the host laptop or whatever.
 
geofft said:
a real shame as this could have been a nice feature fully implemented with legal speed

I just took a test ride with the firmware of my fork, where the speed limit is implemented already (BionX IGH DirectDrive with S06S Controller). It works fine, I think. First I accelerated hard to something about 28 km/h, the battery current drops to zero if the speed exceeds 27 km/h. In the second phase I was pedaling comfortably and the power decreases slowly if you exceed 25 km/h. This avoids the feeling of "riding against a wall" when reaching the speed limit.
But to be honest, I don't know where to paste the function in casainhos code.

regards
stancecoke

cutting power at speed limit.PNG
 
stancecoke said:
geofft said:
a real shame as this could have been a nice feature fully implemented with legal speed

I just took a test ride with the firmware of my fork, where the speed limit is implemented already (BionX IGH DirectDrive with S06S Controller). It works fine, I think. First I accelerated hard to something about 28 km/h, the battery current drops to zero if the speed exceeds 27 km/h. In the second phase I was pedaling comfortably and the power decreases slowly if you exceed 25 km/h. This avoids the feeling of "riding against a wall" when reaching the speed limit.
But to be honest, I don't know where to paste the function in casainhos code.
Good!!

So now I think that you need to decide strategically if you keep current master if my branch or your code.

I promisse that I will be reading this topic and that I will help. Even because I will be using the same code for TSDZ2, so both projects can benefit and I would say this one will take the most advantage as the community of testers/users of TSDZ2 is clearly bigger.

As for speed controller, I would do just the same I do for current control. The motor code, on fast loop, controls the value and is very fast to actuate. On slow loop, ebike_app, I just set the current value to my desire and there we can implement some some ramp up/down.

Note: I will answer later about the changing of documentation, etc. I am not on computer.
 
casainho said:
So now I think that you need to decide strategically if you keep current master if my branch or your code.

I'll stay at my own fork, as I'm much more familiar with it and it meets exactly my needs :D
But of course I can support your master with little services if wanted.

regards
stancecoke
 
stancecoke said:
geofft said:
a real shame as this could have been a nice feature fully implemented with legal speed

I just took a test ride with the firmware of my fork, where the speed limit is implemented already (BionX IGH DirectDrive with S06S Controller). It works fine, I think.

Stancecoke, I would like to try this fork sometime but I've rather lost track of what they all do and where they are... :?
Could you post up a link to it - thanks.
 
geofft said:
Could you post up a link to it - thanks.

You can find the link and the explanation in the "Alternative Fork" tab of the windows instructions.

But be careful, there are less safety features for hardware protection implemented. Make sure, that you are using a fuse in the battery wire, although I haven't had any problems so far...

regards
stancecoke

p.s. I have not implemented the latest feature (simple regen by brake lever) in the java tool. You can use it, if you don't want to activate the regen option.
 
drunkencat129 said:
hey guys wondering if some one can help me out i got a kt 18 fet i got with 4110 fets and 100v caps moded to it also built up the traces does any one know how to make the power on circut support 100v i can replace the voltage reg with a dc to dc converter but is that only thing i need to change thanks

i am trying to do the same right now ... not tested yet
my plan is to change
- fets -> CSD19536KCS
- big caps -> 100v 470uF x 3
- dcdc for powering the controller -> 100v mini stepdown module from ebay
- battery voltage resistors
- snubber? caps to 100v 470nF
 
dr_lulz said:
drunkencat129 said:
hey guys wondering if some one can help me out i got a kt 18 fet i got with 4110 fets and 100v caps moded to it also built up the traces does any one know how to make the power on circut support 100v i can replace the voltage reg with a dc to dc converter but is that only thing i need to change thanks

i am trying to do the same right now ... not tested yet
my plan is to change
- fets -> CSD19536KCS
- big caps -> 100v 470uF x 3
- dcdc for powering the controller -> 100v mini stepdown module from ebay
- battery voltage resistors
- snubber? caps to 100v 470nF

If you are doing that with 18fet. I think you will need to mod. Gate drivers or longer deadtime. (Ask Casainho, Stancecoke)

I did the same mod and Its triping 10A breaker even without motor connected. I got no short anywhere and fets seems to be still ok.

I dont know when I will get back to it..
 
stancecoke said:
DarkDD said:
Ended up using a snapshot version of their executable.

Does that mean the linked release did not work for you?!

regards
stancecoke

Didn't want to spend much time figuring out when working builds with simple .exe installers were already there :p

Got it running! Some questions though...

First, post pwm mode, motion gets jerky and out of sync. Where could that be arising from?
Second, when rotating the wheel by hand backwards, it tends to jerk and stop, what do I need to change?
Third, what exactly does
Code:
PWM_CYCLES_COUNTER_MAX
do?? I see the definition for Q11 motor in main.h but its missing this value in the ifdefs...

I am using a 1000W direct drive motor and not an S series controller but rather a KT48ZWSRMT... Any Idea what all settings to change?
 
honya96 said:
dr_lulz said:
drunkencat129 said:
hey guys wondering if some one can help me out i got a kt 18 fet i got with 4110 fets and 100v caps moded to it also built up the traces does any one know how to make the power on circut support 100v i can replace the voltage reg with a dc to dc converter but is that only thing i need to change thanks

i am trying to do the same right now ... not tested yet
my plan is to change
- fets -> CSD19536KCS
- big caps -> 100v 470uF x 3
- dcdc for powering the controller -> 100v mini stepdown module from ebay
- battery voltage resistors
- snubber? caps to 100v 470nF

If you are doing that with 18fet. I think you will need to mod. Gate drivers or longer deadtime. (Ask Casainho, Stancecoke)

I did the same mod and Its triping 10A breaker even without motor connected. I got no short anywhere and fets seems to be still ok.

I dont know when I will get back to it..
On firmware, is possible to start by disabling all fets driver, enable a specific one (low side or high side only), change dead time.
Also, keep braking active at startup will disable the fet drivers while active, so you can try something that even if does not work, you can "reset" up to program again with a different setup.
 
casainho said:
On firmware, is possible to start by disabling all fets driver, enable a specific one (low side or high side only), change dead time.
Also, keep braking active at startup will disable the fet drivers while active, so you can try something that even if does not work, you can "reset" up to program again with a different setup.
Can you point me where to change deadtime? By holding brakes on startup it will trip when I release..

Changing deadtime may be a way to avoid moding drivers, but still better to do it. (Efficiency?..)
 
honya96 said:
casainho said:
On firmware, is possible to start by disabling all fets driver, enable a specific one (low side or high side only), change dead time.
Also, keep braking active at startup will disable the fet drivers while active, so you can try something that even if does not work, you can "reset" up to program again with a different setup.
Can you point me where to change deadtime? By holding brakes on startup it will trip when I release..

Changing deadtime may be a way to avoid moding drivers, but still better to do it. (Efficiency?..)
Dead time is on PWM configuration.
 
DarkDD said:
I am using a 1000W direct drive motor and not an S series controller but rather a KT48ZWSRMT...

The "ZWS"-type is the block commutating one. In this, the phase current sensor is missing. You have to solder in the sensor or you have to buy a "SVP"-type. Or you can disable the "simplyfied FOC" and work with a static advance angle, but this will cause some losses and will heat up the controller and the motor unnecessarily.

regards
stancecoke
 
I've managed to improve regen significantly! 8)

index.php


vs.

index.php


The trick was to switch to a certain ratio of ERPS and DutyCycle, if the PI-controller can't hold the asked regen-current and starts to run to nirvana...

Code:
            ui32_setpoint= PI_control(ui16_BatteryCurrent, REGEN_CURRENT_MAX_VALUE);  //Curret target = max regen,
            if (ui32_setpoint==0){ui32_setpoint=ui16_motor_speed_erps*2;} //try to get best regen at Low Speeds for BionX IGH

regards
stancecoke
 
honya96 said:
Can you point me where to change deadtime? By holding brakes on startup it will trip when I release..

Changing deadtime may be a way to avoid moding drivers, but still better to do it. (Efficiency?..)

maybe you could just reduce the gate resistors?
 
Hello to You All..!

I’m Maarten from The Netherlands, 68 years young, and for the first time in my life on a forum.
Long story short: since my BionX-system failed on me, and my Trek-dealer offered me to repair my bike at absurd prices, I decided to repair it myself. I half-unspoked my backwheel, so I could separate the two motor-halves and saw a rotor with 22 magnets, a stator with 24 coils,and a mechanically broken 502 bipolair hall-sensor. Replaced the sensor and had to remove the controller inside whereby my strain-gauge broke down. I decided to say goodbye to BionX and make a system of my own. So I closed the motor again after leading the wires to the outside world, removed all the BionX parts, bought me a cheap chinese controller (20 euro’s including shipping) and it worked like hell. King of the world at 35km/h! Although I found that it was rather current-consuming. Eye fell on the endless-sphere pages, fell in love with the idea of controlling my own controller, bought a S06S-one.
Programmed it and….disaster: It won’t run! According to my led-tester my hall-sensors do an OK-six-step commutation pattern which is repeated 11 times for one turning of the wheel (22 magnets).
Swapped all the hall- and motorwires, but no result! Or the wheel oscillates, or it turns very slow foreward with a scary loud hum which is getting worse when turning the potmeter, or it turns slow (there is that HUM again!) backwards and won’t stop when turning the pot to zero.
The learn function doesn’t seem to work (if present?).
So I have the burning question: What am I doing wrong?
Hope for and looking foreward to an answer ……
Greetz…
 
Mavabo said:
Programmed it and….disaster: It won’t run!

First, welcome to this projcet! :)
Can you please tell us, which release of the firmware and which tools for flashing did you use? What is your config.h setting?

I'm runnig the firmware (my fork) with a BionX very successfully!

regards
stancecoke
 
Hello stancecoke: thank you for welcoming me! (and the quick answer!)
I'm glad to hear that you are running the software on BionX too. So there is hope for me!

For flashing the STM8S105C6T6 I use the ST-Link V2 (clone) 'lookalike' wich is connected to the ST Visual programmer.

My .cproject file in the firmware file starts with these two remarks:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>

And the copy of my config.h is:
/*
* config.h
*
* Automatically created by OSEC Parameter Configurator
* Author: stancecoke
*/

#ifndef CONFIG_H_
#define CONFIG_H_

#define PAS_NUMBER_MAGNETS 8
#define PAS_MAX_CADENCE_RPM 90
#define MOTOR_ROTOR_OFFSET_ANGLE 0
#define ADC_BATTERY_CURRENT_MAX 30
#define ADC_BATTERY_REGEN_CURRENT_MAX 30
#define ADC_MOTOR_CURRENT_MAX 43
#define ADC_MOTOR_REGEN_CURRENT_MAX 20
#define ASSIST_LEVEL_0 0
#define ASSIST_LEVEL_1 0.2
#define ASSIST_LEVEL_2 0.4
#define ASSIST_LEVEL_3 0.6
#define ASSIST_LEVEL_4 0.8
#define ASSIST_LEVEL_5 1
#define PWM_DUTY_CYCLE_RAMP_UP_INVERSE_STEP 37
#define PWM_DUTY_CYCLE_RAMP_DOWN_INVERSE_STEP 15
#define MOTOR_ROTOR_ERPS_START_INTERPOLATION_60_DEGREES 131
#define LI_ION_CELL_VOLTS_MAX 4.25
#define LI_ION_CELL_VOLTS_100 4.06
#define LI_ION_CELL_VOLTS_80 3.93
#define LI_ION_CELL_VOLTS_60 3.78
#define LI_ION_CELL_VOLTS_40 3.6
#define LI_ION_CELL_VOLTS_20 3.38
#define LI_ION_CELL_VOLTS_10 3.25
#define LI_ION_CELL_VOLTS_0 3.00
#define PAS_THRESHOLD 1.70
#define LCD_BATTERY_CURRENT_FACTOR 1.50
#define EBIKE_THROTTLE_TYPE EBIKE_THROTTLE_TYPE_THROTTLE_PAS
#define EBIKE_THROTTLE_TYPE_THROTTLE_PAS_CURRENT_SPEED
#define EBIKE_THROTTLE_TYPE_TORQUE_SENSOR_HUMAN_POWER
#define PAS_DIRECTION PAS_DIRECTION_RIGTH
#define BATTERY_LI_ION_CELLS_NUMBER 10

#endif /* CONFIG_H_ */
 
please try

Code:
#define MOTOR_ROTOR_ERPS_START_INTERPOLATION_60_DEGREES 5

and then try different values for

Code:
#define MOTOR_ROTOR_OFFSET_ANGLE

in steps of 5, the last user basia told, that a value about 130 worked for him.


If all of this doesn't work, please try this release, with ride mode set to throttle:
https://github.com/stancecoke/BMSBattery_S_controllers_firmware/archive/Master.zip

regards
stancecoke
 
I notice Mavabo has got both throttle/pas and torquesensor modes defined:-

#define EBIKE_THROTTLE_TYPE EBIKE_THROTTLE_TYPE_THROTTLE_PAS
#define EBIKE_THROTTLE_TYPE_THROTTLE_PAS_CURRENT_SPEED
#define EBIKE_THROTTLE_TYPE_TORQUE_SENSOR_HUMAN_POWER

...not sure if one of those should be commented out?
 
Yes your right geofft..
I thought that when I chose the PAS in the configurator the other possebilities where neglected.. which is not the case obviously.
So I commented the rule by hand in the config.h file. Will check it more careful next time.
Thanks for your comment!
 
geofft said:
#define EBIKE_THROTTLE_TYPE_TORQUE_SENSOR_HUMAN_POWER
...not sure if one of those should be commented out?

This entry is not necessary, but it does not harm.

regards
stancecoke
 
guys do I need sdcc 3.8 to flash current fw? old version flashes

>>> Filling PROGRAM MEMORY image in computer with Blank Value
<<< Filling PROGRAM MEMORY image in computer succeeds

>>> Loading file main.ihx in PROGRAM MEMORY image in computer
(API) ERROR : No such file or directory
 
Back
Top