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

Electric Motors and Controllers
buba   10 kW

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

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

Post by buba » Aug 08 2019 10:16am

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

Also SW102 has 256 kbytes of flash memory (previous I though it was 128 kbytes) and current project that has most of the code done (configurations menu, main scree menu and Bluetooth) is using a bit less than 50% of the total available programming memory. This means there is a good potential on this LCD.
One extra button makes a big difference and will simplify so much!

And space is very important too. I just hope that those 50 % will be enough as well!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

buba   10 kW

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

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

Post by buba » Aug 08 2019 12:03pm

I found a way to slightly optimize space in the motor controller for the Alpha 3. So did some work on that but there is more to do.

Have taken a test ride and everything is working as expected! The configurable startup without pedal rotation feature is working much better than I expected! Especially with eMTB and Torque Assist as they are based solely on the torque sensor.

Will take another test right now and then determine what the best next step is. Either:

1. Make more optimizations in the motor controller and tune it even better
2. Wrap up the Alpha 3 so it can be released and save the finishing touches for Alpha 4
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

buba   10 kW

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

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

Post by buba » Aug 08 2019 2:19pm

Alpha 3 is live!

Please make sure that startup assist without pedal rotation is configured as it should be. Some users might have some old data saved in the same address where startup assist without pedal rotation is saved. So when powering up for the first time be careful and do not apply torque. If possible keep the wheel off the ground just to make sure everything is either set to (0), disabled, or some low value (around 10-15 %) that works for you.

I have an idea how to eliminate these kinds of problems but that involves more code and the KT-LCD3 has not much space left. So for the time being I hope everyone is okay with this.

For new users, coming from any previous version or maybe trying out the open source firmware for the first time, there are no problems and the 0.20.0 Alpha 3 will automatically and beautifully configure everything to default values.

Here is the wiki (work in progress):
https://github.com/OpenSource-EBike-fir ... %7C-Manual

Here is my Google Drive folder with the Alpha 3:
https://drive.google.com/open?id=1CPGT- ... bYtY4_JH2R

Here is my branch where you can see the source code and latest changes:
https://github.com/leon927/TSDZ2-Smart- ... ng-pwm-acc

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

Here are the changes from Alpha 2:

* EEPROM slightly more efficient
* Motor temperature not displayed in odometer field, solved
* No assistance over 90 cadence RPM, solved
* Backwards resistance, solved
* Slightly better motor control in the low range
* Error code for cadence calibration
* Startup assist without pedal rotation with adjustable sensitivity
* Easier to navigate the configuration menu
* New light configuration variable: lights disabled/enabled at startup or remember state through power cycles
* Values on display are slightly filtered (Will be gradually improved)
* Overall improvements, space optimizations

I have a feeling that I missed something so let me know if that is the case, whatever it might be! The Alpha 3 should be pretty solid and we are not far away from making an official beta.

The tuning of the motor controller is around 80 % complete so expect faster response times and reduced delays in the future. The complete tuning will be saved for when we have validated that everything works and no major changes will be needed. Then I will reinstall my TSDZ2 coaster brake clutch and validate that it works with that version as well. This will make the open source firmware support all versions of the TSDZ2.
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

Rydon   100 W

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

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

Post by Rydon » Aug 09 2019 12:36am

buba wrote:
Aug 08 2019 2:19pm
Alpha 3 is live!
Indeed it is! We just installed v0.20.0 alpha 3 on a friends coaster brake handcycle and it works!!! This is truly a turning point for powered handcycles. After celebratory yells and high fives, I took this picture of Jeff with the handcycle we installed it on. It's his bike.
.
v0.20.0-Handcycle-Coaster-Brk.jpg
v0.20.0-Handcycle-Coaster-Brk.jpg (502.94 KiB) Viewed 642 times
.
We only tested it with 5 levels of power assist with the multiplier being simply 1 to 5. EMTB mode was set to 5. We will tweak it later but the initial test ride was awesome. We have yet to set up the advanced cadence sensor mode so there was a very slight delay for the motor to stop that was only noticeable in the higher levels. It was overall very smooth and responsive.

Thanks to Buba for a truly awesome release and to Casainho for providing the foundation. You guys are helping more people than you realize that will be able to once again do what they love. Also, a special thanks to Buba for supporting the coaster brake. Jeff can only ride a coaster brake since he is a quadriplegic with only partial use of his harms and no use of his hands. He pedals, steers and brakes with his arms all at the same time. He is super excited to ride this in an 80 mile mountain race in Park City, Utah next week.

perryscope   100 W

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

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

Post by perryscope » Aug 09 2019 2:24am

Rydon wrote:
Aug 09 2019 12:36am
buba wrote:
Aug 08 2019 2:19pm
Alpha 3 is live!
Indeed it is! We just installed v0.20.0 alpha 3 on a friends coaster brake handcycle and it works!!! This is truly a turning point for powered handcycles. After celebratory yells and high fives, I took this picture of Jeff with the handcycle we installed it on. It's his bike.
.
v0.20.0-Handcycle-Coaster-Brk.jpg
.
We only tested it with 5 levels of power assist with the multiplier being simply 1 to 5. EMTB mode was set to 5. We will tweak it later but the initial test ride was awesome. We have yet to set up the advanced cadence sensor mode so there was a very slight delay for the motor to stop that was only noticeable in the higher levels. It was overall very smooth and responsive.

Thanks to Buba for a truly awesome release and to Casainho for providing the foundation. You guys are helping more people than you realize that will be able to once again do what they love. Also, a special thanks to Buba for supporting the coaster brake. Jeff can only ride a coaster brake since he is a quadriplegic with only partial use of his harms and no use of his hands. He pedals, steers and brakes with his arms all at the same time. He is super excited to ride this in an 80 mile mountain race in Park City, Utah next week.
Excellent News Rydon!,
We (Empowered People) have not yet had a project where a coaster brake was needed, but we have several handcycle projects on the go and Its great to know there are even more options now to provide assistance to a wider range of people with unique requirements. The TSDZ2 is hot become my motor of choice :D I hope to provide some similar feedback on the Cadence assist feature in regards to the Trike project but this may also help a handcycle even when conventional brakes are used due to the effective single side crank (both cranks are aligned so you only give human assistance once every rotation not twice). Traditionally we have used hub motors for this but being able to use a mid drive offers many more advantages!. Really exciting times for All ability Cycling.
Empowered people support rider and trustee
www.empoweredpeople.co.uk

casainho   1.21 GW

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

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

Post by casainho » Aug 09 2019 4:24am

perryscope wrote:
Aug 09 2019 2:24am
I hope to provide some similar feedback on the Cadence assist feature in regards to the Trike project but this may also help a handcycle even when conventional brakes are used due to the effective single side crank (both cranks are aligned so you only give human assistance once every rotation not twice). Traditionally we have used hub motors for this but being able to use a mid drive offers many more advantages!. Really exciting times for All ability Cycling.
I am SUPER HAPPY to see this results and that picture!! Thank you for sharing!!

About the power on both cranks are aligned so you only give human assistance once every rotation not twice, with the full calibration of torque sensor, I had to identify the position of the pedals to differentiate between left and right pedals. The code works very well for this but user need to start the TSDZ2 with the right pedal in direction to ground to it starts counting from there and every 1 rotation has exactly 20 magnets. I had tried to use the max torque sensor value of 1 rotation and it works but has a slow reaction as the value is only updated every 1 rotation, however, maybe for hand cycles it is ok. Also is possible to use the torque sensor value for each 1/2 of rotation, maybe the max of each 1/2 of rotation.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

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

bwb   1 mW

1 mW
Posts: 17
Joined: Jun 23 2019 7:07am

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

Post by bwb » Aug 09 2019 5:06am

Upgraded from Alpha 2 to 3 without issues:

* cadence>90 => solved
* slight backward resistance => solved
* lights: didn't play with since I prefer to start always from "lights off". I was wondering if lights eg could could come on when brakes are applied (or flash when lights were already on)? This is no real request.
* motor acceleration adjustment 10.0: for the first time set (35% for 36/36).
* Startup assist 10.1: for the first time set (10%).
* Cadence sensor mode & calibration: done for first time. When manually rotating pedals, I did notice an internal motor resistance every 180°, with some mechanical grinding noice. Did anyone noticed the same thing?
* Throttle control: much smoother
* menu navigation: I really get used to it, the additional info symbols, letters while nagigating => really good idea.

An even better bike behaviour than before, but I have no clue what setting really plyed with it since I did a lot some stuff I didn't before.

I gues my wife (still hub motor) gets jalous on the TSDZ2.

Thx for all the efforts on such short notice.

casainho   1.21 GW

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

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

Post by casainho » Aug 09 2019 5:10am

bwb wrote:
Aug 09 2019 5:06am
* lights: I was wondering if lights eg could could come on when brakes are applied (or flash when lights were already on)? This is no real request.
That is a very good idea and I always thought on this, could be a configuration for enable/disable this feature.

On motor controller side, once break sensors get activated, the lights would also be activated. It is something easy to implement.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

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

perryscope   100 W

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

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

Post by perryscope » Aug 09 2019 5:18am

casainho wrote:
Aug 09 2019 5:10am
bwb wrote:
Aug 09 2019 5:06am
* lights: I was wondering if lights eg could could come on when brakes are applied (or flash when lights were already on)? This is no real request.
That is a very good idea and I always thought on this, could be a configuration for enable/disable this feature.

On motor controller side, once break sensors get activated, the lights would also be activated. It is something easy to implement.
+1 Thats a great idea bwb!
Empowered people support rider and trustee
www.empoweredpeople.co.uk

buba   10 kW

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

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

Post by buba » Aug 09 2019 8:09am

Rydon wrote:
Aug 09 2019 12:36am
buba wrote:
Aug 08 2019 2:19pm
Alpha 3 is live!
Indeed it is! We just installed v0.20.0 alpha 3 on a friends coaster brake handcycle and it works!!! This is truly a turning point for powered handcycles. After celebratory yells and high fives, I took this picture of Jeff with the handcycle we installed it on. It's his bike.

Thanks to Buba for a truly awesome release and to Casainho for providing the foundation. You guys are helping more people than you realize that will be able to once again do what they love. Also, a special thanks to Buba for supporting the coaster brake. Jeff can only ride a coaster brake since he is a quadriplegic with only partial use of his harms and no use of his hands. He pedals, steers and brakes with his arms all at the same time. He is super excited to ride this in an 80 mile mountain race in Park City, Utah next week.
Wow! There are no words to describe my happiness reading that post! It sure got to me and the picture was wonderful! I am so incredibly proud to be part of this community and what it has accomplished. Thank you so much for sharing that moment, Rydon!


Rydon wrote:
Aug 09 2019 12:36am
We only tested it with 5 levels of power assist with the multiplier being simply 1 to 5. EMTB mode was set to 5. We will tweak it later but the initial test ride was awesome. We have yet to set up the advanced cadence sensor mode so there was a very slight delay for the motor to stop that was only noticeable in the higher levels. It was overall very smooth and responsive.
That delay will be reduced in the Advanced Mode and with even more tuning. I promise that I will do whatever I can to reduce that delay as much as possible! Will have some serious time for tuning as soon as we confirm that everything else works as expected!

Once again, thank you, Rydon!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

nbdriver   100 mW

100 mW
Posts: 37
Joined: Jul 31 2015 4:38am
Location: Belgium

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

Post by nbdriver » Aug 09 2019 8:27am

What a surprise, i came to repport conclusions of my last ride with alpha 2.0, mainly a cadence problem (90 limit), and i see it is already fixed. All this is going so fast :D

Another thing i tested, is the torque assist mode, and with multipliers between 0,5 and 3 it is very weak on motor power, i have to use higher values multipliers. I started with values similar to bosch based ebikes where 300% is turbo and already a lot but here we need to use higher values, and it feels far from reality regarding input power. Not a huge problem, just a thing that i noticed.

Another question has somebody a good design or idea to make a flash port for the LCD3, because opening the thing every time to flash a new version is not easy.

I was thinking of designing a 3D printed enclosure for the jumper cables to glue to the LCD3 but it is not a nice solution, anothe solution would be using a female usb cable soldered to the flash ports, as it has 4 wires inside. Any ideas ?

buba   10 kW

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

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

Post by buba » Aug 09 2019 9:04am

bwb wrote:
Aug 09 2019 5:06am
Upgraded from Alpha 2 to 3 without issues:

* cadence>90 => solved
* slight backward resistance => solved
:bigthumb:

bwb wrote:
Aug 09 2019 5:06am
* lights: didn't play with since I prefer to start always from "lights off". I was wondering if lights eg could could come on when brakes are applied (or flash when lights were already on)? This is no real request.
Great idea and as Casainho says is is very easy to implement! Would the community think it would be good if they also fast-flash in situations where the lights are already activated and we are braking? So we signal traffic that we are stopping even if our lights are already on? Casainho? Just throwing out ideas so when it is time to implement this we have all the info we need!


bwb wrote:
Aug 09 2019 5:06am
* motor acceleration adjustment 10.0: for the first time set (35% for 36/36).
Let me know if you are satisfied with the acceleration or if it is too fast or something. I deliberately broke blue gears as I wanted to find the limit during development. Later configured everything so that it would be very safe for every user and setup. But at the same time give the fastest response and performance possible without straining the drive train too much and causing premature failure. The acceleration is actually dynamic and changes the faster you go. So you are effectively configuring the default acceleration with the motor acceleration. This is very important for startups as there are many reasons why you want to control those in a very controlled manner.


bwb wrote:
Aug 09 2019 5:06am
* Startup assist 10.1: for the first time set (10%).
I think this works great and will be much appreciated by many! Especially those that were used to it in previous versions. Should have implemented and tried earlier but wanted to guarantee safety and a configurable sensitivity. Was wrong that it is not needed as it does serve a purpose.


bwb wrote:
Aug 09 2019 5:06am
* Cadence sensor mode & calibration: done for first time. When manually rotating pedals, I did notice an internal motor resistance every 180°, with some mechanical grinding noice. Did anyone noticed the same thing?
No idea actually. Let me know if there is something you can report!


bwb wrote:
Aug 09 2019 5:06am
* Throttle control: much smoother
Thank you for confirming that the throttle works and is smoother! We have a bug where some users have a throttle that is more like a switch. Will hopefully be solved with more feedback from the community but glad that it works for you!


bwb wrote:
Aug 09 2019 5:06am
* menu navigation: I really get used to it, the additional info symbols, letters while nagigating => really good idea.
Thanks to Perryscope for the idea!


bwb wrote:
Aug 09 2019 5:06am
An even better bike behaviour than before, but I have no clue what setting really plyed with it since I did a lot some stuff I didn't before.

I guess my wife (still hub motor) gets jealous on the TSDZ2.

Thx for all the efforts on such short notice.
Great feedback! Thank you, bwb! I think it is time that she upgrades to the TSDZ2? :)
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

buba   10 kW

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

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

Post by buba » Aug 09 2019 9:35am

nbdriver wrote:
Aug 09 2019 8:27am
What a surprise, i came to repport conclusions of my last ride with alpha 2.0, mainly a cadence problem (90 limit), and i see it is already fixed. All this is going so fast :D
Hope you will like the Alpha 3! :wink:

nbdriver wrote:
Aug 09 2019 8:27am
Another thing i tested, is the torque assist mode, and with multipliers between 0,5 and 3 it is very weak on motor power, i have to use higher values multipliers. I started with values similar to bosch based ebikes where 300% is turbo and already a lot but here we need to use higher values, and it feels far from reality regarding input power. Not a huge problem, just a thing that i noticed.
We have a different scale to get more resolution. To compare it to the Bosch we have ten times the resolution for users to configure. So you could setup Torque Assist completely after your own preference and have it be perfectly matched to your particular torque sensor. It will measure your input torque and assist accordingly.

Torque Assist needs no calibration but needs to be setup so it fits your personal preference and torque sensor.


nbdriver wrote:
Aug 09 2019 8:27am
Another question has somebody a good design or idea to make a flash port for the LCD3, because opening the thing every time to flash a new version is not easy.

I was thinking of designing a 3D printed enclosure for the jumper cables to glue to the LCD3 but it is not a nice solution, anothe solution would be using a female usb cable soldered to the flash ports, as it has 4 wires inside. Any ideas ?
I hope you get some really good suggestions but will use this opportunity to say something to the entire community:

I understand that testing and installing new versions is tricky for a lot of users. I have a large gratitude for those that do take the time to install non stable releases and not only test out the changes but report back to this thread. This feedback loop is the only way possible to actually be able to release stable versions and have confidence that there are no bugs.

So a big thanks to everyone taking their time to install and test! I promise to do my best to minimize setup times and unnecessary versions. And whenever there is a update that only requires installation on either the display or TSDZ2, I will make sure to let you all know so you the installation goes that much quicker and smoother.
Last edited by buba on Aug 09 2019 9:37am, edited 1 time in total.
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

perryscope   100 W

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

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

Post by perryscope » Aug 09 2019 9:37am

buba wrote:
Aug 09 2019 9:04am
Great idea and as Casainho says is is very easy to implement! Would the community think it would be good if they also fast-flash in situations where the lights are already activated and we are braking? So we signal traffic that we are stopping even if our lights are already on? Casainho? Just throwing out ideas so when it is time to implement this we have all the info we need!
I put this little video together about brake lights. I built a witlessness from a couple of Arduino Naqnos and the NRF radio modules for the 'Bike Train' ( Ebike+Recumbent Trike on tow)

I settled on a mode where it flashed the rear lights when riding and then solid under braking. worked great and makes you much more visible. I understand that in some countries a fixed tail light is the law, so maybe that needs to be considered?
I also have a spare button to switch modes as well, which you could in theory add if you want different flash patterns or the option to stay solid all the time.

Here is a short video to show what its like.



and yes i need more room for my bikes ;)
Empowered people support rider and trustee
www.empoweredpeople.co.uk

buba   10 kW

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

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

Post by buba » Aug 09 2019 9:59am

perryscope wrote:
Aug 09 2019 9:37am
buba wrote:
Aug 09 2019 9:04am
Great idea and as Casainho says is is very easy to implement! Would the community think it would be good if they also fast-flash in situations where the lights are already activated and we are braking? So we signal traffic that we are stopping even if our lights are already on? Casainho? Just throwing out ideas so when it is time to implement this we have all the info we need!
I put this little video together about brake lights. I built a witlessness from a couple of Arduino Naqnos and the NRF radio modules for the 'Bike Train' ( Ebike+Recumbent Trike on tow)

I settled on a mode where it flashed the rear lights when riding and then solid under braking. worked great and makes you much more visible. I understand that in some countries a fixed tail light is the law, so maybe that needs to be considered?
I also have a spare button to switch modes as well, which you could in theory add if you want different flash patterns or the option to stay solid all the time.

Here is a short video to show what its like.



and yes i need more room for my bikes ;)
Absolutely great implementation and video! That is so sweet! :bigthumb:

The points you make are very all very good! I hope we will have a great discussion!

Here are some implementation so it will be easier to discuss:

- Manual operation (standard/default)
- Manual operation but lights are on while braking
- Manual operation but lights are flashing
- Manual operation but lights are flashing but will be solid when braking
- Manual operation but lights are solid but will be flashing when braking

EDIT: I just thought we do not need to choose because we could implement a configuration variable that sets whatever mode you wish to use and is legal to use in your particular country. Would take less than 1 % of program memory and it would be possible to optimize other things so we stay at same available program space or less. Casainho, what do you think?

(For some reason I think this would be very cool feature and I can not stop thinking about it... I don't even have e-brakes installed :lol: )
Last edited by buba on Aug 09 2019 10:17am, edited 1 time in total.
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

casainho   1.21 GW

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

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

Post by casainho » Aug 09 2019 10:17am

buba wrote:
Aug 09 2019 9:59am
perryscope wrote:
Aug 09 2019 9:37am
buba wrote:
Aug 09 2019 9:04am
Great idea and as Casainho says is is very easy to implement! Would the community think it would be good if they also fast-flash in situations where the lights are already activated and we are braking? So we signal traffic that we are stopping even if our lights are already on? Casainho? Just throwing out ideas so when it is time to implement this we have all the info we need!
I put this little video together about brake lights. I built a witlessness from a couple of Arduino Naqnos and the NRF radio modules for the 'Bike Train' ( Ebike+Recumbent Trike on tow)

I settled on a mode where it flashed the rear lights when riding and then solid under braking. worked great and makes you much more visible. I understand that in some countries a fixed tail light is the law, so maybe that needs to be considered?
I also have a spare button to switch modes as well, which you could in theory add if you want different flash patterns or the option to stay solid all the time.

Here is a short video to show what its like.



and yes i need more room for my bikes ;)
Absolutely great implementation and video! That is so sweet! :bigthumb:

The points you make are very all very good! I hope we will have a great discussion!

Here are some implementation so it will be easier to discuss:

- Manual operation (standard/default)
- Manual operation but lights are on while braking
- Manual operation but lights are flashing
- Manual operation but lights are flashing but will be solid when braking
- Manual operation but lights are solid but will be flashing when braking

EDIT: I just thought we do not need to choose because we could implement a configuration variable that sets whatever mode you wish to use and is legal to use in your particular country. Would take less than 1 % of program memory and I can optimize other things so we stay at same available space or less. Casainho, what do you think?

(For some reason I think this would be very cool feature and I can not stop thinking about it... I don't even have e-brakes installed :lol: )
For me seems ok.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

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

buba   10 kW

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

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

Post by buba » Aug 09 2019 10:22am

casainho wrote:
Aug 09 2019 10:17am
buba wrote:
Aug 09 2019 9:59am
Here are some implementation so it will be easier to discuss:

- Manual operation (standard/default)
- Manual operation but lights are on while braking
- Manual operation but lights are flashing
- Manual operation but lights are flashing but will be solid when braking
- Manual operation but lights are solid but will be flashing when braking

EDIT: I just thought we do not need to choose because we could implement a configuration variable that sets whatever mode you wish to use and is legal to use in your particular country. Would take less than 1 % of program memory and I can optimize other things so we stay at same available space or less. Casainho, what do you think?

(For some reason I think this would be very cool feature and I can not stop thinking about it... I don't even have e-brakes installed :lol: )
For me seems ok.
:bigthumb:
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

buba   10 kW

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

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

Post by buba » Aug 09 2019 10:42pm

bwb wrote:
Aug 09 2019 5:06am
* lights: didn't play with since I prefer to start always from "lights off". I was wondering if lights eg could could come on when brakes are applied (or flash when lights were already on)? This is no real request.
perryscope wrote:
Aug 09 2019 9:37am
I settled on a mode where it flashed the rear lights when riding and then solid under braking. worked great and makes you much more visible. I understand that in some countries a fixed tail light is the law, so maybe that needs to be considered?
I also have a spare button to switch modes as well, which you could in theory add if you want different flash patterns or the option to stay solid all the time.
casainho wrote:
Aug 09 2019 10:17am
buba wrote:
Aug 09 2019 9:59am
Here are some implementation so it will be easier to discuss:

- Manual operation (standard/default)
- Manual operation but lights are on while braking
- Manual operation but lights are flashing
- Manual operation but lights are flashing but will be solid when braking
- Manual operation but lights are solid but will be flashing when braking

EDIT: I just thought we do not need to choose because we could implement a configuration variable that sets whatever mode you wish to use and is legal to use in your particular country. Would take less than 1 % of program memory and I can optimize other things so we stay at same available space or less. Casainho, what do you think?

(For some reason I think this would be a very cool feature and I can not stop thinking about it... I don't even have e-brakes installed :lol: )
For me seems ok.

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


I see dots everywhere from all the testing with the front and rear lights!

But it is worth it as we now have a really nice new feature! Also, I have validated that it will work with the e-brakes even though I do not have them installed. So no user testing and validation required!

Also added a little feature in a feature: when braking (and you have configured that it should flash when braking) it will flash a little faster. This signals that you are decelerating to your surroundings and makes them aware that something is happening. This is something I recommend seeing live.

Here are the modes:

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

(0) ON when lights enabled, OFF when lights disabled, (default)

(1) FLASHING when lights enabled, OFF when lights disabled,

(2) ON when lights enabled, OFF when lights disabled, BRAKE-FLASHING when lights enabled and braking

(3) FLASHING when lights enabled, OFF when lights disabled, ON when lights enabled and braking

(4) FLASHING when lights enabled, OFF when lights disabled, BRAKE-FLASHING when lights enabled and braking

(5) ON when lights enabled, OFF when lights disabled, ON always when braking regardless of lights enabled/disabled

(6) ON when lights enabled, OFF when lights disabled, BRAKE-FLASHING always when braking regardless of lights enabled/disabled

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

Here is what I planned:

1. Finalize and determine the duty cycle and frequency of the lights (might change from user feedback)
2. Tune the motor controller (hopefully to 100 % so it can be validated in Alpha 4)
3. Add more filtering on the display (so it is possible to see the values even better than Alpha 3)
4. Listen for more suggestions from the community and implement those (not possible for everything but do not hesitate to ask)
5. Release Alpha 4 (probably within 24 hours so give suggestions)

It is not sustainable that I ask everyone to update and test all the time so will therefore try to make this new Alpha really polished. It would then be possible to have a longer evaluation time with long term feedback.
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

casainho   1.21 GW

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

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

Post by casainho » Aug 10 2019 5:10am

Here is an alpha version of firmware for SW102 -- it is only for the brave ones as there is no easy tool to flash the firmware yet on Windows. Seems developers are using Linux and users used to it will be able to flash more easily.

Also, the firmware includes a bootloader, meaning it is just once to flash using the STLinkV2 and wires and after firmware can be update using Bluetooth only.

Also, it is a PITA to have access to board to solder the wires and solder to the so tiny pads.

Here the firmware alpha release: https://github.com/OpenSource-EBike-fir ... tag/0.19.6
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

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

Rafe   10 W

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

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

Post by Rafe » Aug 10 2019 5:35am

Hi Buba just a quick comment on A3. The throttle is still acting as an on off switch. The throttle I have by the way came with the original purchase of TSDZ2. The readings in 11.1 are exactly the same as I had in A2 in that there is speed control from 0 to 30 (zero speed to max max speed) which is such a small movement of the throttle that it feels like a switch and then no change from 30 to 255.


The additional set up menu symbols are helpful but I'm glad you kept the numbering system too.

Thanks for all your hard work.

buba   10 kW

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

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

Post by buba » Aug 10 2019 6:38am

Rafe wrote:
Aug 10 2019 5:35am
Hi Buba just a quick comment on A3. The throttle is still acting as an on off switch. The throttle I have by the way came with the original purchase of TSDZ2. The readings in 11.1 are exactly the same as I had in A2 in that there is speed control from 0 to 30 (zero speed to max max speed) which is such a small movement of the throttle that it feels like a switch and then no change from 30 to 255.


The additional set up menu symbols are helpful but I'm glad you kept the numbering system too.

Thanks for all your hard work.
Hi Rafe,

Thanks for the feedback as I really want to solve this!

Could you maybe do one last test? Can you set the max battery current to 18 A and max battery power to 900+ W and then try the throttle to see if it operates any better?

Also, you need to be testing "live" as there needs to be a load on the motor for the throttle to work.

The system in place is controlling the torque but when there is no load on the motor this will not work. So try riding the bike with the settings I mention and then see if the throttle behaves as expected. So in other words, try using the throttle as you would in a real situation.

If we confirm that it works with those settings I know what the problem is. It should work with your settings as well but I just want to see if we can make it work first.

Again, I hope I can solve this for the Alpha 4 so your help is vital!

Thank you for testing and giving constant feedback!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

Rafe   10 W

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

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

Post by Rafe » Aug 10 2019 7:26am

buba wrote:
Aug 10 2019 6:38am


Also, you need to be testing "live" as there needs to be a load on the motor for the throttle to work.


And live it works perfectly :thumb: As the throttle was not working correctly live in A2 and was giving the same results in the advance technical data on A3 I never took it for a live test drive. You have cracked it, well done sir.

buba   10 kW

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

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

Post by buba » Aug 10 2019 7:27am

Rafe wrote:
Aug 10 2019 7:26am
buba wrote:
Aug 10 2019 6:38am


Also, you need to be testing "live" as there needs to be a load on the motor for the throttle to work.


And live it works perfectly :thumb: As the throttle was not working correctly live in A2 and was giving the same results in the advance technical data on A3 I never took it for a live test drive. You have cracked it, well done sir.
Wonderful! Enjoy! :D
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

Popo15   10 mW

10 mW
Posts: 21
Joined: Nov 25 2018 9:56am

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

Post by Popo15 » Aug 10 2019 7:30am

hello good afternoon Buba, speaking of the accelerator in the original firmware the accelerator in mode 0 does not activate starts to work from mode 1,
  you can solve that in mode 0 it does not activate, thank you very much for the enormous work you are doing.

buba   10 kW

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

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

Post by buba » Aug 10 2019 9:54am

Popo15 wrote:
Aug 10 2019 7:30am
hello good afternoon Buba, speaking of the accelerator in the original firmware the accelerator in mode 0 does not activate starts to work from mode 1,
  you can solve that in mode 0 it does not activate, thank you very much for the enormous work you are doing.
Good afternooon, Popo15,

I am afraid of situations where it can be classified as a bug if the users are not aware that setting the Power Assist, or any other riding mode, to assist level 0 will disable the throttle as well. Another situation is if there are users that only ride with the eMTB mode and remove all assist levels, then throttle would not work. Would it be okay if we leave it as it is?

But I am glad you are suggesting improvements! Please let me know if you have more!

And if anyone thinks that I am in any way wrong and this needs to be implemented, please let me know as I will happily do my best to provide a solution!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

Post Reply