TSDZ2 mid drive and 850C and SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Electric Motors and Controllers
orfait   10 µW

10 µW
Posts: 5
Joined: Feb 26 2019 7:51am

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by orfait » Mar 18 2019 11:42am

NIPSEN wrote:
Mar 18 2019 11:04am
bs47G wrote:
Mar 18 2019 10:50am
Currently I am a step before installing kit on the bike. Could you advise me how many milliohms is recommended to set for my battery (13s5p Sanyo 17,5A NCR18650GA 840Wh)? I set default 130 but I guess this number have to be different.
It seems that the internal resistance of one cell is 40mOhm, as you have 13 in series, this gives a total resistance of 520mOhm.
5 in parallel, 13 in serie : 105 mOhms

maximusdm   10 W

10 W
Posts: 78
Joined: Sep 08 2018 12:51pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by maximusdm » Mar 18 2019 4:21pm

casainho wrote:
Mar 18 2019 5:30am
At higher speeds you may be near the limit of motor speed. Please look on LCD3 for the motor erps speed and the PWM duty-cycle value. If PWM duty-cycle is like 250 at that situations, then you are on the limit of the motor and the energy that flows to the motor drops. You can get the max energy flow to the motor at near 0 speed of the motor and vice-versa.
ERPS speed goes around 480 at high load
PWM duty-cycle hits 254 quite easy

Is there a way to overcome this limitation? Can this be increased?
High cadence mode for 48v helps here?

James Broadhurst   10 W

10 W
Posts: 73
Joined: Nov 10 2016 3:29pm
Location: Oxford, England

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by James Broadhurst » Mar 18 2019 5:43pm

NIPSEN wrote:
Mar 18 2019 11:04am
It seems that the internal resistance of one cell is 40mOhm, as you have 13 in series, this gives a total resistance of 520mOhm.
Is it not the sum of the inverse parallel cells so 40 mohm per cell would be for a 4p pack 10mohm and if 13s, total 130mohm?

NIPSEN   100 mW

100 mW
Posts: 38
Joined: Feb 26 2019 5:14pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by NIPSEN » Mar 18 2019 6:16pm

James Broadhurst wrote:
Mar 18 2019 5:43pm
orfait wrote:
Mar 18 2019 11:42am
NIPSEN wrote:
Mar 18 2019 11:04am
bs47G wrote:
Mar 18 2019 10:50am
Currently I am a step before installing kit on the bike. Could you advise me how many milliohms is recommended to set for my battery (13s5p Sanyo 17,5A NCR18650GA 840Wh)? I set default 130 but I guess this number have to be different.
It seems that the internal resistance of one cell is 40mOhm, as you have 13 in series, this gives a total resistance of 520mOhm.
5 in parallel, 13 in serie : 105 mOhms
Is it not the sum of the inverse parallel cells so 40 mohm per cell would be for a 4p pack 10mohm and if 13s, total 130mohm?
Oh sorry guys, it's 104 mOhms for 13S5P (8mOhm for 5P multiply by 13). :oops:

thineight   100 W

100 W
Posts: 211
Joined: Oct 05 2018 3:53am

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by thineight » Mar 18 2019 6:51pm

For the developers: last update of marcoq firmware after few bugs correction, useful to take a look at the backwards resistance code (don't know if this changed from yesterday's rev. 0.3)

http://www.jobike.it/Public/data/marcoq ... _0.3.2.zip

No fried controllers reported so far in the other forum...
MTB KTM Ultra 29" - City bike DAYTONA 28"

User avatar
jbalat   10 kW

10 kW
Posts: 570
Joined: Nov 10 2012 11:50pm
Location: Melbourne, Australia

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by jbalat » Mar 18 2019 10:44pm

maximusdm wrote:
Mar 18 2019 5:26am
I managed to do some good testing of 0.18.2 in the past 3 weeks.
A strange thing that I noticed is that in some cases even if the human power increases, the motor power in W drops. This happens at higher speeds. Also if I use assist of 0.6 and assist of 4 it is almost same difficulty to pass 42-43 km/h.
Scenario:
- Setup: run 0.6 assistance, speed 35km/h
- Start to press harder maintaining the cadence
- Screen shows a drop from 400w to 300w

Any ideas? It looks like the easier you press the harder you are assisted.
Maximus, I noticed that too as soon as you back off the watts go up and definitely not at max cadence but perhaps close to the max duty cycle ? It doesnt make sense though by backing off the torque a little you get an increase in power.. There must be something wrong there somewhere ?? I have definitely noticed I can get more power in this range with the high cadence mods for sure...
Please subscribe to my Youtube home page for Quadcopters, FPV and Bike Rides http://www.youtube.com/jbalatutube
My build log here http://endless-sphere.com/forums/viewto ... =6&t=55352
For some cool ebike talk join us on The Best ebike https://www.facebook.com/groups/193581737807033/
Tech talk TSDZ2 Opensource firmware https://endless-sphere.com/forums/viewt ... &start=150
Opensource TSDZ2 Wiki https://github.com/OpenSource-EBike-fir ... _wiki/wiki

Rydon   100 W

100 W
Posts: 244
Joined: Aug 11 2016 5:26pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by Rydon » Mar 18 2019 11:46pm

casainho wrote:
Mar 17 2019 2:22pm

Rydon, can you help on this questions??
Yes, as soon as possible. Unfortunately, I am slammed this week and also need to get the coaster brake bike back in the shop. Next week for sure.

User avatar
eyebyesickle   10 kW

10 kW
Posts: 697
Joined: Apr 07 2015 9:28pm
Location: Nashville

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by eyebyesickle » Mar 19 2019 12:49am

I am just now starting to dig deep on this, as I have been laid up mostly, and not able to test myself.... so now that I have been riding...no matter what I try to do I notice that when I am pedaling HARD, at FAST CADENCE/RPM - the motor starts to 'shudder' a little bit... I tried variations of riding/pedaling style,and could not replicate the problem by ONLY pedaling HARD, or ONLY pedaling FAST, but when I pedal HARD AND FAST, once I hit around 90ish RPM at the cranks - Motor SHUDDER/unbalanced rotation or something...

Am I just topping out the RPM and need to look at the settings you guys are referring to? I like the smooth roll-on variations of power compared to the micro steps from the stock firmware, but when hitting max/min power, and like I described above...things can get a little jolty and rough... still trying various setups... but I have rode a bit with around 10 different configurations, and so far at one point or another, I am hitting rough patches where the motor power is not smooth...

Any recommendations? (as I scramble to go back and re-read this)...

User avatar
jbalat   10 kW

10 kW
Posts: 570
Joined: Nov 10 2012 11:50pm
Location: Melbourne, Australia

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by jbalat » Mar 19 2019 5:02am

Eyebyecickle That's what happens when you hit the max cadence. When you use the high cadence mods it's actually really smooth and powerful at 90+ rpm but as mentioned above the power can start dropping off a little which I can't explain.
Please subscribe to my Youtube home page for Quadcopters, FPV and Bike Rides http://www.youtube.com/jbalatutube
My build log here http://endless-sphere.com/forums/viewto ... =6&t=55352
For some cool ebike talk join us on The Best ebike https://www.facebook.com/groups/193581737807033/
Tech talk TSDZ2 Opensource firmware https://endless-sphere.com/forums/viewt ... &start=150
Opensource TSDZ2 Wiki https://github.com/OpenSource-EBike-fir ... _wiki/wiki

andrea_104kg   100 W

100 W
Posts: 177
Joined: Mar 05 2018 5:51pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by andrea_104kg » Mar 19 2019 5:17am

I believe it is a characteristic of the simple torsimeter of the tsdz2. needs to feel the strength of the wheel to give power. when the wheel advances with little resistance the torsion force decreases and obviously the watts supplied by the motor decrease. On more complex bikes the software can remedy the inconvenience but I don't think it's on our side.

NIPSEN   100 mW

100 mW
Posts: 38
Joined: Feb 26 2019 5:14pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by NIPSEN » Mar 19 2019 7:15am

Hi guys,
About the shudder issue, I think you reach the maximum current limit, so controller start to decrease duty-cycle (every 12 cycle of 64µs if necessary), and then increase (because signal like torque pedal may be noisy, or under battery current limit) and you feel it, like micro torque decrease/increase.

If you try to reduce "max current battery" in settings, you could have the issue sooner.

I suggest you to reduce the duty-cyle ramp up (not the ramp down one because of safety).

File config.h

Code: Select all

#define PWM_DUTY_CYCLE_RAMP_UP_INVERSE_STEP 20
The higher the value, the slow it will be. So maybe try 40, 80 or 120 (it is the number of cycles before increasing the duty cycle).

maximusdm   10 W

10 W
Posts: 78
Joined: Sep 08 2018 12:51pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by maximusdm » Mar 19 2019 8:32am

I am trying to make a summary of what are my options:
1. Use high cadence 48v to see how it works
2. Decrease the inverse ramp. I am pretty sure I am not hitting max current with 300w. (300w/48v is much smaller than 18a.)
3. Increase the PWM_Max_Duty_Cycle. This is not trivial because the calculations for this use uint8 which has max value 255.
@casainho Do you think it is possible to to something about this?

From what I understood PWM is max power the motor can provide/cycle. ERPS * torque/cycle.

NIPSEN   100 mW

100 mW
Posts: 38
Joined: Feb 26 2019 5:14pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by NIPSEN » Mar 19 2019 10:13am

maximusdm wrote:
Mar 18 2019 4:21pm
casainho wrote:
Mar 18 2019 5:30am
At higher speeds you may be near the limit of motor speed. Please look on LCD3 for the motor erps speed and the PWM duty-cycle value. If PWM duty-cycle is like 250 at that situations, then you are on the limit of the motor and the energy that flows to the motor drops. You can get the max energy flow to the motor at near 0 speed of the motor and vice-versa.
ERPS speed goes around 480 at high load
PWM duty-cycle hits 254 quite easy

Is there a way to overcome this limitation? Can this be increased?
High cadence mode for 48v helps here?
Strange that with a PWM at 254 you only have 300W motor.

casainho   1.21 GW

1.21 GW
Posts: 3826
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by casainho » Mar 19 2019 10:32am

NIPSEN wrote:
Mar 19 2019 10:13am
Strange that with a PWM at 254 you only have 300W motor.
That is not strang. Please tell also what is the erps value when you measured the other values.
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of the Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

casainho   1.21 GW

1.21 GW
Posts: 3826
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by casainho » Mar 19 2019 11:10am

casainho wrote:
Mar 19 2019 10:32am
NIPSEN wrote:
Mar 19 2019 10:13am
Strange that with a PWM at 254 you only have 300W motor.
That is not strang. Please tell also what is the erps value when you measured the other values.
Just saw the previous message, where the erps value is 480.

Our motors has 16 magnets, so 8 pairs of them. Motor max rpm is 4000 at 48V. So, (4000/60)* 8 = 533 erps.

48v/533 = 0.09V per erps of motor generated BEMF that is contrary to power supply 48V.

At 480 erps, it is a BEMF of 43.2V. This means the only voltage on motor coils are 48 - 43.2 = 4.8V.

If the power was 300W, the current can be about 300/48 = 6 amps.

So, motor is absorbing only 6 amps instead of the 18 amps you would like to, but that is a limitation of the BLDC motors, they say they has max torque at startup and it reduces to 0 at motor max speed.
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of the Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

NIPSEN   100 mW

100 mW
Posts: 38
Joined: Feb 26 2019 5:14pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by NIPSEN » Mar 19 2019 1:54pm

Thank you for all this valuable informations, if I understand correctly, it respects this graph quite well:

Image

User avatar
jbalat   10 kW

10 kW
Posts: 570
Joined: Nov 10 2012 11:50pm
Location: Melbourne, Australia

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by jbalat » Mar 19 2019 6:13pm

casainho wrote:
Mar 19 2019 11:10am
So, motor is absorbing only 6 amps instead of the 18 amps you would like to, but that is a limitation of the BLDC motors, they say they has max torque at startup and it reduces to 0 at motor max speed.
Ok so by increasing erps we can get more power near the high end.

So we have done some very basic tweaking to get higher RPM using Field weakening but to get further benefits we need variable phase advance angle and this needs to be calculated under different load conditions.

ie. a special version of the firmware where we can advance throttle and phase advance angle manually have a readout of all the stats including erps and power then use a bicycle trainer to increase load. We can then make a better judgment of how to increase field weakening in an efficient way to get more power and cadence.
Please subscribe to my Youtube home page for Quadcopters, FPV and Bike Rides http://www.youtube.com/jbalatutube
My build log here http://endless-sphere.com/forums/viewto ... =6&t=55352
For some cool ebike talk join us on The Best ebike https://www.facebook.com/groups/193581737807033/
Tech talk TSDZ2 Opensource firmware https://endless-sphere.com/forums/viewt ... &start=150
Opensource TSDZ2 Wiki https://github.com/OpenSource-EBike-fir ... _wiki/wiki

klaus2650   10 µW

10 µW
Posts: 5
Joined: Mar 19 2019 10:47pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by klaus2650 » Mar 19 2019 11:04pm

Will this firmware work with TSDZ2 coaster brake version ?
and if will this need any specific configuration ?

Rydon   100 W

100 W
Posts: 244
Joined: Aug 11 2016 5:26pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by Rydon » Mar 20 2019 1:26am

klaus2650 wrote:
Mar 19 2019 11:04pm
Will this firmware work with TSDZ2 coaster brake version ?
and if will this need any specific configuration ?
Not yet. However, this is being addressed. There is a lot of resistance pedaling backward in the current version that hopefully will be fixed soon. Watch this forum for updates.

maximusdm   10 W

10 W
Posts: 78
Joined: Sep 08 2018 12:51pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by maximusdm » Mar 20 2019 3:38am

casainho wrote:
Mar 19 2019 11:10am
So, motor is absorbing only 6 amps instead of the 18 amps you would like to, but that is a limitation of the BLDC motors, they say they has max torque at startup and it reduces to 0 at motor max speed.
Thanks for the good technical explanation!
jbalat wrote:
Mar 19 2019 6:13pm
So we have done some very basic tweaking to get higher RPM using Field weakening but to get further benefits we need variable phase advance angle and this needs to be calculated under different load conditions.
I know there is an enhancement request in github for this. If the devs have some idea how to enhance this, I will help with beta testing.

NIPSEN   100 mW

100 mW
Posts: 38
Joined: Feb 26 2019 5:14pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by NIPSEN » Mar 20 2019 4:04am

maximusdm wrote:
Mar 20 2019 3:38am
casainho wrote:
Mar 19 2019 11:10am
So, motor is absorbing only 6 amps instead of the 18 amps you would like to, but that is a limitation of the BLDC motors, they say they has max torque at startup and it reduces to 0 at motor max speed.
Thanks for the good technical explanation!
jbalat wrote:
Mar 19 2019 6:13pm
So we have done some very basic tweaking to get higher RPM using Field weakening but to get further benefits we need variable phase advance angle and this needs to be calculated under different load conditions.
I know there is an enhancement request in github for this. If the devs have some idea how to enhance this, I will help with beta testing.
Unfortunately, I think our engine is limited by the BEMF and this limit is unbreakable.
If you only reach 480erps instead of 522, is due to the fact that the engine was not running idle (load), the rpm stabilizes at the balance of forces.

User avatar
stancecoke   100 kW

100 kW
Posts: 1080
Joined: Aug 02 2017 2:56pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by stancecoke » Mar 20 2019 8:24am

maximusdm wrote:
Mar 20 2019 3:38am
I know there is an enhancement request in github for this. If the devs have some idea how to enhance this, I will help with beta testing.
you could increase the advance angle at high speeds for field weakening by using an exponential function. But I don't know, if the calculation can be done in real time. Perhaps we could use a lookup table.
advance angle with power law.PNG
regards
stancecoke

casainho   1.21 GW

1.21 GW
Posts: 3826
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by casainho » Mar 20 2019 8:49am

stancecoke wrote:
Mar 20 2019 8:24am
maximusdm wrote:
Mar 20 2019 3:38am
I know there is an enhancement request in github for this. If the devs have some idea how to enhance this, I will help with beta testing.
you could increase the advance angle at high speeds for field weakening by using an exponential function. But I don't know, if the calculation can be done in real time. Perhaps we could use a lookup table.

advance angle with power law.PNG

regards
stancecoke
I really like to see users/developers participating like this!! <3
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of the Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

casainho   1.21 GW

1.21 GW
Posts: 3826
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by casainho » Mar 20 2019 1:47pm

850C LCD

I am happy, although I did burn a 850C LCD and an USB port of my computer. I was blocked on this firmware because I was missing communication packages and the display data was hanging/blocking but now it is now more. I had to rewrite a lot of things to get it working. There is still more parts to optimize but the LCD do not blocks anymore which means it is usable at least for me.
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of the Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

NIPSEN   100 mW

100 mW
Posts: 38
Joined: Feb 26 2019 5:14pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by NIPSEN » Mar 20 2019 3:30pm

casainho wrote:
Mar 20 2019 1:47pm
850C LCD

I am happy, although I did burn a 850C LCD and an USB port of my computer. I was blocked on this firmware because I was missing communication packages and the display data was hanging/blocking but now it is now more. I had to rewrite a lot of things to get it working. There is still more parts to optimize but the LCD do not blocks anymore which means it is usable at least for me.
It's a great step forward, good work! :thumb:

Post Reply