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

casainho said:
usertogo said:
Hello folks, congratulations on this probably busiest tread of the whole forum. I have been hoping and just searched the tread if anybody has started to work on implementing an open source PCB for this open source firmware? I didn't find anything here in this tread or the status here: https://opensourceebikefirmware.bitbucket.io/FLEXIBLE_OPENSOURCE_FIRMWARE.html#h1-3
Has anybody initiated schematic capture for example on KICAD? I also am still confused if this is really STM32 or only 8 bit MCU compatible? Maybe if there is interest we can start a separate forum tread on the development of our own open source PCB? I can do pretty good PCB design work even if I am such a NOOB on MCU programming, that I downloaded the source code from the repository and didn't even find the actual code source file in it! Is it written in C or assembler? Thanks for all your tireless work guys!
Are you interested in developing the OpenSource hardware?

It is STM8, 8 bits. See here: https://opensourceebikefirmware.bitbucket.io/development/

Here my sources: https://github.com/OpenSource-EBike-firmware/BMSBattery_S_controllers_firmware and it is C code.

I see potencial only if Its gonna have 2-3 Phase current sensors (STM32, true FOC?), for high power applications.

Why would anybody build a 15A 6fet when you can get it for less then 30$.
 
usertogo said:
but with a huge support group like participating here I think now is the time
Unfortunally, there is only one active developer, Stancecoke. I think that your idea will not happen.
 
I am new to this but yesterday managed to compile the code with no issues except that I had to comment out the following lines from the makefile-windows:
# @$(ENTF) *.asm
# @$(ENTF) *.rel
# @$(ENTF) *.lk
# @$(ENTF) *.lst
# @$(ENTF) *.rst
# @$(ENTF) *.sym
# @$(ENTF) *.cdb
# @$(ENTF) *.map
# @$(ENTF) *.elf
# @$(ENTF) *.adb

It used to get stuck on the cleaning stage and not progress to compiling. I am not sure why these are in the makefile just after clean.bat which does the same.
Anyways, instructions are good if I managed to do it. Thanks for that.

I also fitted the 72v 18fet sinewave controller to the bike and ran it with the standard firmware to make sure halls and phases are wired right.
Also overvolted it to 24s (100v) with the only modification beeing fitting a dc-dc switching regulator instead of the lm317s. Caps and mosfets beeing rated at 100v seem to be doing just fine after 1 day of riding.

Now before flashing the firmware I have a few questions:
1. Is the firmware compatible with the 72v 3kw 18fet controller? It has the current sensor on one of the phases.
2. How does it perform compared to the stock formware? The notes say something about block commutation not available yet. I can feel the motor currently starting in non-sinewave mode and then switches to noiseless shortly after.
3. Does it show battery voltage on LCD3?
3. Do I need to reflash LCD3 with alternative code?

Thank you for your help. Although not a programmer by trade I have some experince and I am looking forward to understanding the code and possibly helping improve it as much as I can.
 
apple2 said:
I am new to this but yesterday managed to compile the code with no issues

First, welcome to this project! :)

apple2 said:
Now before flashing the firmware I have a few questions:
1. Is the firmware compatible with the 72v 3kw 18fet controller? It has the current sensor on one of the phases.

It should work, perhaps you will have to adjust the calibration for the battery current
Code:
Battery Current cal a

apple2 said:
2. How does it perform compared to the stock formware? The notes say something about block commutation not available yet. I can feel the motor currently starting in non-sinewave mode and then switches to noiseless shortly after.
user geofft reported, that the controller gets slightly hotter with our firmware than with the stock firmware. For me the main advantage is the possibility to connect the torque-sensor directly. We start with 6steps commutation also. Not with classical "block" commutation, but with just 6 points of the sinusodial wave

apple2 said:
3. Does it show battery voltage on LCD3?
not as a digtal value, but as bars.


apple2 said:
4. Do I need to reflash LCD3 with alternative code?
No.

I hope you will be successful!

regards
stancecoke
 
honya96 said:
lqbweb said:
So, do you think my assumptions are right? Do you think with this system, I could increase my top speed? Right now it is topping at around 40km/h. But at this point I am only using 400w or so. If at this point I press a switch to connect another battery module to increase the voltage to 72V for instance, I should have another 200W more of reliable power right?

Would there be any problem with the hall sensors? can this controller read so fast the halls?
Your assumptions are totally wrong, forget about all that and just get 48v battery.

Lots of wasted time saved.

If Its still not enough, get bigger and faster motor.

Hmm... I thought that the motor size or the power rating is irrelevant since the power output is dependent from the max current of the controller times the battery voltage... I have read somewhere that people are driving their "250W" motors up to 1kW and above with no problems at all. So the rating of the motor is just implicating the limits of the controller and nothing else. Please, correct me if I'm wrong here.
 
apple2 said:
I also fitted the 72v 18fet sinewave controller to the bike and ran it with the standard firmware to make sure halls and phases are wired right.
Also overvolted it to 24s (100v) with the only modification beeing fitting a dc-dc switching regulator instead of the lm317s. Caps and mosfets beeing rated at 100v seem to be doing just fine after 1 day of riding.

The mosfets Are gonna blow sooner or later. Sooner with this FW. Recommend to run 20s max with 100v mosfets.

Thats just how it is, no need to discuss.
 
Valopallo said:
Hmm... I thought that the motor size or the power rating is irrelevant since the power output is dependent from the max current of the controller times the battery voltage... I have read somewhere that people are driving their "250W" motors up to 1kW and above with no problems at all. So the rating of the motor is just implicating the limits of the controller and nothing else. Please, correct me if I'm wrong here.

2.2kg gear motor at 48v 20A Will have like 40% efficiency uphill..

you need more than 40km/h, thats why I recommend bigger.

I Run 14s batt, 1000w Direct motor at 5kw with Stock 18fet kunteng. 70km/h on flat.

Cheapest "High" power setup possible.
 
apple2 wrote: ↑07 Jul 2018, 10:33
2. How does it perform compared to the stock formware? The notes say something about block commutation not available yet. I can feel the motor currently starting in non-sinewave mode and then switches to noiseless shortly after.

If you're using the Master Branch you may find that changing the value of MOTOR_ROTOR_OFFSET_ANGLE (Config.h) can make the initial startup a little smoother. For me an offset of 15 here made a noticeable improvement.
 
Stancecoke:
For me the main advantage is the possibility to connect the torque-sensor directly.

@stancecoke, I'm about to start installing my torque sensor (sempu T2, 10-24v, gen 2 I think..). Is there any useful information you can point me to regarding controller connections... :wink:
 
honya96 said:
Valopallo said:
Hmm... I thought that the motor size or the power rating is irrelevant since the power output is dependent from the max current of the controller times the battery voltage... I have read somewhere that people are driving their "250W" motors up to 1kW and above with no problems at all. So the rating of the motor is just implicating the limits of the controller and nothing else. Please, correct me if I'm wrong here.

2.2kg gear motor at 48v 20A Will have like 40% efficiency uphill..

you need more than 40km/h, thats why I recommend bigger.

I Run 14s batt, 1000w Direct motor at 5kw with Stock 18fet kunteng. 70km/h on flat.

Cheapest "High" power setup possible.

Which motor do you have?

I am just curious why my assumptions are wrong? I know the efficiency would be crap and that I would have to keep an eye on the motor temperature or try to cool it with oil or something. But apart from that?

Have you guys implemented field weakening?
 
lqbweb said:
honya96 said:
Valopallo said:
Hmm... I thought that the motor size or the power rating is irrelevant since the power output is dependent from the max current of the controller times the battery voltage... I have read somewhere that people are driving their "250W" motors up to 1kW and above with no problems at all. So the rating of the motor is just implicating the limits of the controller and nothing else. Please, correct me if I'm wrong here.

2.2kg gear motor at 48v 20A Will have like 40% efficiency uphill..

you need more than 40km/h, thats why I recommend bigger.

I Run 14s batt, 1000w Direct motor at 5kw with Stock 18fet kunteng. 70km/h on flat.

Cheapest "High" power setup possible.

Which motor do you have?

Me? I'm just starting my build my bike with this motor; http://www.syimotor.com/productDe_5.html
And I'm planning to buy this https://bmsbattery.com/ebike-kit/721-s12sn-1000w-40a-torque-simulation-sine-wave-controller-ebike-kit.html to have 1440W max output from it with my 36V 10ah li-ion battery. Please, if this is not going to work for some reason, let me know. Thnx :)
 
geofft said:
@stancecoke, I'm about to start installing my torque sensor (sempu T2, 10-24v, gen 2 I think..). Is there any useful information you can point me to regarding controller connections... :wink:

You have to get the right voltage from an extra DC/DC converter or from the controller PCB. The rest is quite simple:

Throttle connector: GND and Torque
PAS connector: PAS

the direction signal is not used. Ignore the right hand side of the picture, it shows a controller that is sold in a set with the sensor at aliexpress.

index.php


regards
stancecoke
 
Valopallo said:
lqbweb said:
honya96 said:
Valopallo said:
Hmm... I thought that the motor size or the power rating is irrelevant since the power output is dependent from the max current of the controller times the battery voltage... I have read somewhere that people are driving their "250W" motors up to 1kW and above with no problems at all. So the rating of the motor is just implicating the limits of the controller and nothing else. Please, correct me if I'm wrong here.

2.2kg gear motor at 48v 20A Will have like 40% efficiency uphill..

you need more than 40km/h, thats why I recommend bigger.

I Run 14s batt, 1000w Direct motor at 5kw with Stock 18fet kunteng. 70km/h on flat.

Cheapest "High" power setup possible.

Which motor do you have?

Me? I'm just starting my build my bike with this motor; http://www.syimotor.com/productDe_5.html
And I'm planning to buy this https://bmsbattery.com/ebike-kit/721-s12sn-1000w-40a-torque-simulation-sine-wave-controller-ebike-kit.html to have 1440W max output from it with my 36V 10ah li-ion battery. Please, if this is not going to work for some reason, let me know. Thnx :)

Motor looks good but I wouldn't buy without knowing Its RPM/KV.

It Will be better to get 48v battery

40A Draw for 10Ah Is a bit too much, ok for a while if those Are 10A cells, but really bad range.

Check if your bms can handle 40A, I dont think so.

Field weakening Is not implemented.

I recommend you order 2 controllers if you want to try this FW.
 
honya96 said:
Valopallo said:
lqbweb said:
honya96 said:
2.2kg gear motor at 48v 20A Will have like 40% efficiency uphill..

you need more than 40km/h, thats why I recommend bigger.

I Run 14s batt, 1000w Direct motor at 5kw with Stock 18fet kunteng. 70km/h on flat.

Cheapest "High" power setup possible.

Which motor do you have?

Me? I'm just starting my build my bike with this motor; http://www.syimotor.com/productDe_5.html
And I'm planning to buy this https://bmsbattery.com/ebike-kit/721-s12sn-1000w-40a-torque-simulation-sine-wave-controller-ebike-kit.html to have 1440W max output from it with my 36V 10ah li-ion battery. Please, if this is not going to work for some reason, let me know. Thnx :)

Motor looks good but I wouldn't buy without knowing Its RPM/KV.

It Will be better to get 48v battery

40A Draw for 10Ah Is a bit too much, ok for a while if those Are 10A cells, but really bad range.

Check if your bms can handle 40A, I dont think so.

Field weakening Is not implemented.

I recommend you order 2 controllers if you want to try this FW.

I guess that's all the information I can get about the motor and I'm using this 36V battery for this first build since I have it already for free. So do you think it would be wiser to save some money for these and buy the s09s maybe? I don't really mind the range that much but would really love to see how much power I can get from this setup as short sprints at least. If the efficiency would come to a beautiful harmony with the battery and the motor, then would the safe bet be some lower current/mosfet controller than the s12s? S09S maybe then?
 
stancecoke said:
geofft said:
@stancecoke, I'm about to start installing my torque sensor (sempu T2, 10-24v, gen 2 I think..). Is there any useful information you can point me to regarding controller connections... :wink:

You have to get the right voltage from an extra DC/DC converter or from the controller PCB. The rest is quite simple:

Throttle connector: GND and Torque
PAS connector: PAS

the direction signal is not used. Ignore the right hand side of the picture, it shows a controller that is sold in a set with the sensor at aliexpress.

regards
stancecoke

Thanks, seems straightforward enough. I'm gonna try using the 14v supply from the controller, hopefully the LM317 won't complain too much.. :?
 
Valopallo said:
honya96 said:
Valopallo said:
lqbweb said:
Which motor do you have?

Me? I'm just starting my build my bike with this motor; http://www.syimotor.com/productDe_5.html
And I'm planning to buy this https://bmsbattery.com/ebike-kit/721-s12sn-1000w-40a-torque-simulation-sine-wave-controller-ebike-kit.html to have 1440W max output from it with my 36V 10ah li-ion battery. Please, if this is not going to work for some reason, let me know. Thnx :)

Motor looks good but I wouldn't buy without knowing Its RPM/KV.

It Will be better to get 48v battery

40A Draw for 10Ah Is a bit too much, ok for a while if those Are 10A cells, but really bad range.

Check if your bms can handle 40A, I dont think so.

Field weakening Is not implemented.

I recommend you order 2 controllers if you want to try this FW.

I guess that's all the information I can get about the motor and I'm using this 36V battery for this first build since I have it already for free. So do you think it would be wiser to save some money for these and buy the s09s maybe? I don't really mind the range that much but would really love to see how much power I can get from this setup as short sprints at least. If the efficiency would come to a beautiful harmony with the battery and the motor, then would the safe bet be some lower current/mosfet controller than the s12s? S09S maybe then?

I think 9 fet Is not tested. You can set lower current with 12fet. Problem with 40A Will be the battery, not motor. That motor can handle much more, if you buy 48v in Future you can get 60A+ from the 12fet with this FW..

But I am still not running it reliably on Direct motor.

We need a developer interested in higher power builds, get Phase current limiting of some kind on the same fork as linear brake, motor temperature power derating, etc etc..
 
honya96 said:
Valopallo said:
honya96 said:
Valopallo said:
Me? I'm just starting my build my bike with this motor; http://www.syimotor.com/productDe_5.html
And I'm planning to buy this https://bmsbattery.com/ebike-kit/721-s12sn-1000w-40a-torque-simulation-sine-wave-controller-ebike-kit.html to have 1440W max output from it with my 36V 10ah li-ion battery. Please, if this is not going to work for some reason, let me know. Thnx :)

Motor looks good but I wouldn't buy without knowing Its RPM/KV.

It Will be better to get 48v battery

40A Draw for 10Ah Is a bit too much, ok for a while if those Are 10A cells, but really bad range.

Check if your bms can handle 40A, I dont think so.

Field weakening Is not implemented.

I recommend you order 2 controllers if you want to try this FW.

I guess that's all the information I can get about the motor and I'm using this 36V battery for this first build since I have it already for free. So do you think it would be wiser to save some money for these and buy the s09s maybe? I don't really mind the range that much but would really love to see how much power I can get from this setup as short sprints at least. If the efficiency would come to a beautiful harmony with the battery and the motor, then would the safe bet be some lower current/mosfet controller than the s12s? S09S maybe then?

I think 9 fet Is not tested. You can set lower current with 12fet. Problem with 40A Will be the battery, not motor. That motor can handle much more, if you buy 48v in Future you can get 60A+ from the 12fet with this FW..

But I am still not running it reliably on Direct motor.

Please explain, what would be the problem with the battery? I understand that 10ah isn't much range if drawing 40Amps from it but is there something else like heat problems involved when going this high current draw?
Also, what do you mean by; "But I am still not running it reliably on Direct motor" ?
 
Valopallo said:
Please explain, what would be the problem with the battery? I understand that 10ah isn't much range if drawing 40Amps from it but is there something else like heat problems involved when going this high current draw?
Also, what do you mean by; "But I am still not running it reliably on Direct motor" ?

Well, I know nothing about programing So I cant get it to run reliably, its still better Stock.
But Stancecoke Is running Direct motor with it..

You Have some Brand battery in plastic case with bms inside? Send photos maybe...

Overheating of the cells should not be that bad, but if it has 15A bms with 30A overcurrent protection, it Will shut off.
 
honya96 said:
Valopallo said:
Please explain, what would be the problem with the battery? I understand that 10ah isn't much range if drawing 40Amps from it but is there something else like heat problems involved when going this high current draw?
Also, what do you mean by; "But I am still not running it reliably on Direct motor" ?

Well, I know nothing about programing So I cant get it to run reliably, its still better Stock.
But Stancecoke Is running Direct motor with it..

You Have some Brand battery in plastic case with bms inside? Send photos maybe...

Overheating of the cells should not be that bad, but if it has 15A bms with 30A overcurrent protection, it Will shut off.

Ok. I see. I have the list of the manufacturer's products but haven't opened the battery case yet. So if the original controller that the battery came with was operating max 15A should I conclude that the BMS be operating at that same continuous current 15A because what I see from the list without even knowing the exact type of my BMS yet, it seems the lowest overcurrent protection with 15A continous current would be 26-33A. This is ofcourse just speculation, I have to check the exact type of the bms and the cells to really be sure.

http://spard.gotoip1.com/plus/list.php?tid=57
 
So, I just implemented battery SOC based on discharged watts hour. That is something I though that could be implemented on the controller side, but the thing is that the discharged watts hour are saved on EEPROM when the LCD is disabled by the user and on the controller, there is no information that power will shutoff so no way to save the value on EEPROM. I think this feature should stay on the LCD side.

I wish developers could join to implement the support for KT motor controllers. The menu and submenu configuration structure is now ready for expanding with more configurations.

casainho said:
KT LCD3 for TSDZ2: battery state of charge based on discharged watts hour

I implemented the feature on the firmware of KT LCD3 for TSDZ2, of user being able to configure on the LCD3 the total amount of watts hour available on the battery pack. With this information, LCD3 shows a numeric value of battery state of charge (on the bottom right field).
User can also configure to see the value incrementing or decrementing and even enable or disable this feature.
Also, user can change current discharged watts hour (can be useful if changing to a different battery).

See the next video where I show this new feature (also the configuration menu and submenus). The sources are on github as usual so for the users can build the firmware, test and give feedback.

[youtube]fFjo4UKV-qY[/youtube]
 
Had a bit of a disaster with my controller tonight (Master branch, throttle/pas mode). Just recently upgraded to CSD19506 mosfets and it's been running fine until I tried it tonight for the first time with a fully charged battery. Had immediate problems on power up in that the battery bars would climb 1-2-3-4 as normal, but then would immediately reset to zero bars and cycle 1-2-3-4 again and then repeat this ad infinitum. Whilst this cycling was happening the lcd3 brake indicator was activated and there was no response to throttle or pas input.

After a few power up attempts this seemed to stop happening and it powered up as normal but with the motor growling at standstill and sometimes jerking forward at power up. Then suddenly the battery trip switch popped out and a quick meter check showed I had shorted green phase mosfets.

I'm hoping this was just a bad mosfet in the process of breaking down, if so this is disappointing for supposedly high quality TI components from a good supplier.

I'm about to order some replacement CSD19506's, in the meantime I'd just thought I'd run this in front of you guys in case you think this may be a bug in the firmware, or anything else you think I ought to check.... :wink:
 
Hmm, strange. Which fork did you use? What max current did you choose? Can you post your config.h?

I never tried more than 6amps yet.

regards
stancecoke
 
stancecoke said:
Hmm, strange. Which fork did you use? What max current did you choose? Can you post your config.h?

I never tried more than 6amps yet.

regards
stancecoke

I'm using the current casainho fork of the master branch.

You may be on the right track with max current, I've just remembered I did play around with these numbers. I may have put something stupid in for these, at the time I couldn't remember what the division factor was and was too lazy to look it up - I reckon that may have come back to bite me... :oops:

Config.h attached.
 
Back
Top