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

Electric Motors and Controllers
honya96
100 W
100 W
Posts: 164
Joined: Mar 05, 2015 9:38 am
Location: Czech Republic

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

Post by honya96 » Feb 01, 2018 1:28 pm

infernomer wrote:
Feb 01, 2018 11:44 am
I want to buy a 72v and around max 40 amp controller from aliexpress. Can you provide me a link which controller should buy ?
Please provide as detailed info as possible about your build, so I can suggest the best.

If I remember correctly you can get 72v 40A from bmsbattery.com for 60$

+72v lcd3 from aliexpress, that way you get both tax free.

But you can't be sure it will work for you without sharing your battery/motor etc specs.

infernomer
10 µW
10 µW
Posts: 5
Joined: May 28, 2017 3:29 pm

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

Post by infernomer » Feb 01, 2018 2:38 pm

now i have magic pie 4 its 48 v 30amp max. But i want 72v because the future builds. I think i will get rid magic pie 4 and will buy leaf motor 1500w hub motor.
I dont have any battery yet but i am building it from recycled laptop batteries.
I live in turkey and 60 $ is not tax free in my country its about 25$ :( .
Thank you for helping me

honya96
100 W
100 W
Posts: 164
Joined: Mar 05, 2015 9:38 am
Location: Czech Republic

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

Post by honya96 » Feb 01, 2018 3:33 pm

I have 20s14p pack of used laptop 18650. Calculate with using max 6A per cell for really short bursts or 4A for a bit longer. Best to install 1$ lcd with temp sensor to keep battery under 60°C if you want to push it.

72v 40A 12fet controller can't handle hallomotor 48v 1000w motor (no load rpm at 20s is around 1150, so its asking too much phase current.) So look it up and get lower rpm motor than this one or/+ 72v 45A 18fet on Aliexpress for around 82$ it can handle 45A for much longer than 12fet its 40A rating.

25$ taxfree EU limit is not including shipping so you can ask seller to declare 22$ product + 38$ shipping and send you invoice with these prices so it can pass tax free even if they stop it.

casainho
100 kW
100 kW
Posts: 1197
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Feb 01, 2018 3:50 pm

BMSBattery can ship to EU without client paying taxes, I always do that. They sent first the package to UK and then finally to the EU country.
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

infernomer
10 µW
10 µW
Posts: 5
Joined: May 28, 2017 3:29 pm

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

Post by infernomer » Feb 01, 2018 4:42 pm

honya96 wrote:
Feb 01, 2018 3:33 pm
I have 20s14p pack of used laptop 18650. Calculate with using max 6A per cell for really short bursts or 4A for a bit longer. Best to install 1$ lcd with temp sensor to keep battery under 60°C if you want to push it.

72v 40A 12fet controller can't handle hallomotor 48v 1000w motor (no load rpm at 20s is around 1150, so its asking too much phase current.) So look it up and get lower rpm motor than this one or/+ 72v 45A 18fet on Aliexpress for around 82$ it can handle 45A for much longer than 12fet its 40A rating.

25$ taxfree EU limit is not including shipping so you can ask seller to declare 22$ product + 38$ shipping and send you invoice with these prices so it can pass tax free even if they stop it.
I will make it 20s20p with tesla fuses to be super safe. Good idea to put 1$ lcd sensor now its in my todo list.

Can you give me a link from aliexpress for kt controllers because i want to use opensource firmware.

Our customs is really hard to trick. But if they stop my package i can pay for tax its not big deal.

Thank you

casainho
100 kW
100 kW
Posts: 1197
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Feb 01, 2018 4:54 pm

I strongly suggest you to buy BMSBattery controller if possible, as the probability to work well with our OpenSource firmware is high.
Honya96 is having difficulties running our OpenSource firmware on his no BMSBattery controller.
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

honya96
100 W
100 W
Posts: 164
Joined: Mar 05, 2015 9:38 am
Location: Czech Republic

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

Post by honya96 » Feb 01, 2018 5:31 pm

Tesla fuses make sense with tesla cell which have no PTC, CID protection. Here In 20p It may be worth it, but if one cell fails it will (90%) not blow the fuse, just slowly take down all other paralel cells. Fuse will blow only if you mechanicaly damage some cells. Then it will save you.

Your battery, motor and this controller

http://s.click.aliexpress.com/e/IIQFqNf?fromSns=Copy

Should be ok even for 80A short peaks, but you will have to change controller power wires and traces. + add capacitors.

72v LCD3 here:
http://s.click.aliexpress.com/e/2RNzJYV?fromSns=Copy

I will get commission credit if you buy through the links :D

@Casainho - this controller has the same board number as bms s12xx only difference is the 12 / 18.
Works for me easily with main branch. Only issue is wrong power measurement which you can correct by soldering your second shunt back and testing. And adding shunt number option to java app.

Here with 72v may be problem with lvc (same will be with bmsbattery controller) can be corrected by changing one smd resistor to the same which 48v version uses, or by firmware option.

Anyway you should add lvc setting not depending on liion cell number set. Some people use 2.5v, some use 3.2v.
Last edited by honya96 on Feb 01, 2018 5:46 pm, edited 1 time in total.

infernomer
10 µW
10 µW
Posts: 5
Joined: May 28, 2017 3:29 pm

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

Post by infernomer » Feb 01, 2018 5:41 pm

honya96 wrote:
Feb 01, 2018 5:31 pm
Tesla fuses make sense with tesla cell which have no PTC, CID protection. Here In 20p It may be worth it, but if one cell fails it will (90%) not blow the fuse, just slowly take down all other paralel cells. Fuse will blow only if you mechanicaly damage some cells. Then it will save you.

Your battery, motor and this controller

http://s.click.aliexpress.com/e/IIQFqNf?fromSns=Copy

Should be ok even for 80A short peaks, but you will have to change controller power wires and traces. + add capacitors.

72v LCD3 here:
http://s.click.aliexpress.com/e/2RNzJYV?fromSns=Copy

I will get commission credit if you buy through the links :D

@Casainho - this controller has the same board number as bms s12xx only difference is the 12 / 18.
Works for me easily with main branch. Only issue is wrong power measurement which you can correct by soldering your second shunt back and testing. And adding shunt number option to java app.
Cannot deliver to turkey :)

I think i will get in touch to bmsbattery

honya96
100 W
100 W
Posts: 164
Joined: Mar 05, 2015 9:38 am
Location: Czech Republic

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

Post by honya96 » Feb 01, 2018 5:57 pm

infernomer wrote:
Feb 01, 2018 5:41 pm

Cannot deliver to turkey :)

I think i will get in touch to bmsbattery
But you cant use your battery potencial power with the 12fet. It overheat's fast at 40A and has no protection. :? Think about what continuous power you expect.

You can contact the seller about shipping, once they added my country shipping quote to the listing after contacting them.

For me it shows 30$ fedex to Czech republic and 48$ standard shipping to Turkey

Edit: try both mobile app and desktop, they give different quotes sometimes.

honya96
100 W
100 W
Posts: 164
Joined: Mar 05, 2015 9:38 am
Location: Czech Republic

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

Post by honya96 » Feb 01, 2018 6:24 pm

Or another option if you are ok with 4kw max, 70kph is to go with 14s battery and ordering motor/controller kit from https://risunmotor.com you will save a lot of money this way. They have special tax free shipping to EU.. don't know what about Turkey.

User avatar
stancecoke
1 kW
1 kW
Posts: 448
Joined: Aug 02, 2017 2:56 pm

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

Post by stancecoke » Feb 02, 2018 2:16 am

@honya96: Can you please measure the voltage on pin 15 (AIN7). That's the input for the regen throttle. I checked the code and found, that it isn't initializied to be an input pin but it works on the 6FET nevertheless.
Image

And can you please check, if there's a solderpad marked as X4 on the PCB of the 18 FET

Before the code processes the throttle signal, there are several conditions being checked:
1. regen throttle
2. low voltage
3. brake lever signal
4. erps limit
5. pedals turning (disabled in THROTTLE mode)

regards
stancecoke

honya96
100 W
100 W
Posts: 164
Joined: Mar 05, 2015 9:38 am
Location: Czech Republic

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

Post by honya96 » Feb 02, 2018 7:01 am

@stancecoke - I have added connector to X4 to fit my regen thumb throttle. Not connected yet. Will measure that voltage when I get home :wink:

casainho
100 kW
100 kW
Posts: 1197
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Feb 02, 2018 11:28 am

I started to play with the PI controller and tested it for speed controller only, and this time controlling the wheel speed and not motor ERPS as before.

I did follow what I saw for STM32 FOC, using only integer operations and just multiplication, no division or floats:
Image
Image

I tested the code and seems to work as expected -- I tested for the speed controller. I also had to restructure the code, as now wheel speed and motor current controllers will go to inside of ebike_app.c and not like before, inside motor.c. This is more like what Stancecoke does, on his update_setpoint.c.
Here is current PI controller code:
Image

And the initialization of KP and KI, for speed controller - was structure in a way that when finished the implementation, the user will be able to change them on the firmware configuration tool:
Image
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

honya96
100 W
100 W
Posts: 164
Joined: Mar 05, 2015 9:38 am
Location: Czech Republic

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

Post by honya96 » Feb 02, 2018 11:33 am

@Stancecoke
4.928v on pin 15, same at x4 pad.
4.527v at throttle 5v input
0v at throttle signal input

Seems that my pin 15 voltage is wrong?

nieles
10 kW
10 kW
Posts: 627
Joined: Jul 14, 2008 5:39 pm
Location: The Netherlands

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

Post by nieles » Feb 02, 2018 11:34 am

there is a bug in your snapshot.
casainho wrote:
Feb 02, 2018 11:28 am
Image
you assign the value of DIVIDENT to DIVISOR for the KI parameter

casainho
100 kW
100 kW
Posts: 1197
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Feb 02, 2018 11:38 am

nieles wrote:
Feb 02, 2018 11:34 am
there is a bug in your snapshot.
casainho wrote:
Feb 02, 2018 11:28 am
Image
you assign the value of DIVIDENT to DIVISOR for the KI parameter
Thanks for the code review!! Got it :-)
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

nieles
10 kW
10 kW
Posts: 627
Joined: Jul 14, 2008 5:39 pm
Location: The Netherlands

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

Post by nieles » Feb 02, 2018 11:47 am

no problem.. really eager to play around with this.. just waiting on the stlink V2 dongle to get started.

do have one question. where is the ERPS limit of 520 coming from? is this a hardware/mcu restriction?

casainho
100 kW
100 kW
Posts: 1197
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Feb 02, 2018 11:52 am

nieles wrote:
Feb 02, 2018 11:47 am
no problem.. really eager to play around with this.. just waiting on the stlink V2 dongle to get started.

do have one question. where is the ERPS limit of 520 coming from? is this a hardware/mcu restriction?

Code: Select all

#define MOTOR_OVER_SPEED_ERPS 520 // motor max speed, protection max value | 30 points for the sinewave at max speed
At PWM frequency 64us, sinewave will be draw using the 30 points and lot less. Using not less than 30 points seems a good value, like the original firmware seems to do.
And yes, we can increase a bit the PWM freq to get higher ERPs... but not much more due to microcontroller speed limit as also hardware...

What controller version do you have to play?
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

User avatar
stancecoke
1 kW
1 kW
Posts: 448
Joined: Aug 02, 2017 2:56 pm

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

Post by stancecoke » Feb 02, 2018 12:28 pm

honya96 wrote:
Feb 02, 2018 11:33 am
@Stancecoke
4.928v on pin 15, same at x4 pad.
4.527v at throttle 5v input
0v at throttle signal input

Seems that my pin 15 voltage is wrong?
Yes, this will be the reason, why the motor doens't run, but that's no problem hopefully. You can try to pull X4 down to gnd with a resistor about 10k. I will upload a new commit soon, that sets AIN7 to input. If there's no external pullup on the board, pin 15 shoul show 0V then. (perhaps the internal pullup is active at the moment....)

edit: I've just pushed the changes to the HighSpeedMotors branch on github. You can try if there are still 5V on X4, or if it's zero now.

@casainho: fine, that you are following this way for the PI-controller now :) The code is quite confusing with all the shift operations :shock: , but I understand, that you have the technical ambition to avoid floating point arithmetics :wink: ...

regards
stancecoke
Last edited by stancecoke on Feb 02, 2018 12:55 pm, edited 2 times in total.

honya96
100 W
100 W
Posts: 164
Joined: Mar 05, 2015 9:38 am
Location: Czech Republic

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

Post by honya96 » Feb 02, 2018 12:49 pm

casainho wrote:
Feb 02, 2018 11:52 am
And yes, we can increase a bit the PWM freq to get higher ERPs... but not much more due to microcontroller speed limit as also hardware...
Whats the theoretical microcontroler max PWM freq? I was thinking how hard it will be to mod all whats needed to run 23K rpm / 10pole motor (60khz?) Maybe replacing by stm32 will help? I am able to do it..

@Stancecoke - will test now.

4.918v at pin 15. Still not running

Should I try cutting the trace near pin 15 to see if the voltage goes in or from the microcontroller?

Well looks like from the pin. From what i see its going through smd capacitor to pin 13 + through capacitor somewhere + to the otherside of pcb ?directly to x4?
Last edited by honya96 on Feb 02, 2018 1:25 pm, edited 1 time in total.

User avatar
stancecoke
1 kW
1 kW
Posts: 448
Joined: Aug 02, 2017 2:56 pm

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

Post by stancecoke » Feb 02, 2018 1:23 pm

honya96 wrote:
Feb 02, 2018 12:49 pm
4.918v at pin 15. Still not running
Should I try cutting the trace near pin 15 to see if the voltage goes in or from the microcontroller?
No, try to pull down x4 with a 1k resistor to gnd first. There is an external pullup obviously.
I've just uploaded a new commit, with regen disabled. You can try, if the motor runs with this .

regards
stancecoke

nieles
10 kW
10 kW
Posts: 627
Joined: Jul 14, 2008 5:39 pm
Location: The Netherlands

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

Post by nieles » Feb 02, 2018 1:28 pm

Not 100% sure what controller I have. I can't find the top cover of the controller housing. It has the phase current sensor and the STM MCU. But looks a bit different than the photos on the bitbucket website. But I am confident I will get it working.

Good to know I can up the PWM freq a bit. I will dive in to the datasheet to see what's possible. What's the next limitation? The amount of processing that can be done in the PWM period?

honya96
100 W
100 W
Posts: 164
Joined: Mar 05, 2015 9:38 am
Location: Czech Republic

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

Post by honya96 » Feb 02, 2018 1:36 pm

stancecoke wrote:
Feb 02, 2018 1:23 pm
honya96 wrote:
Feb 02, 2018 12:49 pm
4.918v at pin 15. Still not running
Should I try cutting the trace near pin 15 to see if the voltage goes in or from the microcontroller?
No, try to pull down x4 with a 1k resistor to gnd first. There is an external pullup obviously.
I've just uploaded a new commit, with regen disabled. You can try, if the motor runs with this .

regards
stancecoke
Runs with regen disabled. 1k or 10k? Then the regen should work??

Now with basic setting motor speed oscilates. At full throttle

User avatar
stancecoke
1 kW
1 kW
Posts: 448
Joined: Aug 02, 2017 2:56 pm

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

Post by stancecoke » Feb 02, 2018 1:54 pm

honya96 wrote:
Feb 02, 2018 1:36 pm
Runs with regen disabled. 1k or 10k? Then the regen should work??
No, you have to find and remove the component that connects pin 15 to Vcc (the pull-up resistor).

But you can look for another unused pad, that's labeled with x... and check the voltage on that. If you find one with 0V, you can try to find the pin it is connected to.
honya96 wrote:
Feb 02, 2018 1:36 pm
Now with basic setting motor speed oscilates. At full throttle
Without load? That's no problem, it won't oszillate with enough load...

regards
stancecoke

p.s. I've reactivated regen at github again...

casainho
100 kW
100 kW
Posts: 1197
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Feb 02, 2018 2:02 pm

nieles wrote:
Feb 02, 2018 1:28 pm
Good to know I can up the PWM freq a bit. I will dive in to the datasheet to see what's possible. What's the next limitation? The amount of processing that can be done in the PWM period?
Yes, the limitation is that amount of processing/time used on each PWM cycle, if we can reduce it, we can increase the frequency up to some limit of the hardware (which may be something like 1.5x). We are using the same frequency as original firmware.
Stancecoke already did code with increased PWM frequency.

Do we need faster PWM?? If so, which controllers are on the market that do 2, 3 or 4 times the 16khz PMW from this base controllers??

JinHui controllers have STM32 but I bet the hardware do only the standard 16khz -- they should do FOC and sensorless:
https://opensourceebikefirmware.bitbuck ... llers.html
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

Post Reply