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

Electric Motors and Controllers
fratto   10 µW

10 µW
Posts: 5
Joined: Jan 17 2020 2:18am

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

Post by fratto » Jan 17 2020 3:06am

Hi, I'm new in the forum.

Congratulations for all the people involved in developing this great FOS Firmware project !!! :bigthumb:
I've been reading and learning all that I could from these web sites:

https://opensourceebikefirmware.bitbucket.io/
https://github.com/hurzhurz/tsdz2/
https://www.eco-ebike.com/collections/t ... f-products

But still have some doubts so I've finally decided to write on this thread , asking for your advice:

- First of all, I've read it here but still don't quite get it:
What is the way to disable simplified FOC in the code, in order to load FOS firmware on a KT ZWS controller ?

- Second and last :
Is it possible ( using FOS firmware ) to set "max speed limit" as low as 6 km/h ( walking speed ) ?
( because now using stock firmware on my KT48ZWS controller and KT LCD3 display, it only lets me set it as low as 10km/h )

Your help will be much appreciated,
Regards and thanks in advande for any comments! :)

User avatar
stancecoke   100 kW

100 kW
Posts: 1162
Joined: Aug 02 2017 2:56pm

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

Post by stancecoke » Jan 17 2020 3:32am

fratto wrote:
Jan 17 2020 3:06am
I've been reading and learning all that I could from these web sites:
Then you missed the main information page :-)
https://github.com/stancecoke/BMSBatter ... mware/wiki

You can disable the simplified FOC by commenting out line 126 of the motor.c

Code: Select all

//ui8_foc_enable_flag = 1;
All other questions are self explaining with the wiki, I think.

regards
stancecoke

simpletech   100 µW

100 µW
Posts: 8
Joined: Jan 20 2020 8:26am

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

Post by simpletech » Jan 20 2020 8:49am

Hi,

Does anyone else on the thread tried to use a KT-LCD1 display with this firmware? I flashed the firmware on a KT48ZWS controller, but the display shows nothing apart from the assist level. The battery indicator is showing as empty and all numbered fields shows zeroes.

The controller is responding to throttle commands (wheel turns), but the display is not showing any data.

I've selected KT-LCD3 as the display on the Java configuration tool.

User avatar
stancecoke   100 kW

100 kW
Posts: 1162
Joined: Aug 02 2017 2:56pm

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

Post by stancecoke » Jan 20 2020 10:54am

simpletech wrote:
Jan 20 2020 8:49am
..tried to use a KT-LCD1 display ... I've selected KT-LCD3 as the display on the Java configuration tool.
I don't know the communication protocol of the KT-LCD1. I guess it "speaks" a different protocol, as it only knows the P-parameters. Can you log the bytes sent by the display with a USB-TLL converter? (Hex values, logged with hterm e.g.)

regards
stancecoke

User avatar
Valopallo   10 W

10 W
Posts: 74
Joined: May 29 2018 1:37pm

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

Post by Valopallo » Jan 20 2020 4:12pm

I'm working my AWD setup. Both motors are using OSEC with S06S controllers and sharing a 36V/20A BMS battery. 7A front geared hub motor/ 12A rear DD motor. Can someone confirm that these parameters are ok to flash;

Front motor S06S
Battery current max = 70 (as for 7A when battery current cal. a value = 100)
Phase current max = 140 (as for 14A when battery current cal. a value = 100)
Battery current cal. a = 100

Rear motor S06S
Battery current max = 120 (as for 12A when battery current cal. a = 100)
Phase current max = 240 (as for 24A when battery current cal. a = 100)
Battery current cal. a = 100

From wiki:
Battery Current cal a: Factor a in the calibration function. 1A = a/10 * ADC value. Required for internal calculation of the current from the 10bit ADC value. For a 6FET and 12FET controller the value has to be something around 100, for the 18FET about 50.
Has anyone calculated the exact value here or is 100 close enough value to work with S06S?
BluOSEC@36V|AWD|2xS06S|15A rear DD|10A front geared|Hardtail|Tunturi

simpletech   100 µW

100 µW
Posts: 8
Joined: Jan 20 2020 8:26am

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

Post by simpletech » Jan 20 2020 9:23pm

stancecoke wrote:
Jan 20 2020 10:54am
Can you log the bytes sent by the display with a USB-TLL converter? (Hex values, logged with hterm e.g.)
Hi,

Here's the hterm log file with the bytes sent by the display (hex values). Used 9600 as baud rate.

EDIT: I was able to get some different patterns when changing assist levels on the display:

0C00E557299B0E - Assist lvl 0
0C01E557299A0E - Assist lvl 1
0C02E55729990E - Assist lvl 2
0C03E55729980E - Assist lvl 3
0C04E557299F0E - Assist lvl 4
0C05E557299E0E - Assist lvl 5

Apparently the 2nd byte sends the Assist level to the controller.
Attachments
output_2020-01-20_22-56-56.log
(2.13 KiB) Downloaded 36 times

User avatar
stancecoke   100 kW

100 kW
Posts: 1162
Joined: Aug 02 2017 2:56pm

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

Post by stancecoke » Jan 21 2020 4:38am

Valopallo wrote:
Jan 20 2020 4:12pm
Has anyone calculated the exact value here or is 100 close enough value to work with S06S?
You have to verify the battery current with a ammeter. The calibration factor may vary slightly from controller to controller due to resistance-tolerances of the shunt and the feedback-resistor of the opamp.
I think the "100" is exact enough for your purpose.

simpletech wrote:
Jan 20 2020 9:23pm
I was able to get some different patterns when changing assist levels on the display:
0C 00 E5 57 29 9B 0E - Assist lvl 0
So this protocol is different to the LCD3 protocol.

You would have to listen to the "answer" of the controller with the stock firmware and implement the protocol in the open source firmware.

It's much easier to buy an already supported display. :-)

regards
stancecoke

User avatar
Valopallo   10 W

10 W
Posts: 74
Joined: May 29 2018 1:37pm

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

Post by Valopallo » Jan 21 2020 5:24pm

Front motor S06S
Battery current max = 70 (as for 7A when battery current cal. a value = 100)
Phase current max = 140 (as for 14A when battery current cal. a value = 100)
Battery current cal. a = 100
Voltage calib = 50
Undervoltage limit = 164

Whenever I plug in the Hall sensors the 5V rail drops to 4.20V and motor doesn't respond to throttle. Tested from throttle also and it's the same 4.20V. The s06s is brand new. Motor has had a hall sensor burn before. Recently I changed all the HALL sensors. The sensor type I'm using is A3144E. Sensors work as they should, but they get only 4.20V when powered by the controller. I have tested them with external 5V power supply plugged and rotated the wheel to confirm switching from 0 to 5V properly. I've also tested the windings in case of shorts by grounding them to each other and rotating the wheel. Everything seems to be ok. No continuity to axle either. What could cause this?
BluOSEC@36V|AWD|2xS06S|15A rear DD|10A front geared|Hardtail|Tunturi

User avatar
stancecoke   100 kW

100 kW
Posts: 1162
Joined: Aug 02 2017 2:56pm

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

Post by stancecoke » Jan 22 2020 3:09am

Valopallo wrote:
Jan 21 2020 5:24pm
What could cause this?
Hm, can you check the value of the big resistor next to the LM317? There are several reports about trouble with the voltage supply lately.

Image

In the schematic the value is 82 Ohm.

regards
stancecoke

User avatar
Valopallo   10 W

10 W
Posts: 74
Joined: May 29 2018 1:37pm

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

Post by Valopallo » Jan 22 2020 8:01am

stancecoke wrote:
Jan 22 2020 3:09am
Hm, can you check the value of the big resistor next to the LM317? There are several reports about trouble with the voltage supply lately.
Yes, I can confirm that it's 82ohms

Oh btw, I flashed with display type: BluOSEC app(for the future) but I don't have bluetooth transmitter plugged in yet. Should I flash again with display type:none for this testing purpose? Does it matter?
BluOSEC@36V|AWD|2xS06S|15A rear DD|10A front geared|Hardtail|Tunturi

simpletech   100 µW

100 µW
Posts: 8
Joined: Jan 20 2020 8:26am

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

Post by simpletech » Jan 22 2020 10:17am

stancecoke wrote:
Jan 21 2020 4:38am
So this protocol is different to the LCD3 protocol...
Right, it's roughly the same encoding when the display talks to the controller (first 6 bytes have the same function). I'll check what the controller sends to this display when I grab one with the original firmware to compare with the controller-to-lcd documentation on the link you sent, maybe it's not too hard to adapt the code for it. Anyway, thanks for the information.

User avatar
stancecoke   100 kW

100 kW
Posts: 1162
Joined: Aug 02 2017 2:56pm

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

Post by stancecoke » Jan 22 2020 1:08pm

Valopallo wrote:
Jan 22 2020 8:01am
I flashed with display type: BluOSEC app(for the future) but I don't have bluetooth transmitter plugged in yet. Should I flash again with display type:none for this testing purpose? Does it matter?
It's much better to test with BluOsec or Debugging-Mode, as you can read the controller state via UART then. Without this information you are poking around in the dark.

regards
stancecoke

transposon   10 W

10 W
Posts: 94
Joined: Nov 24 2011 4:37pm
Location: Massachusetts

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

Post by transposon » Jan 24 2020 6:08pm

I was thinking of flashing the firmware onto this controller: KT48ZWSRLT-LCD 48V controller with LCD5. Any idea if this controller would work? I think it may be the kind without phase current sensing, but I am not sure.

Thanks!

User avatar
Valopallo   10 W

10 W
Posts: 74
Joined: May 29 2018 1:37pm

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

Post by Valopallo » Jan 25 2020 4:14am

stancecoke wrote:
Jan 22 2020 1:08pm
Valopallo wrote:
Jan 22 2020 8:01am
I flashed with display type: BluOSEC app(for the future) but I don't have bluetooth transmitter plugged in yet. Should I flash again with display type:none for this testing purpose? Does it matter?
It's much better to test with BluOsec or Debugging-Mode, as you can read the controller state via UART then. Without this information you are poking around in the dark.

regards
stancecoke
Plugged the bluetooth in but bluOSEC doesn't read anything. Bluetooth module is tested and used. State = 0|-1. I'm starting to think there was a short somewhere and it broke the controller. Vin of the controller gives out 3.8V.
BluOSEC@36V|AWD|2xS06S|15A rear DD|10A front geared|Hardtail|Tunturi

User avatar
stancecoke   100 kW

100 kW
Posts: 1162
Joined: Aug 02 2017 2:56pm

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

Post by stancecoke » Jan 25 2020 7:06am

Valopallo wrote:
Jan 25 2020 4:14am
I'm starting to think there was a short somewhere and it broke the controller. Vin of the controller gives out 3.8V.
Hm, what do you mean with Vin?
Have you read the wiki carefully?
https://github.com/stancecoke/BMSBatter ... ndroid-App

If you connect the battery and short red to blue at the display connector, the voltage between the red and the black wire of the PAS connector has to be app. 4.7V. The same on the throttle connector.

Image

If not, there's something wrong with the power supply LM417 and/or LM7895.

regards
stancecoke

User avatar
Valopallo   10 W

10 W
Posts: 74
Joined: May 29 2018 1:37pm

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

Post by Valopallo » Jan 26 2020 4:14am

stancecoke wrote:
Jan 25 2020 7:06am
Hm, what do you mean with Vin?
Just a voltage measurement from the controller power cables, when battery is not connected to those. Probably irrelevant. Charged caps, right?
stancecoke wrote:
Jan 25 2020 7:06am
If you connect the battery and short red to blue at the display connector, the voltage between the red and the black wire of the PAS connector has to be app. 4.7V. The same on the throttle connector.
Measured 4.5V at the PAS and also 4.5V at the throttle.
What next? I'm out of options what to do to locate the problem and if there's something else I can do to save this controller. I have a spare zws -type controller which had a mosfet burn, to take parts from if needed.
BluOSEC@36V|AWD|2xS06S|15A rear DD|10A front geared|Hardtail|Tunturi

simpletech   100 µW

100 µW
Posts: 8
Joined: Jan 20 2020 8:26am

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

Post by simpletech » Jan 26 2020 9:13pm

Valopallo wrote:
Jan 26 2020 4:14am
Measured 4.5V at the PAS and also 4.5V at the throttle.
What next?
Hi,

Just my opinion about the issue, from what I know about this type of motor controller. Normally the throttle VCC pin is a little lower than 5v because there's a diode in series with the 5V rail that feeds that pin:
s06 throttle circuit.png
s06 throttle circuit.png (8.77 KiB) Viewed 1624 times
Use the 5V Hall sensor pin (red wire) to check the voltage of the rail without the diode drop.

If the voltage on the Hall sensor 5V wire is still low: In one of your posts, you said that whenever you plug in the Hall sensors the 5V rail drops. Have you tried to use the BlueOSEC app without the hall sensors connected? Just to check if it connects and sends any info. If the app works with unplugged Hall sensor wires, the problem is either on the circuit that creates the 5V rail (the 78L05 IC), or the new sensors that you replaced on the motor are pulling too much current (the 78L05 has a current limit of 100mA).

User avatar
Valopallo   10 W

10 W
Posts: 74
Joined: May 29 2018 1:37pm

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

Post by Valopallo » Jan 27 2020 2:21am

simpletech wrote:
Jan 26 2020 9:13pm
Have you tried to use the BlueOSEC app without the hall sensors connected?
I have. No difference whatsoever. Blu OSEC doesn't read anything. The hall sensor output is 25mA if that's relevant https://components101.com/a3144-hall-effect-sensor.
BluOSEC@36V|AWD|2xS06S|15A rear DD|10A front geared|Hardtail|Tunturi

simpletech   100 µW

100 µW
Posts: 8
Joined: Jan 20 2020 8:26am

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

Post by simpletech » Jan 27 2020 8:49am

transposon wrote:
Jan 24 2020 6:08pm
I was thinking of flashing the firmware onto this controller: KT48ZWSRLT-LCD 48V controller with LCD5...
Hi,

According to the documentation, the KT-LCD5 is supported (it will show info on the screen), but as far as I know only the assist level, speed limit and lights on/off are configurable through the display on the custom firmware. The P and C parameters have to be preset using the equivalent configuration options on the Java configuration tool. If you don't need to change the parameters constantly, I don't see a problem with that.
Valopallo wrote:
Jan 27 2020 2:21am
I have. No difference whatsoever. Blu OSEC doesn't read anything.
What's the reading of the 5V rail with the Hall sensors disconnected? Is it near 5V?

Also, thinking outside the 5V rail problem, check if you enabled the "Torquesensor" option in the GUI, it's enabled by default. In my tests, this option disables the motor to turn on by only using the throttle.

User avatar
Valopallo   10 W

10 W
Posts: 74
Joined: May 29 2018 1:37pm

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

Post by Valopallo » Jan 27 2020 9:20am

simpletech wrote:
Jan 27 2020 8:49am
What's the reading of the 5V rail with the Hall sensors disconnected? Is it near 5V?
It's 4.5V without sensors connected and with sensors it drops to 4.2V.
BluOSEC@36V|AWD|2xS06S|15A rear DD|10A front geared|Hardtail|Tunturi

simpletech   100 µW

100 µW
Posts: 8
Joined: Jan 20 2020 8:26am

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

Post by simpletech » Jan 27 2020 11:18am

Valopallo wrote:
Jan 27 2020 9:20am
It's 4.5V without sensors connected and with sensors it drops to 4.2V.
Well, then I suggest you checking the 78L05 IC in a separate circuit, if possible, to check if the chip can generate the 5V properly.

User avatar
Valopallo   10 W

10 W
Posts: 74
Joined: May 29 2018 1:37pm

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

Post by Valopallo » Jan 27 2020 12:23pm

simpletech wrote:
Jan 27 2020 11:18am
Valopallo wrote:
Jan 27 2020 9:20am
It's 4.5V without sensors connected and with sensors it drops to 4.2V.
Well, then I suggest you checking the 78L05 IC in a separate circuit, if possible, to check if the chip can generate the 5V properly.
Did this soldering extended legs to pcb and used external 12V input. The output pin gave 4.99V so the chip seems to be fine.
BluOSEC@36V|AWD|2xS06S|15A rear DD|10A front geared|Hardtail|Tunturi

simpletech   100 µW

100 µW
Posts: 8
Joined: Jan 20 2020 8:26am

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

Post by simpletech » Jan 27 2020 12:38pm

Valopallo wrote:
Jan 27 2020 12:23pm
Did this soldering extended legs to pcb and used external 12V input. The output pin gave 4.99V so the chip seems to be fine.
OK, then check if the LM317 IC is working properly by applying 20v on its Vin pin and checking if:
- The LM317 output reaches 13-15V
- The 78L05 outputs 5V properly again (in this case, it will use the LM317 output voltage to generate 5V, as designed)

You can check it in-circuit, the only thing you should do to assure your input voltage is only going to the LM317 input is desolder 1 pin of the big 82R resistor while doing the test.

User avatar
Valopallo   10 W

10 W
Posts: 74
Joined: May 29 2018 1:37pm

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

Post by Valopallo » Jan 27 2020 3:40pm

simpletech wrote:
Jan 27 2020 12:38pm
Valopallo wrote:
Jan 27 2020 12:23pm
Did this soldering extended legs to pcb and used external 12V input. The output pin gave 4.99V so the chip seems to be fine.
OK, then check if the LM317 IC is working properly by applying 20v on its Vin pin and checking if:
- The LM317 output reaches 13-15V
- The 78L05 outputs 5V properly again (in this case, it will use the LM317 output voltage to generate 5V, as designed)
Input voltage= 19.45V
The LM317 tested output 15.48V. The 78L05 tested output 5V.
BluOSEC@36V|AWD|2xS06S|15A rear DD|10A front geared|Hardtail|Tunturi

simpletech   100 µW

100 µW
Posts: 8
Joined: Jan 20 2020 8:26am

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

Post by simpletech » Jan 27 2020 4:39pm

Valopallo wrote:
Jan 27 2020 3:40pm
Input voltage= 19.45V
The LM317 tested output 15.48V. The 78L05 tested output 5V.
It seems that the power ICs are fine then. If the 82R resistor is measuring its specified value and the battery is relatively charged, then I'm afraid I don't have any other places for you to check. Something is consuming too much current to force the 5V rail lower than normal, and apparently the STM8 is not working properly (or at all, according to your posts) with this lowered voltage.

Also, have you disabled the torquesensor configuration and tried to check if at least the wheel is turning by using the throttle?

Post Reply