TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Electric Motors and Controllers
casainho   10 GW

10 GW
Posts: 4350
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by casainho » Mar 30 2020 8:53am

r0mko wrote:
Mar 30 2020 6:58am
At lower RPM the pedal power is low, so the motor does not help me to gain speed, and at higher cadence it is already high to maintain speed
I may not be understanding correctly but this does not make sense as the average pedal power should be similar over the full cadence range (10 RPM to 90 RPM).

You should calibrate your torque sensor and see how your pedal power value changes over the full cadence range, that is why I asked you for your values otherwise there is not much point discussing without valid data.
- 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.

HughF   10 W

10 W
Posts: 95
Joined: Jan 23 2020 6:13pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by HughF » Mar 30 2020 9:06am

casainho wrote:
Mar 30 2020 8:53am
r0mko wrote:
Mar 30 2020 6:58am
At lower RPM the pedal power is low, so the motor does not help me to gain speed, and at higher cadence it is already high to maintain speed
I may not be understanding correctly but this does not make sense as the average pedal power should be similar over the full cadence range (10 RPM to 90 RPM).

You should calibrate your torque sensor and see how your pedal power value changes over the full cadence range, that is why I asked you for your values otherwise there is not much point discussing without valid data.
Just curious if the way the assistance is calculated changed between 0.19 and 0.56? I can't calibrate until I find some weights.

Is there a way to data-log the required data to my cellphone via the sw102 bluetooth when I go out for a ride? Otherwise I have to try and setup my cellphone to record the screen I guess?

r0mko   10 W

10 W
Posts: 79
Joined: Jan 20 2017 8:06pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by r0mko » Mar 30 2020 9:30am

casainho wrote:
Mar 30 2020 8:53am
r0mko wrote:
Mar 30 2020 6:58am
At lower RPM the pedal power is low, so the motor does not help me to gain speed, and at higher cadence it is already high to maintain speed
I may not be understanding correctly but this does not make sense as the average pedal power should be similar over the full cadence range (10 RPM to 90 RPM).

You should calibrate your torque sensor and see how your pedal power value changes over the full cadence range, that is why I asked you for your values otherwise there is not much point discussing without valid data.
Incorrect. Given the constant torque (i. e. rider's efforts to push pedals) the pedal power at 90 RPM is nine times the power at 10 RPM. In other words, motor will try to put 9 times more current at 90 RPM compared to 10 RPM. This is exactly how the motor behaves now. Torque sensor non-linearity makes very little influence on that.

casainho   10 GW

10 GW
Posts: 4350
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by casainho » Mar 30 2020 9:37am

r0mko wrote:
Mar 30 2020 9:30am
casainho wrote:
Mar 30 2020 8:53am
r0mko wrote:
Mar 30 2020 6:58am
At lower RPM the pedal power is low, so the motor does not help me to gain speed, and at higher cadence it is already high to maintain speed
I may not be understanding correctly but this does not make sense as the average pedal power should be similar over the full cadence range (10 RPM to 90 RPM).

You should calibrate your torque sensor and see how your pedal power value changes over the full cadence range, that is why I asked you for your values otherwise there is not much point discussing without valid data.
Incorrect. Given the constant torque (i. e. rider's efforts to push pedals) the pedal power at 90 RPM is nine times the power at 10 RPM. In other words, motor will try to put 9 times more current at 90 RPM compared to 10 RPM. This is exactly how the motor behaves now. Torque sensor non-linearity makes very little influence on that.
Again, you need to do your work and calibrate the torque sensor then you will see that what you are assuming does not happen in the reality.
- 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.

r0mko   10 W

10 W
Posts: 79
Joined: Jan 20 2017 8:06pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by r0mko » Mar 30 2020 1:31pm

casainho wrote:
Mar 30 2020 9:37am
Again, you need to do your work and calibrate the torque sensor then you will see that what you are assuming does not happen in the reality.
I've calibrated my torque sensor. I was curious how providing more precise data can overcome multiplication by zero or almost zero at low RPM in the pedal power formula. As I expected, this barely changed this behavior. I must admit that the motor became a little bit more responsive to high force pedaling at low RPM, but still it is quite unbalanced: very hard at start or low RPM and almost effortless at 80 RPM. At 96 RPM it is hard again due to motor speed limit. Shall we continue discussion about calculation of current?

casainho   10 GW

10 GW
Posts: 4350
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by casainho » Mar 30 2020 1:33pm

r0mko wrote:
Mar 30 2020 1:31pm
casainho wrote:
Mar 30 2020 9:37am
Again, you need to do your work and calibrate the torque sensor then you will see that what you are assuming does not happen in the reality.
I've calibrated my torque sensor. I was curious how providing more precise data can overcome multiplication by zero or almost zero at low RPM in the pedal power formula. As I expected, this barely changed this behavior. I must admit that the motor became a little bit more responsive to high force pedaling at low RPM, but still it is quite unbalanced: very hard at start or low RPM and almost effortless at 80 RPM. At 96 RPM it is hard again due to motor speed limit. Shall we continue discussion about calculation of current?
And so what are the average pedal power values at startup and near the 90 RPM?

Also report for the same situation the weigh in kgs on the pedals, you can see the value on tecnhical configurations menu.
- 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.

plpetrov   1 W

1 W
Posts: 63
Joined: Oct 22 2019 7:25am

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by plpetrov » Mar 30 2020 2:28pm

casainho wrote:
Mar 30 2020 6:37am
Here is a testing release for TSDZ2 motor firmware that solves the overrun and improve the TSDZ2 coast braking version:

https://github.com/OpenSource-EBike-fir ... ses/0.56.2

Please give me feedback so I can release it.
I installed the new version and tested it. Unfortunately only in the living room with the rear tyre in the air, so my observation could be impacted by the low load of the motor and also the low force applied on the pedals, as I turned them bay hand. Torque sensor is freshly calibrated and I hope this should not be the reason for some of the findings.

The good news is that there is a huge improvement with the motor overrun. As I wrote previously, with the previous version when I just pushed the pedal they will start rotating and will never stop. Now in 5 of six attempts they will stop after rotation of 30 degrees. However in the 6 attempt they will continue to rotate and will stop only after pressing the brake or negative torque on the pedals. I could not recognise the pattern that will invoke this particular situation.
The negative torque is really improved and stops the motor with less force. However it will be good to be able to adjust the negative torque based on what we need. I definitely feel significant improvement and reduction of the stopping time and force in comparison with version 0.56.1 but still I have the feeling the the stopping of the motor is slower compared to the use of the handbrake. This might be due to the delay introduced by the negative torque detection.

Some strange findings. Now with the improvement of the motor overrun, it is very clear that the left pedal is times more sensitive than the right pedal. When turning the pedals I can hear the motor engages with power on the half turn when the left pedal goes from the top to down position and then almost no motor on the other half turn when the right pedal goes from the top to down position.
I had also the feeling the the required torque for stopping when braking is different based on the position of the pedals.

Also it seems there is something caused by the mechanics of the motor. In case the motor is not running or I wait it to fully stop, I can turn the pedals back and stop normally. However in case I turn the pedals back immediately while the motor is turning, it will stop but then somehow it seems it is very difficult to impossible to brake using the coaster brake. The workaround is to put just a bit of force to engage the negative torque, release the braking effort for a part of a second until the motor stops and then when again I brake rotating the pedals back. This way it works very smooth.

In case you need some data, please do not hesitate to come back to me. I want to do more test just to find the problem with the uneven motor behaviour on pressing the left and the right pedal. I want to be sure that it is not due to peculiarities of the torque sensor of my motor.

r0mko   10 W

10 W
Posts: 79
Joined: Jan 20 2017 8:06pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by r0mko » Mar 30 2020 3:36pm

casainho wrote:
Mar 30 2020 1:33pm
r0mko wrote:
Mar 30 2020 1:31pm
casainho wrote:
Mar 30 2020 9:37am
Again, you need to do your work and calibrate the torque sensor then you will see that what you are assuming does not happen in the reality.
I've calibrated my torque sensor. I was curious how providing more precise data can overcome multiplication by zero or almost zero at low RPM in the pedal power formula. As I expected, this barely changed this behavior. I must admit that the motor became a little bit more responsive to high force pedaling at low RPM, but still it is quite unbalanced: very hard at start or low RPM and almost effortless at 80 RPM. At 96 RPM it is hard again due to motor speed limit. Shall we continue discussion about calculation of current?
And so what are the average pedal power values at startup and near the 90 RPM?

Also report for the same situation the weigh in kgs on the pedals, you can see the value on tecnhical configurations menu.
Test conditions: motor assist level 0 (disabled), a flat ground and a stable 10% incline both ≈300 meters long, +3°C, fresh calibrated torque sensor.

Startup:
flat: pedal power quickly ramps from 0 to ≈60W, pedal weight falls from about 25 kg to 7-8 kg.
incline: ramp from 0 to ~90W, pedal force falls from ≈35-38 kg to 20-25 kg.

Low cadence (≈20 RPM):
flat: power hovers around 30..40W, pedal force around 8 kg
incline: power 70..100W, pedal force 30-35 kgs. Pedalling uphill with such cadence is very hard, with cracks and pain in knees.

High cadence (≈80 RPM):
flat: 50..70W, pedal force 5-8 kg
incline: 300-400W, pedal force around 22-24 kg. Comfortable pedalling workout without painful efforts.

Harsh acceleration from 20 to 80 RPM with maximum force: pedal weight immediately ramps from 5 to 35 kg, pedal power slowly increases from 50W to 400W as RPM rises.

The pedal weight (aka force aka torque) appears to be a much more accurate representation of rider's efforts. I would like the motor assist to reflect this, but not the pedal power (torque multiplied by cadence).

plpetrov   1 W

1 W
Posts: 63
Joined: Oct 22 2019 7:25am

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by plpetrov » Mar 30 2020 3:48pm

plpetrov wrote:
Mar 30 2020 2:28pm
casainho wrote:
Mar 30 2020 6:37am
Here is a testing release for TSDZ2 motor firmware that solves the overrun and improve the TSDZ2 coast braking version:

https://github.com/OpenSource-EBike-fir ... ses/0.56.2

Please give me feedback so I can release it.
I installed the new version and tested it.
.................
I repeated the testing again with different assist levels. The results are different depending on the assist levels used:
1. From assist level 1 to assist level 10 the motor runs very smooth and the unwanted effects are not there. There is no over run. The motor stops immediately after I stop pedalling. No difference between left and right side.
2. From assist level 10 up the effect of different motor power from between the left and the right I described starts appearing. As of asset level 15 when the the left pedal is at the top position, there is a very hard and strong kick from the motor. On the upper levels it is even worse. Looking at the display I see human power increasing from 1 to 10 at that moment. On the right pedal it stays one. So may be the motor reacts correctly but to an error input.

The problem with the back pedalling necessary for coaster braking remains at any level. If I do not release the pedals for a moment I can not turn them back to brake easily. Looks like there is something locking the back movement in the motor that requires the pedal to be released before further braking.

casainho   10 GW

10 GW
Posts: 4350
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by casainho » Mar 30 2020 3:58pm

plpetrov wrote:
Mar 30 2020 3:48pm
2. From assist level 10 up the effect of different motor power from between the left and the right I described starts appearing. As of asset level 15 when the the left pedal is at the top position, there is a very hard and strong kick from the motor. On the upper levels it is even worse. Looking at the display I see human power increasing from 1 to 10 at that moment. On the right pedal it stays one. So may be the motor reacts correctly but to an error input.
Please check on the display technical configurations the pedal side, is the pedal side working correctly??
- 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.

plpetrov   1 W

1 W
Posts: 63
Joined: Oct 22 2019 7:25am

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by plpetrov » Mar 30 2020 4:41pm

casainho wrote:
Mar 30 2020 3:58pm
plpetrov wrote:
Mar 30 2020 3:48pm
2. From assist level 10 up the effect of different motor power from between the left and the right I described starts appearing. As of asset level 15 when the the left pedal is at the top position, there is a very hard and strong kick from the motor. On the upper levels it is even worse. Looking at the display I see human power increasing from 1 to 10 at that moment. On the right pedal it stays one. So may be the motor reacts correctly but to an error input.
Please check on the display technical configurations the pedal side, is the pedal side working correctly??
This is the first thing I checked. It is working as expected without an issue. I also put the pedals in the wrong order before motor initialisation to check. What was strange is that the effect remained exactly the same. I was expecting to appear on the opposite pedal. It is like a very hard kick that starts when the left pedal is at the highest position. With the incase of the asset level the kick is extremely strong. I can send you a video if you want.

casainho   10 GW

10 GW
Posts: 4350
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by casainho » Mar 30 2020 5:30pm

plpetrov wrote:
Mar 30 2020 4:41pm
casainho wrote:
Mar 30 2020 3:58pm
plpetrov wrote:
Mar 30 2020 3:48pm
2. From assist level 10 up the effect of different motor power from between the left and the right I described starts appearing. As of asset level 15 when the the left pedal is at the top position, there is a very hard and strong kick from the motor. On the upper levels it is even worse. Looking at the display I see human power increasing from 1 to 10 at that moment. On the right pedal it stays one. So may be the motor reacts correctly but to an error input.
Please check on the display technical configurations the pedal side, is the pedal side working correctly??
This is the first thing I checked. It is working as expected without an issue. I also put the pedals in the wrong order before motor initialisation to check. What was strange is that the effect remained exactly the same. I was expecting to appear on the opposite pedal. It is like a very hard kick that starts when the left pedal is at the highest position. With the incase of the asset level the kick is extremely strong. I can send you a video if you want.
I am experiencing the same issue and is annoying and I tough it was a bad calibration on the left pedal. I wonder if with torque sensor calibration disabled the issue persist.

I did some change on this version because on previous ones there was no such issue. I need to find... Thanks for your tests, that helped me a lot, now I can go further...
- 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.

jeff.page.rides   100 W

100 W
Posts: 135
Joined: Aug 13 2019 10:16am

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by jeff.page.rides » Mar 30 2020 7:37pm

jeff.page.rides wrote:
Mar 27 2020 11:50am
casainho wrote:
Mar 27 2020 6:16am
jeff.page.rides wrote:
Mar 26 2020 4:19pm
casainho & others,
I can't wait to put the 860C on my handcycle, I have an 860C and I am just waiting to see reports that it is safe and stable and doesn't have any overrun then I'll be installing it right away!
Thanks for supporting and using the 860C and for all your hard work!
Jeff, you are in luck because other than the 860C, I am right now adding the code for detecting braking on the coast brake of TSDZ2. I did look at the code done by Buba and I am re using it.

Detect brake on coast brakes is easy, it is like a negative torque value on the torque sensor. Pedals torque sensor value is positive when when pedal forward and a negative value when we pedal backward. On TSDZ2 coast brake version is possible to detect this negative value but not on the regular version -- I am assuming this after looking at the code and comments Buba did, as also with all my current experience with the torque sensor, because I never tested a TSDZ2 coast brake version.

Here is the simple code to detect the braking on coast brakes:

Code: Select all

 #define COASTER_BRAKE_TORQUE_THRESHOLD    40

  // check if coaster brake is engaged
  if (UI16_ADC_10_BIT_TORQUE_SENSOR < (ui16_g_adc_torque_sensor_min_value - COASTER_BRAKE_TORQUE_THRESHOLD))
  {
    ui8_g_brakes_state = 1;
  }
WOW, Thanks!
When I was using version 19 it was scary to try to stop the motor. But when Buba made those changes to version 20 it wasn't perfect, but it definitely was an awesome improvement and wasn't scary anymore.
Please let me know when it's ready to go and we will give it a try. We also installed the overrun fix and it did seem to help make things just a little lighter to stop the motor to shift gears. I have a shift sensor that I'm going to install and that should make my shifting much easier I hope. To install a brake sensor on my bike would be a little more complicated.
Rydon and I have been putting version 20 with LCD3's on all the handcycles we do. When your firmware is ready and better then 20 we will start using 860C's on all the handcycles.
Thanks again,
Jeff
I installed my shift sensor and wow does it shift great. The second I push my shift button the motor stops it shifts fast, smooth, and quiet. Now the problem is it powers off for about 2 seconds and about 2 revolutions at 75 RPM before the power comes back on, that's a long dead-spot.
Is there a way in the firmware that we can speed up this power back on, to only a half a second?

casainho   10 GW

10 GW
Posts: 4350
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by casainho » Mar 30 2020 9:57pm

jeff.page.rides wrote:
Mar 30 2020 7:37pm
I installed my shift sensor and wow does it shift great. The second I push my shift button the motor stops it shifts fast, smooth, and quiet. Now the problem is it powers off for about 2 seconds and about 2 revolutions at 75 RPM before the power comes back on, that's a long dead-spot.
Is there a way in the firmware that we can speed up this power back on, to only a half a second?
Try increasing the current ramp, I hope it works.
- 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.

jeff.page.rides   100 W

100 W
Posts: 135
Joined: Aug 13 2019 10:16am

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by jeff.page.rides » Mar 30 2020 10:40pm

casainho wrote:
Mar 30 2020 9:57pm
jeff.page.rides wrote:
Mar 30 2020 7:37pm
I installed my shift sensor and wow does it shift great. The second I push my shift button the motor stops it shifts fast, smooth, and quiet. Now the problem is it powers off for about 2 seconds and about 2 revolutions at 75 RPM before the power comes back on, that's a long dead-spot.
Is there a way in the firmware that we can speed up this power back on, to only a half a second?
Try increasing the current ramp, I hope it works.
10: Advanced Setup
0; Motor acceleration adjustment 0-45% 35%
Is this what you're talking about? What setting should I try? Thanks

casainho   10 GW

10 GW
Posts: 4350
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by casainho » Mar 31 2020 2:34am

jeff.page.rides wrote:
Mar 30 2020 10:40pm
casainho wrote:
Mar 30 2020 9:57pm
jeff.page.rides wrote:
Mar 30 2020 7:37pm
I installed my shift sensor and wow does it shift great. The second I push my shift button the motor stops it shifts fast, smooth, and quiet. Now the problem is it powers off for about 2 seconds and about 2 revolutions at 75 RPM before the power comes back on, that's a long dead-spot.
Is there a way in the firmware that we can speed up this power back on, to only a half a second?
Try increasing the current ramp, I hope it works.
10: Advanced Setup
0; Motor acceleration adjustment 0-45% 35%
Is this what you're talking about? What setting should I try? Thanks
Motor current ramp, see the wiki configurations page.
- 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.

plpetrov   1 W

1 W
Posts: 63
Joined: Oct 22 2019 7:25am

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by plpetrov » Mar 31 2020 4:06am

casainho wrote:
Mar 30 2020 5:30pm
I am experiencing the same issue and is annoying and I tough it was a bad calibration on the left pedal. I wonder if with torque sensor calibration disabled the issue persist.

I did some change on this version because on previous ones there was no such issue. I need to find... Thanks for your tests, that helped me a lot, now I can go further...
I was experiencing similar issues also during my testings with the previous versions of the motor firmware. At that time I thought that they are caused by the different version of the motor I am using. You know that in the coaster brake version the pedals are always turned by the motor. My explanation of the effect was that the inertia moment of the pedal arms and the pedals will influence the sensor data that there is continuation of the pedalling effort even there was no any.
Now with the motor overrun issue solved the problem became more evident as the motor will try to stop faster as soon as you stop turning the pedals.
I remember some users reporting the motor going to full power with no evident reason. I also noticed now a bit of an uneven and not reproducible motor response to the pedal turning.

casainho   10 GW

10 GW
Posts: 4350
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by casainho » Mar 31 2020 4:30am

r0mko wrote:
Mar 30 2020 3:36pm
Low cadence (≈20 RPM):
incline: power 70..100W, pedal force 30-35 kgs. Pedalling uphill with such cadence is very hard, with cracks and pain in knees.

High cadence (≈80 RPM):
incline: 300-400W, pedal force around 22-24 kg. Comfortable pedalling workout without painful efforts.

Harsh acceleration from 20 to 80 RPM with maximum force: pedal weight immediately ramps from 5 to 35 kg, pedal power slowly increases from 50W to 400W as RPM rises.
All your values are similar to my values.

You only measure max of 35kgs so I assume you didn't put stand up because then you would get 75kgs (assuming you weigh 75kgs), your power would go from 50W to 800W, the same full range that TSDZ2 can give, this means no need to change the assistance to get the motor full range of assistance.

What I don't agree with your values is the 24kg / 400W at 80 RPM. I think is a high value to sustain, but, if you can really do it, that means you should do at least the same or more at startups bursts. Let's do the math for the same:

If you stand up on startups, you do 75 kgs, effectively multiplying by 3 what you are doing at 80 RPM, so, you will be doing the same 400W at 27 RPM which is a bit after the startup RPM. On the other side, as the cadence increases you should not sustain the same weight values but they should decrease linear with cadence linear, this means you will be doing same human power even when one decreases and the other increases.

The way the system works now, if you want a boost from the motor at startup, you should do also do a boost with your legs by stand up.

If instead you change the assist level to be big so you have a lot of power from motor at startup, then after at high cadence you will need to reduce the assist level. This is not the way usually I prefer to ride, I really like to be more dynamic, stand up on the pedals to get a boost at startup or on short hills while not reducing the gears.

If the system would work on human torque and not human power, then you would have big motor assistance at startup but soon the motor assistance would reduce with increase of cadence to the regular values - I think would be strange because when you increase your weight/torque on the pedals, you will get less motor assistance because the cadence increases and you naturally reduce the weight/torque on the pedals because you can sustain that...

The BOOST feature makes an extra higher assist level for startups, so users can avoid to do their own boost with their legs by stand up.

Well, but if anyone want to make a pull request, with well structure and tested code to add this second mode of human torque, I will accept it. Maybe you are right, maybe that other different mode have advantages, because we are all different so we may have different riding styles.
- 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.

r0mko   10 W

10 W
Posts: 79
Joined: Jan 20 2017 8:06pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by r0mko » Mar 31 2020 5:30am

casainho wrote:
Mar 31 2020 4:30am
r0mko wrote:
Mar 30 2020 3:36pm
Low cadence (≈20 RPM):
incline: power 70..100W, pedal force 30-35 kgs. Pedalling uphill with such cadence is very hard, with cracks and pain in knees.

High cadence (≈80 RPM):
incline: 300-400W, pedal force around 22-24 kg. Comfortable pedalling workout without painful efforts.

Harsh acceleration from 20 to 80 RPM with maximum force: pedal weight immediately ramps from 5 to 35 kg, pedal power slowly increases from 50W to 400W as RPM rises.
All your values are similar to my values.

You only measure max of 35kgs so I assume you didn't put stand up because then you would get 75kgs (assuming you weigh 75kgs), your power would go from 50W to 800W, the same full range that TSDZ2 can give, this means no need to change the assistance to get the motor full range of assistance.

What I don't agree with your values is the 24kg / 400W at 80 RPM. I think is a high value to sustain, but, if you can really do it, that means you should do at least the same or more at startups bursts. Let's do the math for the same:

If you stand up on startups, you do 75 kgs, effectively multiplying by 3 what you are doing at 80 RPM, so, you will be doing the same 400W at 27 RPM which is a bit after the startup RPM. On the other side, as the cadence increases you should not sustain the same weight values but they should decrease linear with cadence linear, this means you will be doing same human power even when one decreases and the other increases.

The way the system works now, if you want a boost from the motor at startup, you should do also do a boost with your legs by stand up.

If instead you change the assist level to be big so you have a lot of power from motor at startup, then after at high cadence you will need to reduce the assist level. This is not the way usually I prefer to ride, I really like to be more dynamic, stand up on the pedals to get a boost at startup or on short hills while not reducing the gears.

If the system would work on human torque and not human power, then you would have big motor assistance at startup but soon the motor assistance would reduce with increase of cadence to the regular values - I think would be strange because when you increase your weight/torque on the pedals, you will get less motor assistance because the cadence increases and you naturally reduce the weight/torque on the pedals because you can sustain that...

The BOOST feature makes an extra higher assist level for startups, so users can avoid to do their own boost with their legs by stand up.

Well, but if anyone want to make a pull request, with well structure and tested code to add this second mode of human torque, I will accept it. Maybe you are right, maybe that other different mode have advantages, because we are all different so we may have different riding styles.
Let's do a simple math. Rotational power P = w (angular speed) * t (torque)
Power is used to calculate the motor current.
Let's calculate the power on pedals on startup. I apply my full weight on pedal (85 kg). RPM is zero.
85 kg applied to 0,175 m crank gives ~149 N*m of torque (which is way too much, I would never apply my full weight to a pedal of TSDZ2, I've once broken the axle this way)

P = w * t = 0 * 149 = 0W.
0W means 0A to the motor -> no assistance
I agree that stand still is an edge case, so let's consider the crank speed 1 RPM, the very beginning of acceleration, where the motor must kick in. 1 RPM is roughly 0,1 rad/s
P = w * t = 0,1 * 149 = ~15W.
15W is nearly 10-15% of normal human power on pedals during cruising. But I stand on the pedal which means that I want to accelerate as fast as possible, i.e. I expect maximum assistance from the motor at that point, but it gives only 5% of maximum current (of course in reality this depends on assist ratio and many other factors).

Next let's calculate pedal power during normal cruising on flat ground. RPM is 60, I apply about 10 kg of force.
60 RPM = 6,28 rad/s
10 kg at cranks = 17,5 N*m
P = 6,28 * 17,5 = ~110W
In this case motor will provide much more assistance than I need.

During normal cruising where I've already gained speed the pedal power is ~10 times more than during startup, but the force I apply on a pedal is 8 times less. This makes me think that formula for motor current should not contain candence (angular speed), at least in this way it does now, not as multiplier.
I would like to experiment with it and flash my motor with a custom firmware, but I need your assistance. I don't know orders of magnitude of values in line 233 in the ebike_app.c and afraid to change the formula without knowing value ranges because motor can become crazy.

casainho   10 GW

10 GW
Posts: 4350
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by casainho » Mar 31 2020 6:08am

r0mko wrote:
Mar 31 2020 5:30am
85 kg applied to 0,175 m crank gives ~149 N*m of torque (which is way too much, I would never apply my full weight to a pedal of TSDZ2, I've once broken the axle this way)
Well, I always apply my weight of 105 kgs and I already used a few different TSDZ2, no problem so far. And that is my expectation... I am not aware of specification on TSDZ2 for this max value. But in past I already broke other type of bottom bracket torque sensors, from other systems, and I know the feeling.
r0mko wrote:
Mar 31 2020 5:30am
P = w * t = 0 * 149 = 0W.
0W means 0A to the motor -> no assistance
I agree that stand still is an edge case, so let's consider the crank speed 1 RPM, the very beginning of acceleration, where the motor must kick in. 1 RPM is roughly 0,1 rad/s
P = w * t = 0,1 * 149 = ~15W.
15W is nearly 10-15% of normal human power on pedals during cruising. But I stand on the pedal which means that I want to accelerate as fast as possible, i.e. I expect maximum assistance from the motor at that point, but it gives only 5% of maximum current (of course in reality this depends on assist ratio and many other factors).
Well, the minimum cadence possible to be measured if 10 RPM, until there you will get no power from the motor, so, the power you will get on that example is 150W but soon you hit the 20 RPM and you will get 300W.

Note that if you prefer to get assistance from 0 RPM, you can enable the feature to startup without pedal rotation. On this mode, only the torque sensor is used until cadence >= 10.
r0mko wrote:
Mar 31 2020 5:30am
Next let's calculate pedal power during normal cruising on flat ground. RPM is 60, I apply about 10 kg of force.
60 RPM = 6,28 rad/s
10 kg at cranks = 17,5 N*m
P = 6,28 * 17,5 = ~110W
In this case motor will provide much more assistance than I need.
Then, you need to reduce assistance BUT apply your own human boost by stand up on startups. This is the logic, the way I ride.
r0mko wrote:
Mar 31 2020 5:30am
During normal cruising where I've already gained speed the pedal power is ~10 times more than during startup
This is only true if you do a constant pedal torque and we consider the cadence increases from 10 to 90, then the pedal power will increase 9x at 90 RPM, BUT, I think no one does a constant and small pedal torque... well, maybe I have no reason here, I think there are users that may be kind of weak and can´t or prefer not do a strong torque/force at startup and only do a small amount, more continuous... and I think this users are low cadence users, maybe that old persons that don´t even shift gears.

Well, this is not my priority. If you want for yourself as a quick hack, then go to the code:

Code: Select all

      // force a min of 10 RPM cadence
      ui32_pedal_power_no_cadence_x10 = (((uint32_t) ui16_m_pedal_torque_x100 * 10) / (uint32_t) 96);

      if (m_config_vars.ui8_motor_assistance_startup_without_pedal_rotation == 0 ||
          ui8_pas_cadence_rpm)
      {
        ui32_current_amps_x10 = ((uint32_t) ui16_m_pedal_power_x10 * ui32_assist_level_factor_x1000) / 1000;
      }
      else
      {
        ui32_current_amps_x10 = (ui32_pedal_power_no_cadence_x10 * ui32_assist_level_factor_x1000) / 1000;
      }
And change to this:

Code: Select all

      // force a min of 10 RPM cadence
      ui32_pedal_power_no_cadence_x10 = (((uint32_t) ui16_m_pedal_torque_x100 * 10) / (uint32_t) 96);

      if (m_config_vars.ui8_motor_assistance_startup_without_pedal_rotation == 0 ||
          ui8_pas_cadence_rpm)
      {
        ui32_current_amps_x10 = (ui32_pedal_power_no_cadence_x10 * ui32_assist_level_factor_x1000) / 1000;
      }
      else
      {
        ui32_current_amps_x10 = (ui32_pedal_power_no_cadence_x10 * ui32_assist_level_factor_x1000) / 1000;
      }
- 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.

User avatar
stancecoke   100 kW

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

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by stancecoke » Mar 31 2020 6:20am

r0mko wrote:
Mar 31 2020 5:30am
I would like to experiment with it and flash my motor with a custom firmware

You could try the v0.20 version (with LCD3 or original Tongsheng Display), where you can choose between several ride modes:
5 assistance modes are available, choose your preferred one.
POWER ASSIST assistance proportional to the power on the pedals
TORQUE ASSIST assistance proportional to the force on the pedals
CADENCE ASSIST assistance subordinated to the movement of the pedals
EMTB ASSIST assistance with progressive percentage of the torque on the pedals
CRUISE MODE assistance with speed control.
EN-Manual_display operation-TSDZ2-mb.20beta1.A

regards
stancecoke

HughF   10 W

10 W
Posts: 95
Joined: Jan 23 2020 6:13pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by HughF » Mar 31 2020 7:08am

stancecoke wrote:
Mar 31 2020 6:20am
r0mko wrote:
Mar 31 2020 5:30am
I would like to experiment with it and flash my motor with a custom firmware

You could try the v0.20 version (with LCD3 or original Tongsheng Display), where you can choose between several ride modes:
5 assistance modes are available, choose your preferred one.
POWER ASSIST assistance proportional to the power on the pedals
TORQUE ASSIST assistance proportional to the force on the pedals
CADENCE ASSIST assistance subordinated to the movement of the pedals
EMTB ASSIST assistance with progressive percentage of the torque on the pedals
CRUISE MODE assistance with speed control.
EN-Manual_display operation-TSDZ2-mb.20beta1.A

regards
stancecoke
Latest Casainho code only supports Power mode then?

casainho   10 GW

10 GW
Posts: 4350
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by casainho » Mar 31 2020 7:40am

plpetrov wrote:
Mar 31 2020 4:06am
I was experiencing similar issues also during my testings with the previous versions of the motor firmware. At that time I thought that they are caused by the different version of the motor I am using. You know that in the coaster brake version the pedals are always turned by the motor. My explanation of the effect was that the inertia moment of the pedal arms and the pedals will influence the sensor data that there is continuation of the pedalling effort even there was no any.
Now with the motor overrun issue solved the problem became more evident as the motor will try to stop faster as soon as you stop turning the pedals.
I did a release of motor firmware version were we can disable the permitted relative min cadence (motor overrun), enabling the lights on the display disable the permitted relative min cadence.

Can you please test by enable/disable the lights and see the left and right pedals seems to produce different assist levels??

Here the firmware 0.56.3: https://github.com/OpenSource-EBike-fir ... ses/0.56.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.

plpetrov   1 W

1 W
Posts: 63
Joined: Oct 22 2019 7:25am

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by plpetrov » Mar 31 2020 8:33am

casainho wrote:
Mar 31 2020 7:40am
plpetrov wrote:
Mar 31 2020 4:06am
I was experiencing similar issues also during my testings with the previous versions of the motor firmware. At that time I thought that they are caused by the different version of the motor I am using. You know that in the coaster brake version the pedals are always turned by the motor. My explanation of the effect was that the inertia moment of the pedal arms and the pedals will influence the sensor data that there is continuation of the pedalling effort even there was no any.
Now with the motor overrun issue solved the problem became more evident as the motor will try to stop faster as soon as you stop turning the pedals.
I did a release of motor firmware version were we can disable the permitted relative min cadence (motor overrun), enabling the lights on the display disable the permitted relative min cadence.

Can you please test by enable/disable the lights and see the left and right pedals seems to produce different assist levels??

Here the firmware 0.56.3: https://github.com/OpenSource-EBike-fir ... ses/0.56.3
You mean enabling / disabling the lights by long press the + button? I will test but most probably I will have the time to do that in two or three hours.

casainho   10 GW

10 GW
Posts: 4350
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Post by casainho » Mar 31 2020 9:12am

plpetrov wrote:
Mar 31 2020 8:33am
You mean enabling / disabling the lights by long press the + button? I will test but most probably I will have the time to do that in two or three hours.
Yes, that's it. Thanks, that will help me understand and them solve this issue.
- 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.

Post Reply