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

Electric Motors and Controllers
buba   10 kW

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

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

Post by buba » Aug 07 2019 7:05am

NexusG wrote:
Aug 07 2019 6:33am
Wonderful job buba! the emtb combined with torque mode is especially useful on the singletracks
Very glad to hear you find it useful! That actually makes me very happy as I do not know how this eMTB compares to other eMTB modes from other forks or commercial products. Would like to hear some comparisons! But if you find it useful then it does serve a purpose!


NexusG wrote:
Aug 07 2019 6:33am
I confirm that high cadence mode (48V motor) seems not to work properly

"Start without pedal rotation" is no more a feature ? I did really like it...

Moreover, a way to switch fast between the power, torque and cadence mode would be a good idea
The "assistance-without-pedal-rotation" I will try to add. Especially if it can be as safe as what I had in mind! Will fix, consider and do my best! Thank you for the feedback!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

casainho   1.21 GW

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

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

Post by casainho » Aug 07 2019 8:26am

buba wrote:
Aug 07 2019 6:06am
casainho wrote:
Aug 06 2019 9:36pm
buba wrote:
Aug 06 2019 4:53pm
And just so that everyone knows, whatever I implement will not in any way stop anyone from modifying the TSDZ2 in any way they like. I always strive to make the code more modular, simple to understand and accessible to anyone.
I think it is a strategic error to increase the project complexity. Supporting more different user types will add more options paths for users and so more confusion, more work for developers to support users, users will be dispersed, will be harder to maintain the same the quality compared to have a smaller and a more focused project, the project as a whole will be weaker.

Don't count with me to develop and maintain a project I don't believe, that I am not motivated to.
I just want to clarify that I did not mean for us to add project complexity. I simply stated that no one should be worried for all the changes planned as it will never stop anyone from doing their thing in another fork. But that this project needs to focus on the things that is happening now.

I really hope you did not get any intentions wrong.

Anyway, I will assume we are on the same page regarding the EEPROM thing... Let me know if you feel more comfortable with leaving things as it is.
Currently you are trying to stabilize v0.20.0. After that version, the EEPROM code should be removed as also run time configurations variables initialization. On that time, I think we will have a working version of firmware for SW102 and for 850C displays.
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.

casainho   1.21 GW

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

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

Post by casainho » Aug 07 2019 9:18am

Torque sensor full calibration

From my previous try, I found that the points I did record were incorrect - maybe because I did it alone and it is hard like that.

I weight about 100 kgs and my girlfriend about 60 kgs. I used this values as also initial values of 10 and 20 kgs using weights. The middle values I did extrapolate following a curve that seems logic to me. At least, to the weights I did measure the torque sensor measures it correctly.

I decided to use 8 points and it seems to work. I don't know if there is a better way for the users.

Image

For now, firmware must be download from here: https://github.com/OpenSource-EBike-fir ... alibration
and user will need to edit the tables values of right and left pedals (ui16_torque_sensor_linearize_right and ui16_torque_sensor_linearize_left), on the file ebike_app.c:

casainho wrote:
Jul 26 2019 8:06pm
Finally we own the TSDZ2 torque sensor!!

Up to now we were reading the torque sensor in a wrong way and it could only measure up to 25 kgs. Also there is a big different from the values read on left or right pedal. This are the output values of my torque sensor (that I bought 3 weeks ago):

Image

I implemented the linearization of the torque sensor measures and it can now measure up to at least 102 kgs (which is my weight). I also implemented a linearization based on a table with values for left and right pedal and it works very well: before my right pedal was measuring the 102 kgs of my weight but left pedal would measure only 70 kgs, now both pedals measure the same values.

Before my display was showing to me a value of pedal human power of a bit more than 100 watts, no matter the force I did and now, I can go up 400 watts for short peaks. I think strong cyclists will love to see their real pedal human power on the display!!

And by the way, I am pretty sure there is no need to calibrate the sensor as I did before, no need to open the motor and adjust the hall sensor position of the torque sensor.

Calibration process

1. user put values on right pedal, starting at 5 kgs, in steps of 5 kgs up to about 30 kgs. Finally put itself on the pedal with his known weight value. The pair of weight and torque sensor ADC value should be registered and later user will need to decide for 5 points only, 1 at start, other at the last value and 3 values near the knee on the graph, as shown on the graphs.
2. Repeat for left pedal.
3. Put the pair values of weight and torque sensor ADC values, for each pedal, on the specific LCD configuration menu.

One important thing for all this work is that at system power up, the right pedal should be pointing to ground -- as there is the need to identify which pedal we are doing the force and there is no way to identify them, I decided to do like this, having the pedal at a known position at startup and after that everything will work well.

I have the code working on my bicycle and I can see on the LCD the weight value in kgs on the LCD. The tables for linearization are for now hardcoded on the firmware, I can't setup them yet on LCD. When we have the next version of firmware I can add this feature to it.
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.

Rafe   10 W

10 W
Posts: 91
Joined: Oct 16 2018 5:56pm

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

Post by Rafe » Aug 07 2019 9:19am

buba wrote:
Aug 07 2019 6:29am


- Maybe improve the throttle depending on user feedback

I did answer your questionnaire on throttle data Buba but you may have missed it with the deluge of responses you have had in the last 3 days :)

viewtopic.php?f=30&t=93818&start=3025#p1486393

buba   10 kW

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

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

Post by buba » Aug 07 2019 10:08am

Rafe wrote:
Aug 07 2019 9:19am
buba wrote:
Aug 07 2019 6:29am


- Maybe improve the throttle depending on user feedback

I did answer your questionnaire on throttle data Buba but you may have missed it with the deluge of responses you have had in the last 3 days :)

viewtopic.php?f=30&t=93818&start=3025#p1486393
I think my reply drowned in the flood of all other posts - It was intense! :bolt: Thank you by the way!

buba wrote:
Aug 06 2019 8:25am
Rafe wrote:
Aug 06 2019 4:50am
With the bike on a kick stand

1. Yes from 0 - 255
2. Yes
3. No, It is quite linear , with only a small movement required to leave zero at the bottom end and it reaches 255 with just a little movement left at the top end.
Wheel starts moving at 5 reaches maximum speed at about 30 with no further increase of speed all the way up to 255. As the physical movement between 5 and 30 is so small and difficult even on the kickstand to achieve this must be why when riding the bike it feels like an on off switch. Edit: to ensure the throttle was not cutting out at maximum wheel speed I did this test again with that set to maximum (62mph) and in 1st gear and had the same result of approximately 30.
4. 182
6. 42
7. 0
Would you mind testing one last thing so we can confirm something? :wink:

Can you set the power limit to 1000+ watt and increase the max battery current to 18 A? And then try the throttle and see if it reacts more as one would expect.

Rafe wrote:
Aug 06 2019 4:50am
You also asked me about Cadence on the BBS HD but since then Perryscope has replied and I could not add anything useful to his (or her) excellent answer. I also set my BBSHD up a couple of years ago and have never had to revisit the settings. The throttle works like a throttle though :)

Thank you for taking an interest but don't put yourself out too much over it. I tend to use the manual throttle in a sudden situation where it is not possible to pedal and just need it to keep the bike moving and it does that just as it is now except it can be too much help. For now though I will disable cadence mode as your other 3 modes are more than enough to play with and enjoy. If only someone would come up with a tougher plastic gear, the metal gear is too noisy but lasts forever and the blue gear is quiet but suddenly fails under too much load.
Okay, totally agree. Let us put Cadence Assist on hold for now and just think about it in the back of our heads. A lot of things going on now. There is a chance we will revisit this when everything else settles :)

Also agree on your comments regarding the gear!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

buba   10 kW

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

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

Post by buba » Aug 07 2019 10:32am

Quick update:

- EEPROM will be slightly more efficient thanks to mspider65! SOLVED

- Motor temperature not displayed in odometer field when user selects it to be displayed, this will be sorted out! SOLVED

- No assistance over 90 cadence, will be fixed! SOLVED

- Backwards resistance that comes and goes, bye bye! SOLVED

- Slightly better motor control in the low range when using Power Assist SOLVED

- Maybe improve the throttle depending on user feedback

- Error code if the cadence calibration is not done and users are trying to use the Advanced Mode SOLVED

- Maybe pedal assistance without pedal rotation in a very safe way! IMPLEMENTING RIGHT NOW

- Overall improvements SOLVED
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

mspider65   100 µW

100 µW
Posts: 7
Joined: Aug 04 2019 2:10pm

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

Post by mspider65 » Aug 07 2019 12:40pm

buba wrote:
Aug 07 2019 6:29am
I just want to say that I will be developing today and making Alpha 3. Here is what I planned:

- EEPROM will be slightly more efficient thanks to mspider65!

- Motor temperature not displayed in odometer field when user selects it to be displayed, this will be sorted out!

- No assistance over 90 cadence, will be fixed!

- Backwards resistance that comes and goes, bye bye!

- Slightly better motor control in the low range when using Power Assist

- Maybe improve the throttle depending on user feedback

- Error code if the cadence calibration is not done and users are trying to use the Advanced Mode

- Maybe pedal assistance without pedal rotation in a very safe way!

- Overall improvements

And if I have missed something or users have more suggestions I will add that to! But will be rather absent from the thread so I can focus on development. But will of course read suggestions and also reply if there is something that I can help with!
Hello Buba,
I've done a fork of your brach...
Check also uart_receive_packag in ebike_app.c. Probably ui8_received_package_flag should be reset to 0 also when CRC check fails.
Last edited by mspider65 on Aug 07 2019 1:00pm, edited 1 time in total.

buba   10 kW

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

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

Post by buba » Aug 07 2019 12:56pm

mspider65 wrote:
Aug 07 2019 12:40pm
buba wrote:
Aug 07 2019 6:29am
I just want to say that I will be developing today and making Alpha 3. Here is what I planned:

...


And if I have missed something or users have more suggestions I will add that to! But will be rather absent from the thread so I can focus on development. But will of course read suggestions and also reply if there is something that I can help with!
Hallo Buba,
I've done a fork of your brach...
Check also uart_receive_packag in ebike_app.c. Probably ui8_received_package_flag should be reset to 0 also when CRC check fails.
Hey mspider65,

Nice job! Will be interesting to see what you come up with! :D

Taking a look at the code! Thank you!

EDIT: Looked and you are totally right! This "bug" has been with us on all versions before 0.20.0 so by changing this (thanks to you) we will be discarding a bad package and reading the correct one without testing all data before we get the new package! This will be in the Alpha 3! Thank you, again!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

buba   10 kW

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

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

Post by buba » Aug 07 2019 2:12pm

Another update:

I have pushed the changes to my branch and this is the 0.20.0 Alpha 3 candidate:

https://github.com/leon927/TSDZ2-Smart- ... ng-pwm-acc

We currently have bad weather so I can not test the changes today. Will test as soon as possible tomorrow. After I have confirmed that everything is okay I will make the last changes and release the Alpha 3.

The Alpha 3 will have overall improvements with none of the bugs found in Alpha 2.

If there are any suggestions or improvements you would like, please let me know and I will try to add it to the Alpha 3. It is not possible to add every suggestion as some suggestions need more time and require extensive work that can make it difficult to validate the last fixes. But will listen and consider everything!


NexusG wrote:
Aug 07 2019 6:33am
"Start without pedal rotation" is no more a feature ? I did really like it...
It will hopefully be even better and safer in the Alpha 3! :)


NexusG wrote:
Aug 07 2019 6:33am
Moreover, a way to switch fast between the power, torque and cadence mode would be a good idea
That one is tricky, requires a lot of work and more configuration variables. Maybe even a new button event and a way for the users to see what riding mode they are switching to. Am definitively open for discussion but maybe best to save this one as a possible future enhancement if the community ends up wanting such a switch.
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

bruwie   1 mW

1 mW
Posts: 13
Joined: Mar 02 2017 3:12pm
Location: Lower Saxony,Germany

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

Post by bruwie » Aug 07 2019 3:15pm

buba wrote:
Aug 07 2019 2:12pm

We currently have bad weather so I can not test the changes today. Will test as soon as possible tomorrow.

If there are any suggestions or improvements you would like, please let me know and I will try to add it to the Alpha 3. It is not possible to add every suggestion as some suggestions need more time and require extensive work that can make it difficult to validate the last fixes. But will listen and consider everything!
Hello, buba,
I always drive with lights on, which I switch on with the up button. Could you make it configurable that the lights are switched on when the display is switched on? Of course it's not so important, but maybe others would use it as well. Sometimes I forget to turn the light on again, especially after a break. It's just a suggestion because you asked.
TSDZ2 36 Volt 350 Watt with motor temperature sensor, LCD3, Batterypack 36 Volt 23 Ah, no throttle and brakesensors

casainho   1.21 GW

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

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

Post by casainho » Aug 07 2019 3:23pm

bruwie wrote:
Aug 07 2019 3:15pm
Hello, buba,
I always drive with lights on, which I switch on with the up button. Could you make it configurable that the lights are switched on when the display is switched on? Of course it's not so important, but maybe others would use it as well. Sometimes I forget to turn the light on again, especially after a break. It's just a suggestion because you asked.
Maybe keep in memory last time state of lights, maybe this is ok for everyone.
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   10 kW

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

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

Post by buba » Aug 07 2019 4:32pm

bruwie wrote:
Aug 07 2019 3:15pm
buba wrote:
Aug 07 2019 2:12pm

We currently have bad weather so I can not test the changes today. Will test as soon as possible tomorrow.

If there are any suggestions or improvements you would like, please let me know and I will try to add it to the Alpha 3. It is not possible to add every suggestion as some suggestions need more time and require extensive work that can make it difficult to validate the last fixes. But will listen and consider everything!
Hello, buba,
I always drive with lights on, which I switch on with the up button. Could you make it configurable that the lights are switched on when the display is switched on? Of course it's not so important, but maybe others would use it as well. Sometimes I forget to turn the light on again, especially after a break. It's just a suggestion because you asked.
Hello Bruwie! Yeah, sure!


casainho wrote:
Aug 07 2019 3:23pm
bruwie wrote:
Aug 07 2019 3:15pm
Hello, buba,
I always drive with lights on, which I switch on with the up button. Could you make it configurable that the lights are switched on when the display is switched on? Of course it's not so important, but maybe others would use it as well. Sometimes I forget to turn the light on again, especially after a break. It's just a suggestion because you asked.
Maybe keep in memory last time state of lights, maybe this is ok for everyone.
Do you think we should have it configurable so users can choose to have it remember the state or reset with every power on? Or is it okay that it remembers the state for everyone?
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

casainho   1.21 GW

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

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

Post by casainho » Aug 07 2019 5:22pm

buba wrote:
Aug 07 2019 4:32pm
Do you think we should have it configurable so users can choose to have it remember the state or reset with every power on? Or is it okay that it remembers the state for everyone?
Maybe these 3 options:
0 - always reset at power on
1 - always set at power on
2 - keep previous state at power on

Luckily this needs to be only on the display side.
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   10 kW

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

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

Post by buba » Aug 07 2019 5:40pm

casainho wrote:
Aug 07 2019 5:22pm
buba wrote:
Aug 07 2019 4:32pm
Do you think we should have it configurable so users can choose to have it remember the state or reset with every power on? Or is it okay that it remembers the state for everyone?
Maybe these 3 options:
0 - always reset at power on
1 - always set at power on
2 - keep previous state at power on

Luckily this needs to be only on the display side.
Can fix!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

bruwie   1 mW

1 mW
Posts: 13
Joined: Mar 02 2017 3:12pm
Location: Lower Saxony,Germany

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

Post by bruwie » Aug 07 2019 10:51pm

casainho wrote:
Aug 07 2019 3:23pm
Maybe keep in memory last time state of lights, maybe this is ok for everyone.
For me personally, this option would be quite sufficient. As simple as possible.
TSDZ2 36 Volt 350 Watt with motor temperature sensor, LCD3, Batterypack 36 Volt 23 Ah, no throttle and brakesensors

perryscope   100 W

100 W
Posts: 106
Joined: Jan 06 2019 4:29pm
Contact:

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

Post by perryscope » Aug 08 2019 2:59am

buba wrote:
Aug 07 2019 10:32am
Quick update:

- EEPROM will be slightly more efficient thanks to mspider65! SOLVED

- Motor temperature not displayed in odometer field when user selects it to be displayed, this will be sorted out! SOLVED

- No assistance over 90 cadence, will be fixed! SOLVED

- Backwards resistance that comes and goes, bye bye! SOLVED

- Slightly better motor control in the low range when using Power Assist SOLVED

- Maybe improve the throttle depending on user feedback

- Error code if the cadence calibration is not done and users are trying to use the Advanced Mode SOLVED

- Maybe pedal assistance without pedal rotation in a very safe way! IMPLEMENTING RIGHT NOW

- Overall improvements SOLVED

Hi Bubu,

Had my first real ride today on 0.20.0 Alpha 2

I can confirm the no assistance over 90 cadence is effecting me as well I am using 36V motor/ 48V battery and choose the option for high cadence 36v. As reported the power cuts out at almost exactly at 90 rpm.

Is you fix for Alpha 3 applicable for both 36V and 48V modes?

Also as pointed out already the Motor watt value jumps a lot (for me it can jump up and down about 100W when trying to ride at a very steady pace, I'm sure this is just the filtering on the value but it does make it difficult to see if its using more power than what i expect on 19.0.0 release. at a steady pace the assistance feels simular to what i was used to in 0.19.0.

In Power assist mode only at the moment.

The startup is definitely smoother and less stress on the motor, but I feel i will need to increase the motor acceleration a little as its noticeably different to the boost mode I was used to. will play with that on the commute home

EMTB mode also does not feel to be giving as much power as I expected, again I will experiment with the sensitivity value to see if that helps scale it more to my legs ;)
Empowered people support rider and trustee
www.empoweredpeople.co.uk

fi7ippo   10 mW

10 mW
Posts: 24
Joined: Aug 26 2018 2:29am

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

Post by fi7ippo » Aug 08 2019 3:08am

casainho wrote:
Aug 07 2019 9:18am
Torque sensor full calibration

I decided to use 8 points and it seems to work. I don't know if there is a better way for the users.

user will need to edit the tables values of right and left pedals (ui16_torque_sensor_linearize_right and ui16_torque_sensor_linearize_left), on the file ebike_app.c:
Hi casainho, I believe in the multipoint calibration how to edit the tab values? What is the formula for insert our weight data?

Thanks You

#define TORQUE_SENSOR_LINEARIZE_NR_POINTS 8
uint16_t ui16_torque_sensor_linearize_right[TORQUE_SENSOR_LINEARIZE_NR_POINTS * 2] =
{
// ADC 10 bits step, steps_per_kg_x100
0, 17,
252, 17,
280, 18,
310, 33,
344, 88,
352, 313,
357, 480,
360, 500,
};
uint16_t ui16_torque_sensor_linearize_left[TORQUE_SENSOR_LINEARIZE_NR_POINTS * 2] =
{
// ADC 10 bits step, steps_per_kg_x100
0, 18,
248, 18,
272, 21,
306, 29,
356, 60,
364, 313,
368, 600,
370, 750,
};

casainho   1.21 GW

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

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

Post by casainho » Aug 08 2019 4:39am

fi7ippo wrote:
Aug 08 2019 3:08am
casainho wrote:
Aug 07 2019 9:18am
Torque sensor full calibration

I decided to use 8 points and it seems to work. I don't know if there is a better way for the users.

user will need to edit the tables values of right and left pedals (ui16_torque_sensor_linearize_right and ui16_torque_sensor_linearize_left), on the file ebike_app.c:
Hi casainho, I believe in the multipoint calibration how to edit the tab values? What is the formula for insert our weight data?

Thanks You

#define TORQUE_SENSOR_LINEARIZE_NR_POINTS 8
uint16_t ui16_torque_sensor_linearize_right[TORQUE_SENSOR_LINEARIZE_NR_POINTS * 2] =
{
// ADC 10 bits step, steps_per_kg_x100
0, 17,
252, 17,
280, 18,
310, 33,
344, 88,
352, 313,
357, 480,
360, 500,
};
uint16_t ui16_torque_sensor_linearize_left[TORQUE_SENSOR_LINEARIZE_NR_POINTS * 2] =
{
// ADC 10 bits step, steps_per_kg_x100
0, 18,
248, 18,
272, 21,
306, 29,
356, 60,
364, 313,
368, 600,
370, 750,
};
Please follow the information bellow and ask if you have more questions. I need your feedback and this process is not fast, I would like to know if in the end you see/feel any advantage of doing the calibration.

I shared my calc file I used here: https://github.com/OpenSource-EBike-fir ... s?raw=true

Calibration process

1. user put values on right pedal, starting at 5 kgs, in steps of 5 kgs up to about 30 kgs. You can try use known big weights maybe like of one of your kids and yourself, as it is very hard to do force by hand over 30 kgs.
The pair of weight and torque sensor ADC value should be registered and later user will need to decide for 8 points. You can try extrapolate some points, in a way you think they are following a curve line representing the real values as if you would measure all of them.
2. Repeat for left pedal.
3. Put the pair values of weight and torque sensor ADC values, for each pedal, on the specific LCD configuration menu (you will need to multiply by for the values the values you see on LCD, like the value of 252 for right pedal, second line of table, is 63 (63 * 4 = 252).
After you flash this firmware, the torque sensor value on LCD is instead the value of weight in kgs on the pedal and will correspond to reality probably only after you do the calibration.

One important thing for all this work is that at system power up, the right pedal should be pointing to ground -- as there is the need to identify which pedal we are doing the force and there is no way to identify them, I decided to do like this, having the pedal at a known position at startup and after that everything will work well.

I have the code working on my bicycle and I can see on the LCD the weight value in kgs on the LCD. The tables for linearization are for now hardcoded on the firmware, I can't setup them yet on LCD. When we have the next version of firmware I can add this feature to it.
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   10 kW

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

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

Post by buba » Aug 08 2019 6:38am

perryscope wrote:
Aug 08 2019 2:59am
Hi Bubu,

Had my first real ride today on 0.20.0 Alpha 2

I can confirm the no assistance over 90 cadence is effecting me as well I am using 36V motor/ 48V battery and choose the option for high cadence 36v. As reported the power cuts out at almost exactly at 90 rpm.
Hello Perrscope,

Yes I can confirm that the fix will work for any setup.

Clarification: I immediately knew what the problem was when users started reporting lack of assistance at 90 cadence. There was a experimental transition there. I have removed this transition and everything will work as usual for all users and setups.


perryscope wrote:
Aug 08 2019 2:59am
Also as pointed out already the Motor watt value jumps a lot (for me it can jump up and down about 100W when trying to ride at a very steady pace, I'm sure this is just the filtering on the value but it does make it difficult to see if its using more power than what i expect on 19.0.0 release. at a steady pace the assistance feels simular to what i was used to in 0.19.0.
So sorry about that! I previously explained it is for my sake as the raw values does help me to debug at a much faster rate. One example is the "90 cadence problem" you mentioned. If the cadence was filtered there would be a lot of people reporting a far lower value taking it longer to pinpoint the problem. The very first time a user reported "90 cadence" to be a problem I immediately knew what the problem was.

However, I think there are no other bugs reported so I might as well add the filtering in the Alpha 3! :) Really sorry for the inconvenience in the meantime but now you know why they are flying around! :bolt:


perryscope wrote:
Aug 08 2019 2:59am
In Power assist mode only at the moment.

The startup is definitely smoother and less stress on the motor, but I feel i will need to increase the motor acceleration a little as its noticeably different to the boost mode I was used to. will play with that on the commute home
Absolutely! Try increasing the acceleration as it can be set to the same or even faster than 0.19.0. If you feel you do not receive enough assistance from startup you maybe need the "startup without pedal rotation"? That will come back in a new form in the Alpha 3.

Please try to configure after your likening and let me know if you are satisfied. The 0.20.0 can be configured in more ways, has more functions and features and is overall smoother and safer than all previous versions. The only thing it lacks is the Startup Boost which I have tried to include in all riding modes and in the "startup without pedal assistance" present in Alpha 3.

Clarification: I will do whatever it takes so that every single user feels that the 0.20.0 is better in every regard than 0.19.0. You will just have to configure after your preference.


perryscope wrote:
Aug 08 2019 2:59am
EMTB mode also does not feel to be giving as much power as I expected, again I will experiment with the sensitivity value to see if that helps scale it more to my legs ;)
Definitely try increasing the sensitivity! The default values are often taken out of thin air and everything depends on your particular torque sensor and setup. But as I get more feedback I can put better default values that are more appropriate. But the best approach is to always setup the bike after your own preference.

And my goal is that you will never have to reset the firmware so the configuration you have now will stick around a long time. Will do my best to never force another user to reconfigure their setup. This has taken a lot of thought and planning and if we are lucky it will work beautifully! :)
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

perryscope   100 W

100 W
Posts: 106
Joined: Jan 06 2019 4:29pm
Contact:

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

Post by perryscope » Aug 08 2019 7:43am

buba wrote:
Aug 08 2019 6:38am
perryscope wrote:
Aug 08 2019 2:59am
Hi Bubu,

Had my first real ride today on 0.20.0 Alpha 2

I can confirm the no assistance over 90 cadence is effecting me as well I am using 36V motor/ 48V battery and choose the option for high cadence 36v. As reported the power cuts out at almost exactly at 90 rpm.
Hello Perrscope,

Yes I can confirm that the fix will work for any setup.

Clarification: I immediately knew what the problem was when users started reporting lack of assistance at 90 cadence. There was a experimental transition there. I have removed this transition and everything will work as usual for all users and setups.


perryscope wrote:
Aug 08 2019 2:59am
Also as pointed out already the Motor watt value jumps a lot (for me it can jump up and down about 100W when trying to ride at a very steady pace, I'm sure this is just the filtering on the value but it does make it difficult to see if its using more power than what i expect on 19.0.0 release. at a steady pace the assistance feels simular to what i was used to in 0.19.0.
So sorry about that! I previously explained it is for my sake as the raw values does help me to debug at a much faster rate. One example is the "90 cadence problem" you mentioned. If the cadence was filtered there would be a lot of people reporting a far lower value taking it longer to pinpoint the problem. The very first time a user reported "90 cadence" to be a problem I immediately knew what the problem was.

However, I think there are no other bugs reported so I might as well add the filtering in the Alpha 3! :) Really sorry for the inconvenience in the meantime but now you know why they are flying around! :bolt:


perryscope wrote:
Aug 08 2019 2:59am
In Power assist mode only at the moment.

The startup is definitely smoother and less stress on the motor, but I feel i will need to increase the motor acceleration a little as its noticeably different to the boost mode I was used to. will play with that on the commute home
Absolutely! Try increasing the acceleration as it can be set to the same or even faster than 0.19.0. If you feel you do not receive enough assistance from startup you maybe need the "startup without pedal rotation"? That will come back in a new form in the Alpha 3.

Please try to configure after your likening and let me know if you are satisfied. The 0.20.0 can be configured in more ways, has more functions and features and is overall smoother and safer than all previous versions. The only thing it lacks is the Startup Boost which I have tried to include in all riding modes and in the "startup without pedal assistance" present in Alpha 3.

Clarification: I will do whatever it takes so that every single user feels that the 0.20.0 is better in every regard than 0.19.0. You will just have to configure after your preference.


perryscope wrote:
Aug 08 2019 2:59am
EMTB mode also does not feel to be giving as much power as I expected, again I will experiment with the sensitivity value to see if that helps scale it more to my legs ;)
Definitely try increasing the sensitivity! The default values are often taken out of thin air and everything depends on your particular torque sensor and setup. But as I get more feedback I can put better default values that are more appropriate. But the best approach is to always setup the bike after your own preference.

And my goal is that you will never have to reset the firmware so the configuration you have now will stick around a long time. Will do my best to never force another user to reconfigure their setup. This has taken a lot of thought and planning and if we are lucky it will work beautifully! :)

No need to apologies Bubu its an Alpha and totally expect it to be running in a debug mode. I just want to help as much as possible by feeding back my experiences :)

Just as a side thought, I noticed you have added the 8 segment display logos for 'Power assist', 'Torque assist' and 'Cadence assist'. This is very useful when navigating the menus to find the right section to change ( especially when the settings within those menus are so similar).

Would it be possible to show those logos while selecting the menus without having to go into each one?

I know I will learn the numbers over time but at the moment i do find i am having to refer to the wiki page on my phone allot to check which menu is which and relearn between versions. as you are going through the menus a clue as to what menu you are about to select would be helpful i think?

You could maybe add other 8 segment display icons for the all?

0 Basic = b
1 Battery = B
2 Power Assist = P
3 Torque Assist = t
4 Cadence Assist = 'cadence symbol'
5 eMTB = E
6 Walk Assist = l l
7 Cruise = C
8 Screen = O
9 Street Mode = S
10 Advanced= A
11 Advanced Technical Data = _

just helps spot the relevant menu quicker maybe? Not an issue on the 850C or SW102 screens but I still think there is like in the LCD3 yet ;)
Empowered people support rider and trustee
www.empoweredpeople.co.uk

buba   10 kW

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

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

Post by buba » Aug 08 2019 8:12am

perryscope wrote:
Aug 08 2019 7:43am
No need to apologies Bubu its an Alpha and totally expect it to be running in a debug mode. I just want to help as much as possible by feeding back my experiences :)

Just as a side thought, I noticed you have added the 8 segment display logos for 'Power assist', 'Torque assist' and 'Cadence assist'. This is very useful when navigating the menus to find the right section to change ( especially when the settings within those menus are so similar).

Would it be possible to show those logos while selecting the menus without having to go into each one?

I know I will learn the numbers over time but at the moment i do find i am having to refer to the wiki page on my phone allot to check which menu is which and relearn between versions. as you are going through the menus a clue as to what menu you are about to select would be helpful i think?

You could maybe add other 8 segment display icons for the all?

0 Basic = b
1 Battery = B
2 Power Assist = P
3 Torque Assist = t
4 Cadence Assist = 'cadence symbol'
5 eMTB = E
6 Walk Assist = l l
7 Cruise = C
8 Screen = O
9 Street Mode = S
10 Advanced= A
11 Advanced Technical Data = _

just helps spot the relevant menu quicker maybe? Not an issue on the 850C or SW102 screens but I still think there is like in the LCD3 yet ;)
Great idea! I am actually validating the Alpha 3 right now but seems that I will have to implement that as it is a wonderful suggestion! Will do my best to implement whatever I can so I still have time to test the Alpha 3 today and release it. Can start by adding the icons to the riding modes at least. Later on we can expand!

Thank you for the feedback, Perryscope! Need I say it is much appreciated? :)

EDIT: There is a big difference going through the menus now! Not all menus have a symbol but it is possible to add later. The new displays will be much better in this regard but it does not hurt to simplify for the current users as this can help menu navigation greatly.
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

perryscope   100 W

100 W
Posts: 106
Joined: Jan 06 2019 4:29pm
Contact:

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

Post by perryscope » Aug 08 2019 9:36am

buba wrote:
Aug 08 2019 8:12am
EDIT: There is a big difference going through the menus now! Not all menus have a symbol but it is possible to add later. The new displays will be much better in this regard but it does not hurt to simplify for the current users as this can help menu navigation greatly.
:bigthumb:

edit: rethinking this a little for a later alpha. dont want you to delay Alpha 3 release :wink:

0 Basic = b
1 Battery = (show full battery symbol)
2 Power Assist = P and 'Assist' segment
3 Torque Assist = t and 'Assist' segment
4 Cadence Assist = (cadence crank symbol) and 'Assist' segment
5 eMTB = E
6 Walk Assist = (show walk assist person segment and word assist)
7 Cruise = (Show 'Cruise' and 'Assist' segments)
8 Screen = O
9 Street Mode = S
10 Advanced= A
11 Advanced Technical Data = _
Last edited by perryscope on Aug 08 2019 9:58am, edited 1 time in total.
Empowered people support rider and trustee
www.empoweredpeople.co.uk

casainho   1.21 GW

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

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

Post by casainho » Aug 08 2019 9:48am

buba wrote:
Aug 08 2019 8:12am
EDIT: There is a big difference going through the menus now! Not all menus have a symbol but it is possible to add later. The new displays will be much better in this regard but it does not hurt to simplify for the current users as this can help menu navigation greatly.
One interesting thing about SW102 is that has 4 buttons instead of the 3 like on KT-LCD3 and 850C displays. This means more way for user interact and quick change features options.

Also SW102 has 256 kbytes of flash memory (previous I though it was 128 kbytes) and current project that has most of the code done (configurations menu, main scree menu and Bluetooth) is using a bit less than 50% of the total available programming memory. This means there is a good potential on this LCD.
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 W

100 W
Posts: 106
Joined: Jan 06 2019 4:29pm
Contact:

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

Post by perryscope » Aug 08 2019 10:07am

casainho wrote:
Aug 08 2019 9:48am
buba wrote:
Aug 08 2019 8:12am
EDIT: There is a big difference going through the menus now! Not all menus have a symbol but it is possible to add later. The new displays will be much better in this regard but it does not hurt to simplify for the current users as this can help menu navigation greatly.
One interesting thing about SW102 is that has 4 buttons instead of the 3 like on KT-LCD3 and 850C displays. This means more way for user interact and quick change features options.

Also SW102 has 256 kbytes of flash memory (previous I though it was 128 kbytes) and current project that has most of the code done (configurations menu, main scree menu and Bluetooth) is using a bit less than 50% of the total available programming memory. This means there is a good potential on this LCD.
Looking forward to playing with the SW102 Casainho.
I have one waiting to be cracked open as soon as there is an alpha that needs tested and have been reading up on the viewtopic.php?f=30&t=99698 thread. Looks great!
Empowered people support rider and trustee
www.empoweredpeople.co.uk

buba   10 kW

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

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

Post by buba » Aug 08 2019 10:14am

perryscope wrote:
Aug 08 2019 9:36am
buba wrote:
Aug 08 2019 8:12am
EDIT: There is a big difference going through the menus now! Not all menus have a symbol but it is possible to add later. The new displays will be much better in this regard but it does not hurt to simplify for the current users as this can help menu navigation greatly.
:bigthumb:

edit: rethinking this a little for a later alpha. dont want you to delay Alpha 3 release :wink:

0 Basic = b
1 Battery = (show full battery symbol)
2 Power Assist = P and 'Assist' segment
3 Torque Assist = t and 'Assist' segment
4 Cadence Assist = (cadence crank symbol) and 'Assist' segment
5 eMTB = E
6 Walk Assist = (show walk assist person segment and word assist)
7 Cruise = (Show 'Cruise' and 'Assist' segments)
8 Screen = O
9 Street Mode = S
10 Advanced= A
11 Advanced Technical Data = _
That is almost exactly how I implemented it! :lol: And I just pushed the code to GitHub!

There are a couple that I need to add but will save your suggestion for those and we can add later!

Will focus on the motor controller now and validate that everything works as expected. If everything goes as planned there will be a Alpha 3 in a couple of hours!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

Post Reply