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

Electric Motors and Controllers
fi7ippo   1 mW

1 mW
Posts: 13
Joined: Aug 26 2018 2:29am

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

Post by fi7ippo » Jul 10 2019 3:35pm

dameri wrote:
Jul 10 2019 11:07am
fi7ippo wrote:
Jul 10 2019 5:48am

I am very happy that you like the idea, but I was thinking, and I believe that if it is not too much trouble, and there is enough memory space, the ideal would be to have two parameters that can be changed by the user:

1- User calibration weight available with an approximation of 0.1 or 0.5 kg (this is because it would be difficult for everyone to have an identical weight to be applied for the ADC reading);

Excuse me for coming to this technical discussion. How does the driver's weight work? At least I sit in the saddle practically every time I cycle. So I don't push my pedal at full weight almost ever. And I think many others do the same when driving on an electric bike.
Hi Dameri, maybe I didn't express myself correctly!
The fact is that to calibrate the torque sensor (assuming it is now linear) we need at least 2 points. The first is the value at rest detected during power on, we must enter the second which apparently varies from sensor to sensor.

Now, we can perform an ADC reading with a defined weight applied to the crank (example 20 - 30kg), or, since it would not be easy for everyone to have the same calibration weight to apply at the crank to perform the second reading, we can have 2 parameters to configure, the weight applied during calibration and the ADC reading with applied weight! In this way, since a straight line passes only by two points each one would have its own sensor perfectly calibrated regardless of the weight used for calibration!
thineight wrote:
Jul 10 2019 12:16pm

Thanks for the effort and the new ideas guys! This project has now the right people onboard to obtain a great product!! :thumb: :thumb:
I will try to test the range of my torque sensor in the next days to see if it is linear or not..
Is it sufficient to have the bike on the ground (brakes activated) and apply the force on one pedal only with a luggage scale? Any better idea?

Thanks again
Yes thineight, essentially I do the same, the only trick is to apply the weight perpendicular to the crank to get an accurate reading. For me was difficult maintain the bike straight and firm with more than 25-30kg, I suggest you lock the bike firmly to something fixed or have someone help you keep the bike straight during the test.

Thank You guys, see you soon!

jimmyfergus   10 mW

10 mW
Posts: 22
Joined: Jul 17 2018 4:19pm

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

Post by jimmyfergus » Jul 10 2019 4:03pm

buba wrote:
Jul 10 2019 6:57am
I have added so many functions and optimized so much space it is insane. But there is a limit. Trying to make the firmware react so good that we do not need Startup Boost and get some space back.
I definitely think Boost seems like a band-aid that can be discarded if you improve the responsiveness. Personally I would be very happy to see it dropped. It seems to be a frequent pattern with control systems that they accumulate band-aids to try to fix behavior where if you get back to the fundamentals you can avoid them altogether.

I'm assuming that you're also improving the slow-down responsiveness. In 0.19 the run-on is pretty strong, feels like ~1s after stopping pedaling, and to me at high assist even feels like a ramp up and then sudden stop. This is a problem for me with an internal gear hub, where gear shifts are very abrupt - unlike a derailleur when the chain ramps between cogs - I'm pretty sure if my shift comes through under power I'm really stressing that poor blue gear, but avoiding it means a very long, slow gearshift.

I'm also hoping whatever causes set-off to lag sometimes will go away. I'm not running a brake cut-off at present, and I'm not sure if that contributes, but a lot of times I get nothing much for the first revolution or two on set-off, and then a slow ramp-up. I think it's related to having a foot on the pedals when stationary.

I'm looking forward to your new beta - though I'll probably be on vacation.

What recommended sdcc version works for the codebase? I tried a few and got various SEGVs and other issues during compilation.

Thanks for your efforts!

buba   100 W

100 W
Posts: 205
Joined: Aug 31 2018 12:36am

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

Post by buba » Jul 10 2019 5:06pm

flufferty wrote:
Jul 10 2019 1:33pm
I may be completely out of the loop here, but why do we need the human power to be accurate?
It seems that all the TSDZ2-units have differently calibrated sensors, and perhaps the stock firmware is compensating for that (undocumented eeprom-data?), perhaps it isn't.

Couldn't we include a calibration routine that takes the resting value, and then records the highest torque value read, and uses that for dynamically applying the power-factor. (given we don't need real-watt human power, we only need a deterministic torque-sensor range)

The firmware could continuously save the highest torque recorded, and use that. So the harder you press your bike (torque sensor range allowing) the higher you'll raise the torque-range (until its saturated, or you cant push it more).
So given a "well-calibrated" physical torque sensor, you will get a larger/finer range, but someone with a badly calibrated physical torque sensor, will have the same range, but with worse resolution.

If needed, perhaps a new "weaker" person wants to use THAT motor, you reset the calibrated value in a menu-option.
With the above option of "dynamic" high-point, a child could ride the motor and enjoy it's full benefits, even without reaching the 40kg or so where the torque sensors seems to max out.
The things you describe actually define Torque Assist that will be released soon!

It all boils down to a desire to have the torque sensor perform the very best it can. The better it can interpret user input the better the response of the system. For the coming Torque Assist there is no problem at all as it is similar to the original firmware. The torque sensor will be calibrated during power on and establish a resting value. After this, the more you press on the pedals the more power you will get. Simple as that. And if you have some user having problems with applying enough force you simply adjust the assist level multipliers so it suits that user.

For Power Assist we need to calibrate the torque sensor so it gives us a correct conversion between the ADC value and real life force/torque. This enables us to accurately measure human power which can be a fun riding mode to be in. If we can make it work 100 % then it would be very natural and responsive. But the operating range and characteristics of the torque sensor in the TSDZ2 is setting the limit and it is this limit we are trying to push now.
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

buba   100 W

100 W
Posts: 205
Joined: Aug 31 2018 12:36am

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

Post by buba » Jul 10 2019 5:29pm

jimmyfergus wrote:
Jul 10 2019 4:03pm
buba wrote:
Jul 10 2019 6:57am
I have added so many functions and optimized so much space it is insane. But there is a limit. Trying to make the firmware react so good that we do not need Startup Boost and get some space back.
I definitely think Boost seems like a band-aid that can be discarded if you improve the responsiveness. Personally I would be very happy to see it dropped. It seems to be a frequent pattern with control systems that they accumulate band-aids to try to fix behavior where if you get back to the fundamentals you can avoid them altogether.
I am very thankful you commented and said that. We will see what the feedback is from the community when the next beta is released. Will do my best to jam as much as possible including Boost.


jimmyfergus wrote:
Jul 10 2019 4:03pm
I'm assuming that you're also improving the slow-down responsiveness. In 0.19 the run-on is pretty strong, feels like ~1s after stopping pedaling, and to me at high assist even feels like a ramp up and then sudden stop. This is a problem for me with an internal gear hub, where gear shifts are very abrupt - unlike a derailleur when the chain ramps between cogs - I'm pretty sure if my shift comes through under power I'm really stressing that poor blue gear, but avoiding it means a very long, slow gearshift.
Totally understand you. My goal with this next version is to improve everything but can already say that it will be impossible to do everything perfect from the very first beta. But just releasing it will be a big step. After it is released I will listen for much needed feedback from the community and make improvements based on that feedback.

It will be over 4000 lines of code added/changed/improved when the new beta arrives. 1 % time spent on new riding modes, 9 % time spent on feeling and response, 90 % time spend for preparation of handling many riding modes, creating a modular system, safety, easier future development, future display support and so on.


jimmyfergus wrote:
Jul 10 2019 4:03pm
I'm also hoping whatever causes set-off to lag sometimes will go away. I'm not running a brake cut-off at present, and I'm not sure if that contributes, but a lot of times I get nothing much for the first revolution or two on set-off, and then a slow ramp-up. I think it's related to having a foot on the pedals when stationary.

I'm looking forward to your new beta - though I'll probably be on vacation.

What recommended sdcc version works for the codebase? I tried a few and got various SEGVs and other issues during compilation.

Thanks for your efforts!
Look forward to you testing the new beta and of course your feedback! As I said, it will not be perfect but the foundation will be rock solid.

I use SDCC 3.8.0.

Appreciate it!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

casainho   1 GW

1 GW
Posts: 3179
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Jul 10 2019 5:54pm

buba wrote:
Jul 10 2019 5:06pm
The torque sensor will be calibrated during power on and establish a resting value. After this, the more you press on the pedals the more power you will get. Simple as that. And if you have some user having problems with applying enough force you simply adjust the assist level multipliers so it suits that user.
There is an issue here. My torque sensor could measure only 10 kgs and after that was very not linear.

So, the first 5 kgs was my legs resting than just another 5 kgs for measure user actual leg force, which is almost nothing, so user will simple not get any assistance by putting more force on the pedals because the sensor saturates very early -- it is like if sensor is faulty.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

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   100 W

100 W
Posts: 205
Joined: Aug 31 2018 12:36am

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

Post by buba » Jul 10 2019 6:12pm

casainho wrote:
Jul 10 2019 5:54pm
buba wrote:
Jul 10 2019 5:06pm
The torque sensor will be calibrated during power on and establish a resting value. After this, the more you press on the pedals the more power you will get. Simple as that. And if you have some user having problems with applying enough force you simply adjust the assist level multipliers so it suits that user.
There is an issue here. My torque sensor could measure only 10 kgs and after that was very not linear.

So, the first 5 kgs was my legs resting than just another 5 kgs for measure user actual leg force, which is almost nothing, so user will simple not get any assistance by putting more force on the pedals because the sensor saturates very early -- it is like if sensor is faulty.
Correct, for that case I have added an error code warning users that something might be wrong with the torque resolution. The new wiki explains that the user should:

1. Not press the pedals during calibration

2. Follow your tutorial and adjust the torque sensor as it needs to be calibrated

So if the resting torque is higher than 64 (value can be changed, just chose 64 for now) it is due to the user applying force on the pedals or the torque sensor simply needs calibration. I think we should advise users in the wiki to check their sensor if they feel that the response is lacking. And if it is above a certain level (probably higher than 64) the sensor should be calibrated.

What do you think?
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

buba   100 W

100 W
Posts: 205
Joined: Aug 31 2018 12:36am

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

Post by buba » Jul 11 2019 4:22am

Feels great, coming soon...!

Notice it is the same power scale!

Previous power steps:
Motor Power for every ADC Current Step   _   Previous Current Controller.png
Motor Power for every ADC Current Step _ Previous Current Controller.png (21.74 KiB) Viewed 364 times
New power steps:
Motor Power for every ADC Current Step   _   New Current Controller.png
Motor Power for every ADC Current Step _ New Current Controller.png (30.92 KiB) Viewed 364 times
Much greater response and control now.
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

casainho   1 GW

1 GW
Posts: 3179
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Jul 11 2019 4:53am

buba wrote:
Jul 10 2019 6:12pm
casainho wrote:
Jul 10 2019 5:54pm
buba wrote:
Jul 10 2019 5:06pm
The torque sensor will be calibrated during power on and establish a resting value. After this, the more you press on the pedals the more power you will get. Simple as that. And if you have some user having problems with applying enough force you simply adjust the assist level multipliers so it suits that user.
There is an issue here. My torque sensor could measure only 10 kgs and after that was very not linear.

So, the first 5 kgs was my legs resting than just another 5 kgs for measure user actual leg force, which is almost nothing, so user will simple not get any assistance by putting more force on the pedals because the sensor saturates very early -- it is like if sensor is faulty.
Correct, for that case I have added an error code warning users that something might be wrong with the torque resolution. The new wiki explains that the user should:

1. Not press the pedals during calibration

2. Follow your tutorial and adjust the torque sensor as it needs to be calibrated

So if the resting torque is higher than 64 (value can be changed, just chose 64 for now) it is due to the user applying force on the pedals or the torque sensor simply needs calibration. I think we should advise users in the wiki to check their sensor if they feel that the response is lacking. And if it is above a certain level (probably higher than 64) the sensor should be calibrated.

What do you think?
This is a difficult situation as a bad calibrated torque sensor is more like a fault torque sensor, or almost as if does not exist. In this case, I think a human power controller or PAS controller is better than a torque sensor controller. The previous wrong code for reading human power was acting more like a PAS controller and it worked so well that we didn't discover the wrong code until we started to measure the human power with care.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

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.

thineight   100 W

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

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

Post by thineight » Jul 11 2019 6:09am

Hello everyone,
this morning I borrowed a digital luggage scale and I made some quick tests on the force/sensor response.

It has a sort of hook, therefore I put the bike upright in normal position with the brake pressed, pedal horizontal (no laser level though :wink:) and force applied upwards on the pedal at the back (right).
I flipped the bike, rotated the pedals 180° and repeated the measurements on the left pedal just to have 2 sets of values.
The precision may not be that accurate but I think it gives the idea.

My rest value, read from menu 9.2, is about 50. To be noted that it was 48-49 few weeks ago when buba asked the first time.

Here below my chart, i think I can conclude that it can linearly appreciate about 20 kg.
force vs torque.png
force vs torque.png (29.15 KiB) Viewed 334 times
Hope more data helps the development.
Cheers
MTB KTM Ultra 29" - City bike DAYTONA 28"

dameri   10 W

10 W
Posts: 95
Joined: Sep 20 2018 10:57am

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

Post by dameri » Jul 11 2019 6:14am

fi7ippo wrote:
Jul 10 2019 3:35pm
dameri wrote:
Jul 10 2019 11:07am
fi7ippo wrote:
Jul 10 2019 5:48am

I am very happy that you like the idea, but I was thinking, and I believe that if it is not too much trouble, and there is enough memory space, the ideal would be to have two parameters that can be changed by the user:

1- User calibration weight available with an approximation of 0.1 or 0.5 kg (this is because it would be difficult for everyone to have an identical weight to be applied for the ADC reading);

Excuse me for coming to this technical discussion. How does the driver's weight work? At least I sit in the saddle practically every time I cycle. So I don't push my pedal at full weight almost ever. And I think many others do the same when driving on an electric bike.
Hi Dameri, maybe I didn't express myself correctly!
The fact is that to calibrate the torque sensor (assuming it is now linear) we need at least 2 points. The first is the value at rest detected during power on, we must enter the second which apparently varies from sensor to sensor.

Now, we can perform an ADC reading with a defined weight applied to the crank (example 20 - 30kg), or, since it would not be easy for everyone to have the same calibration weight to apply at the crank to perform the second reading, we can have 2 parameters to configure, the weight applied during calibration and the ADC reading with applied weight! In this way, since a straight line passes only by two points each one would have its own sensor perfectly calibrated regardless of the weight used for calibration!
Thank you for explanation.

thineight   100 W

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

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

Post by thineight » Jul 11 2019 7:41am

Hello casainho, i've just updated the wiki for the brake sensor installation
https://github.com/OpenSource-EBike-fir ... ke-sensors
I am not sure I did the procedure correctly, anyway I added the note on top to pay attention during the boot to make sure the brake sensors are correctly installed and working, in addition I added the schematic with a good solution to keep the sensor disconnectable.

Unfortunately I think I cannot add pictures on the wiki, therefore I kindly ask you to add the following one to your wiki in order to complete the explaination.
Many thanks.
brake_sensor_schematic.png
MTB KTM Ultra 29" - City bike DAYTONA 28"

casainho   1 GW

1 GW
Posts: 3179
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Jul 11 2019 8:13am

thineight wrote:
Jul 11 2019 7:41am
Hello casainho, i've just updated the wiki for the brake sensor installation
https://github.com/OpenSource-EBike-fir ... ke-sensors
I am not sure I did the procedure correctly, anyway I added the note on top to pay attention during the boot to make sure the brake sensors are correctly installed and working, in addition I added the schematic with a good solution to keep the sensor disconnectable.

Unfortunately I think I cannot add pictures on the wiki, therefore I kindly ask you to add the following one to your wiki in order to complete the explaination.
Many thanks.

brake_sensor_schematic.png
Done, the file is here: https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki

Yes, files need to be upload to other place and works differently.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

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.

thineight   100 W

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

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

Post by thineight » Jul 11 2019 9:23am

casainho wrote:
Jul 11 2019 8:13am
Done, the file is here: https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki

Yes, files need to be upload to other place and works differently.
I think I've done. Please double check as I never used github before. :wink:
MTB KTM Ultra 29" - City bike DAYTONA 28"

Popo15   1 mW

1 mW
Posts: 19
Joined: Nov 25 2018 9:56am

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

Post by Popo15 » Jul 11 2019 4:05pm

Hello good afternoon Buba, finished riding an engine with Throttle, I confirm that the Throttle does not work with version v.19 beta8 I have tested with previous versions example version Throttle v0.16.0 working, thank you very much for your work.

skestans   100 µW

100 µW
Posts: 8
Joined: Jul 12 2019 12:42am
Location: Switzerland

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

Post by skestans » Jul 12 2019 1:08am

I am new to this, and I'm wondering: is the Open Source firmware compatible with the 850c colors display, or is it only with the KT-LCD3? Are there any plans to make the 850c compatible with it?

casainho   1 GW

1 GW
Posts: 3179
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Jul 12 2019 1:21am

skestans wrote:
Jul 12 2019 1:08am
I am new to this, and I'm wondering: is the Open Source firmware compatible with the 850c colors display, or is it only with the KT-LCD3? Are there any plans to make the 850c compatible with it?
I hope to release in a few days a first version for 850C, here is a picture I took recently from the one I am riding in my bicycle:

Image
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

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.

skestans   100 µW

100 µW
Posts: 8
Joined: Jul 12 2019 12:42am
Location: Switzerland

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

Post by skestans » Jul 12 2019 2:10am

casainho wrote:
Jul 12 2019 1:21am
skestans wrote:
Jul 12 2019 1:08am
I am new to this, and I'm wondering: is the Open Source firmware compatible with the 850c colors display, or is it only with the KT-LCD3? Are there any plans to make the 850c compatible with it?
I hope to release in a few days a first version for 850C, here is a picture I took recently from the one I am riding in my bicycle:

Image
Amazing, thank you so much for your work! I have never owned an e-bike but your project has made me very excited to build my first one!

buba   100 W

100 W
Posts: 205
Joined: Aug 31 2018 12:36am

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

Post by buba » Jul 12 2019 4:52am

thineight wrote:
Jul 11 2019 6:09am
Hello everyone,
this morning I borrowed a digital luggage scale and I made some quick tests on the force/sensor response.

It has a sort of hook, therefore I put the bike upright in normal position with the brake pressed, pedal horizontal (no laser level though :wink:) and force applied upwards on the pedal at the back (right).
I flipped the bike, rotated the pedals 180° and repeated the measurements on the left pedal just to have 2 sets of values.
The precision may not be that accurate but I think it gives the idea.

My rest value, read from menu 9.2, is about 50. To be noted that it was 48-49 few weeks ago when buba asked the first time.

Here below my chart, i think I can conclude that it can linearly appreciate about 20 kg.

Hope more data helps the development.
Cheers
Just want to thank you for the extra data and taking the time to test! :bigthumb:

The more we have the better we can model the behavior of the torque sensor. It is interesting that you tested both sides as well! Also, it seems your torque sensor suffers "aging" if the resting value has increased over time. This would explain why it always calibrates when powering on the system in the original firmware. They know that with time it will change. We also calibrate in the same way but not as long as they do. In the new version it will calibrate longer and be much more accurate though.

EDIT: Nice work on the brake sensor tutorial and pictures! I think it will be much appreciated by the whole community!
Last edited by buba on Jul 12 2019 4:58am, edited 2 times in total.
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

buba   100 W

100 W
Posts: 205
Joined: Aug 31 2018 12:36am

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

Post by buba » Jul 12 2019 4:55am

Popo15 wrote:
Jul 11 2019 4:05pm
Hello good afternoon Buba, finished riding an engine with Throttle, I confirm that the Throttle does not work with version v.19 beta8 I have tested with previous versions example version Throttle v0.16.0 working, thank you very much for your work.
Hello Popo15,

Have you enabled the throttle in the Configuration Menu under the Motor Controller Setup?

https://github.com/OpenSource-EBike-fir ... ller_Setup
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

casainho   1 GW

1 GW
Posts: 3179
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Jul 12 2019 7:07am

I got my torque sensor well calibrated and even saved the max value of each pedal rotation and then applied the sinewave average factor, so, I hope this value is correct.

I had a bug on 850C that took me some days to solve... but finally the graph shows correctly the pedal human power and with that white line as a contour.

I had to sweat to get that 300W peak!! I had to put all my body of 100 kgs on the pedals and pedal hard up to get some decent cadence. Since now my torque sensor measures only up to 40 kgs and there is not yet an exploitation of the non linear zone, I guess the peak should be more like double of that value... Anyway, for pedaling seated, I think the values are correct. I can do between 100 to 150 watts continuous for maybe like 30 minutes.
I changed the gears and even if my cadence increase or decrease, the power measured were almost the same as I was trying to keep it the same, feeling that I was doing the same effort/work, so I think it really works well.

Note that black vertical lines are due to the mobile camera recording frequency.
Image

Buba, I have the code ready to move to your code.

Maybe you are wasting time doing all that optimizations on LCD3, I guess it will not handle the options for torque sensor calibration (including the non linear range).
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

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   100 W

100 W
Posts: 205
Joined: Aug 31 2018 12:36am

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

Post by buba » Jul 12 2019 7:36am

casainho wrote:
Jul 12 2019 7:07am
I got my torque sensor well calibrated and even saved the max value of each pedal rotation and then applied the sinewave average factor, so, I hope this value is correct.

I had a bug on 850C that took me some days to solve... but finally the graph shows correctly the pedal human power and with that white line as a contour.

I had to sweat to get that 300W peak!! I had to put all my body of 100 kgs on the pedals and pedal hard up to get some decent cadence. Since now my torque sensor measures only up to 40 kgs and there is not yet an exploitation of the non linear zone, I guess the peak should be more like double of that value... Anyway, for pedaling seated, I think the values are correct. I can do between 100 to 150 watts continuous for maybe like 30 minutes.
I changed the gears and even if my cadence increase or decrease, the power measured were almost the same as I was trying to keep it the same, feeling that I was doing the same effort/work, so I think it really works well.

Note that black vertical lines are due to the mobile camera recording frequency.
Image

Buba, I have the code ready to move to your code.

Maybe you are wasting time doing all that optimizations on LCD3, I guess it will not handle the options for torque sensor calibration (including the non linear range).
Nice work!

One alternative is that you do not commit your changes and do not accept my pull request yet. I can add your changes in my branch and then you can accept the entire pull request when everything is finished. This would be the best for me as I then have more time to finish my development. And when I am finished you can accept the pull request and immediately test my changes in combination with your changes. Everything will work! Can we do that? I can add the changes you have done in the branch: pedal_power_average in the coming days.

If that works with you I would be very grateful!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

casainho   1 GW

1 GW
Posts: 3179
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Jul 12 2019 7:59am

buba wrote:
Jul 12 2019 7:36am
EDIT: One alternative is that you do not commit your changes and do not accept my pull request yet. I can add your changes in my branch and then you can accept the entire pull request when everything is finsihed. This would be the best for me as I then have more time to finish my development. And when I am finished you can accept the pull request and immediately test my changes in combination with your changes. Everything will work! Can we do that? I can add the changes you have done in the branch: pedal_power_average in the coming days.

If that works with you I would be very grateful!
yes, I put my latest code on that branch. Get it from there.

Some notes:
- I decided to calculate in parallel the human pedal power value to be shown on LCD as the one used to control the motor do works well and I didn't to risky what is working well
- the calibration value is for my girlfriend bicycle, that seams to have a double sensitivity torque compared to others

I want to release today firmware version for 850C LCD, for motor controller firmware version 0.19.0.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

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.

perryscope   100 mW

100 mW
Posts: 47
Joined: Jan 06 2019 4:29pm
Contact:

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

Post by perryscope » Jul 12 2019 8:09am

casainho wrote:
Jul 12 2019 7:59am
I want to release today firmware version for 850C LCD, for motor controller firmware version 0.19.0.
Great to hear this is almost ready to Beta Casainho, Are there any flashing instructions for this screen. I have a spare screen waiting to be tested that I have opened and added programming pins, but I'm note sure of the flashing process?
Empowered people support rider and techie.
www.empoweredpeople.co.uk

buba   100 W

100 W
Posts: 205
Joined: Aug 31 2018 12:36am

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

Post by buba » Jul 12 2019 8:09am

casainho wrote:
Jul 12 2019 7:59am
buba wrote:
Jul 12 2019 7:36am
EDIT: One alternative is that you do not commit your changes and do not accept my pull request yet. I can add your changes in my branch and then you can accept the entire pull request when everything is finsihed. This would be the best for me as I then have more time to finish my development. And when I am finished you can accept the pull request and immediately test my changes in combination with your changes. Everything will work! Can we do that? I can add the changes you have done in the branch: pedal_power_average in the coming days.

If that works with you I would be very grateful!
yes, I put my latest code on that branch. Get it from there.

Some notes:
- I decided to calculate in parallel the human pedal power value to be shown on LCD as the one used to control the motor do works well and I didn't to risky what is working well
- the calibration value is for my girlfriend bicycle, that seams to have a double sensitivity torque compared to others
Very nice and I highly appreciate that you asked as this greatly simplifies the development process. I will finish what I have started and then add your changes! Look forward to test the result the coming days! This is so perfect!!

Thanks for the notes!

casainho wrote:
Jul 12 2019 7:59am
I want to release today firmware version for 850C LCD, for motor controller firmware version 0.19.0.
Very cool! :bigthumb:
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

Popo15   1 mW

1 mW
Posts: 19
Joined: Nov 25 2018 9:56am

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

Post by Popo15 » Jul 12 2019 8:41am

buba wrote:
Jul 12 2019 4:55am
Popo15 wrote:
Jul 11 2019 4:05pm
Hello good afternoon Buba, finished riding an engine with Throttle, I confirm that the Throttle does not work with version v.19 beta8 I have tested with previous versions example version Throttle v0.16.0 working, thank you very much for your work.
Hello Popo15,

Have you enabled the throttle in the Configuration Menu under the Motor Controller Setup?

https://github.com/OpenSource-EBike-fir ... ller_Setup
good morning, if enabled and it does not work, thank you very much.

Post Reply