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

racingame said:
I connected phases, hall sensor and throttle to my motor but it spins only for half a second and it stops immediately. What could it be? I tryed all possible 9 combinations of the 3 phases cables.

6 phase cable combinations 6 hall - 36 total. Is it with stock fw?
 
honya96 said:
racingame said:
I connected phases, hall sensor and throttle to my motor but it spins only for half a second and it stops immediately. What could it be? I tryed all possible 9 combinations of the 3 phases cables.

6 phase cable combinations 6 hall - 36 total. Is it with stock fw?

Ok, I found out the combination. Yes, it still has stock fw. Btw, this is STM8, not STM32 right? I guess it will be hard for someone with 0 experience about embedded programming to learn how to program one of these chips :? .
 
racingame said:
I guess it will be hard for someone with 0 experience about embedded programming to learn how to program one of these chips :? .

I suggest to start with a little development board and an electronic starter set
Then you can play around with basic i/o functions like the classic "blink" example or UART communication.

Of course it is much easier to start with a Atmel or STM32 board on the arduino platform as there are much more examples, but the approach is the same in principle. One hurdle is the makefile you have to build on your own using SDCC but you could just edit the makefile from our firmware.

There are commercial toolchains for STM8 (like Cosmic, that's free for STM8) available, but I have no experience with this.

This link gives a good entry I think.

regards
stancecoke
 
I thought I better ask some advice, just to make sure I'm not definitely buying the wrong thing :)

I have a Giant Syncdrive Hub - 36V 250W with Hall Sensors. I can't find much of anything about it, so I have no idea what it's real ratings are.

I'm going to buy an LCD5 and I've been looking at this 36V 350W Sine Wave Controller from PSWPower.

The rated power power seems rather low, at 8A. Is that something I should worry about or will it *probably* be fine?

...and the main point of asking in this thread, it's likely to work with this firmware, right?

I'm fairly certain it's right, but I'd rather not wait 5-6weeks for delivery, more than once :)
 
How do I load the S12S settings while writing the firmware? I'd like to write it for 36V10A battery.
 
racingame said:
How do I load the S12S settings while writing the firmware? I'd like to write it for 36V10A battery.
?write?

I guess that if you want to go with main branch you need older version to get it working now, then it's "easy" by Java tool.

Set 10s battery and start with setting less than half the current you want.

If you need "high speed motor" - stancecoke's branch then start by clicking link at his signature and there "alternative"

best is to read this thread a lot, back where I was trying it. There are solutions to all problems you can get I believe :lol:

Keep in mind both versions are not perfect yet and you will need to spend a lot of time with it, while still far from what I would call "writing"
 
honya96 said:
racingame said:
How do I load the S12S settings while writing the firmware? I'd like to write it for 36V10A battery.
?write?

I guess that if you want to go with main branch you need older version to get it working now, then it's "easy" by Java tool.

Set 10s battery and start with setting less than half the current you want.

If you need "high speed motor" - stancecoke's branch then start by clicking link at his signature and there "alternative"

best is to read this thread a lot, back where I was trying it. There are solutions to all problems you can get I believe :lol:

Keep in mind both versions are not perfect yet and you will need to spend a lot of time with it, while still far from what I would call "writing"
I meant in the Java executable, there is no option for the S12S while being among the 2 tested controllers for this firmware. I just wanted the defalt settings for it.
 
racingame said:
I meant in the Java executable, there is no option for the S12S while being among the 2 tested controllers for this firmware. I just wanted the defalt settings for it.

I think, just set half the current you want. Otherwise it works for all controllers as it is.

But now you can't flash by Java tool, and I think it doesn't work with throttle/pas. It's not tuned yet.

You need the older version or high-speed branch, which is hard to set.
 
honya96 said:
and I think it doesn't work with throttle/pas. It's not tuned yet.

...are you talking about the master branch here? I recently downloaded the latest github master branch and after I corrected my mistake (had Torque Sensor set in config.h... :roll: ) it seemed to work 'Throttle_PAS' pretty well, certainly useable. This is with my geared motor of course, not sure about direct drive.
 
geofft said:
honya96 said:
and I think it doesn't work with throttle/pas. It's not tuned yet.

...are you talking about the master branch here? I recently downloaded the latest github master branch and after I corrected my mistake (had Torque Sensor set in config.h... :roll: ) it seemed to work 'Throttle_PAS' pretty well, certainly useable. This is with my geared motor of course, not sure about direct drive.

Ok, that may be my mistake somewhere.. I had no reaction to throttle
 
Anyone knows if the BMSBattery torque sensor can work with Bafang BBS02 mid drive motor or any other cheap and popular mid drive motor?
 
casainho said:
Anyone knows if the BMSBattery torque sensor can work with Bafang BBS02 mid drive motor or any other cheap and popular mid drive motor?

I am pretty sure it's stock controller is only throttle/pas but a lot of people use BBSHD with external controller and torque sensor through CA v3
 
Seems that the most cheap mid drive motor, that also includes a torque sensor (unlike Bafang mid drive motors), is the Tongsheng TSDZ2 mid drive motor.
BMSBattery sells this motors as also many others online shops. There is a lot of technical information shared by users, on forums like Endless sphere here -- please see here the notes page with a repair manual, etc: https://opensourceebikefirmware.bitbucket.io/development/Motors--Tongsheng_TSDZx_mid_drive_motors.html

The motor controller seems to use the same microcontroller STM8S105C6T6 as S06S and S12S motor controllers, as seen on this youtube video. This means we should be able to develop firmware with minor efforts!!
But we can also just skip the original controller and use an S06S running our firmware. Anyway, we would need to test the original torque sensor as it may be different from the BMSBattery torque sensor.

Here a screenshot showing the microcontroller used:


[youtube]tj2aYtma64o[/youtube]
 
stancecoke said:
honya96 said:
but a lot of people use BBSHD with external controller and torque sensor through CA v3

Hm, how can you mount a commerially available torque sensor to a middrive where the crankshaft is integrated in the motor housing?!
Do you have an example/photo?

regards
stancecoke

Ok, my bad.

I just meant that CA v3 has the function, and people use CA v3.

wasnt thinking about HW compatibility...
 
casainho said:
Anyway, we would need to test the original torque sensor as it may be different from the BMSBattery torque sensor.

I've analyzed that middrive unit already 8) , see here.

You have to put a carrier frequency on the primary coil and amplify the current in the primary ciruit to get the torque signal. So it is much more elaborately to get a usable torque value from this sensor than from the BMS-Sensor....

regards
stancecoke
 
stancecoke said:
I've analyzed that middrive unit already 8) , see here.

You have to put a carrier frequency on the primary coil and amplify the current in the primary ciruit to get the torque signal. So it is much more elaborately to get a usable torque value from this sensor than from the BMS-Sensor....
GREAT!! Seems you did a LOT of work, I really appreciate.

Well, I believe the square wave on primary will "transport" energy to secondary coil and then for the circuit of torque sensor. I would say the torque sensor will change in some way the amplitude of the square wave on the primary coil... and that way would be easy to measure the signal change...

Why aren't you using that motor? what do you think about it?
 
casainho said:
I would say the torque sensor will change in some way the amplitude of the square wave on the primary coil... and that way would be easy to measure the signal change...

You can see the change of torque in the current only, see the oszillograph. The difference is just a little peak in the signal.

index.php


casainho said:
Why aren't you using that motor? what do you think about it?
I buyed it just for analysing the torque-sensor and have sold it again some time ago. I rode just very few kilometers with it. I live in a flat area, so I have no need for a middrive. I prefer a noiseless directdrive hubmotor.
I think this middrive is not suited for heavy duty in the mountains, due to plastic gearwheels. But all relevant spare parts are available easily.

regards
stancecoke
 
stancecoke said:
I buyed it just for analysing the torque-sensor and have sold it again some time ago. I rode just very few kilometers with it. I live in a flat area, so I have no need for a middrive. I prefer a noiseless directdrive hubmotor.
I think this middrive is not suited for heavy duty in the mountains, due to plastic gearwheels. But all relevant spare parts are available easily.
Ok, thanks. I don't plan to buy this motor soon, so I will keep focus on current motors and controller.

I just saw a new version of SDCC that support STM8 but unfortunately, that issue of not being able to initialize static variables inside functions, still persist :-(
 
stancecoke said:
casainho said:
Hmmm... how did you observe that??
The motor was noisy and drew much current without producing torque after a longer regen time.
I tried to improve this, I went did some test rides but I couldn't find anything wrong... like noises. Would be great if you could test this changes - on master branch now:
Code:
// read here the phase B current: FOC Id current
ui8_adc_id_current = UI8_ADC_MOTOR_PHASE_B_CURRENT;

// first, verify if motor current is positive or negative (motor or regen mode), if regen mode, we need to invert the logic for angle correction
// second, adjust ui8_angle_correction so the ui8_adc_id_current is zero (FOC principle)
if (ui8_adc_motor_current > ui8_adc_motor_current_offset)
{
  if (ui8_adc_id_current > ADC_PHASE_B_CURRENT_ZERO_AMPS_FOC_MAX) { ui8_angle_correction++; }
  else if (ui8_adc_id_current < ADC_PHASE_B_CURRENT_ZERO_AMPS_FOC_MIN) { ui8_angle_correction--; }
}
else if (ui8_adc_motor_current < ui8_adc_motor_current_offset)
{
  if (ui8_adc_id_current > ADC_PHASE_B_CURRENT_ZERO_AMPS_FOC_MAX) { ui8_angle_correction--; }
  else if (ui8_adc_id_current < ADC_PHASE_B_CURRENT_ZERO_AMPS_FOC_MIN) { ui8_angle_correction++; }
}
 
Works the recent master branch out of the box? I use the modded BMS-Torquesensor and I fear, that the direction detection will fail with the recent code....

regards
stancecoke
 
stancecoke said:
Works the recent master branch out of the box? I use the modded BMS-Torquesensor and I fear, that the direction detection will fail with the recent code....
I think I didn't changed any code about PAS and PAS direction. I am being testing only with torque sensor. I don't have now any ebike with PAS installed so I can't test.
 
?! But you have modded the Torquesensor with a "normal" PAS to use regen like coast brakes?

Code:
#define EBIKE_REGEN_EBRAKE_LIKE_COAST_BRAKES

regards
stancecoke
 
Back
Top