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

Electric Motors and Controllers
casainho
100 kW
100 kW
Posts: 1485
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 » Apr 06, 2018 4:39 am

stancecoke wrote:
Apr 06, 2018 4:23 am
casainho wrote:
Apr 06, 2018 4:03 am
Can't you try a recent version to see if the issue disappears?
Sorry, I don't want to waste hours struggeling with cygwin again :shock:

A workaround is to comment out line 189 of the ebike_app.c, then it works, why ever and I can try to improve the PAS-processing

Code: Select all

//ebike_app_set_error (EBIKE_APP_ERROR_06_SHORT_CIRCUIT);
The big issue is that I don't want to go back on the code, I think it is already most well structured and I see the end of this project soon (or at least I want to). Also because I want to move to TSDZ2 mid drive motors because I think they have great potential as being the cheapest mid drive motors, just like what Kunteng motor controllers are for geared and direct drive hub motors. And seems mid drive motors are also popular and seem to be a better solution for who rides on hills. And they use also same STM8S105 as Kunteng motor controllers, but the version with 16kbytes flash memory (half of the size of Kunteng motor controllers, although I think they don't implement sinewave/FOC due to high motor RPM needs, so, they need only half of flash memory).

So, seems I am the only one capable to build the firmware because for some reason the SDDC version on Linux builds ok the current firmware version. This is sad for every other users and seems they use Windows and so they will not be able to build the firmware anymore.
Developer of the Flexible OpenSource firmware for EBike motor controllers:
- Kunteng/BMSBattery VLR FOC motor controller: https://opensourceebikefirmware.bitbucket.io/
- TongSheng TSDZ2 mid drive motor controller: https://opensourceebikefirmware.bitbuck ... ment_tsdz2

User avatar
stancecoke
10 kW
10 kW
Posts: 562
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 » Apr 06, 2018 6:10 am

OK, no problem. If anyone want's to use the improved PAS- and regen- functions, he can switch to the High Speed Motor fork :wink:

I'm looking forward to the new project with the TSDZ2 :-)

regards
stancecoke

casainho
100 kW
100 kW
Posts: 1485
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 » Apr 06, 2018 7:13 am

stancecoke wrote:
Apr 02, 2018 12:18 pm
Oh, I hope you weren't injured when the crank broke off....

I found a bug now: In the main.h you define

Code: Select all

// *************************************************************************** //
// Throotle and PAS

#define EBIKE_THROTTLE_TYPE_THROTTLE_PAS		1
#define EBIKE_THROTTLE_TYPE_TORQUE_SENSOR		2
// *************************************************************************** //
with this, the #if statements in the ebike_app.c don't work properly....
I commented out these entries in the main.h, now the right #if statements are active in eclipse (not greyed in the code).
I verified with the following changes to a piece of code:

Code: Select all

#if (EBIKE_THROTTLE_TYPE == EBIKE_THROTTLE_TYPE_THROTTLE_PAS)
  // map throttle value from 0 up to 255 to global variable: ui8_throttle_value
  // setup ui8_is_throttle_released flag
  throttle_read ();
#error "EBIKE_THROTTLE_TYPE == EBIKE_THROTTLE_TYPE_THROTTLE_PAS"
#elif (EBIKE_THROTTLE_TYPE == EBIKE_THROTTLE_TYPE_TORQUE_SENSOR)
  torque_sensor_throttle_read ();
#error "EBIKE_THROTTLE_TYPE == EBIKE_THROTTLE_TYPE_TORQUE_SENSOR"
#else
#error "none defined"
#endif
and I got the expected error while testing:
- #error "EBIKE_THROTTLE_TYPE == EBIKE_THROTTLE_TYPE_THROTTLE_PAS"
- #error "EBIKE_THROTTLE_TYPE == EBIKE_THROTTLE_TYPE_TORQUE_SENSOR"
- #error "none defined"

Maybe you did some mistake, I hope.
Developer of the Flexible OpenSource firmware for EBike motor controllers:
- Kunteng/BMSBattery VLR FOC motor controller: https://opensourceebikefirmware.bitbucket.io/
- TongSheng TSDZ2 mid drive motor controller: https://opensourceebikefirmware.bitbuck ... ment_tsdz2

User avatar
stancecoke
10 kW
10 kW
Posts: 562
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 » Apr 06, 2018 8:41 am

If I set

Code: Select all

#define EBIKE_THROTTLE_TYPE EBIKE_THROTTLE_TYPE_THROTTLE_PAS
in the config.h, this setting is ignored in the ebike_app.c, see eclipse screenshot.

If I comment out the two lines in the main.h, the settings in the ebike_app.c are OK....

regards
stancecoke
Attachments
right ifdefs.PNG
right ifdefs.PNG (19.25 KiB) Viewed 353 times
wrong ifdefs.PNG
wrong ifdefs.PNG (19.37 KiB) Viewed 353 times

casainho
100 kW
100 kW
Posts: 1485
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 » Apr 06, 2018 11:33 am

The Eclipse version I use do show me as I expect... maybe yours is looking for values also in config-example.h??
Anyway, I tested with #error to see when SDDC builds and if it "passes" on that specific piece of code.
Developer of the Flexible OpenSource firmware for EBike motor controllers:
- Kunteng/BMSBattery VLR FOC motor controller: https://opensourceebikefirmware.bitbucket.io/
- TongSheng TSDZ2 mid drive motor controller: https://opensourceebikefirmware.bitbuck ... ment_tsdz2

casainho
100 kW
100 kW
Posts: 1485
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 » Apr 06, 2018 11:37 am

I tried to run with a wheel speed controller mode only and this mode works well, although I will go back to mode speed + current mode.

Also I found that battery SOC on display was wrong (again!!) and I corrected it. It seems to works as expected now. Added 1 more level to SOC: flashing when battery is under 10%.

Code: Select all

// Considering the follow voltage values for each li-ion battery cell
// State of charge 		| voltage
#define LI_ION_CELL_VOLTS_MAX 	4.25
#define LI_ION_CELL_VOLTS_100 	4.20
#define LI_ION_CELL_VOLTS_80 	4.02
#define LI_ION_CELL_VOLTS_60 	3.87
#define LI_ION_CELL_VOLTS_40 	3.80
#define LI_ION_CELL_VOLTS_20 	3.73
#define LI_ION_CELL_VOLTS_10 	3.69
#define LI_ION_CELL_VOLTS_0 	3.27
#define LI_ION_CELL_VOLTS_MIN 	3.10

#define BATTERY_PACK_VOLTS_100	((float) LI_ION_CELL_VOLTS_100 * (BATTERY_LI_ION_CELLS_NUMBER << 8))
#define BATTERY_PACK_VOLTS_80	((float) LI_ION_CELL_VOLTS_80  * (BATTERY_LI_ION_CELLS_NUMBER << 8))
#define BATTERY_PACK_VOLTS_60	((float) LI_ION_CELL_VOLTS_60  * (BATTERY_LI_ION_CELLS_NUMBER << 8))
#define BATTERY_PACK_VOLTS_40	((float) LI_ION_CELL_VOLTS_40  * (BATTERY_LI_ION_CELLS_NUMBER << 8))
#define BATTERY_PACK_VOLTS_20	((float) LI_ION_CELL_VOLTS_20  * (BATTERY_LI_ION_CELLS_NUMBER << 8))
#define BATTERY_PACK_VOLTS_10	((float) LI_ION_CELL_VOLTS_10  * (BATTERY_LI_ION_CELLS_NUMBER << 8))
#define BATTERY_PACK_VOLTS_0	((float) LI_ION_CELL_VOLTS_0   * (BATTERY_LI_ION_CELLS_NUMBER << 8))

Code: Select all

  // calc battery pack state of charge (SOC)
  ui16_battery_volts = ((uint16_t) ebike_app_get_ADC_battery_voltage_filtered ()) * ((uint16_t) ADC_BATTERY_VOLTAGE_K);
  if (ui16_battery_volts > ((uint16_t) BATTERY_PACK_VOLTS_80)) { ui8_battery_soc = 16; } // 4 bars | full
  else if (ui16_battery_volts > ((uint16_t) BATTERY_PACK_VOLTS_60)) { ui8_battery_soc = 12; } // 3 bars
  else if (ui16_battery_volts > ((uint16_t) BATTERY_PACK_VOLTS_40)) { ui8_battery_soc = 8; } // 2 bars
  else if (ui16_battery_volts > ((uint16_t) BATTERY_PACK_VOLTS_20)) { ui8_battery_soc = 4; } // 1 bar
  else if (ui16_battery_volts > ((uint16_t) BATTERY_PACK_VOLTS_10)) { ui8_battery_soc = 3; } // empty
  else { ui8_battery_soc = 1; } // flashing
Developer of the Flexible OpenSource firmware for EBike motor controllers:
- Kunteng/BMSBattery VLR FOC motor controller: https://opensourceebikefirmware.bitbucket.io/
- TongSheng TSDZ2 mid drive motor controller: https://opensourceebikefirmware.bitbuck ... ment_tsdz2

User avatar
stancecoke
10 kW
10 kW
Posts: 562
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 » Apr 06, 2018 11:49 am

casainho wrote:
Apr 06, 2018 11:33 am
The Eclipse version I use do show me as I expect...
Obviously there are more differences between the toolchain in linux and the toolchain in windows. Perhaps geofft or honya96 can crosscheck my findings in a windows system, for me the errors were reproducable on two different laptops...

regards
stancecoke
Last edited by stancecoke on Apr 06, 2018 11:54 am, edited 1 time in total.

casainho
100 kW
100 kW
Posts: 1485
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 » Apr 06, 2018 11:52 am

stancecoke wrote:
Apr 06, 2018 11:49 am
casainho wrote:
Apr 06, 2018 11:33 am
The Eclipse version I use do show me as I expect...
Obviously there are more differences between the toolchain in linux and the toolchain in windows. Perhaps geofft or d can crosscheck my findings in a windows system...
Can you quick try with #error? That is a safe why to see.
Developer of the Flexible OpenSource firmware for EBike motor controllers:
- Kunteng/BMSBattery VLR FOC motor controller: https://opensourceebikefirmware.bitbucket.io/
- TongSheng TSDZ2 mid drive motor controller: https://opensourceebikefirmware.bitbuck ... ment_tsdz2

geofft
100 W
100 W
Posts: 151
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 » Apr 06, 2018 12:04 pm

stancecoke wrote:
Apr 06, 2018 11:49 am
casainho wrote:
Apr 06, 2018 11:33 am
The Eclipse version I use do show me as I expect...
Obviously there are more differences between the toolchain in linux and the toolchain in windows. Perhaps geofft or honya96 can crosscheck my findings in a windows system, for me the errors were reproducable on two different laptops...
....hopefully will get a chance to try this over the weekend, will let you know the result.
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

User avatar
stancecoke
10 kW
10 kW
Posts: 562
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 » Apr 06, 2018 12:09 pm

casainho wrote:
Apr 06, 2018 11:52 am
Can you quick try with #error? That is a safe why to see.
Where is the message shown?

regards

casainho
100 kW
100 kW
Posts: 1485
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 » Apr 06, 2018 12:12 pm

stancecoke wrote:
Apr 06, 2018 12:09 pm
casainho wrote:
Apr 06, 2018 11:52 am
Can you quick try with #error? That is a safe why to see.
Where is the message shown?
During build time. If you put #error on a line that is built, you will get the error.
Developer of the Flexible OpenSource firmware for EBike motor controllers:
- Kunteng/BMSBattery VLR FOC motor controller: https://opensourceebikefirmware.bitbucket.io/
- TongSheng TSDZ2 mid drive motor controller: https://opensourceebikefirmware.bitbuck ... ment_tsdz2

User avatar
stancecoke
10 kW
10 kW
Posts: 562
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 » Apr 06, 2018 12:23 pm

To be sure, that nothing goes wrong, I've deleted the config_example from the file system.

And I can confirm: If the lines in the main.h are not commented out, the error "Torquesensor" occurs.

Code: Select all

#if (EBIKE_THROTTLE_TYPE == EBIKE_THROTTLE_TYPE_THROTTLE_PAS)
  ebike_throttle_type_throttle_pas ();
#error "Throttle"
#elif (EBIKE_THROTTLE_TYPE == EBIKE_THROTTLE_TYPE_TORQUE_SENSOR)
  ebike_throttle_type_torque_sensor ();
#error "Torquesensor"
#else
#error "not defined"
#endif

Code: Select all

ebike_app.c:153:2: error: #error "Torquesensor"
regards
stancecoke

casainho
100 kW
100 kW
Posts: 1485
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 » Apr 06, 2018 12:53 pm

stancecoke wrote:
Apr 06, 2018 12:23 pm
And I can confirm: If the lines in the main.h are not commented out, the error "Torquesensor" occurs.

Code: Select all

#if (EBIKE_THROTTLE_TYPE == EBIKE_THROTTLE_TYPE_THROTTLE_PAS)
  ebike_throttle_type_throttle_pas ();
#error "Throttle"
#elif (EBIKE_THROTTLE_TYPE == EBIKE_THROTTLE_TYPE_TORQUE_SENSOR)
  ebike_throttle_type_torque_sensor ();
#error "Torquesensor"
#else
#error "not defined"
#endif

Code: Select all

ebike_app.c:153:2: error: #error "Torquesensor"
So it seems to be working as supposed as on config.h file you should have other define:

Code: Select all

#define EBIKE_THROTTLE_TYPE EBIKE_THROTTLE_TYPE_TORQUE_SENSOR
Developer of the Flexible OpenSource firmware for EBike motor controllers:
- Kunteng/BMSBattery VLR FOC motor controller: https://opensourceebikefirmware.bitbucket.io/
- TongSheng TSDZ2 mid drive motor controller: https://opensourceebikefirmware.bitbuck ... ment_tsdz2

User avatar
stancecoke
10 kW
10 kW
Posts: 562
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 » Apr 06, 2018 1:05 pm

casainho wrote:
Apr 06, 2018 12:53 pm
So it seems to be working as supposed as on config.h file you should have other define:

Code: Select all

#define EBIKE_THROTTLE_TYPE EBIKE_THROTTLE_TYPE_TORQUE_SENSOR
no, as I wrote before, in the config.h EBIKE_THROTTLE_TYPE EBIKE_THROTTLE_TYPE_THROTTLE_PAS is defined.
Please, install windows on one of your computers and try it yourself, if you don't believe me :wink:

regards
stancecoke

Code: Select all

/*
 * config.h
 *
 *  Automatically created by Flexible OpenSource firmware - Configuration tool
 *  Author: stancecoke
 *  Author: casainho
 */

#ifndef CONFIG_H_
#define CONFIG_H_

//#define EBIKE_THROTTLE_TYPE EBIKE_THROTTLE_TYPE_TORQUE_SENSOR
#define EBIKE_THROTTLE_TYPE EBIKE_THROTTLE_TYPE_THROTTLE_PAS
#define EBIKE_THROTTLE_TYPE_THROTTLE_PAS_CURRENT_SPEED
#define EBIKE_THROTTLE_TYPE_THROTTLE_PAS_ASSIST_LEVEL_PAS_ONLY
#define PAS_NUMBER_MAGNETS 12
#define PAS_MAX_CADENCE_RPM 80
#define PAS_DIRECTION PAS_DIRECTION_RIGHT
#define ASSIST_LEVEL_0 0.0
#define ASSIST_LEVEL_1 0.2
#define ASSIST_LEVEL_2 0.4
#define ASSIST_LEVEL_3 0.6
#define ASSIST_LEVEL_4 0.8
#define ASSIST_LEVEL_5 1.0
#define BATTERY_LI_ION_CELLS_NUMBER 13
#define ADC_BATTERY_CURRENT_MAX 35
#define ADC_BATTERY_REGEN_CURRENT_MAX 35
#define MOTOR_ROTOR_OFFSET_ANGLE 210 // 210 adjusted as a good value for Q11 direct drive motor
#define FOC_READ_ID_CURRENT_ANGLE_ADJUST 115
#define FOC_READ_ID_CURRENT_ANGLE_ADJUST_INVERT 242
#define MOTOR_ROTOR_ERPS_START_INTERPOLATION_60_DEGREES 10
#define ADC_MOTOR_CURRENT_MAX 120
#define ADC_MOTOR_REGEN_CURRENT_MAX 66
#define PWM_DUTY_CYCLE_RAMP_UP_INVERSE_STEP 10
#define PWM_DUTY_CYCLE_RAMP_DOWN_INVERSE_STEP 10

#define EBIKE_REGEN_EBRAKE_LIKE_COAST_BRAKES

#endif /* CONFIG_H_ */

casainho
100 kW
100 kW
Posts: 1485
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 » Apr 06, 2018 1:17 pm

Hmmm, that is really strange. Mayne you can #undefine and use #error and then define again and use error. Maybe there is a way to print the value of that macro/define....
I don't know how I can help, because it works for me and the defines seems to be correct. You be great if someone with experience could revoew this defines...
Developer of the Flexible OpenSource firmware for EBike motor controllers:
- Kunteng/BMSBattery VLR FOC motor controller: https://opensourceebikefirmware.bitbucket.io/
- TongSheng TSDZ2 mid drive motor controller: https://opensourceebikefirmware.bitbuck ... ment_tsdz2

casainho
100 kW
100 kW
Posts: 1485
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 » Apr 06, 2018 1:30 pm

stancecoke wrote:
Apr 06, 2018 12:23 pm
And I can confirm: If the lines in the main.h are not commented out, the error "Torquesensor" occurs.
Wait! So if we do not use that 2 lines, everything works as expected, right??

Because the macro value is defined on main.h and also on config.h, which I guess should not happen!! Should be definwd only once I think... If so, you got it and I took a long time to understand :-)
Developer of the Flexible OpenSource firmware for EBike motor controllers:
- Kunteng/BMSBattery VLR FOC motor controller: https://opensourceebikefirmware.bitbucket.io/
- TongSheng TSDZ2 mid drive motor controller: https://opensourceebikefirmware.bitbuck ... ment_tsdz2

geofft
100 W
100 W
Posts: 151
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 » Apr 06, 2018 1:37 pm

stancecoke wrote:
Apr 03, 2018 1:28 pm
casainho wrote:
Apr 03, 2018 4:16 am
Please update your master branch as I just update it with my most recent code.
The recent master branch throws an error while compiling with windows. :(

Code: Select all

ebike_app.asm:366: Error: <a> machine specific addressing or addressing mode error
ebike_app.asm:403: Error: <a> machine specific addressing or addressing mode error
Can you fix that? Otherwise I have to start from an earlier commit...

regards
stancecoke
I've just given this a quick try (with either Torque_Sensor or Throttle_Pas selected in Config.h), looks like I'm getting the same errors as Stancecoke (above).... :?

Edit: Crossed posts with casainho, looks like he might now be sorting this?
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

User avatar
stancecoke
10 kW
10 kW
Posts: 562
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 » Apr 06, 2018 2:14 pm

geofft wrote:
Apr 06, 2018 1:37 pm
Edit: Crossed posts with casainho, looks like he might now be sorting this?
Thank you for the fast testing! We have two different topics. The one with the #defines (solved now) and the one with the errors while compiling (not solved yet)....

regards
stancecoke

casainho
100 kW
100 kW
Posts: 1485
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 » Apr 06, 2018 3:18 pm

stancecoke wrote:
Apr 06, 2018 2:14 pm
the one with the errors while compiling (not solved yet)....
Something tells me this one will be hard.

I am thinking that may be a good idea to have only one firmware for both motor controllers: Kunteng KT and Tongsheng TSDZ2. Because that way we can reuse most of the tools, since the build tools up to software configuration tool, and maybe most important, keep the users together and that way I hope both firmwares will be strong. Also I think this 2 systems are kind of a complement and not duplicate, they together will cover wider range of ebike types/needs. I think they share the same philosophy: work well, really cheap, easy to buy in many online shops including spare parts for customization or repair.
Last edited by casainho on Apr 06, 2018 5:23 pm, edited 1 time in total.
Developer of the Flexible OpenSource firmware for EBike motor controllers:
- Kunteng/BMSBattery VLR FOC motor controller: https://opensourceebikefirmware.bitbucket.io/
- TongSheng TSDZ2 mid drive motor controller: https://opensourceebikefirmware.bitbuck ... ment_tsdz2

casainho
100 kW
100 kW
Posts: 1485
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 » Apr 06, 2018 5:18 pm

There are a lot of potential, as shops sells programmed controllers to have one of the 3 possible battery voltages (36V, 48V and 52V) and different currents / powers (like 250W, 350W, 500W and 750W versions). Will be much better when we can buy one version and configure for our specific battery pack voltage and max current for our specific needs and no need to buy other controllers.

On 25 April, the project of firmware for Kunteng will make 1 year and maybe I should start to TSDZ2 motors on the same day this year :-)

TSDZ2 motor is appealing also because is more simple to install for no tech users (no need touch on bicycle wheels) and even no need to use/install brake wires, throttle or gear shift sensor. Only needs wheel speed sensor + LCD installation.
eyebyesickle wrote:
Apr 06, 2018 4:48 pm
casainho wrote:
Apr 06, 2018 3:19 am
eyebyesickle wrote:
Apr 05, 2018 12:39 pm
casainho wrote:
Apr 05, 2018 11:24 am
Nice to know that this controllers can hold 18A, this means 48V version can hold 864W (900W considering a full charged battery) with and not can the 720W (advertised 750W, considering battery will hold a bit higher voltage when charged) of 48V * 15A controller. I think 15A controller is just a configured parameter on the firmware and not the controller max current limit, that should be at least that 18A!!
Take note, alot of resellers claim 18a, but almost no one actually knows or sets it at that. FutureBike Italy is on top of his stuff, so he probably does have the 18a, but I know EVERY other company I contact doesn't even really know. If you scroll way back in this thread, you will see where I opened some '18a' motors, and they had a 15a controller inside. Furthermore, the 15a controllers usually are only set to 13a!, so take note...

18a is the highest I recommend though, FYI....
Thank you for your help. And about the voltages, do you think they can also be configured? like the 52V motor controller be configured to work at 48V and 36V?
Yes, from what I can tell, all 6 pin controllers are the same, and all 8 pin controllers are the same, you can just program them as needed. The 36v and 48v motors are different however, with slightly different winds.
Developer of the Flexible OpenSource firmware for EBike motor controllers:
- Kunteng/BMSBattery VLR FOC motor controller: https://opensourceebikefirmware.bitbucket.io/
- TongSheng TSDZ2 mid drive motor controller: https://opensourceebikefirmware.bitbuck ... ment_tsdz2

casainho
100 kW
100 kW
Posts: 1485
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 » Apr 06, 2018 5:53 pm

stancecoke wrote:
Apr 06, 2018 2:14 pm
geofft wrote:
Apr 06, 2018 1:37 pm
Edit: Crossed posts with casainho, looks like he might now be sorting this?
Thank you for the fast testing! We have two different topics. The one with the #defines (solved now) and the one with the errors while compiling (not solved yet)....
If I comment the 2 lines at main.h:

Code: Select all

//#define EBIKE_THROTTLE_TYPE_THROTTLE_PAS		1
//#define EBIKE_THROTTLE_TYPE_TORQUE_SENSOR		2
I get EBIKE_THROTTLE_TYPE_THROTTLE_PAS selected even if on config.h I have #define EBIKE_THROTTLE_TYPE EBIKE_THROTTLE_TYPE_TORQUE_SENSOR. I can also comment that line on config.h and the selection will also be the EBIKE_THROTTLE_TYPE_THROTTLE_PAS. So, seems the way was before is the correct way -- can you please confirm Stancecoke, that changing on config.h will have the expected result (with the commented lines on main.h)??
Developer of the Flexible OpenSource firmware for EBike motor controllers:
- Kunteng/BMSBattery VLR FOC motor controller: https://opensourceebikefirmware.bitbucket.io/
- TongSheng TSDZ2 mid drive motor controller: https://opensourceebikefirmware.bitbuck ... ment_tsdz2

User avatar
stancecoke
10 kW
10 kW
Posts: 562
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 » Apr 07, 2018 2:47 am

with windows it's vice versa: if the two lines in the main.h are not commented out, always torquesensormode is active....

regards
stancecoke

casainho
100 kW
100 kW
Posts: 1485
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 » Apr 08, 2018 5:07 am

I installed SDCC 3.7.0 and the built firmware has 18kbytes of flash memory instead of 25kbytes as when was built with SDCC 3.6.0. An improvement of about 40%, and yes, the firmware works well.

TSDZ2 motor controller has only 16 kbytes flash memory, so I think using SDCC 3.7.0 is a must for that project.
Developer of the Flexible OpenSource firmware for EBike motor controllers:
- Kunteng/BMSBattery VLR FOC motor controller: https://opensourceebikefirmware.bitbucket.io/
- TongSheng TSDZ2 mid drive motor controller: https://opensourceebikefirmware.bitbuck ... ment_tsdz2

casainho
100 kW
100 kW
Posts: 1485
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 » Apr 08, 2018 8:47 am

Between sun and rain, today I did a good ride of 1h30 betweem home and near beachs.
The firmware was built with SDCC 3.7.0.

The only thing I would like to explore a different approach is the current and speed controllers, however current ones work well.

Image
Developer of the Flexible OpenSource firmware for EBike motor controllers:
- Kunteng/BMSBattery VLR FOC motor controller: https://opensourceebikefirmware.bitbucket.io/
- TongSheng TSDZ2 mid drive motor controller: https://opensourceebikefirmware.bitbuck ... ment_tsdz2

geofft
100 W
100 W
Posts: 151
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 » Apr 08, 2018 9:13 am

casainho wrote:
Apr 08, 2018 8:47 am
Between sun and rain, today I did a good ride of 1h30 betweem home and near beachs.
The firmware was built with SDCC 3.7.0.
Will you be making this latest version be available on github sometime? I just wondered if it may have any effect on the (windows users) compiling issue?
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48SVPR 20amp, LCD3, 48v 12s lipo.

Post Reply