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

2019-07-05-15-57-32-1.jpg


That is the current state of 850C LCD firmware. I want to make soon a version for final users. Note that the variable on the graph and on the numeric fields, can't be changed. I hope developers can help to further improve this firmware.
 
[youtube]1oYnNEh2Wc4[/youtube]

always on V 0.16, planned to move to 0.19, human torque sensor on V 0.16 ( hiting 850w human power ...)
 
Just thought I would give a quick update.

It may seem I am absent from the community but it is the exact opposite. Have been developing every night the last week and the week before that. Sorry if I have not answered or engaged in anything! Thought that I should spend the little time I have to focus on the development.

I have changed and altered around 3000 lines of code if looking at GitHub data. A lot of changes that will help us expand the functionality and improve the feeling and response of the system. Am continually working on several things at the same time.

* Have improved the Power Assist function. It is more accurate in calculating the appropriate power and therefore improves the response. Especially in the low range. The human power calculation is also much more accurate.

* Have implemented a Torque Assist function. This one only relies on the pedal torque applied. Similar to how the original firmware does and other commercial versions. Very responsive.

* Have implemented a Cadence Assist. This one is useful for some users that need a more traditional ebike. Not added this implementation yet to my GitHub to reduce complexity in testing but planned for next beta.

* eMTB Assist. No introduction needed! Not added yet to reduce complexity but planned for next beta.

* Total redesign on communication logic so that we easily can expand to more displays. I think this is very important.

* The wiki is suffering but will update that one when I think the layout is finished and everything is ready for beta testing.

* A LOT of changes overall! Improving the execution time, logic, safety and reducing the overall complexity of the system. Have worked on both the display and controller. These last couple of days the focus has been on the feeling and response.

Planning for a beta for all users and gather some feedback. But appreciate that everyone is patient and giving me the time to do this. Will give more info when things start becoming more finished.

-------------------------------------------------------


It seems I have a non-linear torque sensor after some quick testing. This is why I only have accurate human power readings in the low range and why it quickly levels out around 100-150 watts in my development firmware version. Just got the time to test this. Will later make a graph and try to model the torque sensor with continuous data points from min to max.

If other torque sensors are similar to mine this might explain why we always had somewhat accurate readings in the low range but too high in the higher range. Now there is a new code that does not increase this error to high values, instead it dampens the error. So when giving full power it only shows 100-150 watts which is still totally inaccurate. A look-up table will maybe be needed and also higher resolution on the torque.

But will first make some more tests in the coming days and try to investigate this whole thing before I get ahead of myself. Just throwing it out there for now.

-------------------------------------------------------


Question: What is the actual ADC to current conversion on the current sensing ADC? We have discussed figures of 0.625 amps per step for 8 bit but in the comments in the code there are some notes stating five steps per amp -> 0.2 amps per step 10 bit and therefore 0.8 amps per step 8 bit. Just want to confirm and need some help clearing this out.
 
tomtom50 said:
I'm glad to see some work on the human torque reading. My TSDZ2 flatters me daily, my old bones push 200W so easily...

A decent check could be done with rollers. On zero assist pedal a while at a steady speed and get a good human watts reading. Then in the same gear use throttle only to reach the same speed and read the electrical watts.

Rollers eliminate confounding factors like wind resistance, head or tail wind, or changes in grade like you have on the road. If you run rollers the same speed they draw the same power.

Since the motor and gears are about 80% efficient, 0.8 * electrical watts should be very close to the true mechanical work at the spindle and can be used to calibrate human watts. The displayed zero assist human watts should correspond within 5% or so.

I would do this but I don't know anyone who has a set of rollers.

Very good idea! When we are satisfied with the calculations and have something to test it would be very good to validate with rollers. Nice one!



elem said:
[youtube]1oYnNEh2Wc4[/youtube]

always on V 0.16, planned to move to 0.19, human torque sensor on V 0.16 ( hitting 850w human power ...)

You are superman! :wink:
 
buba said:
Just thought I would give a quick update.

It may seem I am absent from the community but it is the exact opposite. Have been developing every night the last week and the week before that. Sorry if I have not answered or engaged in anything! Thought that I should spend the little time I have to focus on the development.

I have changed and altered around 3000 lines of code if looking at GitHub data. A lot of changes that will help us expand the functionality and improve the feeling and response of the system. Am continually working on several things at the same time.


* Have implemented a Torque Assist function. This one only relies on the pedal torque applied. Similar to how the original firmware does and other commercial versions. Very responsive.


Many thanks for all your hard work Buba. I have been off the bike for a couple of months and have just flashed with version 19 and really pleased to find I can now push the bike backwards with the system switched on. That was badly needed.


I am just as pleased you are going to implement torque assist. I've just come back from a test ride on version 19 and all the time I was thinking it is odd not to have the most torque from the motor when you most need it slowly peddling up a steep hill and really pushing hard on the pedals but as the hill levels off and cadence picks up so does the motor assist when it is not really required as much. It's not just version19 of course, it's been like that for sometime.

Just got to sort out the power boost settings now as they have changed since 18

Thanks again for all your hard work.
 
buba said:
It seems I have a non-linear torque sensor after some quick testing. This is why I only have accurate human power readings in the low range and why it quickly levels out around 100-150 watts in my development firmware version. Just got the time to test this. Will later make a graph and try to model the torque sensor with continuous data points from min to max.
I got the same values as you, BUT, I have 4 different bicycles with TSDZ2.

On my own bicycle, I get the same values as you: it is easy to get around 120W but very hard to go like over 180W.

I went to measure again and I got this - ADC values:
- rest: 62
- 5 kgs: 70 (delta of 8 )
- 10 kgs: 78 (delta of 8 )
- 15 kgs: 79 (delta of 1)
- 20 kgs: 80 (delta of 1)
- 25 kgs: 82 (delta of 2)

So as we can so, my torque sensor can measure well up to 10 kgs but at 15 kgs it is already not measuring.

Now with other bicycle, the one from my girlfriend:

ADC values:
- rest: 45
- 5 kgs: 52 (delta of 7)
- 10 kgs: 59 (delta of 7)
- 15 kgs: 66 (delta of 7)
- 20 kgs: 72 (delta of 6)
- 30 kgs: 85 (delta of 6.5)
- unknown kgs: 103 (max value the torque sensor measures)
(could not measure higher values but with my body of 100 kgs, the sensor seems to max out before I put all my weight but goes up to AC value of 103)

I tested on another bicycle and I saw that at rest ADC was 40 and max value was 72.

So, seems there are expressive variations on the TSDZ2 torque sensors :-(

Would be nice if we could look at the torque sensor details (Stancecoke where are you??) and see if we can tweak the bad torque sensors... here is an explanation how TSDZ2 torque sensor works:

https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/wiki/How-TSDZ2-torque-sensor-works

Maybe we can adjust that 2 bolts??

torque-sensor-for-TSDZ2-electric-bicycle-central-mid-motor.jpg
 
casainho said:
So, seems there are expressive variations on the TSDZ2 torque sensors :-(

Would be nice if we could look at the torque sensor details (Stancecoke where are you??) and see if we can tweak the bad torque sensors... here is an explanation how TSDZ2 torque sensor works:

https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/wiki/How-TSDZ2-torque-sensor-works

Maybe we can adjust that 2 bolts??

torque-sensor-for-TSDZ2-electric-bicycle-central-mid-motor.jpg
I just disassembled a torque sensor and I am pretty sure I see the "49E" hall sensor, you can get on google the datasheet of SS49E, Linear Hall Effect Sensor.

The holes for that 2 bolts are not round, they are like oval. I tested and I can move the hall sensor forward/backward and also left/right.
 
Rafe said:
Many thanks for all your hard work Buba. I have been off the bike for a couple of months and have just flashed with version 19 and really pleased to find I can now push the bike backwards with the system switched on. That was badly needed.

So glad to hear from you again, Rafe! And good to have you back! A lot of improvements on the 0.19.0 I think you will like! The backwards resistance was solved by Casainho by the way, credit to him!


Rafe said:
buba said:


* Have implemented a Torque Assist function. This one only relies on the pedal torque applied. Similar to how the original firmware does and other commercial versions. Very responsive.


I am just as pleased you are going to implement torque assist. I've just come back from a test ride on version 19 and all the time I was thinking it is odd not to have the most torque from the motor when you most need it slowly peddling up a steep hill and really pushing hard on the pedals but as the hill levels off and cadence picks up so does the motor assist when it is not really required as much. It's not just version19 of course, it's been like that for sometime.

Just got to sort out the power boost settings now as they have changed since 18

Thanks again for all your hard work.

Nice to see that you are positive even before trying it out. Can report that the feeling using torque assist is very good and I am overall very pleased with the work so far. Have some ideas to further improve it so this is one of many things I will be doing the next couple of days. This is by far the biggest undertaking I have done in this project so hopefully it will be good.

Thank you for the kind words! Much appreciated!
 
casainho said:
buba said:
It seems I have a non-linear torque sensor after some quick testing. This is why I only have accurate human power readings in the low range and why it quickly levels out around 100-150 watts in my development firmware version. Just got the time to test this. Will later make a graph and try to model the torque sensor with continuous data points from min to max.
I got the same values as you, BUT, I have 4 different bicycles with TSDZ2.

On my own bicycle, I get the same values as you: it is easy to get around 120W but very hard to go like over 180W.

I went to measure again and I got this - ADC values:
- rest: 62
- 5 kgs: 70 (delta of 8 )
- 10 kgs: 78 (delta of 8 )
- 15 kgs: 79 (delta of 1)
- 20 kgs: 80 (delta of 1)
- 25 kgs: 82 (delta of 2)

So as we can so, my torque sensor can measure well up to 10 kgs but at 15 kgs it is already not measuring.

Now with other bicycle, the one from my girlfriend:

ADC values:
- rest: 45
- 5 kgs: 52 (delta of 7)
- 10 kgs: 59 (delta of 7)
- 15 kgs: 66 (delta of 7)
- 20 kgs: 72 (delta of 6)
- 30 kgs: 85 (delta of 6.5)
- unknown kgs: 103 (max value the torque sensor measures)
(could not measure higher values but with my body of 100 kgs, the sensor seems to max out before I put all my weight but goes up to AC value of 103)

I tested on another bicycle and I saw that at rest ADC was 40 and max value was 72.

So, seems there are expressive variations on the TSDZ2 torque sensors :-(

Would be nice if we could look at the torque sensor details (Stancecoke where are you??) and see if we can tweak the bad torque sensors... here is an explanation how TSDZ2 torque sensor works:

https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/wiki/How-TSDZ2-torque-sensor-works

Maybe we can adjust that 2 bolts??

torque-sensor-for-TSDZ2-electric-bicycle-central-mid-motor.jpg

It all makes sense now! This is something I have been curious about for a long time and it is exciting to get more data. Nice!

You have a very high resting value, Casinho. That is something I have on my bike as well. But your girlfriend has a lower resting value and her torque sensor works as one would expect and produces basically linear output. Do not know if the resting value has any correlation to the accuracy and/or range but interesting.

My torque sensor is so bad now that it basically can not measure above 100 W if not pressing really hard at high cadence. This is actually why I developed Torque Assist as it is actually less noticeable in that mode. But that is another story.

Am very curious if it is possible to adjust or rectify this problem in a simple way. And then have it accurate without unique calibration coefficients. Otherwise human power will never work to its full potential...

Here is a graph on the data you provided:

Torque sensor readings.png
 




I took the risk to disassembly the torque sensor... and I moved the hall sensor to very near of the magnets. In the end, the torque sensor is working and the rest ADC value is now 17 instead of the previous 62!! The max value is almost the same as previous: 82.
Well, it is not working well as I need to make 25 kgs for the torque before the torque sensor starts increasing over 17... seems that in a few hours will need to make extra work to ride my bicycle on the planned trip :)

So, maybe the hall sensor is saturated because is to near the magnets...
 
850C-LCD.jpg


This is the current state of 850C LCD firmware. The graph is missing some data points, I think it is because system is running slow for all the calculations it need to do. I wish I could implement the top white line on the graph, for it be like an envelope.

And I wish human power could be calculated correctly to be shown on the graph...
 
casainho said:




I took the risk to disassembly the torque sensor... and I moved the hall sensor to very near of the magnets. In the end, the torque sensor is working and the rest ADC value is now 17 instead of the previous 62!! The max value is almost the same as previous: 82.
Well, it is not working well as I need to make 25 kgs for the torque before the torque sensor starts increasing over 17... seems that in a few hours will need to make extra work to ride my bicycle on the planned trip :)

So, maybe the hall sensor is saturated because is to near the magnets...

So it improved the rest value but there is an offset of 25 kg? Wow! I need to study the entire torque sensor package and understand how it works. Because right now it seems as human power readings will be impossible for all users to have... Did not expect this.
 
buba said:
casainho said:




I took the risk to disassembly the torque sensor... and I moved the hall sensor to very near of the magnets. In the end, the torque sensor is working and the rest ADC value is now 17 instead of the previous 62!! The max value is almost the same as previous: 82.
Well, it is not working well as I need to make 25 kgs for the torque before the torque sensor starts increasing over 17... seems that in a few hours will need to make extra work to ride my bicycle on the planned trip :)

So, maybe the hall sensor is saturated because is to near the magnets...

So it improved the rest value but there is an offset of 25 kg? Wow! I need to study the entire torque sensor package and understand how it works. Because right now it seems as human power readings will be impossible for all users to have... Did not expect this.

Hi Buba, I think that Casainho is right, the two bolt are the key, but for adjust the position of hall sensor we have to do a micrometrical movement on sensor. I try to explain me better: before adjust the hall position I was in this situation:

Rest ADC value: 52, Maximun ADC value: 96, so a resolution of 44 ADC steps

After 3 attempts, moving in small steps further and further away from the magnet the new readings are:

Rest ADC value: 35, Maximun ADC value: 96, so a resolution of 61 ADC steps

I think I can still distance the sensor from the magnet until I have a resolution of 70-75 ADC steps, but there is a lot of time for disassemble and reassemble the torque sensor and a resolution of 60 ADC steps could be enough!
Also seems that at the right position of hall sensor (at near 60 ADC steps resolution) we have a linear output to the force applied, but for this I wait the digital dynamometer that I ordered whit a 90kg of capacity and 0,1kg resolution for a detailed report!

Now after a fine calibrating, there is a problem on the pedal sensor torque reading (menu 9 - 3): the parameter reach the maximum value of 255 when the ADC pedal torque sensor reach value of 68, so in this case I can use about half of the sensor capacity...

I think the maximum ADC reading is variable for each torque sensor, but still fixed for each unit, due to the small differences in the windings of the two (transformers) or the magnet near the hall sensor, from unit to unit.

For calibration the torque sensor the rest value is read every time the unit is powered on, right?

So for improve sensor torque experience and resolution it would take a user modifiable parameter regarding the maximum ADC value (the parameter can be easily read from menu 9 - 2 from each user by applying the maximum pressure on the pedals)

Another usefull parameter for fine calibrating the user human power could be an editable parameter that adjust the kg applied for each ADC step (assuming the linear output of sensor)

Thanks guys, your work on this firmware is exceptional!
 
fi7ippo said:
buba said:
casainho said:




I took the risk to disassembly the torque sensor... and I moved the hall sensor to very near of the magnets. In the end, the torque sensor is working and the rest ADC value is now 17 instead of the previous 62!! The max value is almost the same as previous: 82.
Well, it is not working well as I need to make 25 kgs for the torque before the torque sensor starts increasing over 17... seems that in a few hours will need to make extra work to ride my bicycle on the planned trip :)

So, maybe the hall sensor is saturated because is to near the magnets...

So it improved the rest value but there is an offset of 25 kg? Wow! I need to study the entire torque sensor package and understand how it works. Because right now it seems as human power readings will be impossible for all users to have... Did not expect this.

Hi Buba, I think that Casainho is right, the two bolt are the key, but for adjust the position of hall sensor we have to do a micrometrical movement on sensor. I try to explain me better: before adjust the hall position I was in this situation:

Rest ADC value: 52, Maximun ADC value: 96, so a resolution of 44 ADC steps

After 3 attempts, moving in small steps further and further away from the magnet the new readings are:

Rest ADC value: 35, Maximun ADC value: 96, so a resolution of 61 ADC steps

I think I can still distance the sensor from the magnet until I have a resolution of 70-75 ADC steps, but there is a lot of time for disassemble and reassemble the torque sensor and a resolution of 60 ADC steps could be enough!
Also seems that at the right position of hall sensor (at near 60 ADC steps resolution) we have a linear output to the force applied, but for this I wait the digital dynamometer that I ordered whit a 90kg of capacity and 0,1kg resolution for a detailed report!

Now after a fine calibrating, there is a problem on the pedal sensor torque reading (menu 9 - 3): the parameter reach the maximum value of 255 when the ADC pedal torque sensor reach value of 68, so in this case I can use about half of the sensor capacity...

I think the maximum ADC reading is variable for each torque sensor, but still fixed for each unit, due to the small differences in the windings of the two (transformers) or the magnet near the hall sensor, from unit to unit.

For calibration the torque sensor the rest value is read every time the unit is powered on, right?

So for improve sensor torque experience and resolution it would take a user modifiable parameter regarding the maximum ADC value (the parameter can be easily read from menu 9 - 2 from each user by applying the maximum pressure on the pedals)

Another usefull parameter for fine calibrating the user human power could be an editable parameter that adjust the kg applied for each ADC step (assuming the linear output of sensor)

Thanks guys, your work on this firmware is exceptional!
Nice to see someone that went to do what I would like. Thanks for sharing with us your knowledge.

Yes, it is difficult this calibration even because the torque sensor coils and wires are very fragile!!! It is very easy to damage the wires or the coils.

Maybe a way to calibrate a torque sensor could be:
- buy 1 torque sensor
- buy 2 motor controller

- flash a specific firmware on the motor controller that outputs the torque sensor ADC value by UART, so we can see easily on PC the value
- connect the torque sensor to the motor controller and adjust the sensor position to get a rest value of 40.

Can we trust on rest value for calibrate the sensor??

Also, can the square wave frequency and duty-cyle that is generated by the STM8 change in a way to improve the sensor range??
 
fi7ippo said:
Hi Buba, I think that Casainho is right, the two bolt are the key, but for adjust the position of hall sensor we have to do a micrometrical movement on sensor. I try to explain me better: before adjust the hall position I was in this situation:

Rest ADC value: 52, Maximun ADC value: 96, so a resolution of 44 ADC steps

After 3 attempts, moving in small steps further and further away from the magnet the new readings are:

Rest ADC value: 35, Maximun ADC value: 96, so a resolution of 61 ADC steps

I think I can still distance the sensor from the magnet until I have a resolution of 70-75 ADC steps, but there is a lot of time for disassemble and reassemble the torque sensor and a resolution of 60 ADC steps could be enough!
Also seems that at the right position of hall sensor (at near 60 ADC steps resolution) we have a linear output to the force applied, but for this I wait the digital dynamometer that I ordered whit a 90kg of capacity and 0,1kg resolution for a detailed report!

Cool that you have taken the time to test this and post your findings. Very valuable for the entire community! Thanks!

What I am most interested in, and this is by far the most important aspect, is the linearity of the sensor. No point in having a lot of range if it is not consistent with the force applied. Even if it were non-linear we could fix it with software but every torque sensor should be similarly non-linear so we can apply the same solution for all the users.

The things you have done and are planing to do are really great! :bigthumb: Would love to see the data you get!



fi7ippo said:
Now after a fine calibrating, there is a problem on the pedal sensor torque reading (menu 9 - 3): the parameter reach the maximum value of 255 when the ADC pedal torque sensor reach value of 68, so in this case I can use about half of the sensor capacity...

This is solved in my development version. Works with the full range and no conversion!



fi7ippo said:
For calibration the torque sensor the rest value is read every time the unit is powered on, right?

Yes, it is calibrated every time the system is powered on. But it is not calibrated properly in 0.19.0 and previous firmware versions. Noticed it with my particular torque sensor. So I rewrote the calibration process in my development version and now the current and torque are calibrated better and adjusts for every user and their hardware. This also helped to gain a lot of resolution and improved a lot of other things as well.



fi7ippo said:
So for improve sensor torque experience and resolution it would take a user modifiable parameter regarding the maximum ADC value (the parameter can be easily read from menu 9 - 2 from each user by applying the maximum pressure on the pedals)

Another usefull parameter for fine calibrating the user human power could be an editable parameter that adjust the kg applied for each ADC step (assuming the linear output of sensor)

Thanks guys, your work on this firmware is exceptional!

Yes, assuming the torque is linear it would be possible to further develop tools for higher accuracy. Great comments, thank you!
 
casainho said:
...

... because each ADC unit (10 bits) represents 0.156 amps, the best the system can measure. With the 8 bits variable we can store up to 40 amps...

...

What is the actual ADC to current conversion for the current measuring ADC? We have discussed figures of 0.625 amps per ADC step for 8 bit and 0.156 amps per step for 10 bit. But in the comments in the code there are some notes stating five ADC steps per amp -> 0.2 amps per step 10 bit and therefore 0.8 amps per step 8 bit. Just want to confirm what it is.

I am actually using 0.8 and 0.2 as these values are used for the FOC calculation and should be correct.
 
casainho said:
850C-LCD.jpg


This is the current state of 850C LCD firmware. The graph is missing some data points, I think it is because system is running slow for all the calculations it need to do. I wish I could implement the top white line on the graph, for it be like an envelope.

And I wish human power could be calculated correctly to be shown on the graph...

Looks great. Can I try it out? Do you have a hex file and some instructions?
 
It is not practical for users to pull apart their torque sensors although for the few that did it has really given us some good data.

Just stating what everyone else is probably thinking by now...
It should be fairly easy to set up a menu item to measure adc values for 5kg, 10kg, say up to 40kg which can be done with a digital luggage scales attached to the peddle. By interpolating between these values then this would ensure that everyone would have calibrated human torque and the best resolution for their sensor even if it is non linear.
 
Agree with jbalat, removing and, specially, reinstalling the torque sensor is a bit tricky and I would avoid it with pleasure. Iterative process to tune the values (correct me if I misunderstood the above messages) makes the operation even more annoying.
I had to disassemble twice due to a factory faulty torque sensor and I think this operation is not common at all for average user.

Software interpolation between read values (linear or parabolic least square?) sounds a better choice to a non-electronic engineer like me..
Question for the gurus: is it possible for each user to read the values at known force (as suggested by jbalat), plot the result and and determine whether a linear or parabolic/bilinear relationship is applicable?
Of course the two relationship must be implemented in the controller and settable from the display in terms of coefficients..

Thanks
 
jbalat said:
It is not practical for users to pull apart their torque sensors although for the few that did it has really given us some good data.

Just stating what everyone else is probably thinking by now...
It should be fairly easy to set up a menu item to measure adc values for 5kg, 10kg, say up to 40kg which can be done with a digital luggage scales attached to the peddle. By interpolating between these values then this would ensure that everyone would have calibrated human torque and the best resolution for their sensor even if it is non linear.

I agree. Pulling apart sensors is not something that should be expected of users. I am still curious in the non-linearity though. But that is something entirely different and just a mere curiosity to further learn about the torque sensor.

It is possible to:

* Create a calibration menu and setup an array of ADC to pedal torque values
* Send the whole array of data to the controller
* Have the controller measure the ADC torque value and convert it to torque with the help of the calibration array.
* Use the torque value with cadence to calculate human power
* Convert human power to motor assist power

But that is also a lot of effort and complexity. If it is linear it would be much simpler!

Luckily I have created Torque Assist and it seems the timing is perfect. I am only using Torque assist now and the beauty is that when setup correctly for my hardware it feels great. Planning to increase the resolution of the torque sensor and current control by a factor of four (4) so it should be even more responsive. I would assume that this is the way the original firmware does it and also other commercial products. And this is how my eMTB mode works that is user configurable. (Will soon add my eMTB branch to my official branch and start testing eMTB mode extensively)

However, I will do whatever I can to help and try to make the Power Assist work! But it will be good that users have options.


thineight said:
Agree with jbalat, removing and, specially, reinstalling the torque sensor is a bit tricky and I would avoid it with pleasure. Iterative process to tune the values (correct me if I misunderstood the above messages) makes the operation even more annoying.
I had to disassemble twice due to a factory faulty torque sensor and I think this operation is not common at all for average user.

Software interpolation between read values (linear or parabolic least square?) sounds a better choice to a non-electronic engineer like me..
Question for the gurus: is it possible for each user to read the values at known force (as suggested by jbalat), plot the result and and determine whether a linear or parabolic/bilinear relationship is applicable?
Of course the two relationship must be implemented in the controller and settable from the display in terms of coefficients..

Thanks

It is possible to read the values and find a formula that converts the ADC value to real life torque. But if the formula is not applicable between different users and their specific hardware it becomes more complex. If there is a universal formula everyone can use it is only necessary to measure a few data points (coefficients) to adjust the formula. Same is true if it is linear and the range depends on the rest value. But in every other case it can add complexity with diminishing returns.
 
I just calibrate my torque sensor and found it can now measure up to 40 kgs, which is 4x more than before and this means I will get 4x more motor power assistance when I stop and after I need a quick and strong response from the motor, like when I am doing mountain biking!!

I am sure we all want a good torque sensor, that is why most of us prefer TSDZ2 over a Bafang. It is a really fun game, to apply more force with our legs and feel a strong answer from the motor!!

I wrote a wiki page with the process I used to calibrate my sensor (note that I did this process twice, on 2 different torque sensors):

How to calibrate the torque sensor --> https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/wiki/How-to-calibrate-the-torque-sensor
 
I am sure we all want a good torque sensor, that is why most of us prefer TSDZ2 over a Bafang. It is a really fun game, to apply more force with our legs and feel a strong answer from the motor!!

yes, it's why i moved from BBS02b to TSDZ2 .

someone know if it's possible to buy the torque/PAS captor alone ( without axle ) !?
 
casainho said:
I just calibrate my torque sensor and found it can now measure up to 40 kgs, which is 4x more than before and this means I will get 4x more motor power assistance when I stop and after I need a quick and strong response from the motor, like when I am doing mountain biking!!

I am sure we all want a good torque sensor, that is why most of us prefer TSDZ2 over a Bafang. It is a really fun game, to apply more force with our legs and feel a strong answer from the motor!!

I wrote a wiki page with the process I used to calibrate my sensor (note that I did this process twice, on 2 different torque sensors):

How to calibrate the torque sensor --> https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/wiki/How-to-calibrate-the-torque-sensor


Just looked at the code to check the ADC conversion:

Code:
// ADC torque sensor
#define PEDAL_TORQUE_PER_8_BIT_ADC_STEP_X100                      52 // see note below

/*---------------------------------------------------------

  NOTE: regarding the torque sensor output values

  Torque (force) value found experimentaly.
  
  Measured with a cheap digital hook scale, we found that
  each torque sensor unit is equal to 0.52 Nm. Using the 
  scale it was found that 0.33 kg was measured as 1 torque 
  sensor unit.
  
  Force (Nm) = 1 Kg * 9.18 * 0.17 (0.17 = arm cranks size)
---------------------------------------------------------*/

So the value of 52 is too low due to: Force (Nm) = 1 Kg * 9.18 * 0.17 (0.17 = arm cranks size)

It should be: Force (Nm) = 1 Kg * 9.81 * 0.17 (0.17 = arm cranks size)

And therefore the conversion should be 54, up from 52.

Also noticed it says 0.33 kg per ADC step. Assuming that is 10 bit ADC steps it would mean that the 8 bit ADC steps represent 0.33 * 4 = 1.32 kg. Looking at your new data I see that when applying 40 kg on the pedals you get a delta of 25 ADC steps. This is a conversion of at least 62, up from 54.

Another problem is that the conversion is based on 10 bit values. So for the previous value of 52 it was calculated with:
(1) Force (Nm) = 0.33 * 9.18 * 0.17 ≈ 0.52 -> 52

But should have been calculated:
(2) Force (Nm) = 0.33 * 9.81 * 0.17 ≈ 0.54 -> 54

And with your new data and testing it should be around :
(3) Force (Nm) = 0.4 * 9.81 * 0.17 ≈ 0.67 -> 67

But this only holds true for 10 bit values. The 8 bit values are:

(1) Force (Nm) = 1.32 * 9.18 * 0.17 ≈ 2.05 -> 205

(2) Force (Nm) = 1.32 * 9.81 * 0.17 ≈ 2.20 -> 220

(3) Force (Nm) = 1.6 * 9.81 * 0.17 ≈ 2.67 -> 267

Using the new conversion factor would result in around 5 times higher human power readings. When I was giving full power with the new development firmware I only got around 100 - 150 watts human power, even less than that. With the new conversion factor I would get closer to 500 - 750 watts. Which is more plausible in a high power situation.
 
After another heavy trip through the mud with water, I decided to disassemble the motor for prevention. There was water behind the gear cover (I am now redoing the protection cover and installing a rubber seal for a tighter connection, later I will show what happened). I took off the torque sensor and was surprised as the surface of the coils became bare. PCB layer disappeared completely. In casainho photo up in some message later does not have this layer either. What could lead to its destruction? Was water mixed with grease? or something different? I will try to restore the sensor, install thin rings from the PCB. And then adjust the sensor with bolts.
 

Attachments

  • IMG_20190709_122624.jpg
    IMG_20190709_122624.jpg
    115.7 KB · Views: 1,569
  • IMG_20190709_122605.jpg
    IMG_20190709_122605.jpg
    83.4 KB · Views: 1,569
  • IMG_20190709_122549.jpg
    IMG_20190709_122549.jpg
    86.6 KB · Views: 1,569
Rydon said:
casainho said:
850C-LCD.jpg


This is the current state of 850C LCD firmware. The graph is missing some data points, I think it is because system is running slow for all the calculations it need to do. I wish I could implement the top white line on the graph, for it be like an envelope.

And I wish human power could be calculated correctly to be shown on the graph...

Looks great. Can I try it out? Do you have a hex file and some instructions?
There are some small issues that make problematic this firmware, things that I can handle myself but would be a problem for final user. I need to finish a few things before release a version, it is taking more time than what I expected but I didn't stopped yet, I really want it and today I will install this 850C LCD over the KT-LCD3 on my girlfriend bicycle, so I really need it working well.
 
Back
Top