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

Had some time spare today so gave the latest master branch a try. On first testing I shot up the road like a scalded cat, then realised that Battery and Phase Current max are now calculated differently and need much lower numbers than before. After putting this right everything calmed down and seemed to work well.

The only issue I noticed was the PAS detection, which seems unable to detect reverse pedalling and triggers the motor fully in either pedal direction. Changing the 'PAS Threshold' setting seemed to have no effect whatsoever. Was riding in throttle/pas mode, config.h attached below.

Other than this all seemed to work well, with some 'interesting' new settings to play with I see.... :D
 

Attachments

  • config.h
    1.3 KB · Views: 87
honya96 said:
Valopallo said:
honya96 said:
Matters only what current you set.. 25 should be ok as peak. But you can't still hold full throttle.

Yes, I totally forgot that the firmware gives the option to lower the current from the controllers max draw, doh. What happens if I full throttle then?

Even stock fw can be set to half the full current.

How is this done?
 
Valopallo said:
honya96 said:
Valopallo said:
honya96 said:
Matters only what current you set.. 25 should be ok as peak. But you can't still hold full throttle.

Yes, I totally forgot that the firmware gives the option to lower the current from the controllers max draw, doh. What happens if I full throttle then?

Even stock fw can be set to half the full current.

How is this done?

Read manual for lcd3
 
geofft said:
Changing the 'PAS Threshold' setting seemed to have no effect whatsoever.
Thank you for testing and the feedback!
Have you tried the android app already? You can get the PAS ratio displayed there, so can see the values for foreward and reverse pedaling.

regards
stancecoke
 
stancecoke said:
geofft said:
Changing the 'PAS Threshold' setting seemed to have no effect whatsoever.
Have you tried the android app already?

..not yet, but will do soon.

You can get the PAS ratio displayed there, so can see the values for foreward and reverse pedaling.

I tried values from 1.0 to 2.8 for 'PAS Threshold' - strangely, none of these settings made any difference, I think the answer to this lies elsewhere..?
 
Not sure, if 2.8 is enough.

For me it's 3.2 when pedalling normal. Although my sensor does not send any signal when pedaling backwards so I can't test that detection functionality at all.
 
Xnyle said:
Not sure, if 2.8 is enough.

For me it's 3.2 when pedalling normal. Although my sensor does not send any signal when pedaling backwards so I can't test that detection functionality at all.

Ok, I'll try some higher values tomorrow.
 
geofft said:
Xnyle said:
Not sure, if 2.8 is enough.

For me it's 3.2 when pedalling normal. Although my sensor does not send any signal when pedaling backwards so I can't test that detection functionality at all.

Ok, I'll try some higher values tomorrow.

It seems that whatever value is entered for 'Pas Threshold' has no effect on this, even stupid stuff like 0 or 100. It would appear that this setting is being totally ignored by the firmware....?
 
geofft said:
It would appear that this setting is being totally ignored by the firmware....?

Hm, it should work in the same way as in the older commits...

Code:
if (ui8_PAS_Flag == 1) {
		ui8_PAS_Flag = 0; //reset interrupt flag

		ui16_time_ticks_between_pas_interrupt = ui16_time_ticks_for_pas_calculation; //save recent cadence
		ui16_PAS_High = ui16_PAS_High_Counter;

		if ((0 == (ui16_aca_flags & PAS_INVERTED)) && ((float) ui16_time_ticks_between_pas_interrupt / (float) ui16_PAS_High > flt_s_pas_threshold)) {
			if (PAS_act < 7) {
				PAS_act++;
			}
		} else if ((PAS_INVERTED == (ui16_aca_flags & PAS_INVERTED)) && ((float) ui16_time_ticks_between_pas_interrupt / (float) ui16_PAS_High < flt_s_pas_threshold)) {
			if (PAS_act < 7) {
				PAS_act++;
			}
		} else {
			if (PAS_act > 0) {
				PAS_act--;
			}
		}

Please install the BluOsec app and check the values of PAS ratio (choose the item pasFraction in the dropdown in one of the fields of the most left screen)


Screenshot_2018-10-04-16-30-13.png


regards
stancecoke
 
stancecoke said:
geofft said:
It would appear that this setting is being totally ignored by the firmware....?

Hm, it should work in the same way as in the older commits...
Very strange, I rechecked the previous commit I was using (downloaded 5th Sept), the PAS detection with this works just fine.

Please install the BluOsec app and check the values of PAS ratio (choose the item pasFraction in the dropdown in one of the fields of the most left screen)

Ok, but away on holiday at the weekend, so may be a while before I get back to you on this.
 
stancecoke said:
geofft said:
It would appear that this setting is being totally ignored by the firmware....?

Hm, it should work in the same way as in the older commits...

Code:
if (ui8_PAS_Flag == 1) {
		ui8_PAS_Flag = 0; //reset interrupt flag

		ui16_time_ticks_between_pas_interrupt = ui16_time_ticks_for_pas_calculation; //save recent cadence
		ui16_PAS_High = ui16_PAS_High_Counter;

		if ((0 == (ui16_aca_flags & PAS_INVERTED)) && ((float) ui16_time_ticks_between_pas_interrupt / (float) ui16_PAS_High > flt_s_pas_threshold)) {
			if (PAS_act < 7) {
				PAS_act++;
			}
		} else if ((PAS_INVERTED == (ui16_aca_flags & PAS_INVERTED)) && ((float) ui16_time_ticks_between_pas_interrupt / (float) ui16_PAS_High < flt_s_pas_threshold)) {
			if (PAS_act < 7) {
				PAS_act++;
			}
		} else {
			if (PAS_act > 0) {
				PAS_act--;
			}
		}

Please install the BluOsec app and check the values of PAS ratio (choose the item pasFraction in the dropdown in one of the fields of the most left screen)

....just had a quick play with this, Pas Fraction (forwards) is 1.8, reverse is 2.3

Same situation for me though, setting 'Pas Threshold' at 1.8 (or any other number) results in motor drive in either pas direction.

Nice app though! Looks professional and works well, will play more with this when time permits... :D
 
OK, thank you for testing!
A value of 2.1 for threshold should work.

I checked Xnyles code again. He processes the direction signal different now. The motor is not stopped when pedaling in reverse, but the speed limit is set to 6 km/h.

Can you confirm this behaviour?
I think this is not a good solution, as the motor can start working, if you are pushing your bike backwards?!

Code:
// first select current speed limit

	} else if (ui16_time_ticks_for_pas_calculation > timeout ||!PAS_is_active) {
		ui8_speedlimit_actual_kph = ui8_speedlimit_without_pas_kph;
	}

regards
stancecoke
 
stancecoke said:
OK, thank you for testing!
A value of 2.1 for threshold should work.

I checked Xnyles code again. He processes the direction signal different now. The motor is not stopped when pedaling in reverse, but the speed limit is set to 6 km/h.

Can you confirm this behaviour?
I think this is not a good solution, as the motor can start working, if you are pushing your bike backwards?!

Code:
// first select current speed limit

	} else if (ui16_time_ticks_for_pas_calculation > timeout ||!PAS_is_active) {
		ui8_speedlimit_actual_kph = ui8_speedlimit_without_pas_kph;
	}

regards
stancecoke

Ok, a bit more success. The firmware works as you suggest above, but only with Speed Sensor 'Internal' selected. If 'External' is selected the 'Pas Threshold' setting has no effect and you always get unrestricted motor drive in either pas direction... :?
 
Actually PAS activity was ignored, had nothing to do with speedlimit.

Probably fixed with latest commit, although speedsensor setting has nothing to do with it.
 
Finally my S06S arrived! I soldered everything in place. Now, the throttle works but even that my PAS sensor unit shows with a red led that it picks up the signal correctly the wheel doesn't turn when I turn the magnets. I soldered the PAS connector as follows; red(from the PAS) to brown(of the controller), black(PAS) to black (S06S) and white(PAS) to yellow(S06S). I'm trying to find out if the connections are right. What terminals should the PAS wires connect at the pcb of S06S? I'm using the original KT firmware for testing purposes.
 
Lot of questions; Is the PAS assistant at the 0 assist lvl by default @ original kt s06s firmware? So, to get the PAS working I must either have a display with buttons to turn it on or configure the firmware? And for this, I must use the open source fw? So can I test PAS without display or just the throttle? I'm also wondering where to get "the correct phase and Hall sensor assignment" from the original fw before flashing open source fw.
 
Valopallo said:
Is the PAS assistant at the 0 assist lvl by default @ original kt s06s firmware?
I don't know exactly, but I think there will be a default value different from zero. But the original firmware doesn't work with any PAS without adjusting parameter C1 with the LCD display.

Valopallo said:
I'm also wondering where to get "the correct phase and Hall sensor assignment" from the original fw before flashing open source fw.
If the motor runs smooth and quiet with the throtte, the assignment is OK!

I recomment to use the new BluOsec app with our firmware, as it offers all information you need for debugging your peripheral devices!

regards
stancecoke
 
Ok. Thanks. I must flash the opensource firmware hoping that PAS is working as it should.

stancecoke said:
If the motor runs smooth and quit with the throtte, the assignment is OK

Yes, motor runs smoothly with throttle building up speed when more throttle is turned. But about the noise, I have no reference whatsoever how the motor should sound. There is a sound of course but it doesn't sound anything too loud or alarming so I guess it's fine.
 
stancecoke said:
haiyi911 said:
hi,all
i have some problem while "run sdcc batch"

There are no parenthesis allowed in the path to the firmware folder. Please rename the path.

regards
stancecoke

I have renamed the path. there are some other problems, maybe Start_Compiling.bat run badly?
 
haiyi911 said:
maybe Start_Compiling.bat run badly?
can you translate the chinese messages?
please tell us which commit you are using and post the whole log from the console window. You can ingore the red lines from the -clean part, they don't matter.

regards
stancecoke
 
stancecoke said:
haiyi911 said:
maybe Start_Compiling.bat run badly?
can you translate the chinese messages?
please tell us which commit you are using and post the whole log from the console window. You can ingore the red lines from the -clean part, they don't matter.

regards
stancecoke

I know very little about eclipse or sdcc,i guess many Options is setted wrong.thanks
 
Ignore the file not found messages, as the script only tries to delete old stuff that isn't there.

sdcc must be in your path though (as the readme states, read it!) The whole build process is rather bodged together as nobody really cares from the moment on that it's running.

If you're unsure, use the Java Configurator first and only if you understand what's going on try to build via Eclipse.
 
Back
Top