TSDZ2 mid drive and 850C and SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Electric Motors and Controllers
jeff.page.rides   1 W

1 W
Posts: 59
Joined: Aug 13 2019 10:16am

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

Post by jeff.page.rides » Aug 31 2019 9:11pm

Here's the photos you asked for let me know if they worked?
20170824_102230 s.jpg
20170824_102230 s.jpg (407.65 KiB) Viewed 1316 times
20170903_141616 s.jpg
20170903_141616 s.jpg (260.39 KiB) Viewed 1316 times
20170905_121221 s.jpg
20170905_121221 s.jpg (318.2 KiB) Viewed 1316 times
Freedom XShifter 1.jpg
Freedom XShifter 1.jpg (183.03 KiB) Viewed 1316 times
IMG_0091 s.jpg
IMG_0091 s.jpg (347.04 KiB) Viewed 1316 times
IMG_0464 s.jpg
IMG_0464 s.jpg (345.85 KiB) Viewed 1316 times

casainho   1.21 GW

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

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

Post by casainho » Aug 31 2019 9:53pm

jeff.page.rides wrote:
Aug 31 2019 9:11pm
Here's the photos you asked for let me know if they worked?
Perfect!! And the 2nd one seems to be with family, really nice!!

Later I will put this info on a wiki page and link from the main page, I will then share here the link.
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of the Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

casainho   1.21 GW

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

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

Post by casainho » Aug 31 2019 10:07pm

Just curious if someone has interest in starting this project: I was looking for other DIY mid drive motors that are more powerful and seems the Bafang BSSHD is the one, can take 52V 40A: 2000 Watts which is more than double of TSDZ2. This motor has no torque sensor but a DIY torque sensor can be added to cranks using and communications with Bluetooth with SW102, that would then send the torque and cadence value to the STC15W4K32S4.
BotoXbz wrote:
Aug 31 2019 8:13pm
casainho wrote:
Aug 31 2019 5:07pm
Hi.

Can you guys please tell me what is the microcontroller on the motor controller board?? I saw that there are connections for 3 halls sensors from the motor + the connections of the 3 phases.
The controller on the BBSHD is garbage, it's using a Chinese STC15W4K32S4 series MCU
There is a second MCU, I think that one does the motor control and the STC probably only tells it how much current it wants
Original firmware is here: viewtopic.php?t=100064
A much better idea would be to design a good VESC controller that'd fit into the original enclosure.
And then you could do whatever you want.
Thanks for the information.

That STC15W4K32S4 is from ST, there is an English datasheet available as also a c compiler and some examples projects on github.

The c compiler is SDCC, the same we use for the TSDZ2 motor controller, which is also a microcontroller from ST.

So, even if there is other IC that specifically do the motor controller, than should be easy to understand the schematic of the motor controller and then develop the firmware, probably even more easy than the TSDZ2 or the KT Kunteng motor controllers firmware that we also developed.

Can you please tell me the me reference of the motor controller IC??
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of the Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

andrea_104kg   100 W

100 W
Posts: 180
Joined: Mar 05 2018 5:51pm

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

Post by andrea_104kg » Sep 01 2019 3:19am

working with bafang engines is a good idea. But the bbshd is too powerful. There are transmission problems, the chains are broken, free wheels and hubs. Even the rear of most bicycles flexes with its power.

Rafe   10 W

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

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

Post by Rafe » Sep 01 2019 5:12am

andrea_104kg wrote:
Sep 01 2019 3:19am
working with bafang engines is a good idea. But the bbshd is too powerful. There are transmission problems, the chains are broken, free wheels and hubs. Even the rear of most bicycles flexes with its power.

I have been using a BBSHD for far longer than the TSDZ2 and what you say is quite frankly wrong in normal use. The BBSHD is far more reliable (100% in my case) than the TSDZ2, Your opinion applies to people who delight in pushing the boundaries and taking the motor to the extreme.

Go for it cassainho it would be fantastic if we had your opensource skills applied to the BBSHD and a bomb proof motor that can be relied on to go all day and not break down or overheat. And the cherry on the cake is that it is silent unlike the noisy TSDZ2 :)

mctubster   100 W

100 W
Posts: 226
Joined: Feb 26 2018 6:21am

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

Post by mctubster » Sep 01 2019 5:43am

Rafe wrote:
Sep 01 2019 5:12am
andrea_104kg wrote:
Sep 01 2019 3:19am
working with bafang engines is a good idea. But the bbshd is too powerful. There are transmission problems, the chains are broken, free wheels and hubs. Even the rear of most bicycles flexes with its power.

I have been using a BBSHD for far longer than the TSDZ2 and what you say is quite frankly wrong in normal use. The BBSHD is far more reliable (100% in my case) than the TSDZ2, Your opinion applies to people who delight in pushing the boundaries and taking the motor to the extreme.

Go for it cassainho it would be fantastic if we had your opensource skills applied to the BBSHD and a bomb proof motor that can be relied on to go all day and not break down or overheat. And the cherry on the cake is that it is silent unlike the noisy TSDZ2 :)
Is the BBSHD better at maintaining RPM and torque as the battery discharges? I had a BBS01b and while virtually silent, its biggest drawback (other than PAS) was the huge loss of torque / power at decent RPMs. In fact even with a fully charged battery the max RPM was limiting without "hot-rodding" or over-volting. When battery was nearly flat basically no power above 60RPM. Prob fine if you are after a moped though ;)

casainho   1.21 GW

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

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

Post by casainho » Sep 01 2019 6:18am

Rafe wrote:
Sep 01 2019 5:12am
andrea_104kg wrote:
Sep 01 2019 3:19am
working with bafang engines is a good idea. But the bbshd is too powerful. There are transmission problems, the chains are broken, free wheels and hubs. Even the rear of most bicycles flexes with its power.

I have been using a BBSHD for far longer than the TSDZ2 and what you say is quite frankly wrong in normal use. The BBSHD is far more reliable (100% in my case) than the TSDZ2, Your opinion applies to people who delight in pushing the boundaries and taking the motor to the extreme.

Go for it cassainho it would be fantastic if we had your opensource skills applied to the BBSHD and a bomb proof motor that can be relied on to go all day and not break down or overheat. And the cherry on the cake is that it is silent unlike the noisy TSDZ2 :)
Started the thread here: Bafang BBSHD BBS02 mid drive -- Flexible OpenSource firmware

And I think the motor controller hardware is very similar to TSDZ2, the microcontroller has also only 32 kbytes of flash memory, the firmware could be mostly based on our firmware for TSDZ2!! This would also mean that the 850C and SW102 displays running our firmware would work from start of the project.
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of the Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

buba   10 kW

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

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

Post by buba » Sep 01 2019 7:03am

jeff.page.rides wrote:
Aug 31 2019 2:27pm
I am going to start by talking about who I am and what kind of physical strengths and weaknesses I have as a quadriplegic. By doing this it will be easier for all of you to understand the comments I make about the TSDZ2 and the awesome open-source software that's gonna make a life-changing difference for me and others with disabilities. And then from now on, I can just focus on the Awesome Firmware and ways it helps and ways to improve it.

On August 24th, 2015 I was mountain biking in Colorado and rode off a 6-foot drop I didn't see and broke my neck at C 6-7. Wow, a lack of concentration for just a few seconds can change your whole life. Before this time I rode mountain bikes 3 times a week and had been doing so since 1986.

When you see someone in a wheelchair or on a handcycle that has full arms and hands that means there an Amputee or a paraplegic that broke their back or some other cause. Their upper body works exactly the same as yours and they could build huge muscles. When you see someone in a wheelchair or on a handcycle and their hands don't work they are a quadriplegic and they broke their neck or some other cause. Their upper body is compromised in many different ways. Most of the time their heart and lungs never move past Idol so they can not do cardio which means it's very difficult to build muscle. The easy way to remember the majority of the time is a paraplegic =2 lower limbs doesn’t work correctly or at all and they broke there back. A quadriplegic =4 lower and upper limbs don’t work correctly or at all and they broke their necks. I luckily have biceps that work about 50% of a normal week person and triceps that work about 30% of a normal week person.

From the spring of 2016, I had searched the Internet worldwide and made phone calls many times trying to find a power-assist motor that would work with a coaster brake, that quads need because their arms are generally strapped on to the pedals because they have no grip. Then I found Mark (Rydon) the fall of 2017 at https://www.electrifybike.com/#/ and he was only a couple miles away right down the street. He told me he had a power assist that works with the coaster brake.

The TSDZ2 with its factory firmware did not work at all with week arms it was designed to work with legs. It would work when I had a short steep climb I could get up it without someone pushing me and that's about all it did. I accidentally turned it on a couple of times with my other arm pulling backward on the crank. That fooled the torque sensor into thinking that zero was actually a negative? After a couple of months of trial and error figuring out exactly what was needed. I knew the exact amount of pressure to put on the backward rotation to get the correct amount of power-assist.
If I didn't pull hard enough the power-assist wasn't strong enough if I pull too hard it was difficult to stop forward rotation. Without power assist my average speed was 5 miles an hour I could ride 25 miles in 5 hours. After I figured out the power assist I could ride an average of 15 miles an hour for 30 miles in 2 hours. Wow-what a difference, I called it maximizing my joy, others said I was cheating, but how can you cheat if you're not competing?

Mark and I have built handcycles with power-assist and XShifter to do all the shifting without all the cables and wires going everywhere. We have built them for the University of Utah's Trails program, Wasatch Adaptive Sports the National Ability Center and some personal handcycles for individuals. The programs help those with disabilities enjoy the outdoors by cycling, skiing, and other activities.

With this new open-source firmware, they can ride and have a power-assist that works correctly without having to pull back on the cranks the correct amount. Although if I just use the weight of my arm hanging from the crank in the backward rotation when I turn on the power assistit with the new firmware it works much better than if I just leave the cranks in a neutral position. We can now tailor the amount of assistance to meet the exact needs of each rider.

Below are some links to my Strava page so you can see how far and how often I'm able to ride!

Thanks for reading and trying to understand,
Jeff

https://www.strava.com/athletes/180753

https://www.strava.com/activities/2648226863
Thank you for taking the time to write your story and share it with us. I think it is very important and gives us all a different perspective going forward. You and Mark seem to do a lot for those with disabilities and it is just wonderful. I have no words to explain how beautiful that is.

When I was younger I started working as a fitness trainer for people with disabilities. Mainly paraplegics with some limited control. This was before engineering so I was a tad younger. My job was to make devices that worked around the disability so they could use all the regular equipment in our gym. Sometimes this meant I had to use straps and soft balls to make certain muscle groups engage and other times I had to really think outside the box to activate muscles that could be controlled.

What I learnt from the people I worked with changed my life and gave me very valuable lessons. A lot of things I did to simplify, improve and adapt machines proved to actually benefit people with and without a disability. It made the workout better, safer and more efficient.

This applies to the open source firmware as well. Whatever we do to make the firmware operate better for users that might have a disability, will benefit the entire community. Resulting in a more responsive and overall better system for everyone.

Thank you once again for sharing your story and really reminding us to think one step further!

Leon

buba   10 kW

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

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

Post by buba » Sep 01 2019 7:43am

jeff.page.rides wrote:
Aug 31 2019 2:56pm
:bigthumb:
On today's ride, the first ride with version 20 Alpha 10 the resistance going from pedaling to braking without a pause is much much shorter. Before if you went from pedaling to braking the resistance lasted until you backed off the pressure. Now the resistance only lasts one or two seconds and then it backs off the Resistance itself and the brakes are applied.
Great to hear that it is slightly better. I am personally not satisfied with the response but we would have to make some extreme changes to make it react faster. The Coaster Brake version has its crank directly connected to the pedals. So when we stop applying torque to the pedals it takes some time for the torque value to change. What happens is that we try to push against the motor for a split second and it is in turn pushing against our input. The torque sensor has a time delay and maybe even some hardware filtering.

If you do not mind I will use this reply to get out a couple of words to the entire community regarding this:

We need to measure an ADC torque delta value of 0 to stop the motor on the Coaster Brake version. On the free wheel versions it can use the cadence sensor to detect that the user wants to stop because the pedals have stopped rotating. It does not matter what the torque sensor value is in this case. But this is not possible on the Coaster Brake version because the crank is connected to the pedals and they are still rotating when we want to stop. The torque sensor value is therefore critical.

Example: when the ADC torque delta value goes from 100 to 0, most amount of time is spent going from 30 -> 0. This means we need to create a software latch and some extrapolation of the future torque sensor value. It would be possible to interpret the time going from 100 -> 30 as 100 -> 0 and start stopping the motor in less time. But we need to know the time delay of the torque sensor and then choose appropriate values for the extrapolation. This code would be completely dynamic and change depending on the torque sensor value, speed and other parameters.

What I am trying to say is that this will be tricky but there is a way to make it respond faster. This is something that will hopefully only get better and better as time goes on!


jeff.page.rides wrote:
Aug 31 2019 2:56pm
With E-MTB and my weak arms, I am using setting 20.
:bigthumb:
Do you feel you need even higher values than 20?

jeff.page.rides   1 W

1 W
Posts: 59
Joined: Aug 13 2019 10:16am

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

Post by jeff.page.rides » Sep 01 2019 9:40am

casainho wrote:
Aug 31 2019 9:53pm
jeff.page.rides wrote:
Aug 31 2019 9:11pm
Here's the photos you asked for let me know if they worked?
Perfect!! And the 2nd one seems to be with family, really nice!!

Later I will put this info on a wiki page and link from the main page, I will then share here the link.
The first photo was one of my first experiences with power assist on a Nuke that used BionX. As you can see by the photo one hand was on the pedal and the other hand was on the Brake, It works but not very well.

The second and third photos were on my handcycle before power assist. It's with my family on vacation with my wife, son, daughter in law and 3 grandkids. My grandson Talon was 6 years old then and he could ride faster than I could up Hill.

The fourth photo is of me and my prototype XShifter Freedom shifters that I use to shift with my chin.

The fifth photo is of another Nuke with the TSDZ2 and a coaster brake that I converted for the University of Utah Trails program.
It was much much better than the BionX, much safer much easier to ride and much more fun. But of course, the TSDZ2 with the stock firmware was much more difficult to get set correctly. And was impossible to adjust to each individual rider.

The sixth photo of a Lasher full-suspension handcycle that I converted and adapted for the National Ability Center. It doesn't have a coaster brake so we're using the standard motor, with elbow brakes that I designed. It's running version 20 Alpha 6 in the E-MTB setting it's working perfectly for a wide variety of riders just by changing the setting from 4-8. For me in the dirt and all the up Hills 8 wasn't enough so I was using the power assist mode turned up to 6.0.

If you have any questions or want more details please ask. It just takes a lot of time to add it to the blog but that's OK.
Thanks for everyone's expertise and hard work developing this firmware that's going to help so many disabled people.

jeff.page.rides   1 W

1 W
Posts: 59
Joined: Aug 13 2019 10:16am

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

Post by jeff.page.rides » Sep 01 2019 12:06pm

buba wrote:
Sep 01 2019 7:43am
jeff.page.rides wrote:
Aug 31 2019 2:56pm
:bigthumb:
On today's ride, the first ride with version 20 Alpha 10 the resistance going from pedaling to braking without a pause is much much shorter. Before if you went from pedaling to braking the resistance lasted until you backed off the pressure. Now the resistance only lasts one or two seconds and then it backs off the Resistance itself and the brakes are applied.
Great to hear that it is slightly better. I am personally not satisfied with the response but we would have to make some extreme changes to make it react faster. The Coaster Brake version has its crank directly connected to the pedals. So when we stop applying torque to the pedals it takes some time for the torque value to change. What happens is that we try to push against the motor for a split second and it is in turn pushing against our input. The torque sensor has a time delay and maybe even some hardware filtering.

If you do not mind I will use this reply to get out a couple of words to the entire community regarding this:

We need to measure an ADC torque delta value of 0 to stop the motor on the Coaster Brake version. On the free wheel versions it can use the cadence sensor to detect that the user wants to stop because the pedals have stopped rotating. It does not matter what the torque sensor value is in this case. But this is not possible on the Coaster Brake version because the crank is connected to the pedals and they are still rotating when we want to stop. The torque sensor value is therefore critical.

Example: when the ADC torque delta value goes from 100 to 0, most amount of time is spent going from 30 -> 0. This means we need to create a software latch and some extrapolation of the future torque sensor value. It would be possible to interpret the time going from 100 -> 30 as 100 -> 0 and start stopping the motor in less time. But we need to know the time delay of the torque sensor and then choose appropriate values for the extrapolation. This code would be completely dynamic and change depending on the torque sensor value, speed and other parameters.

What I am trying to say is that this will be tricky but there is a way to make it respond faster. This is something that will hopefully only get better and better as time goes on!


jeff.page.rides wrote:
Aug 31 2019 2:56pm
With E-MTB and my weak arms, I am using setting 20.
:bigthumb:
Do you feel you need even higher values than 20?
I will need to do more testing, in 20 A6 8 was not enough for hills for me with my week arms. So I use power assist set at 6.0

wpenner   10 W

10 W
Posts: 98
Joined: May 10 2018 3:27pm

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

Post by wpenner » Sep 01 2019 12:28pm

twiersum wrote:
Jul 16 2019 4:02pm
PhotoPictureResizer_190716_184252676_crop_2132x2192-852x876.jpg

I Lost 8oz on my main drive gear....next I'm going for 4 more oz with a smaller needle clutch bearing.
This thing is built like a tank with a Prius motor!
Did you have any luck installing a smaller needle clutch? I keep hoping someone will release some firmware that does not require LCD to save some additional weight.

casainho   1.21 GW

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

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

Post by casainho » Sep 01 2019 12:31pm

wpenner wrote:
Sep 01 2019 12:28pm
Did you have any luck installing a smaller needle clutch? I keep hoping someone will release some firmware that does not require LCD to save some additional weight.
SW102 is very small and weights only 0.03 kg.
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of the Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

Rydon   100 W

100 W
Posts: 248
Joined: Aug 11 2016 5:26pm

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

Post by Rydon » Sep 01 2019 11:11pm

mctubster wrote:
Sep 01 2019 5:43am
Rafe wrote:
Sep 01 2019 5:12am
andrea_104kg wrote:
Sep 01 2019 3:19am
working with bafang engines is a good idea. But the bbshd is too powerful. There are transmission problems, the chains are broken, free wheels and hubs. Even the rear of most bicycles flexes with its power.
I have been using a BBSHD for far longer than the TSDZ2 and what you say is quite frankly wrong in normal use. The BBSHD is far more reliable (100% in my case) than the TSDZ2, Your opinion applies to people who delight in pushing the boundaries and taking the motor to the extreme.

Go for it cassainho it would be fantastic if we had your opensource skills applied to the BBSHD and a bomb proof motor that can be relied on to go all day and not break down or overheat. And the cherry on the cake is that it is silent unlike the noisy TSDZ2 :)
Is the BBSHD better at maintaining RPM and torque as the battery discharges? I had a BBS01b and while virtually silent, its biggest drawback (other than PAS) was the huge loss of torque / power at decent RPMs. In fact even with a fully charged battery the max RPM was limiting without "hot-rodding" or over-volting. When battery was nearly flat basically no power above 60RPM. Prob fine if you are after a moped though ;)
Although andrea's cautionary statement has some merit, I agree with Rafe that the BBSHD is an awesome bomb-proof motor that is whisper quiet and can be ridden all day at high loads. Just make sure you are in a low enough gear starting out or moving fast enough for higher gears before you apply all of that power and the motor and bike will do just fine. That said, I have seen people that ride it hard in too high of gears, wear out a drivetrain in 3 weeks. I have a BBSHD on one of my mountain bikes with over a thousand miles on it and only moderate wear. I don't ride it hard but I frequently ask it for high levels of power and it delivers.

The BBS02 is another great motor. Even though it is rated at 750 watts in my experience it is roughly twice as powerful as the TSDZ2 and the BBSHD is roughly 3 times more powerful. To give you an idea of how this translates at the parts level, here is the TSDZ2 blue gear side-by-side with the BBSHD equivalent.
Nylon gear comparison BBSHD-TSDZ2.jpg
Nylon gear comparison BBSHD-TSDZ2.jpg (356.01 KiB) Viewed 1132 times
It is likely that the BBS01/02/HD family of motors can all use the same code base and have a legal version in all parts of the world. It might even be easily adapted to the Bafang Ultra-max motor that has torque-sensing built-in.

Rydon   100 W

100 W
Posts: 248
Joined: Aug 11 2016 5:26pm

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

Post by Rydon » Sep 01 2019 11:25pm

mctubster wrote:
Sep 01 2019 5:43am
Is the BBSHD better at maintaining RPM and torque as the battery discharges? I had a BBS01b and while virtually silent, its biggest drawback (other than PAS) was the huge loss of torque / power at decent RPMs. In fact even with a fully charged battery the max RPM was limiting without "hot-rodding" or over-volting. When battery was nearly flat basically no power above 60RPM. Prob fine if you are after a moped though ;)
Actually, just the opposite is true of the BBS02/HD motors. They like to spin fast and have the most torque and are most efficient north of 110 RPMs. I wish they were geared lower so you could contribute more at RPMs where the motor is most efficient. As it is, if you put on a large chainring so you can contribute more and get some exercise at faster speeds you don't actually go faster but you do get more exercise and it is likely that your range is reduced because the motor is less efficient at lower cadences.

Uturn   1 W

1 W
Posts: 58
Joined: Jun 06 2018 10:09am

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

Post by Uturn » Sep 02 2019 3:28am

Rydon wrote:
Sep 01 2019 11:11pm
Nylon gear comparison BBSHD-TSDZ2.jpg
I do not quite agree here. As the TSDZ2 has way higher RPM, it's torque on a first stage gear will be smaller, hence a smaller gear might be well dimensioned. The slow spinning BBS would destroy a small gear as it applies more force on it.

zappan   10 W

10 W
Posts: 68
Joined: Sep 27 2018 3:00am
Location: Sicilia

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

Post by zappan » Sep 02 2019 6:39am

casainho wrote:
Aug 31 2019 10:07pm
Just curious if someone has interest in starting this project: I was looking for other DIY mid drive motors that are more powerful and seems the Bafang BSSHD is the one, can take 52V 40A: 2000 Watts which is more than double of TSDZ2. This motor has no torque sensor but a DIY torque sensor can be added to cranks using and communications with Bluetooth with SW102, that would then send the torque and cadence value to the STC15W4K32S4.
BotoXbz wrote:
Aug 31 2019 8:13pm
casainho wrote:
Aug 31 2019 5:07pm
Hi.

Can you guys please tell me what is the microcontroller on the motor controller board?? I saw that there are connections for 3 halls sensors from the motor + the connections of the 3 phases.
The controller on the BBSHD is garbage, it's using a Chinese STC15W4K32S4 series MCU
There is a second MCU, I think that one does the motor control and the STC probably only tells it how much current it wants
Original firmware is here: viewtopic.php?t=100064
A much better idea would be to design a good VESC controller that'd fit into the original enclosure.
And then you could do whatever you want.
Thanks for the information.

That STC15W4K32S4 is from ST, there is an English datasheet available as also a c compiler and some examples projects on github.

The c compiler is SDCC, the same we use for the TSDZ2 motor controller, which is also a microcontroller from ST.

So, even if there is other IC that specifically do the motor controller, than should be easy to understand the schematic of the motor controller and then develop the firmware, probably even more easy than the TSDZ2 or the KT Kunteng motor controllers firmware that we also developed.

Can you please tell me the me reference of the motor controller IC??
Hi Casainho, why don't you consider the "Lingbei MM28.250" engine
viewtopic.php?f=28&t=94220
Who owns the same hardware as the Bafang, uses the same displays and has the integrated torque ?,
I understand that it does not start from 1000W but I think it supports all the power that can be managed by an ebike.

andrea_104kg   100 W

100 W
Posts: 180
Joined: Mar 05 2018 5:51pm

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

Post by andrea_104kg » Sep 02 2019 7:11am

I continue to think, as a personal opinion, of the unsuitable bbshd. in a mtb it is heavy and forces you to use huge heavy batteries. If you want to use it gently, why carry that weight? Do you really fool yourself that a 2000w bike chain holds? that a hub made for bikes can hold the power of a scooter?

casainho   1.21 GW

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

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

Post by casainho » Sep 02 2019 8:58am

zappan wrote:
Sep 02 2019 6:39am
Hi Casainho, why don't you consider the "Lingbei MM28.250" engine
viewtopic.php?f=28&t=94220
Who owns the same hardware as the Bafang, uses the same displays and has the integrated torque ?,
I understand that it does not start from 1000W but I think it supports all the power that can be managed by an ebike.
Lingbei uses a microcontroller that can be easily programmed and firmware developed for, contrary to Bafang BBS02/HD.

But some points I consider:
- I agree with Andrea_104kg, I see on the market more light mtb bicycles and for me is enough 250 or 350 watts when I do mtb, because that is 2x more of the human power I can do, because I want only to reduce the disadvantage I have over my colleagues that have 70 kgs and are fit and I am a bit fat with 105 kgs, recovering and in middle of some operations.
For respect to my colleagues, I do not want to go ride like a motorcycle but instead doing mtb.
Also this is a DIY motor to install on the bicycle on the market and they are more and more light and also with fragile frame and gears so no big point to go with heavy and big motors and batteries, as also very powerful motor.
- On my city, which is flat, with TSDZ2 and with 2 rear panniers, large MTB tires, dual suspension and me with 105 kgs, I can ride up to 45 km/h using TSDZ2 with periods of 800 W, that is more than enough. Maybe if I would live on mountains I would want more power.
- But I plan to buy another type of bicycle and that is a cargo bike. For this application, sure I will want more power, I think that at least 2x more.

My view of disadvantages of Lingbei:
- only maybe 50% more power than TSDZ2 (but is also more heavy, as expected)
- no spare parts or very expensive, which makes very expensive to develop for
- not popular

TSDZ2 is small, cheap, cheap repair parts and was available from PSWPower at the begin of this project.

I would be interested on another mid drive DIY motor but with at least 2x more power. I think the BBSHD is the one I like for because is 3x more powerful than TSDZ2. It is also popular, although there are repair parts, the motor controller is very expensive. And has no torque sensor...

Since now I think BBS02/HD motor controllers are a dead end road due to the motor controller microcontroller that we don't have a compiler and nor a programmer, I think I will use the cheap OpenSource VESC 60 euros on Ebay, that is high performance FOC and works with 48V 13S batteries and 50 amps continuous.
The torque sensor will need to by DIY anyway.
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of the Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

jeff.page.rides   1 W

1 W
Posts: 59
Joined: Aug 13 2019 10:16am

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

Post by jeff.page.rides » Sep 02 2019 10:54am

jeff.page.rides wrote:
Sep 01 2019 12:06pm
buba wrote:
Sep 01 2019 7:43am
jeff.page.rides wrote:
Aug 31 2019 2:56pm
:bigthumb:
On today's ride, the first ride with version 20 Alpha 10 the resistance going from pedaling to braking without a pause is much much shorter. Before if you went from pedaling to braking the resistance lasted until you backed off the pressure. Now the resistance only lasts one or two seconds and then it backs off the Resistance itself and the brakes are applied.
Great to hear that it is slightly better. I am personally not satisfied with the response but we would have to make some extreme changes to make it react faster. The Coaster Brake version has its crank directly connected to the pedals. So when we stop applying torque to the pedals it takes some time for the torque value to change. What happens is that we try to push against the motor for a split second and it is in turn pushing against our input. The torque sensor has a time delay and maybe even some hardware filtering.

If you do not mind I will use this reply to get out a couple of words to the entire community regarding this:

We need to measure an ADC torque delta value of 0 to stop the motor on the Coaster Brake version. On the free wheel versions it can use the cadence sensor to detect that the user wants to stop because the pedals have stopped rotating. It does not matter what the torque sensor value is in this case. But this is not possible on the Coaster Brake version because the crank is connected to the pedals and they are still rotating when we want to stop. The torque sensor value is therefore critical.

Example: when the ADC torque delta value goes from 100 to 0, most amount of time is spent going from 30 -> 0. This means we need to create a software latch and some extrapolation of the future torque sensor value. It would be possible to interpret the time going from 100 -> 30 as 100 -> 0 and start stopping the motor in less time. But we need to know the time delay of the torque sensor and then choose appropriate values for the extrapolation. This code would be completely dynamic and change depending on the torque sensor value, speed and other parameters.

What I am trying to say is that this will be tricky but there is a way to make it respond faster. This is something that will hopefully only get better and better as time goes on!


jeff.page.rides wrote:
Aug 31 2019 2:56pm
With E-MTB and my weak arms, I am using setting 20.
:bigthumb:
Do you feel you need even higher values than 20?
I will need to do more testing, in 20 A6 8 was not enough for hills for me with my week arms. So I use power assist set at 6.0
I would say the improvement is more than slight. Yes, it would be great if when you stopped pedaling and went directly to brake there was no resistance. But at least the resistance goes away on its own, so in a panic situation you just keep pulling and the resistance will leave and the brakes will apply. Where before you needed to release the pressure for the resistance to go away and then reapply the brake. So thanks a lot for Alpha 10 it was definitely a big improvement!

andrea_104kg   100 W

100 W
Posts: 180
Joined: Mar 05 2018 5:51pm

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

Post by andrea_104kg » Sep 02 2019 10:57am

I think it is really difficult from the mechanical point of view to insert a torsimeter in the bbs. I have been thinking about it for a long time, inserting a hall sensor like that of tsdz2 and powering a bbs02 with an external tsdz2 control unit but mechanically it is not easy .... It could be easier to copy the scheme used by the rocky mountain with a separate wheel and a lever that measures the tension of the chain ... Obviously then there are the electronic problems ...

Elinx   100 W

100 W
Posts: 164
Joined: Aug 09 2019 6:58am

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

Post by Elinx » Sep 02 2019 12:49pm

andrea_104kg wrote:
Sep 02 2019 10:57am
I think it is really difficult from the mechanical point of view to insert a torsimeter in the bbs......
Have you seen the links from Casinio here. Not inside the BBS but outside.
With 4 straingauges on the crank it is possible to measure the pedal pressure.

andrea_104kg   100 W

100 W
Posts: 180
Joined: Mar 05 2018 5:51pm

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

Post by andrea_104kg » Sep 02 2019 2:06pm

ok i replay in other post :D

mctubster   100 W

100 W
Posts: 226
Joined: Feb 26 2018 6:21am

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

Post by mctubster » Sep 03 2019 2:36am

Sorry to raise this again, but I am seeing Human Power readings that are way too high on alpha10.

Not sure if there was regression or maybe this was never solved?

I recall a discussion about peak vs averaged values - I had a look at the code, but I don't understand it ... can anyone comment on

// calculate torque on pedals
ui16_pedal_torque_x100 = ui16_adc_pedal_torque_delta * m_configuration_variables.ui8_pedal_torque_per_10_bit_ADC_step_x100;

Cheers

buba   10 kW

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

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

Post by buba » Sep 03 2019 2:29pm

jeff.page.rides wrote:
Sep 02 2019 10:54am
jeff.page.rides wrote:
Sep 01 2019 12:06pm
buba wrote:
Sep 01 2019 7:43am
jeff.page.rides wrote:
Aug 31 2019 2:56pm
:bigthumb:
On today's ride, the first ride with version 20 Alpha 10 the resistance going from pedaling to braking without a pause is much much shorter. Before if you went from pedaling to braking the resistance lasted until you backed off the pressure. Now the resistance only lasts one or two seconds and then it backs off the Resistance itself and the brakes are applied.
Great to hear that it is slightly better. I am personally not satisfied with the response but we would have to make some extreme changes to make it react faster. The Coaster Brake version has its crank directly connected to the pedals. So when we stop applying torque to the pedals it takes some time for the torque value to change. What happens is that we try to push against the motor for a split second and it is in turn pushing against our input. The torque sensor has a time delay and maybe even some hardware filtering.

...

What I am trying to say is that this will be tricky but there is a way to make it respond faster. This is something that will hopefully only get better and better as time goes on!


jeff.page.rides wrote:
Aug 31 2019 2:56pm
With E-MTB and my weak arms, I am using setting 20.
:bigthumb:
Do you feel you need even higher values than 20?
I will need to do more testing, in 20 A6 8 was not enough for hills for me with my week arms. So I use power assist set at 6.0
I would say the improvement is more than slight. Yes, it would be great if when you stopped pedaling and went directly to brake there was no resistance. But at least the resistance goes away on its own, so in a panic situation you just keep pulling and the resistance will leave and the brakes will apply. Where before you needed to release the pressure for the resistance to go away and then reapply the brake. So thanks a lot for Alpha 10 it was definitely a big improvement!
That sounds great! And thank you for the feedback! Then it is pretty safe to say that we have a good foundation that will only get better.

Apologies for the slow response!
Last edited by buba on Sep 03 2019 2:54pm, edited 4 times in total.

Post Reply