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

Electric Motors and Controllers
kortina   10 mW

10 mW
Posts: 29
Joined: Feb 19 2017 9:24pm

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

Post by kortina » Sep 18 2018 4:13am

The original firmware does:

Turn on the system. (wait about 3 sec).

When you tap the power button it toggles the lights on/off. Hold power to turn off system.

When lights are tapped ON:
Screen backlight = ON
lighting circuit has 6v applied, this circuit has two tails. Often used to power both front and back.

(Brakes do nothing).

Dirkro   1 W

1 W
Posts: 58
Joined: Jun 30 2018 8:18am
Location: Bochum Germay

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

Post by Dirkro » Sep 18 2018 5:52am

kortina wrote:
Sep 18 2018 4:13am
The original firmware does:

Turn on the system. (wait about 3 sec).

When you tap the power button it toggles the lights on/off. Hold power to turn off system.

When lights are tapped ON:
Screen backlight = ON
lighting circuit has 6v applied, this circuit has two tails. Often used to power both front and back.

(Brakes do nothing).

What should the firmware do ? just use the brake signal and switch it to a another cable?

Wouldn't it be more easy to take the signal from the brake switch and conect ot just on a relay ?
Oh darling, this is not a new bike.. :roll:

casainho   100 MW

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

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

Post by casainho » Sep 18 2018 6:35am

Dirkro wrote:
Sep 18 2018 5:52am
kortina wrote:
Sep 18 2018 4:13am
The original firmware does:

Turn on the system. (wait about 3 sec).

When you tap the power button it toggles the lights on/off. Hold power to turn off system.

When lights are tapped ON:
Screen backlight = ON
lighting circuit has 6v applied, this circuit has two tails. Often used to power both front and back.

(Brakes do nothing).

What should the firmware do ? just use the brake signal and switch it to a another cable?

Wouldn't it be more easy to take the signal from the brake switch and conect ot just on a relay ?
The hardware seems to have a max limit of 0.4 Amps, so if using front and rear light and both taking the same current, can't be more than 0.2A / 1.2W each, so the limit of 1W for each lamp seems good but no more than 6V 1W lamps!!

The controller has 2 free connector for digital wires, where 1 of that wires could be used to power an extra strong light for braking light signal. This idea would need to be tested...
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

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

kortina   10 mW

10 mW
Posts: 29
Joined: Feb 19 2017 9:24pm

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

Post by kortina » Sep 18 2018 7:09am

I will do some testing tomorrow... It looks like pwspower offer a taillight that has a brake function.

TS-WD216

https://m.alibaba.com/product/607589414 ... redirect=1

So I will add the brake sensor and read the voltage.

6v 1A is not really enough power for a real headlight (especially for a bike that can do > 30km/h). I use the voltage to trigger a relay.

Maybe the stock firmware has some brake light feature!?

casainho   100 MW

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

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

Post by casainho » Sep 19 2018 3:08am

DST trip distance and total trip distance ODO are implemented on development branch, however I can reset them or so because I do not have free button combination... I am thinking in implementing QUICK PRESS followed by LONG PRESS detection of the same button, so 3 more button presses can be detected. I would use that type of button event: UP to cycle over DST <-> ODO and DOWN to reset each field.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

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

Dirkro   1 W

1 W
Posts: 58
Joined: Jun 30 2018 8:18am
Location: Bochum Germay

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

Post by Dirkro » Sep 19 2018 4:41am

casainho wrote:
Sep 19 2018 3:08am
DST trip distance and total trip distance ODO are implemented on development branch, however I can reset them or so because I do not have free button combination... I am thinking in implementing QUICK PRESS followed by LONG PRESS detection of the same button, so 3 more button presses can be detected. I would use that type of button event: UP to cycle over DST <-> ODO and DOWN to reset each field.
I am happy to see this feature! Maybe ODO should not be able to reset easy.
In the latest Yamaha, there is a reset menue, maybe it is possible to enter a similar menue with "LONG, QUICK QUICK " and then the values are blinking you can scroll through, and you can reset by a long "POWER ON" and exit by the "LONG, QUICK QUICK "
Similar like the setup menue?
Nevertheless I am happy with everything :-)
Oh darling, this is not a new bike.. :roll:

EndlessCadence   100 W

100 W
Posts: 217
Joined: Aug 22 2018 4:31am

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

Post by EndlessCadence » Sep 19 2018 10:19am

kortina wrote:
Sep 18 2018 7:09am
6v 1A is not really enough power for a real headlight (especially for a bike that can do > 30km/h). I use the voltage to trigger a relay.
It's not even 1A (or did you mean 1W? :P ). This is much too little for a serious bike light. Even most standard hub dynamos are generating 2 - 3W! I'm using an e-bike specific headlight of 4W, this is far from extreme. I've ordered a relay and powerful DC-DC converter to drive this headlight.
Maybe the stock firmware has some brake light feature!?
No, I don't think so. I also don't need this feature. I had a tail light with a brake sensor and even turn indicators, it doesn't work in practice. Especially motorists simply ignore or don't notice it. Nowadays I use a bright light sometimes blinking when the circumstances ask for it, this works fine.

EndlessCadence   100 W

100 W
Posts: 217
Joined: Aug 22 2018 4:31am

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

Post by EndlessCadence » Sep 19 2018 10:21am

casainho wrote:
Sep 19 2018 3:08am
DST trip distance and total trip distance ODO are implemented on development branch, however I can reset them or so because I do not have free button combination... I am thinking in implementing QUICK PRESS followed by LONG PRESS detection of the same button, so 3 more button presses can be detected. I would use that type of button event: UP to cycle over DST <-> ODO and DOWN to reset each field.
Nice! Maybe we just reset the ODO using the configuration menu and no quick access? Do we really need the quick access?

casainho   100 MW

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

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

Post by casainho » Sep 20 2018 4:10am

EndlessCadence wrote:
Sep 19 2018 10:21am
casainho wrote:
Sep 19 2018 3:08am
DST trip distance and total trip distance ODO are implemented on development branch, however I can reset them or so because I do not have free button combination... I am thinking in implementing QUICK PRESS followed by LONG PRESS detection of the same button, so 3 more button presses can be detected. I would use that type of button event: UP to cycle over DST <-> ODO and DOWN to reset each field.
Nice! Maybe we just reset the ODO using the configuration menu and no quick access? Do we really need the quick access?
Yes, that was simple to implement and I just did it - it is on development branch and I created the V0.13 wiki page (and updated with ODOMETER changes) and updated the main page with the links.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

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

Dirkro   1 W

1 W
Posts: 58
Joined: Jun 30 2018 8:18am
Location: Bochum Germay

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

Post by Dirkro » Sep 23 2018 2:45am

casainho wrote:
Sep 20 2018 4:10am
EndlessCadence wrote:
Sep 19 2018 10:21am
casainho wrote:
Sep 19 2018 3:08am
DST trip distance and total trip distance ODO are implemented on development branch, however I can reset them or so because I do not have free button combination... I am thinking in implementing QUICK PRESS followed by LONG PRESS detection of the same button, so 3 more button presses can be detected. I would use that type of button event: UP to cycle over DST <-> ODO and DOWN to reset each field.
Nice! Maybe we just reset the ODO using the configuration menu and no quick access? Do we really need the quick access?
Yes, that was simple to implement and I just did it - it is on development branch and I created the V0.13 wiki page (and updated with ODOMETER changes) and updated the main page with the links.
Just one question:
How to reset the standard values for the firmware now?
For me it looks according to the WIKI, that this finktion is gone now?

I think to reset ODO and Trip at the same time is not a good option, because this values will allways be the same.
It would be nice to reset Trip in the main menue and ODO in config menue
Oh darling, this is not a new bike.. :roll:

troebi   1 mW

1 mW
Posts: 16
Joined: Jul 27 2017 3:50pm
Location: South Germany

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

Post by troebi » Sep 23 2018 1:09pm

Good feature!
But I can commit Dirkko: It makes less sence when the values of ODO and DST were same.
My proposal would be, to reset ODO with a long press of "DOWN" (walk assist is actually not used)
and the total DST could be set and reset in the config menue.

The LCD3 has also an icon for DST, ODO and AVG. Perhaps this could also be used.

A further question: The assist of the motor ist very good at high cadences. At low cadences, the assist of the original firmware is much better. Are the values of the torque sensor responsible for this phenomen? Can the value of the torque sensor be set with a factor?
I also found out that the torqu sensor is temperature-sensitive. A warm motor has more torque.

casainho   100 MW

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

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

Post by casainho » Sep 24 2018 4:00am

Dirkro wrote:
Sep 23 2018 2:45am
Just one question:
How to reset the standard values for the firmware now?
For me it looks according to the WIKI, that this finktion is gone now?
6. 3 LCD configurations reset to defaults
0 Increase the value to 10 and the LCD configurations will reset to the default values.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

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

casainho   100 MW

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

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

Post by casainho » Sep 24 2018 8:19am

troebi wrote:
Sep 23 2018 1:09pm
A further question: The assist of the motor ist very good at high cadences. At low cadences, the assist of the original firmware is much better. Are the values of the torque sensor responsible for this phenomen? Can the value of the torque sensor be set with a factor?
Maybe you are not using the startup power boost feature?? https://github.com/OpenSource-EBike-fir ... rsion-0.12
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

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

Eremit   10 mW

10 mW
Posts: 30
Joined: Sep 24 2018 8:33am

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

Post by Eremit » Sep 24 2018 8:43am

I have Problems falshing the firmware. I was able to flash the display and it shows is 88888-Screen now as expected. Also, changing the battery to 24V with the original Software (changing the data field) worked.
But: with STLink/Swin/STM8S105x4 the STVisualProgrammer floods with error messages like

FILE : line 1146: Address 0xC776 is out of range and is ignored!
FILE : line 1146: Address 0xC777 is out of range and is ignored!
FILE : line 1146: Address 0xC778 is out of range and is ignored!
FILE : line 1146: Address 0xC779 is out of range and is ignored!
FILE : line 1146: Address 0xC77A is out of range and is ignored!

If I use STM8S105x6 like with the display, it does not show errors. Is it save to do so?

Dirkro   1 W

1 W
Posts: 58
Joined: Jun 30 2018 8:18am
Location: Bochum Germay

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

Post by Dirkro » Sep 24 2018 9:07am

Eremit wrote:
Sep 24 2018 8:43am
I have Problems falshing the firmware. I was able to flash the display and it shows is 88888-Screen now as expected. Also, changing the battery to 24V with the original Software (changing the data field) worked.
But: with STLink/Swin/STM8S105x4 the STVisualProgrammer floods with error messages like

FILE : line 1146: Address 0xC776 is out of range and is ignored!
FILE : line 1146: Address 0xC777 is out of range and is ignored!
FILE : line 1146: Address 0xC778 is out of range and is ignored!
FILE : line 1146: Address 0xC779 is out of range and is ignored!
FILE : line 1146: Address 0xC77A is out of range and is ignored!

If I use STM8S105x6 like with the display, it does not show errors. Is it save to do so?
I keep the ...x6 in the settings. No problems with flashing so far.
Oh darling, this is not a new bike.. :roll:

Eremit   10 mW

10 mW
Posts: 30
Joined: Sep 24 2018 8:33am

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

Post by Eremit » Sep 24 2018 11:04am

Thanks, already tried and it seems to work.
Wich makes the way free to run into next problem: The Setup manual seems to be a little bit outdated. Any hint where to get the options of 0.13?

Update: I was stuck here: https://github.com/OpenSource-EBike-fir ... -firmwares
But this one is it: https://github.com/OpenSource-EBike-fir ... rsion-0.13
--sort of dead end in the beginner's documentation.
Last edited by Eremit on Sep 24 2018 6:31pm, edited 2 times in total.

Dirkro   1 W

1 W
Posts: 58
Joined: Jun 30 2018 8:18am
Location: Bochum Germay

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

Post by Dirkro » Sep 24 2018 12:58pm

Basicaly 0.12 should be nearly OK ..
https://github.com/OpenSource-EBike-fir ... rsion-0.12
maybe give it a try... PAS cardence in menue 8 2 is 110 instead of 25 but most options are OK I think
Oh darling, this is not a new bike.. :roll:

troebi   1 mW

1 mW
Posts: 16
Joined: Jul 27 2017 3:50pm
Location: South Germany

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

Post by troebi » Sep 24 2018 1:51pm

Dirkro wrote:
Sep 24 2018 12:58pm
Basicaly 0.12 should be nearly OK ..
https://github.com/OpenSource-EBike-fir ... rsion-0.12
maybe give it a try... PAS cardence in menue 8 2 is 110 instead of 25 but most options are OK I think
@Dirkro or @Casainho:
What does this value mean? In V0.12 the default value is about 90? When I reduce this, the assist lowers.

The motor is nearly like a Bosch motor at higher cadences. With lower cadences the power is not as strong as a Bosch.

Can anyone post typical values of the torque sensor? In the menue under §9 I can read the following values:
2 ADC pedal torque sensor see the current value
3 Pedal torque sensor see the current value

Thanks!! :)

troebi   1 mW

1 mW
Posts: 16
Joined: Jul 27 2017 3:50pm
Location: South Germany

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

Post by troebi » Sep 24 2018 2:08pm

casainho wrote:
Sep 24 2018 8:19am
Maybe you are not using the startup power boost feature?? https://github.com/OpenSource-EBike-fir ... rsion-0.12
I set the boost function with default values. But give it a try with a longer boost.

Interesting for me: to get about 350W input power, I have to set about 700W. Can this be plausible?

andrea_104kg   10 mW

10 mW
Posts: 27
Joined: Mar 05 2018 5:51pm

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

Post by andrea_104kg » Sep 24 2018 3:40pm

Hi, I installed the 0.7 version of the software. Unfortunately, I do not have time to install other versions. Unfortunately I did not print the instructions. Is it possible to have the old list of instructions?

troebi   1 mW

1 mW
Posts: 16
Joined: Jul 27 2017 3:50pm
Location: South Germany

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

Post by troebi » Sep 25 2018 12:57am

andrea_104kg wrote:
Sep 24 2018 3:40pm
Is it possible to have the old list of instructions?
https://github.com/OpenSource-EBike-fir ... -firmwares

Dirkro   1 W

1 W
Posts: 58
Joined: Jun 30 2018 8:18am
Location: Bochum Germay

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

Post by Dirkro » Sep 25 2018 4:48am

troebi wrote:
Sep 24 2018 2:08pm
Interesting for me: to get about 350W input power, I have to set about 700W. Can this be plausible?
This is normal, because to get 100 % input level, you need 100% torque at a very high cardence.
So it is comon to put in maybe 1400 W at the high assist levels.
Once you found good values, the system is working great!
Oh darling, this is not a new bike.. :roll:

casainho   100 MW

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

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

Post by casainho » Sep 25 2018 6:56am

Dirkro wrote:
Sep 25 2018 4:48am
troebi wrote:
Sep 24 2018 2:08pm
Interesting for me: to get about 350W input power, I have to set about 700W. Can this be plausible?
This is normal, because to get 100 % input level, you need 100% torque at a very high cardence.
So it is comon to put in maybe 1400 W at the high assist levels.
Once you found good values, the system is working great!
Correct.

Dirko, do you want to volunteer to write a wiki page with information on how to flash on Windows? -- seems users are asking over and over the same questions and would be great to have a page with maybe some screenshots and details...
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

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

Eremit   10 mW

10 mW
Posts: 30
Joined: Sep 24 2018 8:33am

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

Post by Eremit » Sep 25 2018 7:58am

And another question for support (damn, it worked all fine yesterday eveneing, that I thought I'm through it.)
But today, after resoldering the display and (stupid me) changing config at the same time, I get a blinking 0 in the temperature field (no temp protection set), no motor assistence. And the cadence field stays zero. (I did no soldering at the motor itself...)
What could that be?

Guess Tx->Rx Motor was blocked by bad soldering. It's solved now. Nethertheless are there some sort of error codes wich LSD3 could give?

Eremit   10 mW

10 mW
Posts: 30
Joined: Sep 24 2018 8:33am

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

Post by Eremit » Sep 25 2018 10:57am

Anyone tested the offroad mode successfully? With enabled Offroad, I come exactly to the SpeedLimit of the offroad mode. As well as offroad mode switched off. (Well, not above 35 km/h for still using a 24V Battery Pack)
"Assist" is blinking, but there is no difference in Top Speed.

All else is working awesome!! :-)

Post Reply