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

Electric Motors and Controllers
casainho   100 MW

100 MW
Posts: 2662
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Nov 20 2018 5:54am

andyme wrote:
Nov 20 2018 5:33am
markjiizs wrote:
Nov 20 2018 2:19am
One crazy idea came in my mind :) , would it be hard to implement human wh on the screen? I would find it really super interesting to see how much power in wh were used from battery and compare it to pedalling, particularly for longer trips :)

p.s. Still on 14.3 but looking forward to test 16 in a few days :)
before you get no answer at all (unfortunately very common in this forum) you may as well get a wrong one from me... :D

To my understanding, the new assist mode works as a multiplier of your own energy. So that should/could mean: the watts that you see on the display are the sum of both efforts. So depending on the assist factor that you selected in the setup, you can easily extract your own portion. e.g.: assist factor 1, you see 400, 200 is from you, 200 the motor.
On LCD3 is shown motor usage watts AND on odometer field the rider pedal watts.
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, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

markjiizs   1 µW

1 µW
Posts: 4
Joined: Oct 25 2018 9:49pm

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

Post by markjiizs » Nov 20 2018 6:43am

I have LCD3 but I was reffering not to the current consumption/pedalling power in watts, but watt hours of your pedalling - e.g.
If I pedalled 2h with an average of 200w it woudl show 400wh, plus motor was contributing 250 w these 2h, so the battery consumption would be 500wh. Totall energy for the trip 900wh...
I do not want to throw anything at you guys, I know you've done amazing job. It's just an idea and at one point I will also try to look into the code :)

casainho   100 MW

100 MW
Posts: 2662
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Nov 20 2018 6:55am

markjiizs wrote:
Nov 20 2018 6:43am
I have LCD3 but I was reffering not to the current consumption/pedalling power in watts, but watt hours of your pedalling - e.g.
If I pedalled 2h with an average of 200w it woudl show 400wh, plus motor was contributing 250 w these 2h, so the battery consumption would be 500wh. Totall energy for the trip 900wh...
I do not want to throw anything at you guys, I know you've done amazing job. It's just an idea and at one point I will also try to look into the code :)
Yes, it is stressful to get others asking for more and more work. It costs almost nothing to ask here, it is free and takes almost no time to write.

I am doing what I enjoy for me and then I share to others, I am not doing the work of others.
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, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

dameri   10 mW

10 mW
Posts: 24
Joined: Sep 20 2018 10:57am

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

Post by dameri » Nov 20 2018 9:40am

andyme wrote:
Nov 16 2018 5:45am
casainho wrote:
Nov 16 2018 3:51am
I still think is most important to being able to quick change assist level and max power while riding.
If the motor works as a multiplier of human power, there is no need to change the assist level in 99% of my rides! :D
The favorite ride mode is a matter of personal preference, I think!

regards
stancecoke
I think the last sentence is exacty what i think, too. Actually it is not only preference, it is also circumstances!!! Each of us here has different needs, circumstances, roads, distances, hills and so on....so it is very difficult for one person to judge for everyone. And therefore i want to point out again: what i am suggesting would have ZERO IMPACT on how it is now...it should be part of the settings menu, and there you can set a limit per level or not. that is all. If you decide not to set a limit it will work as now...so that is why i do not understand why this has to be debated as no one is losing anything and we are just gaining options. The only people who could be against it are those who write the code... :?
the max power button is very important and would not be affected by it. I am a fan of options and especially if this does not harm anyone...why be against it?
even my new gloves come with options...and it was not me who created them.. :D :D :D
WhatsApp Image 2018-11-16 at 11.55.40.jpeg
[/quote]

Sorry offtopic, but I have same but different gloves. They aren't very warm.
CraftGloves.JPG
CraftGloves.JPG (149.5 KiB) Viewed 498 times

User avatar
jbalat   10 kW

10 kW
Posts: 523
Joined: Nov 10 2012 11:50pm
Location: Melbourne, Australia

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

Post by jbalat » Nov 20 2018 5:52pm

andyme wrote:
Nov 20 2018 5:33am
the watts that you see on the display are the sum of both efforts.
Not true, on the bottom it shows human watts and top right it shows motor watts. It does not add the human watt hours but yeh it could be cool to see in the future :)

As for walk mode on/off we already concluded it was too dangerous to switch it on and off manually. It will only be on when holding the bottom button down, but it will run on for half a second or so just in case your finger bounces on and off as you are going up some rough terrain.
Please subscribe to my Youtube home page for Quadcopters, FPV and Bike Rides http://www.youtube.com/jbalatutube
My build log here http://endless-sphere.com/forums/viewto ... =6&t=55352
For some cool ebike talk join us on The Best ebike https://www.facebook.com/groups/193581737807033/
Tech talk TSDZ2 Opensource firmware viewtopic.php?f=30&t=93818&start=150

casainho   100 MW

100 MW
Posts: 2662
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Nov 20 2018 6:03pm

jbalat wrote:
Nov 20 2018 5:52pm
andyme wrote:
Nov 20 2018 5:33am
the watts that you see on the display are the sum of both efforts.
Not true, on the bottom it shows human watts and top right it shows motor watts. It does not add the human watt hours but yeh it could be cool to see in the future :)

As for walk mode on/off we already concluded it was too dangerous to switch it on and off manually. It will only be on when holding the bottom button down, but it will run on for half a second or so just in case your finger bounces on and off as you are going up some rough terrain.
I am being thinking that adding more options/information to LCD3 will make a big confusion, because we can show there data but the more different types of data we add, the more confusion because we can't label the data so user can't understand -- even if the user read on wiki, the more data the more to confusion.

Because of that, I have high expectations for the 320x480 pixels color LCD that I am working on.

What is not better on this new LCD, is the buttons, they are the same 3 buttons and sometimes seems we would like to have more buttons.
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, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

andyme   100 W

100 W
Posts: 166
Joined: Oct 04 2017 1:40pm

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

Post by andyme » Nov 20 2018 6:18pm

jbalat wrote:
Nov 20 2018 5:52pm
andyme wrote:
Nov 20 2018 5:33am
the watts that you see on the display are the sum of both efforts.
Not true, on the bottom it shows human watts and top right it shows motor watts. It does not add the human watt hours but yeh it could be cool to see in the future :)

As for walk mode on/off we already concluded it was too dangerous to switch it on and off manually. It will only be on when holding the bottom button down, but it will run on for half a second or so just in case your finger bounces on and off as you are going up some rough terrain.
sorry, that was my mistake. i actually do know what it shown in the top right. but is your own effort not the same value if you use multiplier 1? so if you see 500 and you select 1 as a factor it means you are also contributing 500 ?

re. the walk assist: i just had a spontaneous idea, because casainho had mentionned that he needs it. I personally do not really need a walk assist. I just meant to contribute...haha...

if i may ask 2 questions:

1. can i read out the firmware version with ST-Link VP? I do not find this info....

2. can you confirm that boost mode works? i cannot see it working....even worse: i stop at a red light and want to go on, and the motor will not kick in at all...only after about 2 seconds when i am already going..so i really very often start completely without assist...what am i doing wrong? besides that: i love version 0.16 except that personally i am not convinced that it is good to be able to achieve max power in almost every level...it can happen that you climb a hill and what ever assist level you pick, it does not improve because you are already in max in level 2...i don't know.....for me this is not how it should be

Rafe   10 mW

10 mW
Posts: 27
Joined: Oct 16 2018 5:56pm

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

Post by Rafe » Nov 20 2018 7:09pm

Surely Andyme is correct and the readout in the odo field is the sum of human power plus assist power. I did a long ride on firmware 16 at the weekend and that reading was often reading 500 plus, with the Motor watts indicating 200w ish and no way was I inputting 300 watts or anything like that. The reading i'm referring to is the one that comes after battery voltage but as yet the user documentation has not caught up with 16 firmware . I spent the whole 50 miles in assist level 1 even the steepest 22% or more gradients with full panniers so I think the lowest assist level is probably defaulted too high but the amazing thing is the battery used less charge than is normal for that route.


I did though experience lag twice and it was longer than it used to be (power boost enabled). Also had the flashing 1 for resting my foot on the pedal ready for a quick getaway at the lights.
Last edited by Rafe on Nov 24 2018 8:40am, edited 3 times in total.

User avatar
jbalat   10 kW

10 kW
Posts: 523
Joined: Nov 10 2012 11:50pm
Location: Melbourne, Australia

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

Post by jbalat » Nov 21 2018 5:50pm

Hey EC any luck figuring out why the CADENCE display has disappeared ?
Please subscribe to my Youtube home page for Quadcopters, FPV and Bike Rides http://www.youtube.com/jbalatutube
My build log here http://endless-sphere.com/forums/viewto ... =6&t=55352
For some cool ebike talk join us on The Best ebike https://www.facebook.com/groups/193581737807033/
Tech talk TSDZ2 Opensource firmware viewtopic.php?f=30&t=93818&start=150

Kisazul   100 mW

100 mW
Posts: 35
Joined: Jun 18 2018 10:32pm

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

Post by Kisazul » Nov 21 2018 8:08pm

I put 0.16 firmware with the throttle. and I have a comment. my choke only works on on - off (probably at full capacity). settings in 9 menu I see that the throttle pressing on different level changes also to the different level.

User avatar
jbalat   10 kW

10 kW
Posts: 523
Joined: Nov 10 2012 11:50pm
Location: Melbourne, Australia

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

Post by jbalat » Nov 22 2018 3:19am

If you wanted to install the temperature sensor which I highly recommend please check out my video below.


also I have added a couple of pics in the wiki folder.. Can someone please add them to the actual wiki, or I can give it a go later tonight
Please subscribe to my Youtube home page for Quadcopters, FPV and Bike Rides http://www.youtube.com/jbalatutube
My build log here http://endless-sphere.com/forums/viewto ... =6&t=55352
For some cool ebike talk join us on The Best ebike https://www.facebook.com/groups/193581737807033/
Tech talk TSDZ2 Opensource firmware viewtopic.php?f=30&t=93818&start=150

casainho   100 MW

100 MW
Posts: 2662
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Nov 22 2018 3:49am

jbalat wrote:
Nov 22 2018 3:19am
If you wanted to install the temperature sensor which I highly recommend please check out my video below.
GREAT!! You are giving us a great value!!! This is a good video, clear and slow enough to see and learn details. Thank you.

NOTE: your video of the firmware review has now 2200 views, this mean you are helping a LOT of people with your work!! :bigthumb:
jbalat wrote:
Nov 22 2018 3:19am
also I have added a couple of pics in the wiki folder.. Can someone please add them to the actual wiki, or I can give it a go later tonight
I renamed the files you did upload, as is better to have a description name. Yes, please add them to the wiki and add any notes you think are important, and don't forget to put you video there also (you can try copy the way I put your firmware review video on the first page).
jbalat wrote:
Nov 21 2018 5:50pm
Hey EC any luck figuring out why the CADENCE display has disappeared ?
Please look at the LCD3 code, on the odometer(), you will see there the cadence being display -- it works for me!!
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, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

andyme   100 W

100 W
Posts: 166
Joined: Oct 04 2017 1:40pm

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

Post by andyme » Nov 22 2018 11:09am

I don't mean to be stubborn but i would really like to understand what the group here thinks of my objections/remarks:

i am in level 3, i ride with very easy pedalling and the motor contributes 340W

i then think: ok, maybe i should work a bit harder, this is really too little workout...

So i am switching down to level 2 (default settings) . Pedalling is getting harder, but motor is contributing 340W

So: what is the idea behind this? why can i not save battery if i am willing to pedal more?

I could limit the motor power to overall 250W...ok...but then i will not have enough assistance when i may need it on the next hill etc....

I can only repeat myself: i think this concept of multiplying is GREAT, but it is not completely thought to the end and would deserve some correction.

It would be great to get some feedback here....

andyme   100 W

100 W
Posts: 166
Joined: Oct 04 2017 1:40pm

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

Post by andyme » Nov 22 2018 11:20am

jbalat wrote:
Nov 22 2018 3:19am
If you wanted to install the temperature sensor which I highly recommend please check out my video below.

also I have added a couple of pics in the wiki folder.. Can someone please add them to the actual wiki, or I can give it a go later tonight
Thanks, JB for this video, it encourages me to go for the temp sensor myself, since i also have a non throttle version and you are now making it easy to see what needs to be done.

You are mentionning that auto-cooling is difficult given the motor sits in the housing.

What do you think of my idea to use "thermal compound" in order to "connect" the motor to the housing?
(is this the right term for a cream made of metal oxyde powder used to conduct heat towards cooling profiles on electronic elements for example?)

I am thinking that this may transport the heat to the case and then additionally one could add some heat pipe or so outside....this could increase the operational range for the motor.
Last edited by andyme on Nov 22 2018 12:11pm, edited 1 time in total.

crun   10 mW

10 mW
Posts: 29
Joined: Jun 22 2016 7:11pm

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

Post by crun » Nov 22 2018 10:39pm

andyme wrote:
Nov 22 2018 11:20am
hat do you think of my idea to use "thermal compound" in order to "connect" the motor to the housing?
I am thinking that this may transport the heat to the case and then additionally one could add some heat pipe or so outside....this could increase the operational range for the motor.
Thermal cream is ~10x still air, after the loss of radiation, but not terribly good. It is the most god-awful messy stuff in small doses.

Blackening the inside of the cover and motor with a thinnest possible layer of matte black paint improves the radiation transfer, which can be a significant component approx equal to still air conduction - clean and easy to do the cover. (paint should be just thick enough to blacken, but no thicker)

Still air (which thin air films are) has poor conductivity, but far better if you disturb it.
Putting a tiny fan inside to circulate the air might help. This store has some tiny fans. A 20x20 centrifugal blower looks like it would fit nicely between the controller and the motor on the topside, and circulate air around the motor, while the 30x30 might be a snug fit at the bottom - a 40x40x10 fan almost fits.

vreppeto   1 mW

1 mW
Posts: 12
Joined: Oct 03 2018 6:07pm

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

Post by vreppeto » Nov 22 2018 11:55pm

This photo shows the bafang 1000w stator with an IPM rotor! I found this on aliexpress at https://www.aliexpress.com/item/Bafang- ... 4c7fa8f72b . I may have to build a new gearbox with 150:1 ratio.
Q 1. Anybody know the dimensions? Is it close fit for the tsdz2 housing?
Q 2. If we can control the rpms with software why does it matter how many turns of wire there are in the rotor? If you know the answer or you can remember where you read about it, I would really like to know.
Attachments
bafang-ipm-48v-1000w.png
bafang-ipm-48v-1000w.png (144.53 KiB) Viewed 280 times

linklemming   1 mW

1 mW
Posts: 18
Joined: Aug 25 2011 12:55pm

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

Post by linklemming » Nov 23 2018 12:11am

I just wanted to thank everyone for this software.

I got into ebikes about 4 months ago with a Bulls Evo 3 27.5+ Hardtail with Brose Motor. It totally changed my life (seriously). I am much fitter now than I was when I was riding acoustic bikes. I would ride those for fitness but it seemed like a chore. I find the torque sensing experience like crack and just cant get enough (I ride everyday if possible, probably 100-150 miles week). Every ebike ride leaves me sore the next day but not so much that I cant ride.

I installed the software as advertised(0.16.0), the only thing I didnt do was power up the motor when flashing. That being said, for the most part everything appears to be working correctly but I do have some questions.

I am a embedded sw person and have been looking at the code and hope to contribute at some point.

So the questions:

1.) On the main screen, what is the power measurement on the right of the display. Wiki says its power taken out of the battery, posts here seem to imply its human power? It seems very high for human power. Code also seems to imply its human power

2.) On the main screen, what is the scaling of the current reading if chosen in the odometer area. I see values ranging up to about 650 (would that equate to 6.5amps?). That was the highest value no matter what I did for assist level or my pressure on the pedals.

3.) I really dont feel that much difference in the assist levels. On my first ride, I had the power limit set to 500W. My first thought was that I was just hitting this limit all the time so I increased it to 650W. Im not sure there is a difference. To be honest, I can say level 1 feels less powerful than level 9 but not by much. I dont seem to see any real difference in current readings regardless of assist level. I did see in the code that setting the number of assist levels to 9 would basically just allow higher levels of assist and I set the number of assist levels to 9 but Im not sure thats Im feeling it when riding the bike.

Any ides on what to try next (i.e set power level to 0 and see if it acts differently?)

User avatar
jbalat   10 kW

10 kW
Posts: 523
Joined: Nov 10 2012 11:50pm
Location: Melbourne, Australia

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

Post by jbalat » Nov 23 2018 2:44am

Power on top right is motor power Amps x Volts
Power in odd field when you cycle through with on/off button is human power

Set to 5 levels
Level 1 should be like 0.3
Level 2 can be 0.5
Etc.
A value of 1 is pretty powerful, it means if I put in 200w the motor will also give 200w
So use it for level 4
You need to set these yourself

When you cycle to Amps it will display amps there is no scale factor.
The only thing that doesn’t cycle at the moment is the cadence.
The others can be hard to figure out while you are riding except for voltage which is obvious.
Please subscribe to my Youtube home page for Quadcopters, FPV and Bike Rides http://www.youtube.com/jbalatutube
My build log here http://endless-sphere.com/forums/viewto ... =6&t=55352
For some cool ebike talk join us on The Best ebike https://www.facebook.com/groups/193581737807033/
Tech talk TSDZ2 Opensource firmware viewtopic.php?f=30&t=93818&start=150

andyme   100 W

100 W
Posts: 166
Joined: Oct 04 2017 1:40pm

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

Post by andyme » Nov 23 2018 7:48am

crun wrote:
Nov 22 2018 10:39pm
andyme wrote:
Nov 22 2018 11:20am
hat do you think of my idea to use "thermal compound" in order to "connect" the motor to the housing?
I am thinking that this may transport the heat to the case and then additionally one could add some heat pipe or so outside....this could increase the operational range for the motor.
Thermal cream is ~10x still air, after the loss of radiation, but not terribly good. It is the most god-awful messy stuff in small doses.

Blackening the inside of the cover and motor with a thinnest possible layer of matte black paint improves the radiation transfer, which can be a significant component approx equal to still air conduction - clean and easy to do the cover. (paint should be just thick enough to blacken, but no thicker)

Still air (which thin air films are) has poor conductivity, but far better if you disturb it.
Putting a tiny fan inside to circulate the air might help. This store has some tiny fans. A 20x20 centrifugal blower looks like it would fit nicely between the controller and the motor on the topside, and circulate air around the motor, while the 30x30 might be a snug fit at the bottom - a 40x40x10 fan almost fits.
ok...haha..why not...i will first install the temperature sensor as per jbalat and then i will see how my system reacts altogether...this will probably become interesting only from April on or so....it is quite cold now, so temperature will probably not be such an issue..but who knows....in australia it is about summer now, so jbalat is solving current realtime issues for him :-)

andyme   100 W

100 W
Posts: 166
Joined: Oct 04 2017 1:40pm

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

Post by andyme » Nov 23 2018 11:48am

jbalat wrote:
Nov 23 2018 2:44am

Set to 5 levels
Level 1 should be like 0.3
Level 2 can be 0.5
Etc.
A value of 1 is pretty powerful, it means if I put in 200w the motor will also give 200w
So use it for level 4
You need to set these yourself
interesting information.

these values are very different from default settings. but so far no one mentionned it.

linklemming   1 mW

1 mW
Posts: 18
Joined: Aug 25 2011 12:55pm

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

Post by linklemming » Nov 23 2018 6:56pm

jbalat wrote:
Nov 23 2018 2:44am
Power on top right is motor power Amps x Volts
Power in odd field when you cycle through with on/off button is human power

Set to 5 levels
Level 1 should be like 0.3
Level 2 can be 0.5
Etc.
A value of 1 is pretty powerful, it means if I put in 200w the motor will also give 200w
So use it for level 4
You need to set these yourself

When you cycle to Amps it will display amps there is no scale factor.
The only thing that doesn’t cycle at the moment is the cadence.
The others can be hard to figure out while you are riding except for voltage which is obvious.
You do not need to set power levels, they are already setup, This was confirmed by going thru the 3 sub menu. I agree your values are probably better than the defaults.

I did originally use the stock 5 levels of assist, same issue. No noticable difference in power levels

I reset to defaults thru submenu 6 and now all is working fine.

VERY noticable power difference now and I can see the direct multiplier multiplying human power. Thanks for clarifying that.

Im still not see amps

As I toggle Power Button
Flashing 1 in mph field - KM in ODO field (Probably accumulated Battery Power)
Flashing 3 in mph field - Volts in ODO field
Flashing 4 in mph field - Human Power in ODO field.

I thinking I should be seeing Amps in ODO field for Flashing 2 in mph field?

Not sure why Im not seeing it. As I mentioned before, I did not power up motor from battery when flashing and did see an error trying to write to eeprom but looking at the code earlier I could see that it really didnt matter as the code would write default eeprom values if it didnt see certain key values. This correct writing of EEPROM was confirmed by verifying all the values in all the submenus.

I also had reset to defaults a few times while learning the submenu system.

Not having amps doesnt really matter to me, I only wanted to see the amps increasing with assist levels. Im using power limits of 500-600W so amps will always be fine for my 48V system.

Knowing what I know now, for some reason the multiplier was stuck at 0.5 regardless of the assist level before resetting to factory defaults.

crun   10 mW

10 mW
Posts: 29
Joined: Jun 22 2016 7:11pm

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

Post by crun » Nov 23 2018 11:52pm

andyme wrote:
Nov 23 2018 7:48am
so jbalat is solving current realtime issues for him :-)
Probably duct taping a plastic bag over his head so he can breathe when he goes outside, if he's in Sydney.

Nice sunsets for me in 3 days time though...

linklemming   1 mW

1 mW
Posts: 18
Joined: Aug 25 2011 12:55pm

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

Post by linklemming » Nov 24 2018 1:24am

Well, I think my original setup was actually working fine (i.e. resetting to defaults didnt fix anything).

When I wrote that it did, it was on a workout stand and using lower power. For lower power levels (i.e. 150W human), I see the motor output directly correspond to the assist level. I works this way out on the road as well for really low power levels. When I get to my normal riding power levels which seem to be 'roughly 350w', I dont see the assist level scaling anymore like it does at lower power levels. Its hard to give exact numbers but I dont think I ever saw motor output more than 450 or so(stock assist level of 2.5 on level 5). I had motor power limited to 650W when trying this but even if I turn power output off, I get the same results. I even took assist value to 4.0 which had quite a low power kick to it but no real change at the high end.

I know for certain that I dont output that much power, given my age and heartrate I doubt I was doing more than 100w.

So first off, I just think the human power calculation is wrong. I currently reviewing this in the code.

I also think the assist doesnt go as high as you get higher human power, might not be an issue though if the human power is calculated correctly.

linklemming   1 mW

1 mW
Posts: 18
Joined: Aug 25 2011 12:55pm

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

Post by linklemming » Nov 24 2018 3:01am

Im pretty rusty in many of these calculations but went thru the process.

I took an instance of the torque sensor returning a value of 50 and a cadence of 90rpm.

Doing the math in calc_pedal_force_and_torque I get ui16_pedal_power_x10=2229 which Im guessing is multiplied by 10 to keep up the digit accuracy using fixed point. So this should equate to 222.9 watts (Im assuming the unit desired here is watts).

I did my own independent calculation a different way, I decided to stick with force of Newtons and go from there and trying to get to nm/sec which is a watt.

From the comments .33kg was 1 lsb of the torque sensor. Taking the value of 50 read for the torque sensor would make this 16.5Kg which multiplied by 9.81 yields 161 newtons (the code uses 9.18btw)

Since Power is force*distance/sec, we need the distance travelled in 1 revolution

circumference = 2*pi*r and Im assuming the same 170mm cranks that the code does.
= 2*pi*.17 = 1.07m

So nm would be 161*1.07 = 172nm

To factor in the 90 rpms we simply get to the fact that it takes .67sec for 1 rev

So the overall wattage is 114 watts

This seems more in line with what i think I am seeing (wattage about twice what I expect).

That being said, not sure how this gets to the LCD as it appears that the human power is sent via index 14 in the tx_buffer

// pedal human power mapped to 255
ui8_tx_buffer[14] = ui8_pedal_human_power;

but I dont see this value set anywhere. Perhaps the LCD uses the values
// ui16_pedal_power_x10
ui8_tx_buffer[22] = (uint8_t) (ui16_pedal_power_x10 & 0xff);
ui8_tx_buffer[23] = (uint8_t) (ui16_pedal_power_x10 >> 8);

But I thought I saw it using the index of 14.

I still think there will be some 'clipping' of the requested power as well but one problem at a time.

crun   10 mW

10 mW
Posts: 29
Joined: Jun 22 2016 7:11pm

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

Post by crun » Nov 24 2018 3:31am

linklemming wrote:
Nov 24 2018 3:01am
Doing the math in calc_pedal_force_and_torque I get ui16_pedal_power_x10=2229 which Im guessing is multiplied by 10 to keep up the digit accuracy using fixed point. So this should equate to 222.9 watts (Im assuming the unit desired here is watts).

I did my own independent calculation a different way, I decided to stick with force of Newtons and go from there and trying to get to nm/sec which is a watt.

From the comments .33kg was 1 lsb of the torque sensor. Taking the value of 50 read for the torque sensor would make this 16.5Kg which multiplied by 9.81 yields 161 newtons (the code uses 9.18btw)
You might want to start by doing a torque sensor calibration. Make some hooks (or cable tie to the crank) so a wooden arm hangs off one pedal crank horizontally facing forward.
Hang a gym weight off the end. (This is a 2 person job)

You can zero by either unhooking the arm, or (if cable tied) , rotate until the arm is vertical so exerting no torque.

Torque= 9.8*N/kg * (GymWeight.kg** distance-from-axis.m + Wood-weight*WoodLength/2)

5kg at 1m + 2kg wood ~=60N.m

Power (W) = Torque (N.m) x Speed (RPM) 1000/ 9.5488

Post Reply