Sinusoidal wave brushless motor controller

General Discussion about electric vehicles.
Post Reply
fany   10 W

10 W
Posts: 70
Joined: Jun 09 2009 8:31pm

Sinusoidal wave brushless motor controller

Post by fany » Aug 06 2015 10:03pm

People complained KEB/KBS generated terrible noise at the starting-up,especially for hub motor.Because most of hub motors are based on sinusoidal waveform.But KEB/KBS is based on trapezoidal waveform control.That is why there is a noise for the combination of KEB/KBS controller and hub motor or spoked motor.
KLS controller is still supposed to work with sensored BLDC motor controller.The BLDC motor is based on three hall sensors.
Using fast SVPWM and FOC to achieve very high efficiency.
The user program is App type.
The APP software is based on Tablet with Android OS.A Z-TEK USB cable is required to do Auto_Identify function to drive the motor.Z-TEK USB cable is popular in Android OS Marketing.People can get it locally and easily.And customers complained the user program based on Win OS can not be connected well.This problem will not happen on Android OS.The updating frequency for Win OS is too fast.To be honest,we can not catch up it.

The different motors have different features and parameters.People need to do a auto_Identify to update all the related parameters in the controller to match the motor you are using.People don't have to try 36 combinations one by one to find the correct one to run the motor.

tuxadmi   1 µW

1 µW
Posts: 2
Joined: Jul 24 2015 2:59pm

Re: Sinusoidal wave brushless motor controller

Post by tuxadmi » Aug 24 2015 10:27am

I have the KLS7230S together with HT3525 in my bike.

The motor is very quiet, only the wheels on the street make noises.
With this motor and 20S LiPo 60km/h are reached very quick.

The Android APP shows infos while driving, so I tried to recive these values (Speed, voltage, current....) over the Serialport and show them on the bikecomputer.
And it works :)
k-WP_20150824_07_22_00_Pro.jpg
k-WP_20150824_07_22_00_Pro.jpg (33.9 KiB) Viewed 8049 times
There will be a housing for the computer soon :)
*edit*
Unbenannt.png
Unbenannt.png (173.31 KiB) Viewed 7955 times
k-WP_20150831_07_26_52_Pro.jpg
k-WP_20150831_07_26_52_Pro.jpg (49.74 KiB) Viewed 7955 times
*edit end*

If someone is interested in PCB layout or code I can upload it.

I am very happy with the KLS, good work Kelly ;)

User avatar
lollandster   10 W

10 W
Posts: 86
Joined: Sep 15 2012 1:50pm
Location: Norway
Contact:

Re: Sinusoidal wave brushless motor controller

Post by lollandster » Sep 13 2015 3:42am

Hi tuxadmi.
Could you share what you learned about the serial protocol used by the KLS controllers?
I took a crack at reading the serial commands, but it doesn't look like ASCII characters are used. So before I start analyzing with the oscilloscope I thought I just ask you about it. It looks like 19200 baud is used, but that's as far as I've gotten so far.
Disclaimer: I know nothing.
My ebike build blog

fany   10 W

10 W
Posts: 70
Joined: Jun 09 2009 8:31pm

Re: Sinusoidal wave brushless motor controller

Post by fany » Sep 13 2015 6:49pm

fany wrote:People complained KEB/KBS generated terrible noise at the starting-up,especially for hub motor.Because most of hub motors are based on sinusoidal waveform.But KEB/KBS is based on trapezoidal waveform control.That is why there is a noise for the combination of KEB/KBS controller and hub motor or spoked motor.
KLS controller is still supposed to work with sensored BLDC motor controller.The BLDC motor is based on three hall sensors.
Using fast SVPWM and FOC to achieve very high efficiency.
The user program is App type.
The APP software is based on Tablet with Android OS.A Z-TEK USB cable is required to do Auto_Identify function to drive the motor.Z-TEK USB cable is popular in Android OS Marketing.People can get it locally and easily.And customers complained the user program based on Win OS can not be connected well.This problem will not happen on Android OS.The updating frequency for Win OS is too fast.To be honest,we can not catch up it.

The different motors have different features and parameters.People need to do a auto_Identify to update all the related parameters in the controller to match the motor you are using.People don't have to try 36 combinations one by one to find the correct one to run the motor.
KLS controller can support PC software and Android Tablet App now.There is one more choice for customers to program the controller KLS now.

User avatar
lollandster   10 W

10 W
Posts: 86
Joined: Sep 15 2012 1:50pm
Location: Norway
Contact:

Re: Sinusoidal wave brushless motor controller

Post by lollandster » Sep 17 2015 10:59pm

The PC software does not work on my Win10 version. I get Software version does not match, please use the latest software.

I have now played a little with the RS232. It seems to be using very simple 8 bit binary strings. To make it easy the phone software lists the everything in the same order as the data is sent from the controller.
I have not played with anything other than the monitor section yet.
Sending:

Code: Select all

3A 00 3A
returns somthing like:

Code: Select all

3A 10 2D 05 00 00 00 00 01 00 00 3B 00 0E 00 00 00 00 C6
to explain I'll give the 8bit groups individual numbers:

Code: Select all

00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12
3A 10 2D 05 00 00 00 00 01 00 00 3B 00 0E 00 00 00 00 C6
00 seems to be identifying the code sent. If i call 3A 00 3A it returns 3A. If I call 3B 00 3B it returns 3B.
01 I have no idea what this is. It has always been 10 when I've tested.
02 Throttle
03 Brake pedal (not confirmed)
04 Brake switch (not confirmed)
05 Foot switch (not confirmed)
06 Forward switch (not confirmed)
07 Reverse (0 or 1)
08 Hall switch A (0 or 1)
09 Hall switch B (0 or 1)
0A Hall switch C (0 or 1)
0B B+ Voltage
0C Motor Temp (not confirmed)
0D Controller temperature (I think it is Celsius, but it is very off and low res)
0E Setting Dir (0 or 1)
0F Actual Dir (0 or 1)
10 Marked as reserved.
11 Marked as reserved.
12 I have not found out what this is. It might be a checksum.

Not confirmed means that my controller does not support the function or I have not connected the correct switch or sensor yet.

Sending:

Code: Select all

3B 00 3B
returns a similar string as 3A 00 3A
04 and 05 makes up the motor speed
07 is the phase current. I guess 06 also, but I haven't tried >255 amps to see if 06 changes.
The rest of the 3B string and the 3C string is unknown to me.
Disclaimer: I know nothing.
My ebike build blog

__Tango   1 W

1 W
Posts: 53
Joined: Sep 04 2009 11:47pm
Location: Bay Area, CA

Re: Sinusoidal wave brushless motor controller

Post by __Tango » Sep 26 2015 12:39am

Awesome. I'm about to get one of these (but the 144V/300A one. :) I'm going to be adding it to my logger as well. :D

Do you know of any other commands besides

Code: Select all

3A 00 3A
and

Code: Select all

3B 00 3B
. Also, can you post a picture of what the screens of the android and/or PC software looks like?

Thanks!

User avatar
SplinterOz   1 kW

1 kW
Posts: 496
Joined: Apr 21 2010 4:29am
Location: Canberra
Contact:

Re: Sinusoidal wave brushless motor controller

Post by SplinterOz » Sep 26 2015 4:45am

So this is the Colossus outrunner motor with the KSL-D 400amp

https://www.facebook.com/tony.castley/p ... tif_t=like
SplinterOz
In the Capital of Australia
http://rgelectric.wordpress.com

__Tango   1 W

1 W
Posts: 53
Joined: Sep 04 2009 11:47pm
Location: Bay Area, CA

Re: Sinusoidal wave brushless motor controller

Post by __Tango » Nov 01 2015 9:28am

__Tango wrote: Do you know of any other commands besides

Code: Select all

3A 00 3A
and

Code: Select all

3B 00 3B
.
To answer my own question. I sniffed the communication between the windows app and a KLS8080I, there is a third message:

Code: Select all

3C 00 3C
, but the data is all 00s.

__Tango   1 W

1 W
Posts: 53
Joined: Sep 04 2009 11:47pm
Location: Bay Area, CA

Re: Sinusoidal wave brushless motor controller

Post by __Tango » Nov 01 2015 9:29am

Has anyone been able to figure out the checksum algorithm yet?

Thanks!

__Tango   1 W

1 W
Posts: 53
Joined: Sep 04 2009 11:47pm
Location: Bay Area, CA

Re: Sinusoidal wave brushless motor controller

Post by __Tango » Nov 02 2015 7:09pm

__Tango wrote:Has anyone been able to figure out the checksum algorithm yet?
Looks like it's just the low 8 bits of the sum of the data in the binary string.

Code: Select all

3A 10 2D 05 00 00 00 00 01 00 00 3B 00 0E 00 00 00 00 C6
Add all the numbers up and it equals C6.

Here's one that ends up with a number that's larger than 1 byte:

Code: Select all

3B	10	0	0	3	C0	0	7	0	0	0	0	0	0	0	0	0	0	15
Sum them up and it's 0115. 0x115 & 0xFF is 15.

__Tango   1 W

1 W
Posts: 53
Joined: Sep 04 2009 11:47pm
Location: Bay Area, CA

Re: Sinusoidal wave brushless motor controller

Post by __Tango » Nov 06 2015 9:10am

I also think the request is not just

Code: Select all

3A 00 3A
. I think it's a two byte string with the checksum. add 3A + 00, which equals 3A.

fany   10 W

10 W
Posts: 70
Joined: Jun 09 2009 8:31pm

Re: Sinusoidal wave brushless motor controller

Post by fany » Nov 27 2015 3:27am

01050001:The 12V brake switch and motor temp sensor functions used the same port on pin1.
01050002:The 12V brake switch used the different port from motor temp sensor.pin25 is 12V brake switch while pin1 is motor temp sensor.
01060001:The 12V brake switch is pin25 while motor temp sensor is pin1.And we added the brake analog regen mode on pin2.
If the software version is below 0105,there is no frequency to be chose between 10KHz and 20KHz.The Max Output fre can not be configured also.
The lastest one 0106 version will be released next month.People can read software version for each controller in the first picture of user program.
Just let people know we added brake analog regen mode for KLS controller according to so many requests from customers.
It will be released next month.
Customers can use brake analog regen mode on the same pin2.
That is to say,the customers can not use boost function and brake analog regen mode at the same time.
There is item called Boost in the user program.When it is enabled,the pin2 will be used as boost function.
When the Boost item is not chose,the pin2 will be used as brake analog regen mode.
The software version 0106 can support this brake analog regen mode.
But it must be the new controllers.The controller KLS can not support reflashing operation.

KLS8080I is designed for the motor with common three hall sensors.
KLS8080IPS is designed for the motor with sine/cosine speed sensors.
You can find the details in configuration in KLS8080I/IPS user manual.
When speed sensor type is at 4 for linear hall sensor(sin/cosin speed sensor),you need to use KLS8080IPS controller.
For example,we can provide Mars 1115 motor with sin/cosin speed sensor.
There are +5V,GND,Sin and Cosin port from this speed sensor.
We have already provided many KLS-8080IPS and ME1115 motors for customers.

cwah   10 GW

10 GW
Posts: 4228
Joined: Jul 24 2011 5:42am
Location: Between paris and london

Re: Sinusoidal wave brushless motor controller

Post by cwah » Nov 27 2015 6:42am

Is it a help thread?

fany   10 W

10 W
Posts: 70
Joined: Jun 09 2009 8:31pm

Re: Sinusoidal wave brushless motor controller

Post by fany » Jan 30 2016 1:59am

Here is the correct operation steps for identification angle function.

It is for 8080I/IPS controller.
1,Please connect 12V-24V to pin7 and pin6.Pin7 is positive and pin6 is GND.
pin7 and pin6 is the isolated power supply for KLS-8080I/IPS controller.

2,Please connect the motor phase cables to U,V,W.Please connect hall sensors connector to the controller.

3,Please connect the batteries to B+ and B- of the controller.

4,Please connect the throttle wires to the motor controller.

5,Please connect the USB cable and 4pin connector to RS232 converter between controller and user program.

6,Please double click the KLS user program.

7,You will see the first picture of user program.

8,Please read the identification angle value.It is good if it is at 85.

9,Please fill 170 in the identification angle item.And please click the write button.Please turn off the power supply.

10,Please turn on the power supply after the power supply is off for a few seconds.The controller will send a constant beep sound.If you get a KLS-S controller,the LED will be solid on in this case.

11,Please wait about 2-3 minters.

12,If the identification is finished,the constant beep sound or solid Red LED will be disappeared.And you will see reset error in the monitor screen.

13,Please turn off the power supply again.Please wait about a few seconds to turn on the power supply again.

14,You will see 85 in the identification angle item.That is to say,the controller identification angle operation is successful.You can use the controller to drive the motor now.

15,If the constant beep sound last above 5 minters,please return the first picture of user program.Please write 85 instead by manual.
Please don't keep 170 in the identification angle item in this case.
And please turn off the power supply in this case.
Please try again from step 6.

16,Please don't keep 170 in identification angle item before power supply is turned on after the identification operation is successful.



It is for KLS-S/D controller.
1,Please connect Battery Voltage for pin7 and B+/B-.

2,Please connect the motor phase cables to U,V,W.Please connect hall sensors connector to the controller.

3,Please connect the batteries to B+ and B- of the controller.

4,Please connect the throttle wires to the motor controller.

5,Please connect the USB cable and 4pin connector to RS232 converter between controller and user program.

6,Please double click the KLS user program.

7,You will see the first picture of user program.

8,Please read the identification angle value.It is good if it is at 85.

9,Please fill 170 in the identification angle item.And please click the write button.Please turn off the power supply.

10,Please turn on the power supply after the power supply is off for a few seconds.The controller will send a constant beep sound.If you get a KLS-S controller,the LED will be solid on in this case.

11,Please wait about 2-3 minters.

12,If the identification is finished,the constant beep sound or solid Red LED will be disappeared.And you will see reset error in the monitor screen.

13,Please turn off the power supply again.Please wait about a few seconds to turn on the power supply again.

14,You will see 85 in the identification angle item.That is to say,the controller identification angle operation is successful.You can use the controller to drive the motor now.

15,If the constant beep sound last above 5 minters,please return the first picture of user program.Please write 85 instead by manual.
Please don't keep 170 in the identification angle item in this case.
And please turn off the power supply in this case.
Please try again from step 6.

16,Please don't keep 170 in identification angle item before power supply is turned on after the identification operation is successful.

snejky   10 W

10 W
Posts: 67
Joined: Jun 02 2015 11:49pm

Re: Sinusoidal wave brushless motor controller

Post by snejky » May 11 2016 7:02am

Hi. Any news about serial communication? We need realtime communication in usable form! This is real killer feature Fany. Any android prohne can be cycle analyst.

__Tango   1 W

1 W
Posts: 53
Joined: Sep 04 2009 11:47pm
Location: Bay Area, CA

Re: Sinusoidal wave brushless motor controller

Post by __Tango » May 11 2016 9:40am

snejky wrote:Hi. Any news about serial communication? We need realtime communication in usable form! This is real killer feature Fany. Any android prohne can be cycle analyst.
What type of realtime communication are you looking for?

snejky   10 W

10 W
Posts: 67
Joined: Jun 02 2015 11:49pm

Re: Sinusoidal wave brushless motor controller

Post by snejky » May 19 2016 12:56pm

Hi. Tuxadmi shows communication with microcontroller few post's before . I need something like: sent this string RS232 over Bluetooth and kelly responds this string.(voltage, phase, battery current...) I have some useful communion specs from Fany. We can share some knowledge. I'm arduino fan, so this feature is really good for all of us. Sorry for my bad English.

Matthias   1 µW

1 µW
Posts: 1
Joined: May 24 2019 6:02am

Re: Sinusoidal wave brushless motor controller

Post by Matthias » May 24 2019 6:08am

I have a KLS7218 that I want to hook up with an adruino via rs232.
Anyone who already tried this and has some example code?

jumpjack   100 W

100 W
Posts: 197
Joined: Apr 11 2011 6:16am

Re: Sinusoidal wave brushless motor controller

Post by jumpjack » Jun 13 2019 8:29am

using documentation available around and documwntation from Kelly, I was able to build this table:
Image

It summarizes all serial commands I am aware of.
I didn't start experimenting yet, anyway I'm going to do that using an ESP32 module rather than an arduino, as it has builtin wifi, bluetooth and 4MB RAM, so it should be able to perform local logging, realtime connection to smartphone over bluetooth, and remote logging over wifi using smartphone tethering.
Some ESP32 dev boards even come with sd card slot, display and battery holder.

But maybe we should move to a specific thread with a specific title.

jumpjack   100 W

100 W
Posts: 197
Joined: Apr 11 2011 6:16am

Re: Sinusoidal wave brushless motor controller

Post by jumpjack » Jun 13 2019 9:21am

I also tried decoding the error codes, I obtained this picture:
Image

This BASIC source decodes the raw data into human readable error messages (if above picture is right):

Code: Select all

Sub conv(Data9Data10)

Dim ErrorText(15)

Dim ErrorNum(15)

​

ErrorText(0) = "n/a 1"

ErrorText(1) = "Trac­tion battery over vo­ltage error"

ErrorText(2) = "Trac­tion battery low vol­tage error"

ErrorText(3) = "Cont­roller over 90°C war­ning"

ErrorText(4) = "Motor fails to start (<25 RPM in 2 sec)"

ErrorText(5) = "Trac­tion (B+), 12V (PWR) or 5V voltage fault"

ErrorText(6) = "Cont­roller over 100°C te­mperature"

ErrorText(7) = "High throttle at power up"

ErrorText(8) = "Freq­uent reset"

ErrorText(9) = "Inte­rnal reset"

ErrorText(10) = "Thr­ottle short or open circuit when using 1-4v hall sensor thro­ttle"

ErrorText(11) = "Thr­ottle isn’t zero when try to change dire­ction"

ErrorText(12) = "Tra­ction (B+) over volt­age at startup or re­generation"

ErrorText(13) = "Hall sensor signal erro­r"

ErrorText(14) = "Mot­or over temperature"

ErrorText(15) = "n/a 2"

​

ErrorNum(0) = "0x11"

ErrorNum(1) = "0x12"

ErrorNum(2) = "0x13"

ErrorNum(3) = "0x14"

ErrorNum(4) = "0x21"

ErrorNum(5) = "0x22"

ErrorNum(6) = "0x23"

ErrorNum(7) = "0x24"

ErrorNum(8) = "0x31"

ErrorNum(9) = "0x32"

ErrorNum(10) = "0x33"

ErrorNum(11) = "0x34"

ErrorNum(12) = "0x41"

ErrorNum(13) = "0x42"

ErrorNum(14) = "0x43"

ErrorNum(15) = "0x44"

​

For Index = 0 To 15

​ ​ ​ If (Data9Data­10 And (2 ^ Index)) = (2 ^ Index) Then

​ ​ ​ ​ ​ ​ ​ Error­sList = ErrorsList + vbCrLf + ErrorNum(I­ndex) + " - " + Erro­rText(Index)

​ ​ ​ Else

​ ​ ​ ​ ​ ​ ​ 'error not set, do nothing

​ ​ ​ End If

Next

Debug.Print ErrorsLi­st

End Sub

snejky   10 W

10 W
Posts: 67
Joined: Jun 02 2015 11:49pm

Re: Sinusoidal wave brushless motor controller

Post by snejky » Jul 31 2019 12:18am

Jumpjack , thank you. Very intersting.

dave4711   1 µW

1 µW
Posts: 1
Joined: Aug 01 2016 4:41pm

Re: Sinusoidal wave brushless motor controller

Post by dave4711 » Nov 09 2019 5:45pm

hi all,
i decoded the protocol for at least monitoring a kelly KLS and did a quick hack in perl. maybe works for KAC-controllers too.
reads motor speed, phase current, batt voltage, motor temperature / controller temperature (reads about 10 °C too low temperature) , hall sensors, pedal input, error status and the rest the app shows too.
i used it to monitor two KLS7230S.
i got about 12 complete datasets per second, which should be enough for most use cases (segway-style balancing anyone? dont know if its controllable fast enough :wink: ).

sample output of two datasets:

Code: Select all

Actual Dir (0|1, 0=F,1=R) : 000
B+ Volt (0-200V) : 070
Brake Pedal (0-255) : 002
Brake Switch (0|1) : 000
Brake Switch2 (0|1) : 000
Controller Temp (0-150C) : 018
Error Status : 
Foot Switch (0|1) : 000
Forward Switch (0|1) : 000
HaLL B (0|1) : 000
Hall A (0|1) : 001
Hall C (0|1) : 000
Low Speed (0|1) : 000
Motor Speed : 560
Motor Temp (0-150C) : 058
Phase Current : 38
Reversed (0|1) : 000
Setting Dir (0|1, 0=F,1=R) : 000
TPS Pedal (0-255) : 190
Timestamp : 1523094529495
--------------------------------------------------------------------------------
Actual Dir (0|1, 0=F,1=R) : 000
B+ Volt (0-200V) : 070
Brake Pedal (0-255) : 002
Brake Switch (0|1) : 000
Brake Switch2 (0|1) : 000
Controller Temp (0-150C) : 018
Error Status : 
Foot Switch (0|1) : 000
Forward Switch (0|1) : 000
HaLL B (0|1) : 000
Hall A (0|1) : 000
Hall C (0|1) : 001
Low Speed (0|1) : 000
Motor Speed : 572
Motor Temp (0-150C) : 059
Phase Current : 38
Reversed (0|1) : 000
Setting Dir (0|1, 0=F,1=R) : 000
TPS Pedal (0-255) : 200
Timestamp : 1523094529570
script and notes/more samples are here: https://www.dieseltreter.de/kellycontro ... nitor-kls/ .

maybe the decoding is useful for other projects .. i am curious what will be done with it :wink:
not decoded yet: reading configuration, writing configuration (writing may be dangerous .. for example the serial number can be changed this way too as i found out by coincidence :wink: ).

cheers,
david

Post Reply