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

Electric Motors and Controllers
marcoq   1 W

1 W
Posts: 54
Joined: Dec 17 2018 3:55am

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

Post by marcoq » Jul 31 2019 10:38am

buba wrote:
Jul 31 2019 8:56am
Demion wrote:
Jul 31 2019 8:34am
I noticed ADC torque sensor calibration min value fluctuates +-5 each start.
Is there downside to increase sample count twice, for example, to 32? As I understand each reading is only 10ms.
Solved in the coming 0.20.0 :) It calibrates perfectly every time.
Wonderful work Buba!! :D :D :D

buba   10 kW

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

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

Post by buba » Jul 31 2019 11:01am

marcoq wrote:
Jul 31 2019 10:38am
buba wrote:
Jul 31 2019 8:56am
Demion wrote:
Jul 31 2019 8:34am
I noticed ADC torque sensor calibration min value fluctuates +-5 each start.
Is there downside to increase sample count twice, for example, to 32? As I understand each reading is only 10ms.
Solved in the coming 0.20.0 :) It calibrates perfectly every time.
Wonderful work Buba!! :D :D :D
Thank you, marcoq! :D

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

And while I am already posting, here is a quick update to the community:

* Just need to add the sinewave approximation Casainho has done on his branch and then we are good to go! Will then take a ride and validate everything.

* Have created a wonderful filter that is used for all sorts of things. Works great and no attenuation.

Below are some pictures of the riding mode symbols as I thought it would be fun to share. Was such a long time ago I implemented them and also tried the 0.19.0 that I have forgotten all these minor things. Sorry for the picture quality. Anyone want a custom symbol? :wink:

eMTB
eMTB2.jpg
eMTB2.jpg (79.98 KiB) Viewed 814 times
eMTB.jpg
eMTB.jpg (74.88 KiB) Viewed 814 times


Power Assist - The standard mode we have always used in the previous versions:
PowerAssist.jpg
PowerAssist.jpg (77.35 KiB) Viewed 814 times


Torque Assist - Similar to the original firmware but the big difference is that it controls the actual motor torque. The original TSDZ2 firmware has a simplified motor control.
TorqueAssist.jpg
TorqueAssist.jpg (66.68 KiB) Viewed 814 times


Cadence Assist
CadenceAssist.jpg
CadenceAssist.jpg (69.95 KiB) Viewed 814 times


This is in the configuration menu. The symbols are not displayed when riding, except the eMTB symbol if enabled. You choose between Power, Torque and Cadence Assist in the configuration menu. eMTB Assist can be enabled in any riding mode simply by increasing the assist level until the "E" is shown.
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

andrea_104kg   100 W

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

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

Post by andrea_104kg » Aug 01 2019 5:32am

For me the symbol are ok! it's exceptional your work!

buba   10 kW

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

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

Post by buba » Aug 01 2019 7:12am

andrea_104kg wrote:
Aug 01 2019 5:32am
For me the symbol are ok! it's exceptional your work!
You are very kind, thank you, andrea_104kg!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

buba   10 kW

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

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

Post by buba » Aug 01 2019 7:15am

One big update coming tonight or early tomorrow! :wink:

https://github.com/leon927/TSDZ2-Smart- ... ng-pwm-acc
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

mauri_78   10 mW

10 mW
Posts: 26
Joined: Jul 17 2018 9:47am

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

Post by mauri_78 » Aug 01 2019 8:19am

buba wrote:
Jul 31 2019 4:53am
mauri_78 wrote:
Jul 31 2019 3:31am
Hi all, i have noted that removing the battery the trip counter is resetted... Is possible to store trip counter in eeprom for next versions? Sometimes is useful to park the bike without the battery that can be removed for charging... would be nice if trip counter wouldn't be resetted in this situation...
Thanks in advance
There are three distance measurements:

- Odometer (saved in EEPROM)

- Trip (saved in EEPROM)

- Distance since power on (not saved in EEPROM)

This means that all except one are saved in the EEPROM if you power down the system with the ONOFF button. Only the "distance since power on" is reset every time. Let me know if something is not working and we will fix it!
Hi Buba, thank you very much for your work!
I have removed the battery from my bike and i have noted that when you remove the battery the trip counter is resetted.
To be more precise when you remove the battery and then you reconnect it the trip counter indicate 1km.
I'm running 0.19.0 version.

Maurizio

casainho   1.21 GW

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

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

Post by casainho » Aug 01 2019 8:22am

mauri_78 wrote:
Aug 01 2019 8:19am
buba wrote:
Jul 31 2019 4:53am
mauri_78 wrote:
Jul 31 2019 3:31am
Hi all, i have noted that removing the battery the trip counter is resetted... Is possible to store trip counter in eeprom for next versions? Sometimes is useful to park the bike without the battery that can be removed for charging... would be nice if trip counter wouldn't be resetted in this situation...
Thanks in advance
There are three distance measurements:

- Odometer (saved in EEPROM)

- Trip (saved in EEPROM)

- Distance since power on (not saved in EEPROM)

This means that all except one are saved in the EEPROM if you power down the system with the ONOFF button. Only the "distance since power on" is reset every time. Let me know if something is not working and we will fix it!
Hi Buba, thank you very much for your work!
I have removed the battery from my bike and i have noted that when you remove the battery the trip counter is resetted.
To be more precise when you remove the battery and then you reconnect it the trip counter indicate 1km.
I'm running 0.19.0 version.

Maurizio
You need to be careful that before remove the battery you must turn off the LCD or the last values will not be saved. Maybe this can be the issue??
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.

mauri_78   10 mW

10 mW
Posts: 26
Joined: Jul 17 2018 9:47am

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

Post by mauri_78 » Aug 01 2019 8:27am

Hi casahino,
thank you for you rapid response!
Yes probably i have made this mistake!
For sure i will make more tests, but i think that you are in right!
best regards

Maurizio

andrea_104kg   100 W

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

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

Post by andrea_104kg » Aug 01 2019 11:46am

It is the same mistake that I always make, then I realized that the km always remained 500km .... while I had exceeded 1200km ...

:( :(

thineight   100 W

100 W
Posts: 177
Joined: Oct 05 2018 3:53am

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

Post by thineight » Aug 01 2019 3:52pm

andrea_104kg wrote:
Aug 01 2019 5:32am
For me the symbol are ok! it's exceptional your work!
Agree with Andrea, the work you've done lately is impressive buba!
MTB KTM Ultra 29" - City bike DAYTONA 28"

zappan   1 W

1 W
Posts: 56
Joined: Sep 27 2018 3:00am
Location: Sicilia

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

Post by zappan » Aug 02 2019 1:45am

buba wrote:
Aug 01 2019 7:15am
One big update coming tonight or early tomorrow! :wink:

https://github.com/leon927/TSDZ2-Smart- ... ng-pwm-acc
Great job Buba, I look forward to try it.

buba   10 kW

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

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

Post by buba » Aug 02 2019 8:29am

Thank you Zappan, and thineight! Wonderful support and kind words!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

buba   10 kW

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

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

Post by buba » Aug 02 2019 8:48am

Good news and bad news! :wink:

The bad news is that all users must do a total reset when installing the 0.20.0. But for the coming updates this will hopefully not be necessary and might be the last time you need to reconfigure the entire system. Will do my best to not force anyone to reconfigure in the future. But this was such a rewrite that it was necessary.

The good news is that it is possible to download the 0.20.0 Alpha 1.0 from my Google Drive! :bolt:

I know it is still behind my original time line but believe me... it was worth it! For anyone tired of waiting I hope it will be worth the wait.

We now have the possibility to improve a lot of things from user feedback and I have looked forward to this for a long time! This version is very good for showing of the changes so we can base our discussions on something. All riding modes will be improved in one way or another but we will get to that when it is time.

There are some things to fix on the KT-LCD3 but those are esthetic issues. I have prioritized other things so we can have a version out for testing as soon as possible. One example is that some controller data will update very quickly. Such as the wattage, cadence etcetera. Will later filter this so it is much nicer in the coming Alpha.

Please be certain that everything is reset before installing 0.20.0. We do not want any surprises. So when installing the 0.20.0 make sure to erase everything! If not sure how to do that please ask and I will try to help!

Be extra careful and mindful that this update is extreme. GitHub puts it at almost 5000 lines of code and this number will be passed before a stable release... Almost constant development and testing for over a month. So be ready to brake, switch the battery off or whatever it takes to be safe. Double check that the e-brakes work and do everything possible to ensure a safe testing environment. And once again please make sure to reset everything!

I call it the Alpha 1.0 version as I think the official releases from the project GithHub page should be called Beta.

Below is the wiki that still needs more updating but should work fine for now. Read it carefully when configuring.
https://github.com/OpenSource-EBike-fir ... %7C-Manual

Here is my Google Drive:
https://drive.google.com/open?id=1CPGT- ... bYtY4_JH2R
Last edited by buba on Aug 02 2019 9:36am, edited 2 times in total.
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

buba   10 kW

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

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

Post by buba » Aug 02 2019 8:56am

I will update the 0.20.0 wiki and also the cadence sensor tutorial as soon as possible. Will work with that the entire day. Would like to make a video tutorial for the cadence sensor calibration but will probably make a simple text tutorial at first, just to have something for the early adopters.

Anyway, more to come in the coming hours!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

thineight   100 W

100 W
Posts: 177
Joined: Oct 05 2018 3:53am

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

Post by thineight » Aug 02 2019 10:38am

Buba, please make sure you write down the necessary info on how to correctly perform the reset you require.
Thanks!!
MTB KTM Ultra 29" - City bike DAYTONA 28"

buba   10 kW

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

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

Post by buba » Aug 02 2019 10:48am

thineight wrote:
Aug 02 2019 10:38am
Buba, please make sure you write down the necessary info on how to correctly perform the reset you require.
Thanks!!
What I would recommend is to program all zeros before loading the alpha. Here is user Rafe explaining what he usually does:
Rafe wrote:
Jan 19 2019 6:26pm
buba wrote:
Jan 19 2019 4:00pm


- Scroll through the configuration menu and make sure everything is set as desired
- Make a total reset so the default values are loaded and then configure as desired
What I do and it works well for me is when I first start ST visual programmer it automatically presents pages of all zeros for both the programme memory and data memory, then I simply programme each tab with the zeros so nothing remains of the previous firmware. Then I write the new version into the programme memory.
Please let me know if I can make anything more clear! All feedback is welcome, thineight!

EDIT:

Step 1: Connect either the TSDZ2 or the KT-LCD3.

Step 2: Open the ST Visual Programmer.
Step1.png
Step1.png (37.41 KiB) Viewed 420 times
Step 3: Program all tabs with zeros as ST Visual Programmer will open with all zeros as default.
Step2.png
Step2.png (32.99 KiB) Viewed 420 times
Step 4: You have now completely erased the saved data and program memory and can continue to upload any firmware you wish to use.
Last edited by buba on Aug 02 2019 11:58am, edited 1 time in total.
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

vjvj   10 µW

10 µW
Posts: 6
Joined: Aug 02 2019 11:46am

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

Post by vjvj » Aug 02 2019 11:52am

Hello all! I am having this weird issue while trying to run the open source firmware.

I made a video about it here: https://youtu.be/TCxoKsTYjUI

I tried swapping RX/TX. Did not work. I tripled check all connections and flashed both the motor and KT LCD3 three times to make sure. I used 0.19.

Still I am having the problem. I can power on/off the unit but all I see is zeros everwhere... i cannot activate the motor or get any kind of info about it or the battery (52v).

What am I missing here?

buba   10 kW

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

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

Post by buba » Aug 02 2019 12:06pm

vjvj wrote:
Aug 02 2019 11:52am
Hello all! I am having this weird issue while trying to run the open source firmware.

I made a video about it here: https://youtu.be/TCxoKsTYjUI

I tried swapping RX/TX. Did not work. I tripled check all connections and flashed both the motor and KT LCD3 three times to make sure. I used 0.19.

Still I am having the problem. I can power on/off the unit but all I see is zeros everwhere... i cannot activate the motor or get any kind of info about it or the battery (52v).

What am I missing here?
I hope I can help! Try this:

Step 1: Go to the Configuration Menu

Step 2: Go to the "Reset to default settings"

Step 3: When the screen is blank, hold the ONOFF button for a couple of seconds.

Step 4: Release the ONOFF button

Step 5: Try to power on the system

If this does not work try to load all zeros when programming the display. See one post above for more info. And then see if it works. If not, try to reset to defaults once again after programming all zeros.
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

vjvj   10 µW

10 µW
Posts: 6
Joined: Aug 02 2019 11:46am

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

Post by vjvj » Aug 02 2019 12:29pm

buba wrote:
Aug 02 2019 12:06pm
vjvj wrote:
Aug 02 2019 11:52am
Hello all! I am having this weird issue while trying to run the open source firmware.

I made a video about it here: https://youtu.be/TCxoKsTYjUI

I tried swapping RX/TX. Did not work. I tripled check all connections and flashed both the motor and KT LCD3 three times to make sure. I used 0.19.

Still I am having the problem. I can power on/off the unit but all I see is zeros everwhere... i cannot activate the motor or get any kind of info about it or the battery (52v).

What am I missing here?
I hope I can help! Try this:

Step 1: Go to the Configuration Menu

Step 2: Go to the "Reset to default settings"

Step 3: When the screen is blank, hold the ONOFF button for a couple of seconds.

Step 4: Release the ONOFF button

Step 5: Try to power on the system

If this does not work try to load all zeros when programming the display. See one post above for more info. And then see if it works. If not, try to reset to defaults once again after programming all zeros.
Thanks for the reply. It is WORKING now! Yeah!

So strange that i had to reset. I did not changed anything.

buba   10 kW

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

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

Post by buba » Aug 02 2019 12:31pm

vjvj wrote:
Aug 02 2019 12:29pm
Thanks for the reply. It is WORKING now! Yeah!

So strange that i had to reset. I did not changed anything.
I am happier than you are! :D

It was not your fault. You actually reported a common bug with the EEPROM code. This has been with us for as long as I can remember. It is actually due to this bug I tell users to program all zeros. But will have a solution for the 0.20.0.

Thank you, vjvj, for bringing this to the thread!

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

I have removed the Alpha 1.0 from my Drive and will rewrite the EEPROM code starting from scratch. So we can solve this once and for all. Will be finished within one hour and have the 0.20.0 Alpha 2.0 ready as soon as possible.
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

fi7ippo   10 mW

10 mW
Posts: 23
Joined: Aug 26 2018 2:29am

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

Post by fi7ippo » Aug 02 2019 4:11pm

buba wrote:
Aug 02 2019 12:31pm
I have removed the Alpha 1.0 from my Drive and will rewrite the EEPROM code starting from scratch. So we can solve this once and for all. Will be finished within one hour and have the 0.20.0 Alpha 2.0 ready as soon as possible.
Hi Buba, great work! :thumb:

My motor is really more quiter than 0.19.0 with same configuration.
The acceleration is much smoother, the power seems much better modulated. It looks like a new engine :D

Take a look to backward resistance, is present in Alpha 1.0 and...
Odometer says over 6000km
In Odometer I cannot view selection 8 (temp sensor)

I've done a few km but in my opinion the only missing thing is the "startup without pedal rotation". Once You use that with ebrakes you are not happy to go back

Really cool, thank you!

andrea_104kg   100 W

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

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

Post by andrea_104kg » Aug 02 2019 4:20pm

fi7ippo what type of assist have you used, power, torque or cadence?
I have only read the manual ad i have not understand if it's possible to do a mix mode.... es. level 1-4 power mode, 5-6 torque, 7-8 cadence and 9 emtb

fi7ippo   10 mW

10 mW
Posts: 23
Joined: Aug 26 2018 2:29am

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

Post by fi7ippo » Aug 02 2019 5:00pm

andrea_104kg wrote:
Aug 02 2019 4:20pm
fi7ippo what type of assist have you used, power, torque or cadence?
I have only read the manual ad i have not understand if it's possible to do a mix mode.... es. level 1-4 power mode, 5-6 torque, 7-8 cadence and 9 emtb
I've tested the torque mode. I think single mode + emtb at the end!
A trick for cadence calibration: You must lock the crank to the crown so that the motor rotates the pedals during calibration

buba   10 kW

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

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

Post by buba » Aug 02 2019 7:14pm

fi7ippo wrote:
Aug 02 2019 4:11pm
buba wrote:
Aug 02 2019 12:31pm
I have removed the Alpha 1.0 from my Drive and will rewrite the EEPROM code starting from scratch. So we can solve this once and for all. Will be finished within one hour and have the 0.20.0 Alpha 2.0 ready as soon as possible.
Hi Buba, great work! :thumb:

My motor is really more quiter than 0.19.0 with same configuration.
The acceleration is much smoother, the power seems much better modulated. It looks like a new engine :D

Really cool, thank you!
Hello fi7ippo! Appreciate the good feedback!


fi7ippo wrote:
Aug 02 2019 4:11pm
buba wrote:
Aug 02 2019 12:31pm
I have removed the Alpha 1.0 from my Drive and will rewrite the EEPROM code starting from scratch. So we can solve this once and for all. Will be finished within one hour and have the 0.20.0 Alpha 2.0 ready as soon as possible.
Take a look to backward resistance, is present in Alpha 1.0 and...
Odometer says over 6000km
In Odometer I cannot view selection 8 (temp sensor)
All this is due to the EEPROM bug. I am trying to solve this once and for all. If you want to remove all those "bugs" try this:

Step 1: Go to the Configuration Menu, Basic Setup

Step 2: Go to the "reset to default settings"

Step 3: Hold the UP button until the counter goes to 10, the screen will become blank.

Step 4 (important): Hold the ONOFF button firmly for a couple of seconds, do not accidentally click.

Step 5: After a couple of seconds you can release the ONOFF button and then power up the system as usual.

Step 6: You will have a working clean install and no more bugs!


fi7ippo wrote:
Aug 02 2019 4:11pm
I've done a few km but in my opinion the only missing thing is the "startup without pedal rotation". Once You use that with ebrakes you are not happy to go back
Seems we will have to fix that :wink:
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

buba   10 kW

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

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

Post by buba » Aug 02 2019 7:16pm

andrea_104kg wrote:
Aug 02 2019 4:20pm
fi7ippo what type of assist have you used, power, torque or cadence?
I have only read the manual ad i have not understand if it's possible to do a mix mode.... es. level 1-4 power mode, 5-6 torque, 7-8 cadence and 9 emtb
Sadly, for now, you need to select between Power, Torque and Cadence Assist!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

Post Reply