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

Hm, I would prefer a switch between torque-simulation- and torquesensor-mode. There are many people with physical disabilities who want to excercise their body (in torquesensor-mode) but need to have the possibility to switch to "pseudo-pedaling", if they get exhausted on a tour.
I think a throttle is quite exotic on a "pedelec", if I look at all the bikes that are selled at discounters or cycle dealers (in Germany, I have no international experience).

regards
stancecoke
 
I am very confused right now.

Let's assume I have only a throttle installed on my ebike.
P3 = 0: throttle position define a value for the current controller + a value for the speed controller
P3 = 1: throttle position defines what?? a value for the PWM duty_cycle value or a value for the current controller?

After having this defined, I will apply the same for PAS and torque sensor.
 
I dont know how the duty cycle control feels but I think adaptto and others use current. As you said, wheel spins at max rpm when it has enough amps set by throttle to do it. For me there is no need to even have that current+speed setting. Current only just feels to be the right way. Kunteng stock firmware throttle is so bad on street and unusable when riding off-road

But with PAS only their "torque simulation" is good.

Few questions

As I understand you can use only 1 or 0 because of the display firmware, will you also modify it in future?

With current firmware can you do unlimited max speed when set lowest limit on lcd or unlimited when 72 is set or so?

Thank you.
 
PWM throttle (duty cycle) is so poor, why bother with that? Speed throttle is basically the same thing, and not all that useful either.

Torque or torque + speed is nearly equal on the street and trail. The only time it is different is when the wheel is off the ground.

Keep it simple, choose torque throttle and be done with it.
 
Torque and torque+speed is no way near the same. Atleast with stock kunteng. Torque +speed means you get full powet at 1/3 or even less throttle from standstill(its trying to get to set speed by full torque), but you get no power until you reach 2/3 or more at high speeds (its allready over set speed so it does not work). Even worse is that with 18fet stock kunteng you can regen from 65km/h to 10km/h on like 100meters by holding a bit of throttle because torque+speed is trying to get to the set speed by braking. May sound good for street but its not, and offroad Its even dangerous. Maybe you have to try to know what I mean.
 
And it feels the same with kelly kls controllers, only difference is it does not brake that much by throttle. All Kelly software makes their products trash.
 
I dont understand how it can work the way you say when I want 300w helping me to keep 70km/h downhill. but it doesnt matter, torque only is the way to go.

So if possible try P3-0 phase amp throttle and P3-1 battery amp throttle. Just to see the difference
 
So I think I will implement:
1. PWM duty_cycle (someone may prefer BUT is also important for development and debug purposes)
2. torque/current control
3. torque/current control + speed

And I think I will make this options as ifdefs, meaning the options will be selected when building the firmware.

honya96 said:
So if possible try P3-0 phase amp throttle and P3-1 battery amp throttle. Just to see the difference
For now I can't read phase amps and I think firmware original also don't do it.

honya96 said:
Few questions
1. As I understand you can use only 1 or 0 because of the display firmware, will you also modify it in future?
2. With current firmware can you do unlimited max speed when set lowest limit on lcd or unlimited when 72 is set or so?
1. I will not develop the display firmware, I would develop instead an Android app as it would have all the flexibility needed
2. Sure, I don't see why it wouldn't be possible. On current firmware, that value is used for the speed controller meaning if you are using only the current/torque controller, that max speed from LCD don't take effect.
 
casainho said:
For now I can't read phase amps and I think firmware original also don't do it.
??? We read phase B current already, but we just use it for simplified FOC.
But I agree with @honya96, I would like to know the difference in bike behaviour.
The difference between battery current and phase current is discussed often, but I have not seen any comparing measurements yet...

regards
stancecoke
 
At low speed battery current gets multiplied many times by the stepdown in voltage, so low speed control is less precise with battery current control. At a small fraction of full battery current the motor current maxes out and the rest of the throttle rotation is wasted. Motor current control is torque control, and that gives the most predictable response and full range of the throttle mechanism can be used.
 
Of course I know this theoretical interdependencies. But I've never seen real measurements of battery current and phase current vs. rpm and mechanical load for a BLDC.

regards
stancecoke
 
Yes, but the mathematical model behind this just says, that I bat = dutycycle * I mot. But the reality is not that simple.
I played around with LTspice a little.

regards
stancecoke

LTspice_battery_and_motor_current.JPG
 
usertogo said:
So I wonder is this a controller that can be used with some alternative firmware?
Go ahead and investigate if the microcontroller is the same as also the schematic. On the project page you can find the links to buy controllers to where this firmware runs.
 
About throotle/PAS, torque sensor and motor control with motor current/torque + speed

I improved the PAS code, as stancecoke did mention, to count the both ON and OFF time of PAS signal and this way know when the pedals are rotating backwards and zeroing the cadence on that case -- the following part of the code runs every PWM cycle:


And the slow loop code that calcs PAS cadence (every 100ms):


Now the ebike_app_controller () calls the function for throotle and PAS or torque sensor. Firmware need to be build with one of that both options:


And the logic for throotle and PAS is:
1. cadence is mapped from 0 to 255, where 255 is the PAS_MAX_CADENCE_RPM
2. throttle is also mapped from 0 to 255
3. the max value of both throotle and PAS is used and multiplied by (1/5) * LCD assist level
4. now the value is mapped from 0 up to motor controller max current and is applied to the motor current controller
5. if LCD P3 = 1, the same value is also mapped from 0 to LCD max wheel speed and is applied to the motor speed controller, else, the motor speed controller is configured with the LCD max wheel speed



The torque sensor have the same logic, with LCD P3 also configuring the option to have motor current controller/torque or motor current controller/torque + speed.
But there is also a ifdef to choose to use human power or simple torque signal: EBIKE_THROTTLE_TYPE_TORQUE_SENSOR_NO_HUMAN_POWER

The bad news is that I didn't test the code... but I tested most of this code before, in parts. Stancecoke, can you please help testing?
 
a) Very non-linear reaction to throttle changes with a huge step in motor output at one point. The voltage output from the thumb throttle itself is correctly linear.

....with the stock firmware I have since discovered this throttle 'surge' only happens when riding with PAS and some throttle is added to increase assist. When throttle is used alone motor response is correct, it would seem that the stock firmware implementation of this PAS/throttle combination is not good.

It will be interesting to see if your code does this better, maybe this situation is worth adding to your testing.... :wink:
 
casainho said:
About throotle/PAS, torque sensor and motor control with motor current/torque + speed
So still you have not implemented the classical "torque-simulation" mode, see the picture in the old post on page 20.

casainho said:
The bad news is that I didn't test the code... but I tested most of this code before, in parts. Stancecoke, can you please help testing?
I don't have a simple PAS that has this assymetrical output. So I can't test if the direction detection works, sorry.

Have you put all the #defines into the config.h? Then perhaps it's time to update the Java-Tool of the master branch.

regards
stancecoke
 
stancecoke said:
casainho said:
About throotle/PAS, torque sensor and motor control with motor current/torque + speed
So still you have not implemented the classical "torque-simulation" mode, see the picture in the old post on page 20.

file.php

I just put this graph and your notes, on the project notes files as this is important to understand the "torque-simulation" mode.

Here is the code:



Let's consider throttle is not connect (ui8_throttle_value_filtered will be zero).
1. PAS cadence is mapped from 0 to 255, where 255 is the PAS_MAX_CADENCE_RPM
Seems that on your image, PAS_MAX_CADENCE_RPM = 45
2. the max value of both throotle and PAS is used, in this case, PAS cadence is the only one that will have effect
3. is multiplied by (1/5) * LCD assist level (at max level 5, the output will be max of 255)
4. now the value is mapped from 0 up to motor controller max current and is applied to the motor current controller (with LCD assist level of 5, this will represent the top line of your graphic; with level 1, the bottom line of the graph)
5. if LCD P3 = 1, the same value is also mapped from 0 to LCD max wheel speed and is applied to the motor speed controller, else, the motor speed controller is configured with the LCD max wheel speed

The extra here is P3 = 0, were with above all of that, will also set different wheel speed with the same logic as the motor current.

What do you think?

stancecoke said:
I don't have a simple PAS that has this assymetrical output. So I can't test if the direction detection works, sorry.

Have you put all the #defines into the config.h? Then perhaps it's time to update the Java-Tool of the master branch.
So I think we should consider it works until someone tries and say it is not working :)
Maybe I will test it later, as I have one of that PAS.

I didn't put any the #define in config.h. I am not working yet on there and on the Java tool. Can you do that? -- but see if there is any advantage to do that right now, as I could understand, maybe you are the only one using that tool for now. I prefer to do it manually as I need to know very well which options I am selecting and see the source code being disabled/enable when I change that options.

But if you test and agree with the throotle/PAS and torque sensor control schemes, I think they should not change much and will keep that #define options. So will be a good investment to add to Java tool.

I want to put all my ebikes with torque sensor, I have 3 ebikes and 2 torque sensor installed, I just need to buy another one.
This torque sensor detects torque when press the pedals to the ground, my small soon can cheat the system like that. With human power enable it is ok as depends on the cadence but I would like to have motor assist without need to pedaling at startup. Maybe I can implement the walk speed limit of 6km/h when cadence = 0.
 
Just sharing some interesting stuff:

Seat tube controller
http://www.szktdz.com/en/news_show.php?article_id=550

Overpriced Kunteng with current based "3speed switch" on stock firmware? (I would like to have 1st speed 25km/h 1000w, second 50% battery,phase? current, third 100%)

http://e4bike.ru/collection/kontrollery/product/sinusnyy-kontroller-s-tokovym-upravleniem-e4bike-mark-ii?lang=en

Attached screenshots are the best deal I found to get 4kw at 14s 52v nominal 70km/h+ topspeed. lcd3 or 6 included. Duty free shipping and you can add more things without much increase in shipping price. www.Risunmotor.com
Hope its interesting for someone
 

Attachments

  • Screenshot_2017-12-09-16-41-01.png
    Screenshot_2017-12-09-16-41-01.png
    199.1 KB · Views: 2,662
  • 20171209_165434.png
    20171209_165434.png
    141.1 KB · Views: 2,662
casainho said:
1. PAS cadence is mapped from 0 to 255, where 255 is the PAS_MAX_CADENCE_RPM
Seems that on your image, PAS_MAX_CADENCE_RPM = 45
OK, now I see, the mapping function does the limitation and you set the max cadence to a very high value that is not reached at relaxed cycling. I think the limit should be much lower, even the 45 rpm may be too high. The ramp just should give a smooth start up, but then the motor-torque should stay constant and you can adjust the speed with your human power. That's the origin idea of the "torque-simulation" mode.
Perhaps we should give the user the possibility to set the steps of the PAS levels by himself, e.g.
Level 1 = 0%
Level 2 = 10%
Level 3 = 20%
Level 4 = 50%
Level 5 = 100%

See the torque simulation branch.

regards
stancecoke
 
Back
Top