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

Admiralrofl said:
Has anyone else run into this problem I'm having with the torque on x4 fork>
I have all the 3 options for speed limit set to 100 but with my torque sensor, it stops assisting at 25 MPH. It just cuts the power to keep me there. Is there a hidden speed limit setting thats not present the in java tool that affects the torque sensor assist?
So what was the max speed before flashing the controller? Also what motor are you having?
 
I have a 1500w ebikeing hub motor. To be clear with throttle I can easily get up to 35-40 (don't usually do this but it can no problem). It's literally only the torque sensor pedaling that hits this 25 mph limit. I'll look into the morse code thing a bit.
 
Hi, i'm running a Sempu T2.3 with a Bafang G310 Hub motor on the MASTER branch. Torque sensing mode appears to be working okay - I haven't ridden the bike yet, however if I grab pedals with hands and apply pressure to the cranks, while rotating, the motor puts out more power with more pressure, and less power with less pressure. Makes sense to me.

However, I have a problem when I have pressure on the pedals, but don't rotate them (eg. a trackstand) the motor ever so slightly turns. It's nowhere near as much power as when I'm spinning the pedals and the PAS sensor is working, but it is still there. I understand this is how the Sempu T2 works (detects strain across the spindle, regardless of direction/rotation) however I'm wondering if there is a way to configure the firmware to not apply ANY motor power if Sempu PAS is not moving?

I've set WITHOUT PAS to 0 as I thought maybe the firmware was intepreting the Sempu as regular throttle?

Attached are my current config.

Also wondering if the Torque from X4 Branch might be better suited (I'm not using it as I don't need a hand throttle, so I didn't want to worry about adding the X4 wire if I could help it)

sempy.png
 
Major Clod said:
However, I have a problem when I have pressure on the pedals, but don't rotate them (eg. a trackstand) the motor ever so slightly turns. It's nowhere near as much power as when I'm spinning the pedals and the PAS sensor is working, but it is still there.

Okay following up my question, I did some digging into the code and found this line in the updateRequestedTorque() function in ACAcommons,c

Code:
ui16_momentary_throttle = (uint16_t) map(ui8_adc_read_throttle(), ADC_THROTTLE_MIN_VALUE, ADC_THROTTLE_MAX_VALUE, 0, SETPOINT_MAX_VALUE); //read in recent throttle value for throttle override

Not 100% clear what the intent of "Momentary throttle", I'm assuming this is actually the logic to obtain the current thumb throttle value so it can be applied later in the code?

Either way, commenting this line out seems to solve my problem. No more trackstand based power, only power when cranks are turning and it feels proportional to the force put into the cranks.
 
Major Clod said:
commenting this line out seems to solve my problem

your throttle min value is simply too (edit) low. ui16_momentary_throttle is for the throttle override function. The code checks, which value is higher, the direct throttle reading, or human power * assistance level.
https://github.com/stancecoke/BMSBattery_S_controllers_firmware/blob/442f9152ea632542cdaf9870063e05f79928cae2/ACAsetPoint.c#L256

szkuba said:
Any thougths? or i am completely wrong?
This function resets the torque array slowly, to avoid a high power peak after a longer standstill of the pedals in the master.
https://github.com/stancecoke/BMSBattery_S_controllers_firmware/blob/442f9152ea632542cdaf9870063e05f79928cae2/ACAcommons.c#L219
The X4 branch hasn't this feature.

You are comparing different parts of the code...


regards
stancecoke
 
stancecoke said:
Major Clod said:
commenting this line out seems to solve my problem

your throttle min value is simply too high. ui16_momentary_throttle is for the throttle override function. The code checks, which value is higher, the direct throttle reading, or human power * assistance level.

I don't agree re min being too high. I'm using a torque sensor wired to throttle signal as recommended much earlier in this thread. So my throttle min needs to be set at ~1.6v, as my torque sensor is always putting out ~1.55v at rest, scaling up to ~3.0v at full pressure on cranks.

If throttle min is any lower, the code above would be constantly thinking I always have some throttle engaged regardless of cranks moving or not, and as a result wheel would always be turning.

If my torque sensor was smart enough to only output more than 1.5v only when the cranks were being rotated, this wouldn't be an issue. Perhaps the Sempu t4 with it's different strain gauge layout does this (I think its strain gauge only detects rotational input?). However, the Sempu T2 I'm using detects any sort of stress across the spindle, hence why a trackstand is interpreted as throttle.

Perhaps I should be looking at the Torque from X4 branch, where I assume the torque sensor logic *should* be more separated from the throttle logic due to them using completely different inputs.
 
You are right, of course :)
Just set throttle min a little higher, then you don't have to comment out that momentary throttle line.
If you don't like that override function, you can keep it commented out. I don't like it at all :wink:

Major Clod said:
However, the Sempu T2 I'm using detects any sort of stress across the spindle, hence why a trackstand is interpreted as throttle
Are you aware, that the crank has to be mounted in the right position referencing the marking on the spindle?

regards
stancecoke
 
If throttle min is any lower, the code above would be constantly thinking I always have some throttle engaged regardless of cranks moving or not, and as a result wheel would always be turning.

If my torque sensor was smart enough to only output more than 1.5v only when the cranks were being rotated, this wouldn't be an issue. Perhaps the Sempu t4 with it's different strain gauge layout does this (I think its strain gauge only detects rotational input?). However, the Sempu T2 I'm using detects any sort of stress across the spindle, hence why a trackstand is interpreted as throttle.

Ok, now I remember wrestling with just this issue trying to use a T2 type sensor with a combined throttle on the Master branch. The problem I found was (as you state) that the T2 creates drive with any weight on the pedals, but if you configure the firmware to only drive with PAS input you lose the ability to throttle away from a standstill which for me was its main use.

At the time the 'Torque X4' branch wasn't available so I got round the issue by switching to the T4 type torquesensor which worked just fine with this setup, but of course this means more expense and work

I think you'll have to bite the bullet and switch to the 'Torque X4' branch. This branch (I'm fairly sure..) is configured so it only drives on tqsr input when PAS pulses are present, so theoretically should be ok with the T2 type tqsr.
 
stancecoke said:
szkuba said:
Any thougths? or i am completely wrong?
This function resets the torque array slowly, to avoid a high power peak after a longer standstill of the pedals in the master.
https://github.com/stancecoke/BMSBattery_S_controllers_firmware/blob/442f9152ea632542cdaf9870063e05f79928cae2/ACAcommons.c#L219
The X4 branch hasn't this feature.

You are comparing different parts of the code...


regards
stancecoke
thanks for confirmation, discovered the same after digging into code after several days ;) but hopefully the time is gained for my education :)
 
Good day to everyone! Is there anyone who's able to help me understand abit more about this firmware before I embark on it? I've read the entire wiki as well as majority of this forum but I'm still unsure about some things.

I have a KT 48v 17a Sinewave controller (6 fets). With an LCD8H. V12L pas sensor. On a generic "250w" Chinese geared hub motor. Due to the design on my bicycle, I'm unable to replace the drivetrain and can only use an inefficient single speed setup. Thus, I mainly use my bicycle with "speed control mode" rather than the "imitation torque mode" on the stock firmware.

My questions are:

1.) What benefits would I get to enjoy by flashing this open sourced firmware? (Such as better motor efficiency, better mileage etc?)

2.) Would I still be able to continue using the "speed control mode" which I've become accustomed to? If so, how do I get about engaging this mode on this custom firmware?

3.) At this moment of development, I understand there's support for the LCD8 display. Would any of the settings in the display be adjustable as per stock firmware (as I've read that only a couple of the settings would still be functional on the LCD3) or would everything have to be done via Bluosec or the java tool?

I thank everyone for their time and also to the champions who developed this firmware as well as those who continue to develop it.
 
Jamesngkk said:
My questions are:

the main advantage of the this open firmware is the possibility to attach a torque sensor to the controller. This gives you a much more natural "bicycle feeling". Most commercial EBikes use this solution, Yamaha, Panasonic, Bosch.... Even in the "cheap" Bafang middrives, the torque sensor is standard now.....

If you want to use "stupid" speed levels, just stay at the stock firmware...

regards
stancecoke
 
Is it possible to make my own LCD/interface? (with an LCD connected to a separate microcontroller communicating with the motor controller via UART or something)
I've read through the wiki and it seems like I could do something like that via the diagnostics mode (https://github.com/stancecoke/BMSBattery_S_controllers_firmware/wiki/07---The-Diagnostics-Mode), but I just wanna make sure that having it on all the time doesn't interfere with the functionality of the controller and that it transmits everything I'd want on a display (so throttle, speed, whatever)
Edit: OK, I forgot about setting the PAS level, but I think I can figure that out
 
Hello Everyone!

I've bought an e-MTB with 36V sensorless (3 wire) geared hub motor and a dead lishui motor controller, so I ordered a S06P motor controller and a KT-LCD4 display as replacements.

After hooking them all up, I got the motor running, but the system was far from optimised:

-display only shows battery charge level, no other data is displayed
-controller gets out of phase on bumpy roads (especially at higher assist levels)

Therefore I decided to reprogram the controller to better suit my bike's needs. Apart from not being able to backup the original firmware (due to write protection), everything went flawlessly, as far as programming goes. But after connecting everything up (PAS, display, phase wires, battery) I cannot get the motor turning, it's not getting any power... I even tried to hook up a simple potentiometer to the throttle but same results (I can confirm, measured 5V between black and red throttle wires and 0-5V linearly between black and green when turning the potmeter).

Am I missing something obvious?
If further information is required, just let me know please.

Thank you!
 

Attachments

  • S06P_controller.jpg
    S06P_controller.jpg
    1.1 MB · Views: 1,076
  • eng_pl_Display-KT-LCD4-36-48V-803_3.jpg
    eng_pl_Display-KT-LCD4-36-48V-803_3.jpg
    38.8 KB · Views: 1,076
  • Firmware_parameters.jpg
    Firmware_parameters.jpg
    173.9 KB · Views: 1,076
I'm using the bluOSEC app and I had a question regarding what the buttons with battery icons do (see circled in the screenshot). I understand the big arrow buttons are assist level but the battery one?

Screenshot_20220722-203206.png
 
Vazul said:
...
Am I missing something obvious?
If further information is required, just let me know please.

Thank you!

The osec only works in sensored mode.
 
roscop13 said:
I have changed the android's BluoSec battery settings to remove all battery saving optimization, but the app is still crashing as soon as the connection is established. Same on 2 different phones.
Please please if you have experienced the same and have a solution share it.

I am running the latest app on my Pixel 3. Interestingly, through all my bench testing it has worked fine.

However, when actually riding the bike, it periodically crashes or experiences very intermittent connection where the UI fails to update for many seconds at a time. Battery saving on or off it doesn't matter. Also specific app battery settings set to no optimisation at all.

Now interestingly I have managed to make it NOT crash by disconnecting my motor cable (Bafang G310). When I do this, all other telemetry (eg. Torque Sensor X4 values) stream through to the app without any issue, which was quite useful for fine tuning my X4 min/max values. However, as soon as the motor cable is plugged back in again, crash!

Wondering if there is some sort of data or bandwidth issue with the extra motor info streaming through, vs not?
 
Vbruun said:
This a known bug. Use the Andrea104 branch or torque from x4

Interesting, I'm currently on the latest code (sept 2020) from Torque from X4 and still experiencing it... I'll have a look at Andrea104
 
Vbruun said:
Hmm, thats not good. The Foxes are the same in both branches.

Yep, confirming it's happening across both branches. Did a fresh checkout and flash of firmware with the only changes being my x4 min & max values, still crashes when motor is connected. I should have a few older android phones around, I'll try to find and test those.
 
I've had problems with bad power supply for the bt unit. What power supply are you using?
 
Back
Top