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: 188
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 » Jan 21, 2018 6:04 pm

geofft wrote:
Jan 21, 2018 4:39 pm
I don't see this as any great problem, it's fairly obvious what's happening when you see it. It's just a minor issue really, maybe something that could be improved in the future when the major items in the code are working well.
I agree, actually its not even an "issue" its ok as it is.

honya96
100 W
100 W
Posts: 188
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 » Jan 21, 2018 6:29 pm

"With low battery and in case of load, the raw voltage readings are be below the undervoltage threshold, but this should be permissible."

So I was right, he is talking about LVC but if I set to 2.5v per cell, I dont want the battery to have lower voltage EVER in its life time.

So no, this should not be permissible. Even under load. Think about the chemistry, if this is apliciable then you can also charge by 5 volts measure capacity charged and disconnect so you get 4.2v. But it does not work that way. PTC, CID protected cell will disconnect itself by high internal presure. Non-protected will leak or explode.

Chargers are CC CV (float charge mode is not good for lithium, rather 100mA cutoff current per cell. But most chargers still have it)

So in reverse discharging will be best that way.

Btw, with as low as 2.5v you still get decent cycle life, that voltage is not reached much often and when it is, the torque throttle helps here, you can just decrease the load. And drive home.

User avatar
stancecoke
1 kW
1 kW
Posts: 455
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 » Jan 22, 2018 3:22 am

honya96 wrote:
Jan 21, 2018 1:53 pm
I dont know what to do now, my 14s battery on the big bike is blowing 60v mosfets with main branch
@casainho: May this be a problem of too low deadtimes in PWM at higher voltages?
honya96 wrote:
Jan 21, 2018 1:53 pm
now It has 3 shunts (can the cal a,b be set for this?) otherwise stock so like 60A max (limited by wires and traces) It has KTE-18S5-A board, 100A phase current sensor(on 12fet its 50A)....
@ Stancecoke, do you think I will get that running? flashing connector is ready :twisted:
You can try the same approach as before:
1. measure the voltage on AIN8 (Pin 23) to get a first guess for cal b,
2. find the right value for cal b,
3. measure the max current at three values of Battery Current max
4. calculate cal a out of the found values.

But you have to make sure, that we have 2.5V quite exactly on AIN5 (Pin 17), otherwise the FOC will make the commutation fail.

regards
stancecoke

casainho
100 kW
100 kW
Posts: 1225
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 » Jan 22, 2018 4:30 am

stancecoke wrote:
Jan 22, 2018 3:22 am
honya96 wrote:
Jan 21, 2018 1:53 pm
I dont know what to do now, my 14s battery on the big bike is blowing 60v mosfets with main branch
@casainho: May this be a problem of too low deadtimes in PWM at higher voltages?
Yes, can be -- maybe bigger mosfets and/or higher voltage controller version, have different power stage and need bigger dead time. I think in 2 possible ways to get it correct:
1. We would need to measure it like I documented here: https://opensourceebikefirmware.bitbuck ... .html#h1-4

2. On pwm.c file, we see that 16 value that represents the 1us dead time that our firmware uses. I would increase it for 4x more, like 4us and then going decreasing up to get that problems.
I think a bigger value than what is needed is not a problem but may represents a kind of loss of efficiency.
Here is the code to be changed:

Code: Select all

  // break, dead time and lock configuration
  TIM1_BDTRConfig(TIM1_OSSISTATE_ENABLE,
  TIM1_LOCKLEVEL_OFF,
  // hardware nees a dead time of 1us
  16, // DTG = 0; dead time in 62.5 ns steps; 1us/62.5ns = 16
  TIM1_BREAK_DISABLE,
  TIM1_BREAKPOLARITY_LOW,
  TIM1_AUTOMATICOUTPUT_DISABLE);
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

casainho
100 kW
100 kW
Posts: 1225
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 » Jan 22, 2018 4:32 am

@Stancecoke, I need to put a link on main page to your branch - it has some advanced features and advantages. To where should I link?? maybe some place where you are putting instructions?
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

ThierryGTLTS
10 mW
10 mW
Posts: 30
Joined: Jan 10, 2017 8:10 am

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

Post by ThierryGTLTS » Jan 22, 2018 4:33 am

14S battery with 60V MOSFETs is not possible, you'll blow them, that's normal :!:

Spikes of 60V to 75V will occur depending on your wiring and capacitor value and quality.

So for 60V MOSFETs, maximum 12S for safety.

14S needs 80V or 100V MOSFETs.

Have a Nice Day.

Thierry

User avatar
stancecoke
1 kW
1 kW
Posts: 455
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 » Jan 22, 2018 5:36 am

casainho wrote:
Jan 22, 2018 4:32 am
@Stancecoke, I need to put a link on main page to your branch - it has some advanced features and advantages. To where should I link?? maybe some place where you are putting instructions?
I've just added the description to the "Alternative Fork" Page. It is a not revised translation by deepl.com.
We can improve the description, if needed. Some smaller details are currently missing.

regards
stancecoke

honya96
100 W
100 W
Posts: 188
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 » Jan 22, 2018 3:19 pm

Guys I am sorry for the misunderstanding, I know its normal to blow 60v mosfet with 14s. (I did not know its just 60v in that controller) Was just saying I cant test the big bike with 6fet. But 18fet is okay with that voltage since it has 85v mosfets.

geofft
100 W
100 W
Posts: 118
Joined: Nov 09, 2012 9:41 am
Location: Berkshire UK

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

Post by geofft » Jan 23, 2018 4:25 am

casainho wrote:
Jan 21, 2018 1:10 pm
geofft wrote:
Jan 21, 2018 10:34 am
I've tried this with an old-fashioned crt 'scope :-
..this gave a 'rough' result for my (Q128H) motor of about 150 degrees.
I am not sure about that process of scope, I never validated, but it is interesting to see different results. Now that you have the bike training roller, you can put a constant load on the motor and adjust:
...didn't have much success with this, problem is that even with a fixed steady load (on bike training roller) the current draw from the battery is not steady and is constantly moving, making it difficult to estimate an average. In the end both 'scope and meter methods indicated an FOC_READ_ID_CURRENT_ANGLE_ADJUST of 148-152 was correct so I've settled at 150 (Q128H motor).
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

honya96
100 W
100 W
Posts: 188
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 » Jan 23, 2018 5:13 am

geofft wrote:
Jan 23, 2018 4:25 am
the current draw from the battery is not steady and is constantly moving.
You can try something like this
http://s.aliexpress.com/77bUNzEf?fromSns=Copy

And measure Wh consumed in 2 minutes to get more acurate. Stable vollage input will help.

geofft
100 W
100 W
Posts: 118
Joined: Nov 09, 2012 9:41 am
Location: Berkshire UK

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

Post by geofft » Jan 23, 2018 6:05 am

honya96 wrote:
Jan 23, 2018 5:13 am
geofft wrote:
Jan 23, 2018 4:25 am
the current draw from the battery is not steady and is constantly moving.
You can try something like this
http://s.aliexpress.com/77bUNzEf?fromSns=Copy

And measure Wh consumed in 2 minutes to get more acurate. Stable vollage input will help.
Maybe one for the future, I think my 'hobby funds' have all been used up for some time.... :(
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

casainho
100 kW
100 kW
Posts: 1225
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 » Jan 23, 2018 6:47 am

geofft wrote:
Jan 23, 2018 4:25 am
...didn't have much success with this, problem is that even with a fixed steady load (on bike training roller) the current draw from the battery is not steady and is constantly moving, making it difficult to estimate an average. In the end both 'scope and meter methods indicated an FOC_READ_ID_CURRENT_ANGLE_ADJUST of 148-152 was correct so I've settled at 150 (Q128H motor).
Great, thank you!!!

Yes, for me the current also fluctuates - I did used the value shown by the power supply, that may average it already.
I think you are now more confident that you are taking most possible efficiency for your motor.

So, that is great that we now have 2 methods to get that value!

So, 150 (150 - 127) is 23 is 32 degrees angle, a lot!! I wounder if now your controller have lower temperature while running.

Also, with such big fluctuations from motor to motor, I wounder if we running our motors with bad efficiency with original firmware.
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

geofft
100 W
100 W
Posts: 118
Joined: Nov 09, 2012 9:41 am
Location: Berkshire UK

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

Post by geofft » Jan 23, 2018 8:39 am

Also, with such big fluctuations from motor to motor, I wounder if we running our motors with bad efficiency with original firmware.
I'm intending to do some comparison testing (between stock and 'new' firmware) today or tomorrow, should hopefully be able to give you some meaningful information. At this early stage I think I can say the new fw runs no hotter that stock, and maybe just a little cooler... 8)
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

geofft
100 W
100 W
Posts: 118
Joined: Nov 09, 2012 9:41 am
Location: Berkshire UK

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

Post by geofft » Jan 24, 2018 5:40 am

I've got my 'new' firmware installation working well now, so recently reconnected the the 'stock' controller just to see how things compared. My setup is as per Q128H installation in signature line. Some observations:-

Idle current draw (stock) is 80-90mA, new fw 130-140mA, no big deal.

New firmware applies resistance to being pushed backwards, stock firmware does not.

'New' fw is very smooth, quiet and gentle with the motor. Maybe too much so for some tastes, as the stock fw has higher top speed (about 7.5%) and higher torque (I'd guess about 10%). New firmware draws much less max power however, max watts 630 against 850 for stock, so range should be noticeably increased. I'm left with the feeling, however, that the full capability of the motor is not available with the new fw, and some settings within the code could safely be made a little more aggressive.

'New' fw PAS feels really nice, maybe a little slow to build from a standing start but once rolling feels very natural and progressive, and doesn't get ahead of your pedalling like the 'stock' fw tends to do.

'New' fw throttle works generally very well, just a small lag when coming back onto throttle after a brake interruption, but not too bad. I'm now wondering if both this and PAS build up might be improved by decreasing the pwm duty cycle ramp up, I'm currently back to using the default 25.

With 'new' fw, controller was definitely cooler after a ride than 'stock'- I'm not sure if this was down to efficiency gains or simply the fact that the 'new' firmware wasn't able to drive the motor as hard, so not really conclusive at the moment.

Quite a bit of heat is also generated by the LM317 voltage regulators. Probably not a problem at 24v or 36v, but inputting 48v it has to lose a lot of power to get down to 15v and gets very hot in the process, reaching around 90degC. I guess they're designed to run this way but I wonder about their long term reliability at these temperatures. I've fitted them with heatsinks, though I'm not sure how effective they will be inside an enclosed case. Been looking around for possible switch mode replacements for these but space is limited for this, no luck so far.

So overall a positive feeling, as always improvements can be made but considering the complexity of the task you guys have done a great job so far.. :)
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

casainho
100 kW
100 kW
Posts: 1225
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 » Jan 24, 2018 7:23 am

geofft wrote:
Jan 24, 2018 5:40 am
'New' fw is very smooth, quiet and gentle with the motor. Maybe too much so for some tastes, as the stock fw has higher top speed (about 7.5%) and higher torque (I'd guess about 10%). New firmware draws much less max power however, max watts 630 against 850 for stock, so range should be noticeably increased. I'm left with the feeling, however, that the full capability of the motor is not available with the new fw, and some settings within the code could safely be made a little more aggressive.
Thank you for the feedback, it is really important, since you are not a developer so I think you are not biased.

So original firmware uses more 33% battery energy but gives more ~7.5% speed and ~10% torque.
Can you please tell if you are not hitting the MOTOR_OVER_SPEED_ERPS of 520 ERPs?

I went to look at main, to see if max PWM duty_cycle is defined as max possible, and it is - because could be a bit lower like 245:
#define PWM_DUTY_CYCLE_MAX 254

I have one idea of that more used power, more speed and more torque on original firmware. Do you remember the calcs I did before?

Code: Select all

So, 150 (150 - 127) is 23 is 32 degrees angle, a lot!! I wounder if now your controller have lower temperature while running.
I remember to read that motor max speed (over nominal speed) that we can get with advance angle for field weakening is about 30º. And seems that your motor have the hall sensors placed at that +32 degrees as you did measured on that 2 different processes. See here:

Image
In: http://iopscience.iop.org/article/10.10 ... 012004/pdf

So, my suggestion is for you to change the FOC_READ_ID_CURRENT_ANGLE_ADJUST (by increasing or even decreasing his value) and see if you get the same higher speed, torque and current. Well, just if you prefer to have higher speed in exchange of less efficiency. You can search on google for "FOC field weakening" to better understand this.
geofft wrote:
Jan 24, 2018 5:40 am
Idle current draw (stock) is 80-90mA, new fw 130-140mA, no big deal.

New firmware applies resistance to being pushed backwards, stock firmware does not.
I think this is related, because that resistance means that motor coils are always energized while motor is stopped... still, the current on them should be 0 because they have the same voltage applied to them (Voltage battery / 2), slight imperfections on the circuit and/or coils, may result on the very small increase of current.
Anyway, I think would be better to have motor without resistance when pushing backwards.... happens that there is a tecnhical issue to make that, that I could not understand yet on how to do that with this motor controllers hardware: start the motor while it is already running freewheeling.

Added this to issue list, so we don't forget: https://github.com/OpenSource-EBike-fir ... /issues/27
geofft wrote:
Jan 24, 2018 5:40 am
'New' fw PAS feels really nice, maybe a little slow to build from a standing start but once rolling feels very natural and progressive, and doesn't get ahead of your pedalling like the 'stock' fw tends to do.

'New' fw throttle works generally very well, just a small lag when coming back onto throttle after a brake interruption, but not too bad. I'm now wondering if both this and PAS build up might be improved by decreasing the pwm duty cycle ramp up, I'm currently back to using the default 25.
The slow can also be because of current and speed controllers -- I advice you to play with them first. You should increase:
- MOTOR_CURRENT_CONTROLLER_KP
- MOTOR_SPEED_CONTROLLER_KP

Code: Select all

  i16_error = ((int16_t) ui16_target_current_10b) - i16_motor_current;
  i16_output = i16_error * MOTOR_CURRENT_CONTROLLER_KP;

  i16_output = ui8_duty_cycle + i16_output;
You see, the controller output variable (i16_output) is the ui8_duty_cycle + (i16_error * MOTOR_CURRENT_CONTROLLER_KP). If you increase that constant, the response should be faster but if to fast, you may also feel an oscillation on motor torque.

Also, unlike PAS, throttle have a low pass filter that adds lag/delay (YOU SHOULD PLAY HERE FIRST!) -- see void read_throotle (void). You should know by now how to reduce or increase that lag/delay, by changing that ui16_throttle_value_accumulated >> 2.
geofft wrote:
Jan 24, 2018 5:40 am
Quite a bit of heat is also generated by the LM317 voltage regulators. Probably not a problem at 24v or 36v, but inputting 48v it has to lose a lot of power to get down to 15v and gets very hot in the process, reaching around 90degC. I guess they're designed to run this way but I wonder about their long term reliability at these temperatures. I've fitted them with heatsinks, though I'm not sure how effective they will be inside an enclosed case. Been looking around for possible switch mode replacements for these but space is limited for this, no luck so far.
Well, for me, the most heat comes from that power resistor, where I think the most voltage/power drop happens:

https://opensourceebikefirmware.bitbuck ... .html#h1-2
Image
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

geofft
100 W
100 W
Posts: 118
Joined: Nov 09, 2012 9:41 am
Location: Berkshire UK

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

Post by geofft » Jan 24, 2018 8:32 am

Thanks Casainho, lots for me to take in there, will get back to you with answers (or more questions...!) when I can.

TBH I'm still struggling to understand the code but have now ordered a book on 'C' programming so hopefully may soon be more proficient. Should make for some fascinating bedtime reading.... :?
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

casainho
100 kW
100 kW
Posts: 1225
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 » Jan 24, 2018 9:18 am

geofft wrote:
Jan 24, 2018 8:32 am
TBH I'm still struggling to understand the code but have now ordered a book on 'C' programming so hopefully may soon be more proficient. Should make for some fascinating bedtime reading.... :?
That's not my idea for you need to understand C code. Most things I show, like that of delay of throttle signal, are more like tricks of digital electronics and math.
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

casainho
100 kW
100 kW
Posts: 1225
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 » Jan 24, 2018 9:29 am

I got a contact back from Podride and as expected, for a different vehicle of a bicycle, some specific features are desired and I think our Flexible OpenSource firmware is a great that :-)
Let's see if they need our help. And they are using a central motor, as seen on the videos - that work from Stancecoke for higher frequency PWM, to target this high speed motors, may prove to be important.

PodRide - the 4 wheel ebike that looks like a car
Image
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

honya96
100 W
100 W
Posts: 188
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 » Jan 24, 2018 9:37 am

@geofft - try if the regulator and resistor is getting hotter than stock fw

Try increasing P1 (250,270) and test if you get higher real speed (gps or external speedometr or noload if you can notice.)

10% lower torque - test if you get the same battery amps, set it in app so you will get the same, if the torque is still lower at same batt. A, then it can be that phase amperage is lower. But that makes some difference only accelerating from lower speed, not top end.

Try searching LM2596HVS on Aliexpress or ebay. It has simple board, you can get rid of the capacitors (they are on controllers board) and replace the petenciometer by resistors. Then It will fit in :)

@Casainho - I am sure he is not hitting max erps

With hi-end controllers, it is running at max efficiency angle untill the current starts decrease by hitting max erpm then it gradually adds the angle shift (up to some max set) to maintain current draw at a set percentage of max. Battery amps.

With adaptto I am able to get well over 30% higher speed with this function, but I guess its really advanced and hard to implement feature :|
No need for it now.

"" I could not understand yet on how to do that with this motor controllers hardware: start the motor while it is already running freewheeling.""

I think that original firmware with direct motor starts to energize them first so it knows what to do and then adds power, which actualy brakes quite a bit if you are rolling and makes for a really slow response time and overall bad experience with direct motor.

As it is now with your branch the reaction is not faster, maybe changing the values you mentioned will help. :wink:

With Stencecoke's new branch, the throttle reaction is REALLY immediate. Can't immagine an improvement. But on the other side, it has problem starting from standstill - I think its beacuse it does not have square wave start? Or some problem in my settings....

geofft
100 W
100 W
Posts: 118
Joined: Nov 09, 2012 9:41 am
Location: Berkshire UK

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

Post by geofft » Jan 24, 2018 10:00 am

@geofft - try if the regulator and resistor is getting hotter than stock fw
..no, it's the same with either firmware and all my controller 'collection' (2 for testing, one stock).

All other comments noted.
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

casainho
100 kW
100 kW
Posts: 1225
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 » Jan 24, 2018 10:12 am

honya96 wrote:
Jan 24, 2018 9:37 am
With hi-end controllers, it is running at max efficiency angle untill the current starts decrease by hitting max erpm then it gradually adds the angle shift (up to some max set) to maintain current draw at a set percentage of max. Battery amps.

With adaptto I am able to get well over 30% higher speed with this function, but I guess its really advanced and hard to implement feature :|
No need for it now.
Hmmm, it is something I think could be done with current firmware, maybe.
That max erpm you refer, it is a value that user must define, right? is the motor max RPM for a specific battery voltage value, right?
FOC_READ_ID_CURRENT_ANGLE_ADJUST is not a variable right now, but we can make it a variable and increase it or decrease to get the desired angle advance dynamically when hitting the motor max ERPM.
Yes, It is not a priority, at least for me. But would be great to document this idea and post on issue list.
honya96 wrote:
Jan 24, 2018 9:37 am
"" I could not understand yet on how to do that with this motor controllers hardware: start the motor while it is already running freewheeling.""

I think that original firmware with direct motor starts to energize them first so it knows what to do and then adds power, which actualy brakes quite a bit if you are rolling and makes for a really slow response time and overall bad experience with direct motor.
Good that you describe the original firmware behavior. That is what I don't like with direct drive motors...
I am being thinking on this, and like Stancecoke told before "let the current controller do it's job". I mean, when motor is freewheeling (with coils disabled) and we want to start driving it, we need to apply:
1. phase voltages in phase with BEMF
2. phase voltages with same amplitude as BEMF

1. the start value of phase voltage is done by the hall sensors and if motor current is near zero, the angle correction from FOC should also be near zero, but anyway, FOC algorithm should react faster to this change and setup the correct value.

2. let's say with current motor speed, the BEMF value is 30V for a 36V battery voltage, the desired duty_cycle is 212 (with 255 for the 36V) but we can't know it in advance. We can start with duty_cycle = 0 and the motor will brake!! but if we configure regen current to be minimum like 1A, the regen current controller will fast and automatically increase duty_cycle so the regen current will keep at 1A and not at a max value as would be if duty_cycle = 0. So, how to detect that regen current controller did setup the correct duty_cycle and that end of this phase??

Does this makes sense??
honya96 wrote:
Jan 24, 2018 9:37 am
With Stencecoke's new branch, the throttle reaction is REALLY immediate. Can't immagine an improvement. But on the other side, it has problem starting from standstill - I think its beacuse it does not have square wave start? Or some problem in my settings....
I am pretty sure Stancecoke branch is using the same motor controller code but differs on the current and speed controllers -- as he told before, he uses a PID controller and may be using coefficients that makes the response fast.

Unlike original firmware, our motor controller code don't use square wave.

Maybe you need to adjust:

Code: Select all

// This value must be found experimenting. Motor should rotate forward and have a good torque,
// a value to much higher or lower will make the motor not having torque while the motor starting up.
// This value can be tested with motor blocked, at startup, to found a value where is does have the best torque at startup
// A value of MOTOR_ROTOR_OFFSET_ANGLE = 202 was found to be a good one for BMSBattery Q85 motor with S06S controller
#define MOTOR_ROTOR_OFFSET_ANGLE 202
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

honya96
100 W
100 W
Posts: 188
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 » Jan 24, 2018 12:51 pm

Sorry by erpm I meant max motor rpm for given battery voltage.

Middle part is too much for my head now, will think about it later


At ALTERNATIVE FORK
what doesn't work:
Block commutation during start-up

= 6 step? = square wave?? Or I am wrong?

I think it tries to start with sine wave but fails after half a turn and iscilates without torque, I have to push It a bit and then it runs ok

casainho
100 kW
100 kW
Posts: 1225
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 » Jan 24, 2018 12:56 pm

honya96 wrote:
Jan 24, 2018 12:51 pm
At ALTERNATIVE FORK
what doesn't work:
Block commutation during start-up

= 6 step? = square wave?? Or I am wrong?

I think it tries to start with sine wave but fails after half a turn and iscilates without torque, I have to push It a bit and then it runs ok
It starts with sinewave values, but 1 point of the sinewave at each hall sensor commutation, so, it is like 6 steps but we can't say it is.
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

User avatar
stancecoke
1 kW
1 kW
Posts: 455
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 » Jan 24, 2018 1:31 pm

honya96 wrote:
Jan 24, 2018 12:51 pm
I think it tries to start with sine wave but fails after half a turn and iscilates without torque, I have to push It a bit and then it runs ok
As casainho already mentioned, please play around with the value of motor specific angle a little. I hope you will find a value, that fixes your problem.
Motor specific angle: with this value the timing of the motor control can be changed. As a result, manufacturing inaccuracies of the Hall sensor positions in the motor can be compensated. Only change if the engine starts badly.
Does the motor start, if you open the throttle more?
casainho wrote:
Jan 24, 2018 10:12 am
I am pretty sure Stancecoke branch is using the same motor controller code but differs on the current and speed controllers -- as he told before, he uses a PID controller and may be using coefficients that makes the response fast.
To be precise, it is a PI controller, there is no differential part. :wink: But you are right, the fork uses the same basics for commutation, the difference is in the way to control the current.

regards
stancecoke

geofft
100 W
100 W
Posts: 118
Joined: Nov 09, 2012 9:41 am
Location: Berkshire UK

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

Post by geofft » Jan 24, 2018 4:23 pm

casainho wrote:
Jan 24, 2018 7:23 am
geofft wrote:
Jan 24, 2018 5:40 am
'New' fw is very smooth, quiet and gentle with the motor. Maybe too much so for some tastes, as the stock fw has higher top speed (about 7.5%) and higher torque (I'd guess about 10%). New firmware draws much less max power however, max watts 630 against 850 for stock, so range should be noticeably increased. I'm left with the feeling, however, that the full capability of the motor is not available with the new fw, and some settings within the code could safely be made a little more aggressive.
Can you please tell if you are not hitting the MOTOR_OVER_SPEED_ERPS of 520 ERPs?
I don't think this is happening, but I'm not sure how to check it - is there some kind of display (or other) indication?
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

Post Reply