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

Valopallo said:
It connects and sends numbers:
1, 0, 0, 323, 0, 0


OK, that looks like normal operation.

Code:
printf("%u,%u, %u, %u, %u, %u\r\n", ui16_control_state, ui16_setpoint, ui16_motor_speed_erps, ui16_BatteryCurrent, ui16_sum_torque, ui16_momentary_throttle);

Are the values changing when you push the throttle?

You can put in (uint16_t) uint32_current_target instead of ui16_sum_torque (line 193 of the main.c), to see if the controller gets the command to produce power.

Are you sure, that you plugged the throttle to the right connector? The throttle singal line should have 0V if unconnected, and the adc shows 0 for the throttle channel (last number)...

regards
stancecoke
 
stancecoke said:
Valopallo said:
It connects and sends numbers:
1, 0, 0, 323, 0, 0


OK, that looks like normal operation.

Code:
printf("%u,%u, %u, %u, %u, %u\r\n", ui16_control_state, ui16_setpoint, ui16_motor_speed_erps, ui16_BatteryCurrent, ui16_sum_torque, ui16_momentary_throttle);


You can put in (uint16_t) uint32_current_target instead of ui16_sum_torque (line 193 of the main.c), to see if the controller gets the command to produce power.

Like this? (line 193)
Code:
printf("%u,%u, %u, %u, %u, %u\r\n", ui16_control_state, ui16_setpoint, ui16_motor_speed_erps, ui16_BatteryCurrent, (uint16_t) uint32_current_target, ui16_momentary_throttle);

Are you sure, that you plugged the throttle to the right connector? The throttle singal line should have 0V if unconnected, and the adc shows 0 for the throttle channel (last number)...

Oh, the throttle wasn't connected. Only the bluetooth module and battery were. I plug everything to the controller and try again with this main.c line edit.
 
This is the effect of the throttle. The motor moved a little the first time I pressed throttle.
 

Attachments

  • Screenshot_20200128-195005.png
    Screenshot_20200128-195005.png
    167.9 KB · Views: 2,263
Valopallo said:
This is the effect of the throttle.
Very good! So nothing's wrong with the controller :)
We have to check the hallsensor-signals next.

Put in GPIO_ReadInputData(HALL_SENSORS__PORT) & (HALL_SENSORS_MASK) instead of ui16_setpoint now. Then turn the motor shaft slowly by hand. The signal sequence has to be 4-6-2-3-1-5. If you have to turn the motor backwards due to a freewheel, the order is vice versa of course. If the sequence is OK, you have to find the right motor specific angle.
The meaning of the first value (ui16_control_state) can be decrypted as described here.

regards
stancecoke
 
stancecoke said:
If the sequence is OK, you have to find the right motor specific angle.
Sequence is ok. So I just have to try different motor specific angle parameters and see what works?
 
Valopallo said:
So I just have to try different motor specific angle parameters and see what works?

Yes, try to add/substract 64 to/from your recent value (64 is 90 degree as 256 is 360 degree)
Or just increase/decrease in steps of 15 and check what happens...

regards
stancecoke
 
stancecoke said:
Valopallo said:
So I just have to try different motor specific angle parameters and see what works?

Yes, try to add/substract 64 to/from your recent value (64 is 90 degree as 256 is 360 degree)
Or just increase/decrease in steps of 15 and check what happens...

:bolt: And so it happens that everything works! :bolt: Even the BluOSEC reads current and voltage. The speed is not correct and also I cannot access most of the parameters from BluOSEC(greyed out). But this is just because I don't have a wheel trued to the motor yet, I think. Does BluOSEC prevent changing parameters when there is something wrong with the flashed controller parameters? Also, I tested the motor without proper tightening to the fork, so I guess the fault might happen when the axle twists backward and the angle gets diffrerent.
 
Valopallo said:
Does BluOSEC prevent changing parameters when there is something wrong with the flashed controller parameters?

Make sure, that you use the latest BlueOSEC-version with the latest controller firmware version!
https://github.com/Xnyle/bluosec-apk

regards
stancecoke
 
Hi
J have some problem with blueosec app.
My bluetooth hc 05 it works, J try swap rx and tx but app dont receive any data. J use kt60svp and this controller reacts on settings in software.
Are you know how solve this problem?
 
Hi there,

thank you for this interesting topic.

I'm trying to build an electric fatbike with a torque sensor.
I wonder where I can get a KT controller SVP that can drive a 1000W motor.
To tell the truth, I haven't read the 152 pages of this topic.
Can anyone help me?

Have a great day.

Sylvain
 
I am not sure, but I think this one may be it?
https://www.aliexpress.com/item/33006307946.html
 
Thank you so much!!!
I've spent so much time looking for this.

I'll order one and tell you if it works.

Have a good one.

Sylvain
 
stancecoke said:
Valopallo said:
Does BluOSEC prevent changing parameters when there is something wrong with the flashed controller parameters?

Make sure, that you use the latest BlueOSEC-version with the latest controller firmware version!
https://github.com/Xnyle/bluosec-apk

regards
stancecoke

Yes, I am. My hub motor shows wrong speed. I cannot drive without offroad because the motor starts pulsating power as if when limiting speed. It shows Something like 248km/h with offroad. Also shuts the offroad mode back to normal when the load gets too much. Even though set to 10A blueosevc only shows 8.2A max when resisting the wheel with hand. Very low torgue before motor starts "jittering". Maybe my speed hall sensor is wrong type or some settings are wrong. I set gear ratio 10 because I counted 20 magnets at the hub. Is this correct? Also how does high speed motors operate? Could this be high speed motor (unknown chinese front hub motor with a 36v250w label)? My limits are 80km/h and no pas connected.
 
Valopallo said:
I set gear ratio 10 because I counted 20 magnets at the hub. Is this correct?
For a direct drive it is OK, if it's a geared motor, you have to multiply the 10 with the mecanical gear ratio.

regards
stancecoke
 
stancecoke said:
Valopallo said:
I set gear ratio 10 because I counted 20 magnets at the hub. Is this correct?
For a direct drive it is OK, if it's a geared motor, you have to multiply the 10 with the mecanical gear ratio.

regards
stancecoke

Ok, so as it seems I have 21 teeth on the drive gear and 36 teeth on each driven gears. Their ratio is 36/21=1.7. And so multiplying that with the count of the aforementioned pole pairs is 10 x 1.7= 17. Is that the right way to calculate it?
 
Valopallo said:
Ok, so as it seems I have 21 teeth on the drive gear and 36 teeth on each driven gears.

no, I guess, you have a planetary gear. So the number of teeth of the planet gears is irrelevant, important is the ratio from the sun gear to the ring gear.
150px-Epicyclic_Gearing_Stationary_Carrier.gif


regards
stancecoke
 
stancecoke said:
Valopallo said:
Ok, so as it seems I have 21 teeth on the drive gear and 36 teeth on each driven gears.

no, I guess, you have a planetary gear. So number of teeth of the planet gears is irrelevant, important is the ratio from the sun gear to the ring gear.
150px-Epicyclic_Gearing_Stationary_Carrier.gif


regards
stancecoke

Ok. I found this calculator; http://www.mekacademy.com/
It shows 93 teeth ring gear, with 21 teeth sun gear and 3 x 36 teeth planetary gears and so the calculation is: 93/21= 4.4. And multiplying that by 10 gives 4.4 x 10 = 44
Correct?
 

Attachments

  • gear_calculator.jpg
    gear_calculator.jpg
    72.8 KB · Views: 2,540
Valopallo said:
Yes, if the gear has only one stage. I guess, it has more stages, as the displayed speed is that much to high. But you can easily check it by comparing the shown speed with a speedometer.
If you have the external speedsensor set active, make sure, that the number of pulses per wheel revolution is correct.

regards
stancecoke
 
stancecoke said:
Valopallo said:
Yes, if the gear has only one stage. I guess, it has more stages, as the displayed speed is that much to high. But you can easily check it by comparing the shown speed with a speedometer.
If you have the external speedsensor set active, make sure, that the number of pulses per wheel revolution is correct.

regards
stancecoke

Before I get to open the motor plate again, I'm driving external speedsensor set as active, because then there's no "jittering"(and speedometer is accurate), if that's the right word. One thing I came across though is the voltage sag of the throttle. Seems like the rear motor starts to do all sorts of odd behaviours, for example the throttle doesn't shut the rear motor every time when braking. Apparently there's a gas leak :D I'm thinking about ways to get rid of the voltage sag. Could I just power the throttle with external +5V from for example the +5V generated by the DC-DC controller for the Bluetooth module? I actually use my bluetooth module with +6V input because there's two small 6V lights in parallel with it. I mean if I give the +5-6V from this to throttle input and share the signal output to both controllers, should I run to any problems? If this doesn't work, what other options do I have; thicker throttle wires? A second throttle with it's own input voltage and signal?
 
Valopallo said:
what other options do I have
You could remove the big resistor and feed the LM317 with 17V from an extra DC/DC converter...

regards
stancecoke

edit: fixed typo
 
Hi,
I plan to write the stancecoke/BMSBattery_S_controllers_firmware on a KT ZWS controller as my motor is sensorless.
I read the wiki and the forum but I still have some doubs, If someone can help me.

1- Concerning this notes about the ZWS controller "You can disable FOC ... but the motor will not run with best efficiency in this case. Some energy will be wasted as heat."
--> Does it mean that this firmware give worst results than the original one ?
--> I know the answer "you can try" but from a more technical point of vue ? Is there a useffull answer ? Some one has tested it for a long period ?

2 - Do I have to write the firmware on the display too ? I think that not but I read some confusings posts for me.

3 - Does the informations displayed by KT-LCD 5 et KT-LCD3 remain the same after flashing the controller ?

Thanks for the job, I hope I could help.
Christophe
 
Hello Christophe,

I'm not an expert on the matter, but your case is very similar to mine, so I can tell you my own experience :

I have installed the @Stancecoke BMSBattery_S_controllers_firmware on my KT ZWS motor controller with a KT LCD-3 display and also used it with the Android App ( developed by @Xnyle ) via Bluetooth. Now, about your questions :
1- Concerning this notes about the ZWS controller "You can disable FOC ... but the motor will not run with best efficiency in this case. Some energy will be wasted as heat."
--> Does it mean that this firmware give worst results than the original one ?
--> I know the answer "you can try" but from a more technical point of vue ? Is there a useffull answer ? Some one has tested it for a long period ?
On page 151 of this thread, you can read the reply @Stancecoke gave me about how to disable FOC in the code, before compiling and downloading the firmware to your KT ZWS ( you should also mark "disable interpolation" on the Java Configuring Tool )
This does not mean you will get worse results than using KT stock firmware ( in fact, I would say the contrary! :) ). The problem is KT ZWS , unlike the BMS S06S / KT SVP controllers, does not come with the phase current sensor, so you can not implement a FOC to get a better efficiency ( by phase angle and power factor correction ). Remember that your original KT ZWS firmware does not implement FOC or any other kind of PF correction, as it is not bundled with the necessary sensor in hardware ( you can see the place for the sensor in the PCB is empty , so you can solder it if you want to use FOC anyway: more info here )
2 - Do I have to write the firmware on the display too ? I think that not but I read some confusings posts for me.
At least in my experience, for using KT LCD-3 you dont need to change the original firmware that comes with it ( maybe you got confused with the Open Firmware for LCD-3 developed for other brand of controllers named TSDZ2 : see that project here ).
For KT controllers, you can select among 3 display options in the Java config Tool : KT-LCD3 , Kingmeter J-LCD , BlueOSEC App (not really a commercial display, but an android device instead, running the app and connected via bluetooth ).

3 - Does the informations displayed by KT-LCD 5 et KT-LCD3 remain the same after flashing the controller ?

Apparently yes... and you still use the push buttons to power on the system , active the LCD backlight and navigate throghout the menues and pages ... But in reality, after installing OSEC firmware ( and deleting original KT firmware ) the LCD-3 loses all its capabilities to set or change parameters values in the controller data memory: it mostly serves only as displaying unit ( actual speed, instant power, battery level, and not much more... ). I think you can still change assist level and wheel diameter but you can not change anything else except you connect with the Java Config Tool or the BlueOSEC App.
Offroad speed limit can be activated by a "cheat" that involves moving the brake lever in a special sequence to activate the offroad mode ( and after that , just keep pressing the brake lever for 5 seconds if you want to deactivate it).
 
Hi all,

I want to thank specially Stancecoke for helping me last time, and also my congrats to Xnyle for his BlueOSECApp , the info it gives is really great!!! :!:

Sorry for bothering again, but it seems I must ask for your help yet another time...

All went really good after replacing my original KT stock firmware and running the tests via BlueOSECApp to fine tune the parameters in Java Config Tool, till I found that... my eTricycle did not respond anymore to the "reverse" order ... :shock:

Of course, that should not be a surprise for anyone, if we agree this project is aimed mainly to ebikes ( where you dont ever want to drive your motor backwards :lol: )

In case of my electric tricycle, the "reverse march" is a must , so my KT controller came from factory bundled with that functionality.

Basically, the hardware is like this : an input connector ( with a pair of white cables ) that, when closed, gives GND to the "X8" point in my KT48ZWS PCB . After going through a resistor, the signal enters the STM8 in its 43 pin ( PD2 ).

Is there a simple way to assign that pin as an input in the code and then, if it goes low, make it invert direction of the wheel ?

I've been looking at the source code, but could not find anything related with reversing direction of rotation ( though I know that changing the phase secuence, should cause the desired effect, is that right? :confused: )-

Hope someone can guide me in doing the neccesary changes in code or give me their suggestions,
Thanks and Regards :wink:
 
Back
Top