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

Electric Motors and Controllers
andrea_104kg   100 W

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

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

Post by andrea_104kg » Sep 03 2019 2:40pm

I forgot to mention that I have installed the alpha 10 version since Saturday and of course it's fine!
Except emtb which I still don't like but it's not new :-)

buba   10 kW

10 kW
Posts: 588
Joined: Aug 31 2018 12:36am

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

Post by buba » Sep 03 2019 2:40pm

mctubster wrote:
Sep 03 2019 2:36am
Sorry to raise this again, but I am seeing Human Power readings that are way too high on alpha10.

Not sure if there was regression or maybe this was never solved?

I recall a discussion about peak vs averaged values - I had a look at the code, but I don't understand it ... can anyone comment on

// calculate torque on pedals
ui16_pedal_torque_x100 = ui16_adc_pedal_torque_delta * m_configuration_variables.ui8_pedal_torque_per_10_bit_ADC_step_x100;

Cheers
Have you looked at calibrating the torque sensor in the Advanced Setup? Does it help?

Because if it is properly calibrated in the low range it should show the actual human power. In the higher ranges, maybe above 25 kg for most users, it will not be linear and as a result the human power displayed will be much lower than expected.

The line of code you included is the calculation that converts the ADC value of the torque sensor to torque in newton meters. The m_configuration_variables.ui8_pedal_torque_per_10_bit_ADC_step_x100 is the conversion factor. It is this conversion factor you can change in the 0.20.0 firmware version when in the Advanced Setup calibrating the torque sensor.

Side note: we do not have to average the values. Our sampling rate is fast enough. We just continually measure and calculate the human power and then rely on filters.

Sorry for the late reply! And please let me know if you have more questions or if there is anything to improve or simplify!

jeff.page.rides   100 W

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

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

Post by jeff.page.rides » Sep 03 2019 4:38pm

Before the new Firmware having a coaster brake motor had 2 advantages. (1) I could pull backward and brake and (2) I could preset the torque Sensor, by holding backward brake pressure on the torque sensor when it turned on. This allowed me to put in my small amount of effort (week arms) and the torque sensor would register that I was putting in a large amount of effort. If I didn't pull back hard enough then the motor wouldn't have the power I need to ride. If I pulled back too hard then when I went to stop rotation it would jerk some before it stopped rotation or went to brake. Over time I learned the exact amount of pressure to get it right where I wanted it.

With the new firmware and the right settings, I can ride without pulling back on the torque sensor as I turn on the power-assist. But if I use just the weight of my arm hanging off the crank in the brake direction everything works much better especially in E-MTB.

Today I rode 36 miles and the only changes I made were, Changing back and forth from eMTB and the Power-Assist settings with Max 700 Watts and Max 15 amps, set at a multiplier of 6.0. If I pull on the crank with the weight of my arm I like eMTB mode way better. If I just turned it on with no pressure on the cranks then I like the power-assist mode.

I am so grateful for all your work so that I and many others can enjoy hand-cycling and others that ride recumbent trikes and don't have the power to do it on their own. Although I have learned the right amount of pressure to put on the cranks so the torque sensor works for me with the original firmware. It's not something that I wanted to pass on to others because you really can apply more power then is safe, because the motor wanted to just keep moving forward. When I stopped the forward rotation then there was no resistance on the brakes with the original firmware. Now with the changes in 20 Alpha 10, no matter how high I trick the torque sensor to turn it up it stops in just a second or so on its own.

In an earlier post, I listed all my settings. And where I've been using the new firmware for the last couple weeks. I'm not totally sure what each setting does.

I'd like to know if one of these settings is the one for the torque sensor so I can set it where I want it without having to use any back pressure to trick the torque-sensor into thinking I am applying more pressure than I am?

Here are the main settings I'm using below.

0: Basic Setup
4: Motor power limit 350W-700W
or push up&on together (700w)

1: Battery Setup
0: Maximum battery current 10A-18A (15A)

2: Power Assist
0: (0) Disable (1) Enable (1)
1: Number of assist levels 1-9 (3)
2: Power Assist level 1-1.5, 2-3.0, 3-6.0

5: eMTB Assist
Disable (0) Enable (1) 1: eMTB assist sensitivity 1-20 (20)

8: main screen setup
9: Enable main screen power menu (1) enabled (0) disable. (1)
10: Temperature field setup(0) = Display nothing
(5) = Pedal cadence

10: Advanced Setup
0; Motor acceleration adjustment 0-35 % (15%)
1: Startup assist without pedal rotation 0-30 % (20%)
2: Pedal torque conversion factor 57-87 (57)
4: Cadence sensor mode
(0) Standard Mode (1) Advanced Mode (1)

Thanks again, Jeff

mctubster   100 W

100 W
Posts: 231
Joined: Feb 26 2018 6:21am

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

Post by mctubster » Sep 03 2019 5:11pm

buba wrote:
Sep 03 2019 2:40pm

Have you looked at calibrating the torque sensor in the Advanced Setup? Does it help?

Because if it is properly calibrated in the low range it should show the actual human power. In the higher ranges, maybe above 25 kg for most users, it will not be linear and as a result the human power displayed will be much lower than expected.

The line of code you included is the calculation that converts the ADC value of the torque sensor to torque in newton meters. The m_configuration_variables.ui8_pedal_torque_per_10_bit_ADC_step_x100 is the conversion factor. It is this conversion factor you can change in the 0.20.0 firmware version when in the Advanced Setup calibrating the torque sensor.

Side note: we do not have to average the values. Our sampling rate is fast enough. We just continually measure and calculate the human power and then rely on filters.

Sorry for the late reply! And please let me know if you have more questions or if there is anything to improve or simplify!
Hi Buba, thank you for your reply. I'm not aware of "torque" sensor calibration in Advanced setup? I have performed the cadence sensor calibration.

Unless you are referring to the pedal torque conversion factor? I have done this, using my body weight and I get my weight +- 10kg depending on the side when I check. I have access to free weights now so was going to see what the accuracy is like at lower weights, since I am not "standing" on the pedals when I ride.

Do you know approx how many torque samples are being taken per second?

Is there anyway to capture / log a seconds worth of samples?

I have been using the OSF (open source firmware) since early days and the human power has always been a lot larger than it should be. Hence I used lower multipliers (eg .2, .5, .8) when the firmware only had power assist.

Let me give you an example. I ride currently using eMTB mode on level 5 (exp 1.3?). Anyway if I am riding on the flat (no wind) at say 25km/h (cargo bike) the bike says I am putting out approx 300W and itself it is producing 150-180W. That is a lot of power and does not equate with the speed. I would guess I am putting out 100W not 300W.

Anyway let me test my torque sensor with 5kg weight increments (at 170mm) and I will graph my torque sensor output like was done by a few people last year to see how linear it is. I will test both pedals as well.

casainho   10 GW

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

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

Post by casainho » Sep 03 2019 5:44pm

jeff.page.rides wrote:
Sep 03 2019 4:38pm
With the new firmware and the right settings, I can ride without pulling back on the torque sensor as I turn on the power-assist. But if I use just the weight of my arm hanging off the crank in the brake direction everything works much better especially in E-MTB.
The next firmware version 0.21.0, we will implement torque sensor full calibration. You will see on LCD the amount of kgs you can do with your arms and then is just a matter to select a multiply factor of that to final motor power assistance.

I can tell you my regular value of human power with my relative strong legs is about 150 watts. But I can do quick peaks of at least 600 watts at startup. So, If I want to get 600 w of motor assistance, I need to assist level factor of 4.0, as 4.0 x 150 = 600.

Your arms, can you do the same force with both? Are they balanced?
- 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 -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by jeff.page.rides » Sep 03 2019 6:01pm

My arms are even in strength, on a handcycle both cranks are adjusted in the same exact position. I do have really weak arms compared to a normal person, but my biceps and triceps work so I get to pull with both arms and then push with both arms. Unless, of course, I'm on a road or trail with a right or left angle. In that case, because it's 3 wheels it always wants to follow the downhill slope to the right or the left. So if it's a right angle I have to push with my right arm and pull with my left arm so I only get a half stroke out of each arm to keep it going straight on the right angle or vice versa on the left angle.
I've worked with other quadriplegics who only have biceps and no triceps. I've also worked with some that have a lot less bicep on one side then the other side. The one I remember the most was a young girl in her late twenties who was hurt when she was in her early teens. She only had biceps and one was much weaker than the other. She couldn't turn or keep the handcycle straight but with power-assist, she could pedal. So we just set her on a very large lawn at a park and let her go. She was having fun for the first time that she felt like she was under her own power and had never done anything close to that before.
If we will be able to adjust the torque sensor sensitivity it will really benefit a lot of people with week arms that use normal brakes and use the standard motor and can't trick the motor like I can the coaster brake motor. so it'll really help everybody.
:bigthumb:

ri53hu   100 mW

100 mW
Posts: 41
Joined: Apr 30 2018 3:56am
Location: Zlíňák

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

Post by ri53hu » Sep 04 2019 2:24am

Aho guys, I also started to use ALFA 10 but I can not adjust the torque sensor, I can give a more detailed explanation (or I can set it as I have 112 kg and in the hills does not stretch much.) R.

User avatar
elfnino   100 mW

100 mW
Posts: 48
Joined: Mar 06 2019 5:09am

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

Post by elfnino » Sep 04 2019 3:07am

Call me impatient but what is the ETA for the official 0.20 Beta ?
Correct me if I am wrong but this is important milestone for Qmarco to start working on his implementation for original displays and as well for Casainho to start with 850C/SW102 firmware versions for 0.20..

buba   10 kW

10 kW
Posts: 588
Joined: Aug 31 2018 12:36am

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

Post by buba » Sep 04 2019 3:33am

jeff.page.rides wrote:
Sep 03 2019 4:38pm
Before the new Firmware having a coaster brake motor had 2 advantages. (1) I could pull backward and brake and (2) I could preset the torque Sensor, by holding backward brake pressure on the torque sensor when it turned on. This allowed me to put in my small amount of effort (week arms) and the torque sensor would register that I was putting in a large amount of effort. If I didn't pull back hard enough then the motor wouldn't have the power I need to ride. If I pulled back too hard then when I went to stop rotation it would jerk some before it stopped rotation or went to brake. Over time I learned the exact amount of pressure to get it right where I wanted it.

With the new firmware and the right settings, I can ride without pulling back on the torque sensor as I turn on the power-assist. But if I use just the weight of my arm hanging off the crank in the brake direction everything works much better especially in E-MTB.

Today I rode 36 miles and the only changes I made were, Changing back and forth from eMTB and the Power-Assist settings with Max 700 Watts and Max 15 amps, set at a multiplier of 6.0. If I pull on the crank with the weight of my arm I like eMTB mode way better. If I just turned it on with no pressure on the cranks then I like the power-assist mode.

I am so grateful for all your work so that I and many others can enjoy hand-cycling and others that ride recumbent trikes and don't have the power to do it on their own. Although I have learned the right amount of pressure to put on the cranks so the torque sensor works for me with the original firmware. It's not something that I wanted to pass on to others because you really can apply more power then is safe, because the motor wanted to just keep moving forward. When I stopped the forward rotation then there was no resistance on the brakes with the original firmware. Now with the changes in 20 Alpha 10, no matter how high I trick the torque sensor to turn it up it stops in just a second or so on its own.

In an earlier post, I listed all my settings. And where I've been using the new firmware for the last couple weeks. I'm not totally sure what each setting does.

I'd like to know if one of these settings is the one for the torque sensor so I can set it where I want it without having to use any back pressure to trick the torque-sensor into thinking I am applying more pressure than I am?

Here are the main settings I'm using below.

...

Thanks again, Jeff
It is very good that you have explained, in detail, how you actually use the TSDZ2. Because I can now clearly see what parameter you would like to configure. And that is the ADC torque sensor offset. The ADC torque sensor offset is calibrated during every power up. The system usually measures the resting torque value from the ADC for around three seconds and calculates the average value.

When applying backwards torque and letting it calibrate with a lower value it actually tricks the system into believing that you are applying torque when you have the pedals resting. So when you do actually apply torque it seems you are pushing much harder.

There is no way to change the offset in the Alpha 10. But what could be implemented is a way to change the calibration value from the display so it does not need to be calibrated every time you start the system. Basically you could choose between automatic calibration every system startup or manual calibration. Manual calibration is done once and would save around three seconds of startup. But this can be dangerous if not properly configured and the bike might accidentally apply power for users that have the assistance without pedal rotation enabled.

Another solution that would be safer is to add an offset to the eMTB. You mention that the Power Assist works fine with lower torque but eMTB is lacking unless applying backwards torque when calibrating. Can you confirm that you can use Power Assist to your satisfaction without applying backwards torque during calibration but the eMTB needs the backwards torque to work to your satisfaction? If this is confirmed I can give it a thought and come up with an solution.

Thank you!

casainho   10 GW

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

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

Post by casainho » Sep 04 2019 3:38am

elfnino wrote:
Sep 04 2019 3:07am
Call me impatient but what is the ETA for the official 0.20 Beta ?
(...) as well for Casainho to start with 850C/SW102 firmware versions for 0.20..
We can start with current alpha or beta, no worry for us.

And I wish we could jump directly to 0.21.0, by implementing 0.21.0 and on top add the full torque sensor.
- 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   10 GW

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

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

Post by casainho » Sep 04 2019 3:44am

buba wrote:
Sep 04 2019 3:33am
Another solution that would be safer is to add an offset to the eMTB.
I think that if we let users define like 10 points of emtb curve (this curve is applied after calculated pedal human power), that will cover this need. The curve should give much flexibility, like as soon pedal human power > 0, the emtb output --> (200 watts + pedal human power * scale factor).

jeff.page.rides arms may not be strong as some strong legs. But also the legs of my little son were not strong when he had 7 years old. I think there is a good value to be able to fine tune a curve and not only a fixed scale value(the assist level).
- 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.

buba   10 kW

10 kW
Posts: 588
Joined: Aug 31 2018 12:36am

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

Post by buba » Sep 04 2019 3:53am

mctubster wrote:
Sep 03 2019 5:11pm
buba wrote:
Sep 03 2019 2:40pm

Have you looked at calibrating the torque sensor in the Advanced Setup? Does it help?

Because if it is properly calibrated in the low range it should show the actual human power. In the higher ranges, maybe above 25 kg for most users, it will not be linear and as a result the human power displayed will be much lower than expected.

The line of code you included is the calculation that converts the ADC value of the torque sensor to torque in newton meters. The m_configuration_variables.ui8_pedal_torque_per_10_bit_ADC_step_x100 is the conversion factor. It is this conversion factor you can change in the 0.20.0 firmware version when in the Advanced Setup calibrating the torque sensor.

Side note: we do not have to average the values. Our sampling rate is fast enough. We just continually measure and calculate the human power and then rely on filters.

Sorry for the late reply! And please let me know if you have more questions or if there is anything to improve or simplify!
Hi Buba, thank you for your reply. I'm not aware of "torque" sensor calibration in Advanced setup? I have performed the cadence sensor calibration.

Unless you are referring to the pedal torque conversion factor? I have done this, using my body weight and I get my weight +- 10kg depending on the side when I check. I have access to free weights now so was going to see what the accuracy is like at lower weights, since I am not "standing" on the pedals when I ride.
Hi Mctubster! Yes, I meant the torque conversion factor. That is a very simple torque calibration procedure and is usually all it takes for accurate human power in the low ranges. Below 25 kg. So when calibrating, the weight applied should be well below 25 kg.

Sadly the torque sensor is built to a price and it lacks in the effective range. But there is a more extensive calibration on the way that Casainho is going to implement in the 0.21.0. That will improve the range considerably.


mctubster wrote:
Sep 03 2019 5:11pm
Do you know approx how many torque samples are being taken per second?
10 per second, or in other words one every 100 ms.


mctubster wrote:
Sep 03 2019 5:11pm
Is there anyway to capture / log a seconds worth of samples?
Yes, it would be possible.


mctubster wrote:
Sep 03 2019 5:11pm
I have been using the OSF (open source firmware) since early days and the human power has always been a lot larger than it should be. Hence I used lower multipliers (eg .2, .5, .8) when the firmware only had power assist.

Let me give you an example. I ride currently using eMTB mode on level 5 (exp 1.3?). Anyway if I am riding on the flat (no wind) at say 25km/h (cargo bike) the bike says I am putting out approx 300W and itself it is producing 150-180W. That is a lot of power and does not equate with the speed. I would guess I am putting out 100W not 300W.

Anyway let me test my torque sensor with 5kg weight increments (at 170mm) and I will graph my torque sensor output like was done by a few people last year to see how linear it is. I will test both pedals as well.
I totally understand. The code in the 0.20.0 should be the most accurate so far and if you calibrate with weights that are below 25 kg on the pedals it should be accurate in the low range. Do not use your body weight as the torque sensor is not accurate and especially not linear at those level. This is why the human power is too high. Everything above around 25 kg will not be proportional and therefore not accurate on the TSDZ2 torque sensors. Some maybe have up to 40 kg but there is probably a nice distribution where the majority have a rather low range.

Just let me know if I missed something and if I can help in any way! :)
Last edited by buba on Sep 04 2019 4:37am, edited 3 times in total.

buba   10 kW

10 kW
Posts: 588
Joined: Aug 31 2018 12:36am

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

Post by buba » Sep 04 2019 4:00am

ri53hu wrote:
Sep 04 2019 2:24am
Aho guys, I also started to use ALFA 10 but I can not adjust the torque sensor, I can give a more detailed explanation (or I can set it as I have 112 kg and in the hills does not stretch much.) R.
Please use a weight less than 25 kg when calibrating and it should work perfectly! :)

buba   10 kW

10 kW
Posts: 588
Joined: Aug 31 2018 12:36am

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

Post by buba » Sep 04 2019 4:08am

elfnino wrote:
Sep 04 2019 3:07am
Call me impatient but what is the ETA for the official 0.20 Beta ?
Correct me if I am wrong but this is important milestone for Qmarco to start working on his implementation for original displays and as well for Casainho to start with 850C/SW102 firmware versions for 0.20..
There is nothing stopping Marcoq from implementing the 0.20.0 version and the code has always been open for all to see. The source code is even in the official master branch now! :) I look forward to see the implementation!

I think the other developers are working on finalizing the 0.19.0 firmware and then directly jumping to the 0.21.0 with the advanced torque sensor calibration:
casainho wrote:
Sep 04 2019 3:38am
elfnino wrote:
Sep 04 2019 3:07am
Call me impatient but what is the ETA for the official 0.20 Beta ?
(...) as well for Casainho to start with 850C/SW102 firmware versions for 0.20..
We can start with current alpha or beta, no worry for us.

And I wish we could jump directly to 0.21.0, by implementing 0.21.0 and on top add the full torque sensor.

buba   10 kW

10 kW
Posts: 588
Joined: Aug 31 2018 12:36am

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

Post by buba » Sep 04 2019 4:17am

casainho wrote:
Sep 04 2019 3:44am
buba wrote:
Sep 04 2019 3:33am
Another solution that would be safer is to add an offset to the eMTB.
I think that if we let users define like 10 points of emtb curve (this curve is applied after calculated pedal human power), that will cover this need. The curve should give much flexibility, like as soon pedal human power > 0, the emtb output --> (200 watts + pedal human power * scale factor).

jeff.page.rides arms may not be strong as some strong legs. But also the legs of my little son were not strong when he had 7 years old. I think there is a good value to be able to fine tune a curve and not only a fixed scale value(the assist level).
Yes, I think that an adjustable curve would be the best implementation. Sadly there is no more room in the KT-LCD3 to make it adjustable. But using the new displays it will enable a lot of great things and make everything much better! :) I see the 0.20.0 as one great upgrade from 0.19.0 and that is how it should be perceived. It is in no way the final firmware version, just a step in the right direction.

buba   10 kW

10 kW
Posts: 588
Joined: Aug 31 2018 12:36am

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

Post by buba » Sep 04 2019 4:25am

jeff.page.rides wrote:
Sep 03 2019 6:01pm
...

She only had biceps and one was much weaker than the other. She couldn't turn or keep the handcycle straight but with power-assist, she could pedal. So we just set her on a very large lawn at a park and let her go. She was having fun for the first time that she felt like she was under her own power and had never done anything close to that before.
If we will be able to adjust the torque sensor sensitivity it will really benefit a lot of people with week arms that use normal brakes and use the standard motor and can't trick the motor like I can the coaster brake motor. so it'll really help everybody.
:bigthumb:
There are really two possibilities and you are the best one to help us with this:

1. Let users adjust the torque offset from the calibration. Can be dangerous if not properly configured and using the startup without pedal rotation.

2. Everything works great in the Alpha 10 except the eMTB, unless you apply backwards torque during calibration. So to solve this single case I could change eMTB for users that wish for an adjustable offset. If Power Assist works perfectly then the cadence factor could also be included in eMTB for those users that would really benefit from this. Because this would be a top priority and really make the 0.20.0 great for many users!

I have now bombarded you with two replies, this one and the one a couple of posts above. I look forward to your thoughts and input but take your time and I will in the meantime consider what we can do to improve the sensitivity or make it adjustable.

casainho   10 GW

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

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

Post by casainho » Sep 04 2019 4:37am

buba wrote:
Sep 04 2019 4:17am
Yes, I think that an adjustable curve would be the best implementation. Sadly there is no more room in the KT-LCD3 to make it adjustable. But using the new displays it will enable a lot of great things and make everything much better! :) I see the 0.20.0 as one great upgrade from 0.19.0 and that is how it should be perceived. It is in no way the final firmware version, just a step in the right direction.
There is more than enough memory on SW102 and 850C displays, to add the full torque sensor (about 64 bytes) and the emtb curve (80 bytes). But this bytes need to be transferred from the display to the TSDZ2 motor controller and so current way firmware does will not work as this new bytes are about 30x times more, so the firmware will need to change a bit on both sides and don't make sense to make this changes for KT-LCD3 or that would be to "damage" current working good stable KT-LCD3 firmware.

So I think the pair of firmware TSDZ2 motor controller + KT-LCD3 should be freeze, maybe just for any possible bug corrections.

Looking at PSWPower, KT-LCD3 costs $26 while SW102 costs $35. There is no reason for new users buy KT-LCD3 anymore since SW102 has a low price already and much more value.
- 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.

marcoq   1 W

1 W
Posts: 63
Joined: Dec 17 2018 3:55am

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

Post by marcoq » Sep 04 2019 4:57am

buba wrote:
Sep 04 2019 4:08am
elfnino wrote:
Sep 04 2019 3:07am
Call me impatient but what is the ETA for the official 0.20 Beta ?
Correct me if I am wrong but this is important milestone for Qmarco to start working on his implementation for original displays and as well for Casainho to start with 850C/SW102 firmware versions for 0.20..
There is nothing stopping Marcoq from implementing the 0.20.0 version and the code has always been open for all to see. The source code is even in the official master branch now! :) I look forward to see the implementation!

I think the other developers are working on finalizing the 0.19.0 firmware and then directly jumping to the 0.21.0 with the advanced torque sensor calibration:
casainho wrote:
Sep 04 2019 3:38am
elfnino wrote:
Sep 04 2019 3:07am
Call me impatient but what is the ETA for the official 0.20 Beta ?
(...) as well for Casainho to start with 850C/SW102 firmware versions for 0.20..
We can start with current alpha or beta, no worry for us.

And I wish we could jump directly to 0.21.0, by implementing 0.21.0 and on top add the full torque sensor.
Hi Buba!
You're doing a wonderful job!
In the last two months I have had a lot to do ... but I think that soon I will get to work to adapt your firmware on the TSDZ2 OEM displays .... I think I will have to work a lot on the Java configurator too! :wink: :bigthumb:

mctubster   100 W

100 W
Posts: 231
Joined: Feb 26 2018 6:21am

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

Post by mctubster » Sep 04 2019 5:08am

buba wrote:
Sep 04 2019 3:53am

I totally understand. The code in the 0.20.0 should be the most accurate so far and if you calibrate with weights that are below 25 kg on the pedals it should be accurate in the low range. Do not use your body weight as the torque sensor is not accurate and especially not linear at those level. This is why the human power is too high. Everything above around 25 kg will not be proportional and therefore not accurate on the TSDZ2 torque sensors. Some maybe have up to 40 kg but there is probably a nice distribution where the majority have a rather low range.

Just let me know if I missed something and if I can help in any way! :)
Thank you for the reply. I just finished measuring using free weights from 0-25kg (no more because I value my fingers, not great balancing on the center of a pedal!), and based on my measurements you are very correct, the bike at the torque conversion factor I had set (67) was approx double the actual weight on the pedals at low values.
Pedal_Weights.PNG
Pedal_Weights.PNG (4.83 KiB) Viewed 667 times
I just dropped the torque conversion factor to 35 which gives me measured weights far more inline with actual.

Will test in the morning. Looks like I will be upping eMBT to 7 or 8 or more.

Cheers
Last edited by mctubster on Sep 04 2019 5:13am, edited 1 time in total.

thineight   100 W

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

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

Post by thineight » Sep 04 2019 5:10am

buba wrote:
Sep 04 2019 4:00am
ri53hu wrote:
Sep 04 2019 2:24am
Aho guys, I also started to use ALFA 10 but I can not adjust the torque sensor, I can give a more detailed explanation (or I can set it as I have 112 kg and in the hills does not stretch much.) R.
Please use a weight less than 25 kg when calibrating and it should work perfectly! :)
Just for my understanding, what is the range of average force that a "normal" cyclist applies on the pedals during a ride, intended as force during a, say, 15% climb or pushing a bike at 40 km/h with a 52t chainring?
I feel I'm not putting a force above 20 kg for 95% of the time, therefore I do not fully understand the need to calibrate the nonlinear segment up to the full body weight.
If we already have a sensor that can reasonably appreciate linearly 25kg, maybe buba's signal-torque coefficient is enough to calculate the human power that is accurate enough for practically all the situations..

I maybe miss some pieces in the logic, so please feel free to add more details and explaination.

Many thanks
MTB KTM Ultra 29" - City bike DAYTONA 28"

buba   10 kW

10 kW
Posts: 588
Joined: Aug 31 2018 12:36am

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

Post by buba » Sep 04 2019 5:16am

marcoq wrote:
Sep 04 2019 4:57am
buba wrote:
Sep 04 2019 4:08am
elfnino wrote:
Sep 04 2019 3:07am
Call me impatient but what is the ETA for the official 0.20 Beta ?
Correct me if I am wrong but this is important milestone for Qmarco to start working on his implementation for original displays and as well for Casainho to start with 850C/SW102 firmware versions for 0.20..
There is nothing stopping Marcoq from implementing the 0.20.0 version and the code has always been open for all to see. The source code is even in the official master branch now! :) I look forward to see the implementation!

I think the other developers are working on finalizing the 0.19.0 firmware and then directly jumping to the 0.21.0 with the advanced torque sensor calibration:
casainho wrote:
Sep 04 2019 3:38am
elfnino wrote:
Sep 04 2019 3:07am
Call me impatient but what is the ETA for the official 0.20 Beta ?
(...) as well for Casainho to start with 850C/SW102 firmware versions for 0.20..
We can start with current alpha or beta, no worry for us.

And I wish we could jump directly to 0.21.0, by implementing 0.21.0 and on top add the full torque sensor.
Hi Buba!
You're doing a wonderful job!
In the last two months I have had a lot to do ... but I think that soon I will get to work to adapt your firmware on the TSDZ2 OEM displays .... I think I will have to work a lot on the Java configurator too! :wink: :bigthumb:
Hi Marcoq! Likewise! I understand that and no problem! I look very much forward to see your wonderful adaption and implementation!! :D

You are a pro but if there is anything I can do to help please let me know! A lot of people appreciate your work! :bigthumb:

buba   10 kW

10 kW
Posts: 588
Joined: Aug 31 2018 12:36am

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

Post by buba » Sep 04 2019 5:21am

mctubster wrote:
Sep 04 2019 5:08am
buba wrote:
Sep 04 2019 3:53am

I totally understand. The code in the 0.20.0 should be the most accurate so far and if you calibrate with weights that are below 25 kg on the pedals it should be accurate in the low range. Do not use your body weight as the torque sensor is not accurate and especially not linear at those level. This is why the human power is too high. Everything above around 25 kg will not be proportional and therefore not accurate on the TSDZ2 torque sensors. Some maybe have up to 40 kg but there is probably a nice distribution where the majority have a rather low range.

Just let me know if I missed something and if I can help in any way! :)
Thank you for the reply. I just finished measuring using free weights from 0-25kg (no more because I value my fingers, not great balancing on the center of a pedal!), and based on my measurements you are very correct, the bike at the torque conversion factor I had set (67) was approx double the actual weight on the pedals at low values.

Pedal_Weights.PNG

I just dropped the torque conversion factor to 35 which gives me measured weights far more inline with actual.

Will test in the morning. Looks like I will be upping eMBT to 7 or 8 or more.

Cheers
Thank you for getting back and sharing your data! :bigthumb: That is, as always, very interesting to see!

I hope that you will find the calculated human power much more accurate now! :)

As for the Torque Assist and eMTB: both riding modes use the ADC torque value and are not converting it to actual torque. So you can maintain your settings and setup. But the displayed human power and the weight on pedal in the odometer field will be more accurate.
Last edited by buba on Sep 04 2019 5:29am, edited 2 times in total.

casainho   10 GW

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

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

Post by casainho » Sep 04 2019 5:27am

thineight wrote:
Sep 04 2019 5:10am
I feel I'm not putting a force above 20 kg for 95% of the time, therefore I do not fully understand the need to calibrate the nonlinear segment up to the full body weight.
Because the other 5% may be even more relevant than the 95%. The 5% is when you want to momentarily to push the bicycle with much more power like 4x more, like on startups or simple when you want to accelerate faster (that is why startup BOOST makes sense, as on current firmware you can't get that 4x more assistance power even if you do that 4x more power on pedals at startup).

Also emtb makes much more sense when you have a full linear range on the torque sensor.

Also, some torque sensors don't have even that 20 kg of initial linear range (and others have more than the 20 kgs), they have like 10 kgs, which is the weight of the legs so in practice you have a bad torque sensor.
Last edited by casainho on Sep 04 2019 5:31am, edited 1 time in total.
- 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.

mctubster   100 W

100 W
Posts: 231
Joined: Feb 26 2018 6:21am

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

Post by mctubster » Sep 04 2019 5:28am

thineight wrote:
Sep 04 2019 5:10am
buba wrote:
Sep 04 2019 4:00am
ri53hu wrote:
Sep 04 2019 2:24am
Aho guys, I also started to use ALFA 10 but I can not adjust the torque sensor, I can give a more detailed explanation (or I can set it as I have 112 kg and in the hills does not stretch much.) R.
Please use a weight less than 25 kg when calibrating and it should work perfectly! :)
Just for my understanding, what is the range of average force that a "normal" cyclist applies on the pedals during a ride, intended as force during a, say, 15% climb or pushing a bike at 40 km/h with a 52t chainring?
I feel I'm not putting a force above 20 kg for 95% of the time, therefore I do not fully understand the need to calibrate the nonlinear segment up to the full body weight.
If we already have a sensor that can reasonably appreciate linearly 25kg, maybe buba's signal-torque coefficient is enough to calculate the human power that is accurate enough for practically all the situations..

I maybe miss some pieces in the logic, so please feel free to add more details and explaination.

Many thanks
Are are correct.

If you are in the cadence range of 60-90RPM and producing say 200W (a reasonable continuous limit for a fit recreational rider) your torque will be

Torque = 9.5488 x Power (W) / Speed (RPM)
So in this example pedal torque in the range of 32-21 Nm or based on 170mm cranks, approx 19-12kg weight (all of this averaged over 360deg)

mctubster   100 W

100 W
Posts: 231
Joined: Feb 26 2018 6:21am

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

Post by mctubster » Sep 04 2019 5:33am

buba wrote:
Sep 04 2019 5:21am


Thank you for getting back and sharing your data! :bigthumb: That is, as always, very interesting to see!

I hope that you will find the calculated human power much more accurate now! :)

As for the Torque Assist and eMTB: both riding modes use the ADC torque value and are not converting it to actual torque. So you can maintain your settings and setup. But the displayed human power and the weight on pedal in the odometer field will be more accurate.
Got it. Of course, why convert. I've seen all of the gymnastics in the code to use integers only :)

Hopefully my flashing cable for my 850c will turn up any day, would like to see some of this data graphed in real time :)

Thanks again

Post Reply