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

Electric Motors and Controllers
geofft
100 W
100 W
Posts: 108
Joined: Nov 09, 2012 9:41 am
Location: Berkshire UK

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

Post by geofft » Jan 01, 2018 11:19 am

The v. reg is too hot to touch after around 2 minutes - is that ok?

Yes, the 5v is present at all these points.

I think I may have made a stupid mistake with my st-link connector. I used a jst-sh connector (single row) to fit into the st link, completely forgetting that the pins were open to one side of the connector. These were probably touching the other row of pins putting RST-SWCLK and SWIM-SWDIO. I guess this must have been affecting programming and may have damaged the st-link.. :oops: Have now ordered another st-link just in case.

Thanks for your offer to diagnose but I won't trouble you guys with this, you've been enough help already. Like we said these things are cheap enough to not worry too much.
.....I've had a bit of a developement with my 'dead' controller. As an experiment I downloaded the latest github firmware and.....guess what.....my dead controller has sprung into life. Despite my earlier attempts seeming to load up the data ok, there was clearly some error. The hot LM317 reg. and my cable mistake were false trails and were not related to these previous issues.

I won't get to try this 'on the road' till tomorrow but I have one small issue so far - the new configurator layout can't be fully viewed on my laptop screen, which is 1280x800 resolution. The 'write configuration' button at the very bottom disappears off the lower screen and cannot be dragged or scrolled into view. I have got round this by manually changing 'config.h' and running 'start compiling.bat' but this is obviously not ideal, is it possible to fix this?

Anyway, some progress, hopefully a New Years Day pointer for the rest of my year.. :wink:
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48 20amp, LCD3, 48v 12s lipo.

casainho
100 kW
100 kW
Posts: 1144
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Jan 01, 2018 11:28 am

That is great news!! Also great that you could understand the technical side and corner the issue.

I will make the window resizeable and probably smaller... The issue is also that I have a display of 4k or something like that and the window is very small on that display... Maybe there is a way for java to scale automatically the size depending on display ppi.

I hope to have a new version tomorrow.
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

geofft
100 W
100 W
Posts: 108
Joined: Nov 09, 2012 9:41 am
Location: Berkshire UK

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

Post by geofft » Jan 01, 2018 11:48 am

Ok, thanks.

One thing I noticed in the config.h file - I had to change the pas direction (3rd line from the end) and noticed in the default option the word 'RIGHT' was misspelt. Probably of no consequence but thought I'd mention in case it was a significant tag.
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48 20amp, LCD3, 48v 12s lipo.

casainho
100 kW
100 kW
Posts: 1144
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Jan 01, 2018 12:18 pm

geofft wrote:
Jan 01, 2018 11:19 am
but I have one small issue so far - the new configurator layout can't be fully viewed on my laptop screen, which is 1280x800 resolution. The 'write configuration' button at the very bottom disappears off the lower screen and cannot be dragged or scrolled into view.
Can you please send a screenshot?
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

geofft
100 W
100 W
Posts: 108
Joined: Nov 09, 2012 9:41 am
Location: Berkshire UK

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

Post by geofft » Jan 01, 2018 12:37 pm

I'll try...

Should be attached.
Attachments
scrnsht.png
(70.24 KiB) Not downloaded yet
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48 20amp, LCD3, 48v 12s lipo.

casainho
100 kW
100 kW
Posts: 1144
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Jan 02, 2018 6:44 am

geofft wrote:
Jan 01, 2018 11:48 am
Ok, thanks.

One thing I noticed in the config.h file - I had to change the pas direction (3rd line from the end) and noticed in the default option the word 'RIGHT' was misspelt. Probably of no consequence but thought I'd mention in case it was a significant tag.
The window is now a little shorter and also realizable, should work of for you. Please give feedback.

I was looking to the sources and it is written as "PAS_DIRECTION_RIGHT". All seems ok for me - can you please clarify?? as wrong name will probably make a wrong result...
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

User avatar
stancecoke
1 kW
1 kW
Posts: 415
Joined: Aug 02, 2017 2:56 pm

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

Post by stancecoke » Jan 02, 2018 7:29 am

Now, there is no scrollbar any more with windows, you can only scroll down with the mousewheel. With no external mouse, you can't scroll at all... As I mentioned before, I would prefer a GUI, where you don't have to scroll at all, thats much more overseeable.
And as before, the write configuration button is cut at the bottom a little, see screenshot.

regards
stancecoke
Configuration Tool.PNG
Configuration Tool.PNG (23.79 KiB) Viewed 408 times

geofft
100 W
100 W
Posts: 108
Joined: Nov 09, 2012 9:41 am
Location: Berkshire UK

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

Post by geofft » Jan 02, 2018 8:32 am

geofft wrote: ↑01 Jan 2018, 16:48
Ok, thanks.

One thing I noticed in the config.h file - I had to change the pas direction (3rd line from the end) and noticed in the default option the word 'RIGHT' was misspelt. Probably of no consequence but thought I'd mention in case it was a significant tag.
The window is now a little shorter and also realizable, should work of for you. Please give feedback.

I was looking to the sources and it is written as "PAS_DIRECTION_RIGHT". All seems ok for me - can you please clarify?? as wrong name will probably make a wrong result...
I now realise the error lies not in the new configuration_tool.jar but in the 'OSEC_Parameter_Configurator.jar' file in the 'firmware' folder. If you select Pas direction 'Right' it misspells it in the config.h file as 'PAS_DIRECTION_RIGTH'. Sorry about the misinformation.

Will try the updated configuration tool soon, but it seems that stancecoke still has some issues with that.....?

Edit: As stancecoke says, can't scroll at all now with laptop.... :(
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48 20amp, LCD3, 48v 12s lipo.

User avatar
stancecoke
1 kW
1 kW
Posts: 415
Joined: Aug 02, 2017 2:56 pm

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

Post by stancecoke » Jan 02, 2018 8:52 am

I fixed the typo in the "old" C#ROME-B tool ('OSEC_Parameter_Configurator.jar').
It should still work and needs no scrolling...

regards
stancecoke

geofft
100 W
100 W
Posts: 108
Joined: Nov 09, 2012 9:41 am
Location: Berkshire UK

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

Post by geofft » Jan 03, 2018 11:05 am

geofft wrote:
Jan 02, 2018 8:32 am
geofft wrote: ↑01 Jan 2018, 16:48
Edit: As stancecoke says, can't scroll at all now with laptop.... :(
I've since discovered that if you maximize the window the scroll bar is enabled, which means I can now scroll to the very bottom ok. It's not exactly right, but good enough for now.
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48 20amp, LCD3, 48v 12s lipo.

geofft
100 W
100 W
Posts: 108
Joined: Nov 09, 2012 9:41 am
Location: Berkshire UK

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

Post by geofft » Jan 03, 2018 12:21 pm

My replacement controller arrived today, so after much wrestling with the software eventually managed to get the firmware downloaded and ventured out in the current stormy weather to give it a try.

Initial findings are very positive, the pas works progressively and smoothly, also the throttle blends in with pas quite nicely. This is one area where the stock firmware was less than perfect, the added throttle being rather 'all or nothing' with little progression. Out on the road the motor ran quietly with no noticeable jumps or hiccups.

As you'd expect with any project like this there are a few rough edges and minor issues that probably need some attention. I don't know if you guys are looking for more feedback but I'll list some of the more obvious issues. This is with my hardware as shown in my bottom signature line below, 'Throttle/pas' input and 'Current/Speed' control mode.

1) The bike does not like being pushed in reverse - it's ok for about a metre or so but then the motor resists and at times will actively drive the bike forwards quite forcibly. This could create some dangerous situations and needs some attention.

2) PAS doesn't seem to respond to changing power levels (0-5), and generally feels rather overdriven at the lower settings. Tried reducing level 1 to 10% which didn't help and even at level 0 (which presumably should be no assist) I was getting a strong amount of pas drive.

3) With PWM control selected throttle worked ok but there was no response to pas input.

4) The LCD3 wattmeter seemed to have a mind of it's own, drifting around a lot, showing a small draw at idle and often showing a draw under pas or throttle of up to 2000w. This would roughly equate to a current of 40amps which I'm pretty sure wasn't actually happening. The controller was significantly warm after my 3km test ride however, certainly more so that the stock firmware which ran barely lukewarm at all times.

.,...which all sounds rather critical but don't be discouraged, my overall impression was very favourable and with a little 'tweaking' this could make a viable alternative to the stock Kunteng firmware.

If you need any more info or want something trying out on the road let me know, should have some time towards the weekend - weather permitting.... :)
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48 20amp, LCD3, 48v 12s lipo.

User avatar
stancecoke
1 kW
1 kW
Posts: 415
Joined: Aug 02, 2017 2:56 pm

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

Post by stancecoke » Jan 03, 2018 1:53 pm

Thank you for your feedback!
geofft wrote:
Jan 03, 2018 12:21 pm
1) The bike does not like being pushed in reverse - it's ok for about a metre or so but then the motor resists and at times will actively drive the bike forwards quite forcibly. This could create some dangerous situations and needs some attention.
The direction detection is known to be a kind of tricky, so we have to improve the algorithm...
geofft wrote:
Jan 03, 2018 12:21 pm
2) PAS doesn't seem to respond to changing power levels (0-5), and generally feels rather overdriven at the lower settings. Tried reducing level 1 to 10% which didn't help and even at level 0 (which presumably should be no assist) I was getting a strong amount of pas drive.
Seems, that the communication from the display to the controller doesn't work properly. Perhaps the display uses a different checksum again. Two possibilies: Disable the check of the checksum in the controller code, or log the bytes, sent from the display and analyze the used byte pattern. You'll need a UART to USB converter for this.
We should improve the code: Sending Data from the controller to the display only if a valid message from the display was received. When we get no speed information on the display, we definitly know, that there's something wrong with the received messages.
geofft wrote:
Jan 03, 2018 12:21 pm
4) The LCD3 wattmeter seemed to have a mind of it's own, drifting around a lot, showing a small draw at idle and often showing a draw under pas or throttle of up to 2000w. This would roughly equate to a current of 40amps which I'm pretty sure wasn't actually happening. The controller was significantly warm after my 3km test ride however, certainly more so that the stock firmware which ran barely lukewarm at all times.
What was your setting for max motor current? Perhaps the control loop swings up. Perhaps we should use an averaged value for the display.

regards
stancecoke
Last edited by stancecoke on Jan 03, 2018 2:12 pm, edited 3 times in total.

casainho
100 kW
100 kW
Posts: 1144
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Jan 03, 2018 1:59 pm

geofft wrote:
Jan 03, 2018 12:21 pm
My replacement controller arrived today, so after much wrestling with the software eventually managed to get the firmware downloaded and ventured out in the current stormy weather to give it a try.

Initial findings are very positive, the pas works progressively and smoothly, also the throttle blends in with pas quite nicely. This is one area where the stock firmware was less than perfect, the added throttle being rather 'all or nothing' with little progression. Out on the road the motor ran quietly with no noticeable jumps or hiccups.
The feedback is really important, I was waiting for it from your experience :-)
This is with my hardware as shown in my bottom signature line below, 'Throttle/pas' input and 'Current/Speed' control mode.
Please see that you need to use P3 = 0 to have current AND speed control, with P3 = 1, you will have only current control.

1. Ok, the PWM is always active even if throttle (type) value = 0 and the motor should block because of that. Maybe we can disable when wheel speed = 0 and throttle = 0.
Driving the motor forward may be an issue, because it will detect motor speed... well, looking for throttle = 0 condition may avoid this issue.

2. That is strange because looking at the code:

Code: Select all

ui8_temp = ui8_max (ui8_throttle_value_filtered, ui8_temp); // use the max value from throotle or pas cadence
And just after ui8_temp is multiplied by ui8_assist_level...
Also I do remember to test this... can you please test, with your wheel on the hair and P3 = 0, so you should get speed control linear to PAS cadence:

Code: Select all

  // if LCD P3 = 0, control also the speed
  if (lcd_configuration_variables.ui8_power_assist_control_mode)
  {
    // set target motor speed to the value defined on the LCD
    // (due to motor configurations on the motor controller, this will only put a limit to the max permited speed!)
    motor_controller_set_target_speed_erps (motor_controller_get_target_speed_erps_max ());
  }
  else
  {
    // PAS cadence will setup motor speed
    // map PAS candence value to motor speed value
    ui16_target_speed_erps = (uint16_t) (map ((uint32_t) f_temp,
		  (uint32_t) 0,
		  (uint32_t) 255,
		  (uint32_t) 0, // motor speed min value
		  (uint32_t) motor_controller_get_target_speed_erps_max ())); // motor speed from max value, defined on the LCD
    motor_controller_set_target_speed_erps (ui16_target_speed_erps);
  }
3. You are correct, the implementation is the following (you can see at void ebike_throotle_type_throotle_pas (void) in ebike_app.c file). The idea of direct PWM was only throttle, mainly for development... do you want to use it?? If yes, I can add also PAS control to that.

Code: Select all

  f_temp = (float) (((float) ui8_throttle_value_filtered) * f_temp);
  ui8_temp = (uint8_t) (map ((uint32_t) f_temp,
  			 (uint32_t) 0,
  			 (uint32_t) 255,
  			 (uint32_t) 0,
  			 (uint32_t) PWM_DUTY_CYCLE_MAX));
  ui8_pwm_duty_cycle_duty_cycle_controller = ui8_temp;
4. Yes, now I remember that I have the same issue about bad current readings on the LCD. I have LCD3 installed on my direct drive motor ebike and I am not using it right now so I forgot that issue.

About controller to be significantly warm, I think this can happen because:
1. your FOC_READ_ID_CURRENT_ANGLE_ADJUST value is not good and the controller is "giving" more battery power to the motor than what original firmware... I guess the motor would also get warmer on this case
2. the PWM scheme used is different from the original firmware and for what I did read, the original may have less 30% wasted energy on the PWM commutations and meaning maybe 30% warmer on our firmware

I don't really know if 2. cause a big impact. With my tests, I never go the controller to hot (S06S or S12S) but yes, I think with original firmware is less hot. About efficiency, stancecoke did test before and it seems very good, at least as the original firmware if not better.
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

User avatar
stancecoke
1 kW
1 kW
Posts: 415
Joined: Aug 02, 2017 2:56 pm

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

Post by stancecoke » Jan 03, 2018 2:05 pm

casainho wrote:
Jan 03, 2018 1:59 pm
the original may have less 30% wasted energy on the PWM commutations and meaning maybe 30% warmer on our firmware
Do you have some literature on this topic? I want to understand that!

regards
stancecoke

casainho
100 kW
100 kW
Posts: 1144
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Jan 03, 2018 2:17 pm

stancecoke wrote:
Jan 03, 2018 1:53 pm
Thank you for your feedback!
geofft wrote:
Jan 03, 2018 12:21 pm
1) The bike does not like being pushed in reverse - it's ok for about a metre or so but then the motor resists and at times will actively drive the bike forwards quite forcibly. This could create some dangerous situations and needs some attention.
The direction detection is known to be a kind of tricky, so we have to improve the algorithm...
Seems we both wrote a message at the same time :-)
I would like to understand what you mean, what you think may be happening so I can try to improve this. Please look at my answer.
stancecoke wrote:
Jan 03, 2018 1:53 pm
geofft wrote:
Jan 03, 2018 12:21 pm
2) PAS doesn't seem to respond to changing power levels (0-5), and generally feels rather overdriven at the lower settings. Tried reducing level 1 to 10% which didn't help and even at level 0 (which presumably should be no assist) I was getting a strong amount of pas drive.
Seems, that the communication from the display to the controller doesn't work properly. Perhaps the display uses a different checksum again. Two possibilies: Disable the check of the checksum in the controller code, or log the bytes, sent from the display and analyze the used byte pattern. You'll need a UART to USB converter for this.
For start, I think will be easier for geoff to test also with throttle. The LCD assist value scale both throttle and PAS cadence.
And you may be correct, if the checksum is incorrect, that issue will happen: no communication from the LCD to controller firmware. geoff can also try change the wheel max speed on the LCD and use P3 = 0 and throttle and see if the speed limit will apply... -- note that if LCD is not communicating, the default wheel max speed is 25km/h.
Geoff, the default values if LCD is not communicating:

Code: Select all

// *************************************************************************** //
// EEPROM memory variables default values
#define DEFAULT_VALUE_ASSIST_LEVEL 		2
#define DEFAULT_VALUE_MOTOR_CHARACTARISTIC 	202 // for Q85 motor (12.6 * 16)
#define DEFAULT_VALUE_WHEEL_SIZE	 	20 // 26''
#define DEFAULT_VALUE_MAX_SPEED	 		25
#define DEFAULT_VALUE_POWER_ASSIST_CONTROL_MODE 1
#define DEFAULT_VALUE_CONTROLLER_MAX_CURRENT	10
stancecoke wrote:
Jan 03, 2018 1:53 pm
geofft wrote:
Jan 03, 2018 12:21 pm
4) The LCD3 wattmeter seemed to have a mind of it's own, drifting around a lot, showing a small draw at idle and often showing a draw under pas or throttle of up to 2000w. This would roughly equate to a current of 40amps which I'm pretty sure wasn't actually happening. The controller was significantly warm after my 3km test ride however, certainly more so that the stock firmware which ran barely lukewarm at all times.
What was your setting for max motor current? Perhaps the control loop swings up. Or like #2, there might be a problem with the serial communication.
Hmmm, I bet it is a bug on the firmware. Since the communication sued the CRC, I think would be difficult for error on the communication data. That is why we (developers) need to log in real time this values during a test ride...
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

User avatar
stancecoke
1 kW
1 kW
Posts: 415
Joined: Aug 02, 2017 2:56 pm

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

Post by stancecoke » Jan 03, 2018 2:48 pm

casainho wrote:
Jan 03, 2018 2:17 pm
I would like to understand what you mean, what you think may be happening so I can try to improve this. Please look at my answer.
In the "Forumscontroller-" code it is solved by checking the ratio of the PAS_High_counter to the PAS_Low_counter:

Code: Select all

#ifdef SUPPORT_PAS
void pas_change()       //Are we pedaling? PAS Sensor Change------------------------------------------------------------------------------------------------------------------
{
    if (last_pas_event>(millis()-10)) return;
    boolean pas_stat=digitalRead(pas_in);
    if (pas_stat)
    {
        pas_off_time=millis()-last_pas_event;
#if defined(SUPPORT_XCELL_RT) || defined(SUPPORT_SEMPU_V1) || defined(SUPPORT_SEMPU)
        if (analogRead_in_use)
          torque_want_calculation = true;
        else
          read_current_torque();
#endif
    }
    else
    {pas_on_time=millis()-last_pas_event;}
    last_pas_event = millis();
    cad=pas_time/(pas_on_time+pas_off_time);
    
    #ifdef SUPPORT_SEMPU_V1
      pedaling=bitRead(PINE,6); //read direction pin of pas sensor and set pedaling to true
    #else
      pas_failtime=pas_failtime+1;
      double pas_factor=(double)pas_on_time/(double)pas_off_time;
      if ((pas_factor>pas_factor_min)&&(pas_factor<pas_factor_max))
      {
          pedaling=true;
          pas_failtime=0;
      }
    #endif
}
#else
#warning PAS sensor support is required for legal operation of a Pedelec  by EU-wide laws except Austria or Swiss.
#endif
The valid range of the ratio is defined in the configuration tool. The range can be found by a "testing-mode" where the ratio is shown in the "live data view" in realtime.
Image

In the original firmware, the parameter C1 is used to set the PAS characteristic, see page 22.

Can you please recheck my first answer, I had some "new" ideas.

Thanks
stancecoke

geofft
100 W
100 W
Posts: 108
Joined: Nov 09, 2012 9:41 am
Location: Berkshire UK

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

Post by geofft » Jan 03, 2018 3:07 pm

Thanks guys, I need to do my best to understand your responses, do some more tests and get back to you. Please bear in mind that my previous coding experience ended with BASIC back in the late 70's,- early 80's and I will struggle to follow the code you are using for this project. Maybe time for me to go back to school...

Things I can answer quickly now:- Motor current limit was 20a (set to 40 in config.h). I've just checked, my P3 was set to 1 so I need to redo some tests. Whilst checking this at standstill in my garage the motor wattage apparently was 321W.... :?

I notice you say that the power levels (0-5) also scale throttle by the same ratio. I think you'll find that most people who ride pas/throttle in combination prefer to have 100% throttle available at all times and I think the stock firmware is set that way. Is that possible..or maybe offered as an option in the user config?

I'll get back with the other information as soon as I can, but this may take a couple of days.

Geoff.
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48 20amp, LCD3, 48v 12s lipo.

casainho
100 kW
100 kW
Posts: 1144
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Jan 03, 2018 9:35 pm

geofft wrote:
Jan 03, 2018 3:07 pm
Thanks guys, I need to do my best to understand your responses, do some more tests and get back to you. Please bear in mind that my previous coding experience ended with BASIC back in the late 70's,- early 80's and I will struggle to follow the code you are using for this project. Maybe time for me to go back to school...

Things I can answer quickly now:- Motor current limit was 20a (set to 40 in config.h). I've just checked, my P3 was set to 1 so I need to redo some tests. Whilst checking this at standstill in my garage the motor wattage apparently was 321W.... :?

I notice you say that the power levels (0-5) also scale throttle by the same ratio. I think you'll find that most people who ride pas/throttle in combination prefer to have 100% throttle available at all times and I think the stock firmware is set that way. Is that possible..or maybe offered as an option in the user config?

I'll get back with the other information as soon as I can, but this may take a couple of days.

Geoff.
So, first, I added that option to firmware:

Code: Select all

// in the case of EBIKE_THROTTLE_TYPE = EBIKE_THROTTLE_TYPE_THROTTLE_PAS, LCD assist level will apply only to PAS
#define EBIKE_THROTTLE_TYPE_THROTTLE_PAS_ASSIST_LEVEL_PAS_ONLY
You can verify the small changes I did here -- I didn't test but the firmware did built.

Before being worried about that lack of efficiency with the motor, try first understand if the LCD is working (from LCD --> firmware). You will not be able to set P3 value if LCD is not working. Well, you can if you go to main.h and change the default value of:

Code: Select all

#define DEFAULT_VALUE_POWER_ASSIST_CONTROL_MODE 1
If your motor runs well but it is asking to much current with wheel on the air, like 321W (I = 321/48 = 6.7A), try adjust FOC_READ_ID_CURRENT_ANGLE_ADJUST value but like at throttle half or quarter value, not at max value (but in the end, compare also current with max value of throttle).
NOTE: my Q85 328RPM motor, at 30V, uses about 1.8A at max speed of ERPM = 520 (that gives wheel speed of 30 km/h). The firmware limits the ERPM to 520, so you will compare the same max speed as me.
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

casainho
100 kW
100 kW
Posts: 1144
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Jan 03, 2018 9:49 pm

stancecoke wrote:
Jan 03, 2018 1:53 pm
We should improve the code: Sending Data from the controller to the display only if a valid message from the display was received. When we get no speed information on the display, we definitly know, that there's something wrong with the received messages.
That sounds a good idea but at the same time, not good in a way that user will not understand if LCD is working or not at all and can be a wiring problem. This way, at least we can see wiring may be good.
If the motor runs, it is easy to test LCD by changing the assist level and see the result on the motor speed.
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

casainho
100 kW
100 kW
Posts: 1144
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Jan 03, 2018 9:57 pm

stancecoke wrote:
Jan 03, 2018 2:05 pm
casainho wrote:
Jan 03, 2018 1:59 pm
the original may have less 30% wasted energy on the PWM commutations and meaning maybe 30% warmer on our firmware
Do you have some literature on this topic? I want to understand that!
http://www.ccs.asia.edu.tw/ezfiles/2/10 ... 703-21.pdf
We are using top but original firmwares uses bottom:
Image

Oiriginal PWM scheme: https://opensourceebikefirmware.bitbuck ... eware.html
Our PWM scheme: https://eggelectricunicycle.bitbucket.i ... ntrol.html
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

casainho
100 kW
100 kW
Posts: 1144
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Jan 03, 2018 10:09 pm

stancecoke wrote:
Jan 03, 2018 2:48 pm
casainho wrote:
Jan 03, 2018 2:17 pm
I would like to understand what you mean, what you think may be happening so I can try to improve this. Please look at my answer.
In the "Forumscontroller-" code it is solved by checking the ratio of the PAS_High_counter to the PAS_Low_counter:
Maybe you misunderstood the information (or it was me).

I think geofft want to say pushing by hand the bike -- (and on this situation, will regen and that is why it may for some reason drive motor forward at sometimes, because regen control will change PWM duty_cycle...)

The current PAS code seems to work well for me, it detects well when rotating pedals backwards and outputs ui8_pas_cadence_rpm = 0 on that case.
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

User avatar
stancecoke
1 kW
1 kW
Posts: 415
Joined: Aug 02, 2017 2:56 pm

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

Post by stancecoke » Jan 04, 2018 5:58 am

@casainho: There was a post with several questions in the german forum.

especially the things concerning the LCD3 I don't know exactly. Perhaps you can help.

Translation by deepl.com:
What settings and displays are not available on the LCD3?
Where is the speed limit set? Display?
Is the speed signal determined via the external speed sensor and thus also the speed limit is maintained? The S06SC (Central Motor) is currently available for mid-engine applications.
Cheat time? If I need this, can I leave it out? What do I have to set, according to the instructions it doesn't work yet)
Leave engine type? open for new engine selection?
Torque sensor mode? What do I have to select for the known current level control?
How and where is the original Yamaha torque sensor connected?
What about the standard functions:
Low-voltage protection 30/40V (switching off the controller when the battery voltage falls below this level)
Overcurrent protection
Overtemperature protection - Output short-circuit protection (motor phases)
regards
stancecoke

casainho
100 kW
100 kW
Posts: 1144
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Jan 04, 2018 6:44 am

stancecoke wrote:
Jan 04, 2018 5:58 am
Translation by deepl.com:
What settings and displays are not available on the LCD3?
Where is the speed limit set? Display?
Is the speed signal determined via the external speed sensor and thus also the speed limit is maintained? The S06SC (Central Motor) is currently available for mid-engine applications.
Cheat time? If I need this, can I leave it out? What do I have to set, according to the instructions it doesn't work yet)
Leave engine type? open for new engine selection?
Torque sensor mode? What do I have to select for the known current level control?
How and where is the original Yamaha torque sensor connected?
What about the standard functions:
Low-voltage protection 30/40V (switching off the controller when the battery voltage falls below this level)
Overcurrent protection
Overtemperature protection - Output short-circuit protection (motor phases)
LCD can change:
- assist level
- max wheel speed
- P3: Power Assist Control Mode

Speed limit is for wheel speed. The external sensor is supported and when it is not connected, motor speed will be used instead.
There is no cheat time implementation, yet.
There is no engine type option.

Low voltage protection is implemented but currently, we can select only 24, 36 or 48V that are the most common battery voltages. Other values can be implemented quickly -- I can do that if the user explains why he needs that, I want to know the user case.

Overcurrent protection works, for the value the user selects when configuring the firmware.

Overtemperature of what? motor or controller?

Shortcircuit is implemented by the motor overcurrent.
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

User avatar
stancecoke
1 kW
1 kW
Posts: 415
Joined: Aug 02, 2017 2:56 pm

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

Post by stancecoke » Jan 04, 2018 7:59 am

Thanks!
The controller temperature was meant. Is there an internal temperature sensor on the PCB? I can't find one in the schematic.

regards
stancecoke

casainho
100 kW
100 kW
Posts: 1144
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Jan 04, 2018 9:17 am

stancecoke wrote:
Jan 04, 2018 7:59 am
Thanks!
The controller temperature was meant. Is there an internal temperature sensor on the PCB? I can't find one in the schematic.
I think this controllers don't have temperature sensor. Maybe they are developed to withstand mempeax temperature, for the max current over a large period of time and at an higher ambient temperature.
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

Post Reply