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

Electric Motors and Controllers
Lesny   100 µW

100 µW
Posts: 9
Joined: Jan 30 2020 8:09am

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

Post by Lesny » Mar 24 2020 1:44pm

Hi, I try develop my own lcd using arduino but I have problem with uart.
So I use the usb uart conventer and H TERM to check transmison but the controller dont send any data.
Do you know whats wrong?
Thanks for any help .

User avatar
stancecoke   100 kW

100 kW
Posts: 1198
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 » Mar 24 2020 2:15pm

Lesny wrote:
Mar 24 2020 1:44pm
the controller dont send any data.
The controller only sends data when it receives a valid message from the display. It "answers" to the query of the display.

Only in diagnostics-mode, it sends data continously.

regards
stancecoke

Lesny   100 µW

100 µW
Posts: 9
Joined: Jan 30 2020 8:09am

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

Post by Lesny » Mar 24 2020 4:04pm

stancecoke wrote:
Mar 24 2020 2:15pm
Lesny wrote:
Mar 24 2020 1:44pm
the controller dont send any data.
The controller only sends data when it receives a valid message from the display. It "answers" to the query of the display.

Only in diagnostics-mode, it sends data continously.

regards
stancecoke
Thanks for tip.

Lesny   100 µW

100 µW
Posts: 9
Joined: Jan 30 2020 8:09am

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

Post by Lesny » Mar 25 2020 9:47am

So I send to controller this data byte by byte 0012546011006464015014 but controller dont receive any data (I use bluetoth terminal). What I make wrong?

This is my code:

byte txBuffer[13];
byte assistlvl=0;
uint8_t crc = 0x02;
void setup() {
Serial.begin(9600);
txBuffer[0] = 0; //B0 od 0-40 konfiguracja odczytu napięcia
txBuffer[1] = assistlvl; //B1 poziom wspomagania od 0-6; 6 tryb walking
txBuffer[2] = 0b01111101; //B2
txBuffer[3] = 46; //B3 parametr P1 ilość magnesów x przełożenie (w przypadku kt open source wartość jest olewana ale coś trzeba wpisać)
txBuffer[4] = 0b00000000; //B4
txBuffer[5] = 0; //B5
txBuffer[6] = 0b00000000; //B6
txBuffer[7] = 0b01000000; //B7
txBuffer[8] = 0b01000000; //B8
txBuffer[9] = 0b00000000; //B9
txBuffer[10] = 0b00000001; //B10
txBuffer[11] = 0x32; //B11
txBuffer[12] = 0x0E; //B12
}

void loop() {
int i=0;

for (i = 0; i < 13; ++i){
crc ^= txBuffer;
}
txBuffer[5] = crc;
for (i=0;i<13;i++){
Serial.print(txBuffer);
}

}

davideserin   1 W

1 W
Posts: 62
Joined: Feb 01 2016 7:57am

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

Post by davideserin » Mar 25 2020 10:17am

stancecoke wrote:
Mar 21 2020 1:01pm
There seem to be different PCB assemblies. Some have a pullup resistor at X4, some doesn't. See this post:
viewtopic.php?f=30&t=87870&p=1426450&hi ... r#p1426450

So you can try two solutions: Identify the pullup resistor on the pcb and remove it or add an e.g. 1k pull down resistor between X4 and GND. First solution should be preferred :wink:

regards
stancecoke
This worked for me, thanks so much. I simply soldered a 1k resistor at the back of the plug between signal and ground.

I have x4Throttle branch working now with both throttle on x4 and Sempu torque signal on the throttle input.

I noticed a few possible bugs that i'll report once i'm more familiar with the setup and can recreate and confirm the issues clearly.

Thanks,
David.

User avatar
stancecoke   100 kW

100 kW
Posts: 1198
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 » Mar 25 2020 10:29am

Lesny wrote:
Mar 25 2020 9:47am
What I make wrong?
First idea: You have to reset crc in each loop run, or calculate the checksum outside the loop. XOR2 is the last step normally, I don't know if it's a difference.
add a delay of 500ms in the loop.

viewtopic.php?t=73471

davideserin wrote:
Mar 25 2020 10:17am
This worked for me,
:thumb:
davideserin wrote:
Mar 25 2020 10:17am
I noticed a few possible bugs that i'll report once i'm more familiar with the setup and can recreate and confirm the issues clearly.
I'm looking forward to your feedback!

regards
stancecoke

Lesny   100 µW

100 µW
Posts: 9
Joined: Jan 30 2020 8:09am

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

Post by Lesny » Mar 26 2020 7:48am

Hi stancecoke,

The communications works fine but I have another question if I use OpenSource firmware which parameters from kt lcd3 is used by the controller ?

User avatar
stancecoke   100 kW

100 kW
Posts: 1198
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 » Mar 26 2020 8:22am

Lesny wrote:
Mar 26 2020 7:48am
which parameters from kt lcd3 is used by the controller ?
Only light and assistlevel, see this post:
viewtopic.php?f=30&t=87870&start=3875#p1538316

Feel free to add any function to the parameters :wink:

regards
stancecoke

Lesny   100 µW

100 µW
Posts: 9
Joined: Jan 30 2020 8:09am

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

Post by Lesny » Mar 26 2020 8:31am

stancecoke wrote:
Mar 26 2020 8:22am
Lesny wrote:
Mar 26 2020 7:48am
which parameters from kt lcd3 is used by the controller ?
Only light and assistlevel, see this post:
viewtopic.php?f=30&t=87870&start=3875#p1538316

Feel free to add any function to the parameters :wink:

regards
stancecoke
hmm
it is possible to change the configuration so that the controller uses the speed setting sent by uart like ori firmware ?

User avatar
stancecoke   100 kW

100 kW
Posts: 1198
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 » Mar 26 2020 8:37am

Lesny wrote:
Mar 26 2020 8:31am
it is possible to change the configuration so that the controller uses the speed setting sent by uart like ori firmware ?
of course, if you progam it :D
But you can activate the offroad mode by the "morse code" with the break lever, so there is no need to change the max speed with the display...

regards
stancecoke
Last edited by stancecoke on Mar 26 2020 8:46am, edited 2 times in total.

Lesny   100 µW

100 µW
Posts: 9
Joined: Jan 30 2020 8:09am

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

Post by Lesny » Mar 26 2020 8:46am

stancecoke wrote:
Mar 26 2020 8:37am
Lesny wrote:
Mar 26 2020 8:31am
it is possible to change the configuration so that the controller uses the speed setting sent by uart like ori firmware ?
of course, if you progam it :D
But you can activate the offroad mode by the "morse code" with the break lever, so there is no need to change the max speed with the display...

regards
stancecoke

I know but I would like to adapt the predefined driving modes and it would be easier to send the speed setting.

User avatar
stancecoke   100 kW

100 kW
Posts: 1198
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 » Mar 26 2020 8:47am

Lesny wrote:
Mar 26 2020 8:46am
it would be easier to send the speed setting.
If you want to have overall possibilities with your homebrewed arduino display, you should use the protocol of the BluOSEC app. With this you can change most parameters on the fly.
https://github.com/stancecoke/BMSBatter ... Odisplay.c

It uses the modbus protocol, for detailed questions you have to ask @Xnyle. The adresses of the parameters can be found in the BOdisplay.h

regards
stancecoke

Lesny   100 µW

100 µW
Posts: 9
Joined: Jan 30 2020 8:09am

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

Post by Lesny » Mar 26 2020 9:46am

I think it is too complicated for me because I program only in IDE and mainly deals with the electronic part.
The only thing I need is to change the maximum speed to do what I assumed.
Do you know where and what I would have to change the OpenSource code so that the controller does not ignore this value from Ktlcd3 uart?

User avatar
stancecoke   100 kW

100 kW
Posts: 1198
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 » Mar 26 2020 10:05am

you are lucky, Xnyle has implemted it already, I hadn't noticed that before. :-)

Code: Select all

void digestLcdValues(void) {

	ui8_assistlevel_global = lcd_configuration_variables.ui8_assist_level + 80; // always add max regen 
	// added by DerBastler Light On/Off
	light_stat = (light_stat&~128) | lcd_configuration_variables.ui8_light_On; // only update 7th bit, 1st bit is current status
	
	if (lcd_configuration_variables.ui8_max_speed != ui8_speedlimit_kph) {
		ui8_speedlimit_kph = lcd_configuration_variables.ui8_max_speed;
		eeprom_write(OFFSET_MAX_SPEED_DEFAULT, lcd_configuration_variables.ui8_max_speed);
	}
}
regards
stancecoke

Lesny   100 µW

100 µW
Posts: 9
Joined: Jan 30 2020 8:09am

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

Post by Lesny » Mar 26 2020 10:58am

stancecoke wrote:
Mar 26 2020 10:05am
you are lucky, Xnyle has implemted it already, I hadn't noticed that before. :-)

Code: Select all

void digestLcdValues(void) {

	ui8_assistlevel_global = lcd_configuration_variables.ui8_assist_level + 80; // always add max regen 
	// added by DerBastler Light On/Off
	light_stat = (light_stat&~128) | lcd_configuration_variables.ui8_light_On; // only update 7th bit, 1st bit is current status
	
	if (lcd_configuration_variables.ui8_max_speed != ui8_speedlimit_kph) {
		ui8_speedlimit_kph = lcd_configuration_variables.ui8_max_speed;
		eeprom_write(OFFSET_MAX_SPEED_DEFAULT, lcd_configuration_variables.ui8_max_speed);
	}
}
regards
stancecoke
So if I use the latest software and ktlcd3 protocol this should not be a problem with speed setting ?

User avatar
stancecoke   100 kW

100 kW
Posts: 1198
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 » Mar 26 2020 11:29am

Lesny wrote:
Mar 26 2020 10:58am
So if I use the latest software and ktlcd3 protocol this should not be a problem with speed setting ?
Yes, but I think it isn't prooved in hardware yet, as far as I know, Xnyle has no LCD3. So please report, if it works!

regards
stancecoke

Slipy   1 mW

1 mW
Posts: 10
Joined: Mar 19 2020 6:22pm

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

Post by Slipy » Mar 26 2020 9:11pm

Hi, i made own pcb using s06s KingQeen... scheme for my scooter, a check all seems like scheme, but it didn't work, no any reaction,
Vcap ok
OC 4.3v
An8 1.6v
I phase 2.5v
Using Chinese stlink v2
Looks like a microcontroller doesn't start/work
Help please

User avatar
stancecoke   100 kW

100 kW
Posts: 1198
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 » Mar 28 2020 1:03pm

Slipy wrote:
Mar 26 2020 9:11pm
Help please
sorry, but without the use of a scope, you won't find the error. First check the output of the bootstrap circuit (gate of the hi-side FETs)

regards
stancecoke

Slipy   1 mW

1 mW
Posts: 10
Joined: Mar 19 2020 6:22pm

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

Post by Slipy » Mar 28 2020 4:43pm

No any reaction, no any impulses on mosfet drivers, i think what microcontroller damaged if i can to ask you to do simple code for this stm, print on display uart hello word and enable all output ports as 1 (5v)
I will test it without HV part of pcb. I'm don't a programmer, only electronic, and make own home made scooter
Sorry for my English, I'm Ukrainian

obcd   100 W

100 W
Posts: 156
Joined: Jul 16 2019 3:45pm

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

Post by obcd » Mar 28 2020 5:21pm

If you use the stprog program, can you read the program memory from the microcontroller?
There also is a feature that the controller isn't starting up if one of the brake inputs is activated.
(It's starting up but not leaving it's initialising cycle.)
Be very carefull. If you activate both the upper and lower mosfet at the same time, they will short your power supply (or battery)
So it's best to at least disconnect the motor phase wires and use a current limited power supply or use a load in serie with your supply wires that limits the current. With the motor phase wires disconnected, the controller shouldn't use much current.

Vbruun   10 W

10 W
Posts: 65
Joined: Sep 26 2019 8:42am

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

Post by Vbruun » Mar 29 2020 3:02am

Hello

I am looking for a controller to use @48v with a torque sensor. It seems this one will fit the bill!

I can't realy find any info on how the torque sensor input signal can be calibrated from the documentation i find. Is it possible to calibrate it?

- Victor

User avatar
stancecoke   100 kW

100 kW
Posts: 1198
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 » Mar 29 2020 4:11am

Vbruun wrote:
Mar 29 2020 3:02am
Is it possible to calibrate it?
Yes, of course, but only linear. Throttle min is the offset and TQ calib the gain.
We don't use physical units for power/torque/cadence in the code to avoid unnecessary computations, but of course you can calculate them from the ADC and timer values, if you are really interested.
Slipy wrote:
Mar 28 2020 4:43pm
print on display uart hello
Just flash the controller in diagnostics mode, then you should see communication on the UART pins.

regards
stancecoke

Vbruun   10 W

10 W
Posts: 65
Joined: Sep 26 2019 8:42am

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

Post by Vbruun » Mar 29 2020 6:17am

Thanks! I Guess the perfect way to do IT would be to also factor in the cadence in some way and calculate power, but I think this way Will be sufficient for what I am doing :)

User avatar
stancecoke   100 kW

100 kW
Posts: 1198
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 » Mar 29 2020 7:06am

Vbruun wrote:
Mar 29 2020 6:17am
I Guess the perfect way to do IT would be to also factor in the cadence in some way and calculate power
The assistance is proportional to the riders power, not to the torque on the pedal:

Code: Select all

else { // torque sensor mode

	float_temp = (float) ui16_sum_torque;
	float_temp *= ((float) ui8_assist_percent_actual / 100.0);

	if (flt_torquesensorCalibration != 0.0) {
		float_temp *= flt_torquesensorCalibration / ((float) ui16_time_ticks_between_pas_interrupt_smoothed); 				
	}
}
regards
stancecoke


Post Reply