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

First of all, I want to apologize to the community for being absent! Have become time constrained again but I still try to follow the thread as much as possible. A lot of things have been discussed and that is great!

I have personally nothing to add to the discussion for now. But I do want to clarify that I look forward to the stable release of the 0.20.0. That is a priority for me because there are a LOT of changes and I want to get them out there. The community has provided several great suggestions and ideas that have made the firmware even better! What an awesome collaboration!

It will be interesting to see how the development moves forward and what can be done to further improve the experience. I am very excited to see the changes the new developers will introduce and also the ideas Casainho will implement! It will be some great work and I truly look forward to see and try it all out!

For the time being, I hope everyone finds the 0.20.0 Alpha version a great upgrade from the 0.19.0! Because it is going to get even better with the 0.20.0 Beta :wink: More about this in my reply to Microchip7000 below:



microchip7000 said:
Hi, I upgraded to 0.20 alpha 10. I did 1.000 km with 0.17 and 1.000 km with 0.19. My bike's battery is 1kw and the engine is 36v 350w. With the old versions the watt meter was very precise, 1 kw of consumption and the battery was completely discharged at 29v, while with the 0.20 it marks about 20% more consumption, reached 0% I still had a lot of battery, I increased from the menu the battery capacity up to 1.200w to arrive correctly.
Even instant consumption obviously marks 20% more. There is some calibration to do to adjust the shot.
for the rest everything is fine, excellent starting from a standstill and much more linear than the 0.19.
Hello and congratulations for having reached these levels :thumb:

Thank you for being so detailed in your feedback! You have done an amazing job explaining the problem and giving me a very clear picture of what I need to do! I appreciate that a lot so the least I can do is to solve the problem :wink:

As soon as I got home today I did some work on the bike that enabled me to connect some instruments and do some tests. Can confirm that the ADC conversion values are not perfect. Error range: 1 - 20 %. I have already sorted this out and everything should be more accurate.

Oh... and one more thing! How about more torque and power? :wink: Yes, Solving this bug has enabled more power and torque! The changes are already submitted in the pull request and will be available in the 0.20.0 Beta 1 as soon as Casainho has time to take a look and release the beta version. I now recommend everyone to update to 0.20.0 Beta 1 as soon as it is available.

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

A big thanks to the community!

EDIT: 0.20.0 Beta 1 will have several small improvements here and there so I hope everyone will feel it is worth to update, even for users coming from the 0.20.0 Alpha 10!
 
Obviously I speak as inexperienced in programming etc. . Today, at the suggestion of an Italian user, I changed the value of menu 10.2 which has a default of 67. I put 80 and the pedal has become much softer at all levels. Much easier (even too much) to reach maximum power.
Then I started thinking: the torque of the legs is like that of an electric motor (not power, torque) decreases with increasing number of revolutions (cadence), it would not be possible to progressively increase the parameter of menu 10.2 with increasing of the cadence? this should give a better progression.
Obviously it's just an inexperienced consideration .... :-(
 
buba said:
Oh... and one more thing! How about more torque and power? :wink: Yes, Solving this bug has enabled more power and torque! The changes are already submitted in the pull request and will be available in the 0.20.0 Beta 1 as soon as Casainho has time to take a look and release the beta version. I now recommend everyone to update to 0.20.0 Beta 1 as soon as it is available.

A big thanks to the community!

I'm a fat guy who looks forward to the greatest power :D :D
 
andrea_104kg said:
Obviously I speak as inexperienced in programming etc. . Today, at the suggestion of an Italian user, I changed the value of menu 10.2 which has a default of 67. I put 80 and the pedal has become much softer at all levels. Much easier (even too much) to reach maximum power.
Then I started thinking: the torque of the legs is like that of an electric motor (not power, torque) decreases with increasing number of revolutions (cadence), it would not be possible to progressively increase the parameter of menu 10.2 with increasing of the cadence? this should give a better progression.
Obviously it's just an inexperienced consideration .... :-(

Your consideration is not wrong, but there are other variables that need to be considered. By changing that variable, you are making the torque sensor more sensitive. No matter the assist mode you are using you will get more power from the motor, for less pressure on the pedals or power from you.

Interestingly we actually want to scale up the pressure on the pedals (torque) at low RPM's and scale it down at high RPM's so the motor does not produce too much power at high cadence. Not intuitive.

This is what eMTB attempts to achieve BTW, at low RPM's you are pushing on the pedals more to accelerate the bike or push up a hill for example. By using a power function the motor outputs more power when you need it, with high pedal pressure (high torque) and then reduces the power output as you get up to speed.

Confusing things is the fact the torque sensor is not linear, so when you "stand" on the pedals the reading it gives is lower than it should be.

There are a number of users on here that appear to be operating the motor at the upper end of its maximum power output most of the time. In these cases there is not going to be much difference between any of the assist modes (eMTB, Power or Torque) as the torque sensor is scaled up so much the motor produces almost max power for small amounts of pedal pressure, low or high RPM.

Finally here is a paper exercise comparing eMBT assist mode vs Power assist mode. It assumes the human power curve is sinusoidal peaking at 150W, and that human torque is linear. At 1.3x assist (for both the eMBT power multiplier and the Power assist multiplier) it shows that eMBT mode provides similar max power, but at lower RPMs - ie it shifts the power production to the left and then reduces power output as you reach 70 RPM+, which for some riders is ideal and exactly what I use on my bike currently. (please ignore the scaling factor - motor is producing too much power, I suspect because I am not "averaging torque", but I don't have a good approximation for that to use currently, maybe .66 if sin?)

Multiplier 1.3
Power 150
Max torque 66.64 1/2 weight in kg * grav * lever length - alternating tripod effect

Screenshot 2019-09-12 10.28.06.png
 
hello buba, yesterday afternoon I took the whole battery to discharge, I confirm that the watt meter has stopped at 1180 kw. in the 0.19 version it was calibrated 950, there are 200w more.
This morning I forgot to take away the street mode, I noticed that on exceeding 25 km the engine shuts off but the watt meter continues to score from 100 to 180 depending on how hard it tries on the pedals. I went well beyond 25 km and clearly felt that the engine was off, no doubt
The impression is that the wattmeter adds the motor power and the human power
with torque and power it looks good, the start definitely improved, but the test was all on the plain. Consumption also proved to be stable, as in 0.19, with 1 kw I traveled 110 km at 2.5 / 3 level with speeds always exceeding 30 km.
Maybe it may lack maximum power, but it could depend on the watt meter error, it stops at 650w but it seems less.
By increasing the parameter 10.2 I can lighten the pedaling, great for going to work.
I also tried to change the menu 10.0 from 0 to 35%, we get a further increase in torque at the start, but I brought it back to 0% to keep consumption down and it seems to me already enough.
I tried the torque and emb function a little, you have to get used to it are different and more training than power.
Once the wattameter problem has been solved, it is truly complete and customizable
 
andrea_104kg said:
buba said:
Oh... and one more thing! How about more torque and power? :wink: Yes, Solving this bug has enabled more power and torque! The changes are already submitted in the pull request and will be available in the 0.20.0 Beta 1 as soon as Casainho has time to take a look and release the beta version. I now recommend everyone to update to 0.20.0 Beta 1 as soon as it is available.

A big thanks to the community!

I'm a fat guy who looks forward to the greatest power :D :D

It will almost be 20 % more power! :bolt: :)



elem said:
:thumb:

all work fine ;)

I look forward to you testing the 0.20.0 Beta 1! :)
 
mctubster said:
Finally here is a paper exercise comparing eMBT assist mode vs Power assist mode. It assumes the human power curve is sinusoidal peaking at 150W, and that human torque is linear. At 1.3x assist (for both the eMBT power multiplier and the Power assist multiplier) it shows that eMBT mode provides similar max power, but at lower RPMs - ie it shifts the power production to the left and then reduces power output as you reach 70 RPM+, which for some riders is ideal and exactly what I use on my bike currently. (please ignore the scaling factor - motor is producing too much power, I suspect because I am not "averaging torque", but I don't have a good approximation for that to use currently, maybe .66 if sin?)

Multiplier 1.3
Power 150
Max torque 66.64 1/2 weight in kg * grav * lever length - alternating tripod effect

Screenshot 2019-09-12 10.28.06.png

As usual, very nice analysis! And the graph is great! Clearly shows the different characteristics!
 
microchip7000 said:
hello buba, yesterday afternoon I took the whole battery to discharge, I confirm that the watt meter has stopped at 1180 kw. in the 0.19 version it was calibrated 950, there are 200w more.
This morning I forgot to take away the street mode, I noticed that on exceeding 25 km the engine shuts off but the watt meter continues to score from 100 to 180 depending on how hard it tries on the pedals. I went well beyond 25 km and clearly felt that the engine was off, no doubt
The impression is that the wattmeter adds the motor power and the human power
with torque and power it looks good, the start definitely improved, but the test was all on the plain. Consumption also proved to be stable, as in 0.19, with 1 kw I traveled 110 km at 2.5 / 3 level with speeds always exceeding 30 km.
Maybe it may lack maximum power, but it could depend on the watt meter error, it stops at 650w but it seems less.
By increasing the parameter 10.2 I can lighten the pedaling, great for going to work.
I also tried to change the menu 10.0 from 0 to 35%, we get a further increase in torque at the start, but I brought it back to 0% to keep consumption down and it seems to me already enough.
I tried the torque and emb function a little, you have to get used to it are different and more training than power.
Once the wattameter problem has been solved, it is truly complete and customizable

Very nice of you to provide even more data! I hope you will find the 0.20.0 Beta 1 will solve the issues you reported. It will also have more power! It just gets better and better!

Thank you!
 
buba said:
Oh... and one more thing! How about more torque and power? :wink: Yes, Solving this bug has enabled more power and torque! The changes are already submitted in the pull request and will be available in the 0.20.0 Beta 1 as soon as Casainho has time to take a look and release the beta version. I now recommend everyone to update to 0.20.0 Beta 1 as soon as it is available.
Can you please explain what were the changes? And how did you validate the final result?
 
casainho said:
buba said:
Oh... and one more thing! How about more torque and power? :wink: Yes, Solving this bug has enabled more power and torque! The changes are already submitted in the pull request and will be available in the 0.20.0 Beta 1 as soon as Casainho has time to take a look and release the beta version. I now recommend everyone to update to 0.20.0 Beta 1 as soon as it is available.
Can you please explain what were the changes? And how did you validate the final result?

Yes, of course! It all started back rather early in the 0.20.0 development when I explained I wanted to increase the resolution of the current control. We had some good discussions and I also asked for some clarification for the conversion values.

buba said:
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.

Another question:

buba said:
...

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.

So I took the most logical approach and used the values that are used for the FOC calculation. So the current and voltage displayed had new and more accurate conversions in the 0.20.0. And the current control was also improved with a higher resolution and tighter control. This way I did not have to change the conversion values for the FOC calculation.

Some users reported less power but they also explained it could be due to a smoother control so I did not think much of it. But when I got more data from user Microchip7000 I thought it would be good to make some modifications on my bike so I could validate the conversion values. So I installed some instruments I had at home just to get some approximate values. I have access to much better instruments but that would involve some more work and that is better to save for future motor tuning with better filtering, as we discussed.

So when I tested the bike it did show that there was a considerable difference between the actual and displayed amperage. That is why the consumption seemed to increase with the same level of assistance. So I tried out different power levels and noted the difference. I later calculated new conversion values and tested those. Got much closer to real life values for amperage, voltage and of course power.

We need to change all conversion values in the future and also improve the filtering. This will improve the calculation, decrease the execution time and make the system more efficient. This should be in a separate firmware release and maybe it would be possible to also add the field weakening at the same time.

During the last tests I compared the values between the display and the instruments. Everything was done in real time. Seemed to be very accurate and as accurate we can get without increasing the integer size and calculations. More tuning is possible but that would be better to save for future versions together with the motor tuning.
 
I did some tests today.
I kept acceleration to 80 so I am not limited by it and adjusted the torque conversion param from 67 to 75.
It seems that the torque range is extended. I managed on startup to get peak of 700w+ on level 3 assist. This is very good news because I feared i will have problems in my next mountain ride.

@Buba
More power is always good news :D. Can you please point out the branch so I can make and install a build?

Regards,
Max.
 
maximusdm said:
...

@Buba
More power is always good news :D. Can you please point out the branch so I can make and install a build?

Regards,
Max.

Great! :D Yeah, sure! You can find it here:

https://github.com/leon927/TSDZ2-Smart-EBike/tree/0.20.0-Development

Good luck! And let me know if you have any questions!
 
Hi,
I'd like to know if the following warning messages in normal when compile a new release :

...
main.c:125: warning 126: unreachable code
....
....
main.c:83: warning 126: unreachable code

The instruction "Return 0" at the end of the main.c was the cause ?

Thanks
 
vadda said:
Hi,
I'd like to know if the following warning messages in normal when compile a new release :

...
main.c:125: warning 126: unreachable code
....
....
main.c:83: warning 126: unreachable code

The instruction "Return 0" at the end of the main.c was the cause ?

Thanks

Yes, that is normal! It is because there is some unreachable code. Just a simple warning and not an error! :)

If you remove the unreachable code you get no warnings. In this case the "return 0".
 
buba said:
casainho said:
buba said:
Oh... and one more thing! How about more torque and power? :wink: Yes, Solving this bug has enabled more power and torque! The changes are already submitted in the pull request and will be available in the 0.20.0 Beta 1 as soon as Casainho has time to take a look and release the beta version. I now recommend everyone to update to 0.20.0 Beta 1 as soon as it is available.
Can you please explain what were the changes? And how did you validate the final result?

Yes, of course! It all started back rather early in the 0.20.0 development when I explained I wanted to increase the resolution of the current control. We had some good discussions and I also asked for some clarification for the conversion values.
Hmm, because the way I read your message, I thought the new version would have an increase of torque / battery range compared to the last stable version v0.19.0.
 
casainho said:
buba said:
casainho said:
buba said:
Oh... and one more thing! How about more torque and power? :wink: Yes, Solving this bug has enabled more power and torque! The changes are already submitted in the pull request and will be available in the 0.20.0 Beta 1 as soon as Casainho has time to take a look and release the beta version. I now recommend everyone to update to 0.20.0 Beta 1 as soon as it is available.
Can you please explain what were the changes? And how did you validate the final result?

Yes, of course! It all started back rather early in the 0.20.0 development when I explained I wanted to increase the resolution of the current control. We had some good discussions and I also asked for some clarification for the conversion values.
Hmm, because the way I read your message, I thought the new version would have an increase of torque / battery range compared to the last stable version v0.19.0.

Only comparing to the 0.20.0 Alpha versions and have not done any testing to compare the torque between the 0.20.0 and 0.19.0. I know there is some room for tuning that would slightly increase the torque and battery range but that should be saved for a firmware version dedicated to motor tuning/improvements.
 
buba said:
vadda said:
Ok, thanks
But the "Return 0" at the end of the main is necessary ?

No problem!

It is not necessary in the current form but you do not need to remove it. It is just a warning.You can do however you like.

I have compiled and tested the latest version on your GitHub.
The current reading is much better, as is that of the Volts.
There remains a discrepancy of 0.3V on the Volts and about 20W less reported on the LCD3 compared to the Wattmeter (on a reading of about 570W reported by LCD3)
I wanted to know if the two variables that are used to calculate the V and I are BATTERY_VOLTAGE_PER_10_BIT_ADC_STEP_X1000 and BATTERY_CURRENT_PER_10_BIT_ADC_STEP_X100?
I wanted to try raising both by 1 to see if the reading improved.

I do not stop thanking you for the excellent work done and the kindness and competence with which you always respond.
 
Let me share simple and effective heat management improvement for the tsdz2 with silicone thermal conductive pads

I cut pads to half to make them thinner and stick them to motor with double side adhesive heat conductive tape.

Have tested it whole summer and it works really well I was able to keep motor (with 52V battery) easily below 55 C.
It transfers heat to aluminum case much faster.

pads:
https://www.aliexpress.com/item/32890931967.html
tape:
https://www.aliexpress.com/item/32945828630.html

Install Hints:
- clean pads and motor with alcohol before applying the adhesive tape
- pads are soft and easy to adapt its shape while closing the case but small excessive amount might still not fit in so just cut it off
 

Attachments

  • IMG_6879.JPG
    IMG_6879.JPG
    54.2 KB · Views: 2,102
vadda said:
buba said:
vadda said:
Ok, thanks
But the "Return 0" at the end of the main is necessary ?

No problem!

It is not necessary in the current form but you do not need to remove it. It is just a warning.You can do however you like.

I have compiled and tested the latest version on your GitHub.
The current reading is much better, as is that of the Volts.
There remains a discrepancy of 0.3V on the Volts and about 20W less reported on the LCD3 compared to the Wattmeter (on a reading of about 570W reported by LCD3)
I wanted to know if the two variables that are used to calculate the V and I are BATTERY_VOLTAGE_PER_10_BIT_ADC_STEP_X1000 and BATTERY_CURRENT_PER_10_BIT_ADC_STEP_X100?
I wanted to try raising both by 1 to see if the reading improved.

I do not stop thanking you for the excellent work done and the kindness and competence with which you always respond.

Exciting that you are experimenting and testing! If I can help in any way please let me know!

Yes, I know that there is still a discrepancy but I think it is as close we can get for now. It is best to test the voltage and current separately. If they are correct the watts will be correct. But there are filters on the values displayed on the display so when testing it is best to have a "steady state" on whatever you are measuring. Example: if you limit the current to 10 A and use Cruise to give maximum power the system will limit to around 10 A and hold it there. As a result, it will be possible to somewhat accurately measure the current.

You are free to experiment with the other values you mentioned without any problems. But I would advise against changing the x512 values. They are used in the FOC calculation.

Thank you for the kind words, Vadda! We all appreciate that you are testing and experimenting with the code! Again, please let me know if I can help or if you see anything that can be improved in any way!
 
elfnino said:
Let me share simple and effective heat management improvement for the tsdz2 with silicone thermal conductive pads

Thanks for sharing a very effective and cheap solution!
I used aluminium, but it is very hard to make a good contact with the exterior case.
 
Just a quick bit of feedback, I know not many people are using the Cadence assist mode in 0.20.x but for my one user who has the prosthetic leg having finally managed to try it, she is over the moon!. It has fixed her hunting issue altogether, so much so she has taken that trike home for more long ride testing. Personally i much prefer the Power assist mode or eMTB for my own use, but for some users a traditional pedal assist is still a good option.

Thanks again Buba for adding this mode to allow us to have the option.
 
buba said:
vadda said:
buba said:
vadda said:
Ok, thanks
But the "Return 0" at the end of the main is necessary ?

No problem!

It is not necessary in the current form but you do not need to remove it. It is just a warning.You can do however you like.

I have compiled and tested the latest version on your GitHub.
The current reading is much better, as is that of the Volts.
There remains a discrepancy of 0.3V on the Volts and about 20W less reported on the LCD3 compared to the Wattmeter (on a reading of about 570W reported by LCD3)
I wanted to know if the two variables that are used to calculate the V and I are BATTERY_VOLTAGE_PER_10_BIT_ADC_STEP_X1000 and BATTERY_CURRENT_PER_10_BIT_ADC_STEP_X100?
I wanted to try raising both by 1 to see if the reading improved.

I do not stop thanking you for the excellent work done and the kindness and competence with which you always respond.

Exciting that you are experimenting and testing! If I can help in any way please let me know!

Yes, I know that there is still a discrepancy but I think it is as close we can get for now. It is best to test the voltage and current separately. If they are correct the watts will be correct. But there are filters on the values displayed on the display so when testing it is best to have a "steady state" on whatever you are measuring. Example: if you limit the current to 10 A and use Cruise to give maximum power the system will limit to around 10 A and hold it there. As a result, it will be possible to somewhat accurately measure the current.

You are free to experiment with the other values you mentioned without any problems. But I would advise against changing the x512 values. They are used in the FOC calculation.

Thank you for the kind words, Vadda! We all appreciate that you are testing and experimenting with the code! Again, please let me know if I can help or if you see anything that can be improved in any way!


Is the Battery voltage used for the calculations measured at the screen or the motor?
I ask as i noticed that when i had a dodgy wet connection in my cable i could easily get a 0.5v volt drop at the screen compared to the actual battery voltage.

Ideally the voltage should be measured as close to the motor as possible for accuracy.
 
Back
Top