TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Electric Motors and Controllers
obcd   100 W

100 W
Posts: 138
Joined: Jul 16 2019 3:45pm

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

Post by obcd » Feb 18 2020 5:17pm

Doesn't the st-link boot as soon as it has gnd and 5V. (No idea, just thinking loud)

Maybe someone can tell if you are suposed to measure a voltage on the swim line.
If it should have some, you could measure it.
If it's there it means the wires are making contact.

Let's assume you have a motor that was assembled on friday afternoon and finished on monday morning.
Is it possible 2 wires got reversed (again just thinking loud) like the light signal and swim signal?

Again, you should measure 6V on the light signal when you turn the light on.

I have learned from experience that testing is always better than assuming.

If you ask someone a question and he answers "I assume it's xx" or "I think it's xx" it actually means he doesn't know sh*t and you
should ignore his answer. (I even catch myself answering like that sometimes)

hetm4n   10 mW

10 mW
Posts: 22
Joined: Aug 29 2019 6:30am

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

Post by hetm4n » Feb 18 2020 6:47pm

I am asking for help from SW102 users with OSF 0.6.5. I am skipping the problem of not remembering the settings after turning it off again. How to set the temperature on the display is best step by step. I have read the 850c guide but for me the key combination does not work.

User avatar
stancecoke   100 kW

100 kW
Posts: 1169
Joined: Aug 02 2017 2:56pm

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

Post by stancecoke » Feb 19 2020 2:27am

In the german forum is reported, that Tongsheng has completely reengineered the motor in 2020:
https://www.pedelecforum.de/forum/index ... st-1379882
almost changed compare to the old version, shell, chip, accessaries inside, firmware
I'm afraid that the open firmware will not work with this any longer. :-(

regards
stancecoke

NexusG   10 mW

10 mW
Posts: 26
Joined: Aug 06 2019 7:36am

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

Post by NexusG » Feb 19 2020 4:08am

stancecoke wrote:
Feb 19 2020 2:27am
In the german forum is reported, that Tongsheng has completely reengineered the motor in 2020:
https://www.pedelecforum.de/forum/index ... st-1379882
almost changed compare to the old version, shell, chip, accessaries inside, firmware
I'm afraid that the open firmware will not work with this any longer. :-(

regards
stancecoke
This is a good news if the new design is better (tougher components, better protection against water and dust, better heat dissipation, etc...)
The exact model of the chip will be different but I think it will be a STM32 again, so maybe not so much firmware modifications needed ?

obcd   100 W

100 W
Posts: 138
Joined: Jul 16 2019 3:45pm

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

Post by obcd » Feb 19 2020 4:10am

Maybe they saw the light and have implemented simplified foc in their firmware as well.
With a bit of luck, they still use the same microcontroller.
Or it could be that the old controller still works with the new motor.
If it's mechanical more robust, that's a bonus. For the rest, we can only wait and see.

casainho   10 GW

10 GW
Posts: 4099
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Feb 19 2020 6:01am

stancecoke wrote:
Feb 19 2020 2:27am
In the german forum is reported, that Tongsheng has completely reengineered the motor in 2020:
https://www.pedelecforum.de/forum/index ... st-1379882
almost changed compare to the old version, shell, chip, accessaries inside, firmware
I'm afraid that the open firmware will not work with this any longer. :-(
I think the most important thing is to be a good motor, with a good torque sensor AND keep selling all parts at unit and at very cheap prices (and in many online shops). If that happen, then, I will want to make OpenSource firmware for it :-)

I am really happy because I thought the DIY motors would not have any more any improvement...

I just hope the microcontroller is something like and STM8 or STM32 and not a Chinese one without an available compiler and datasheet, impossible to develop firmware for, like on the Bafang DIY mid drive motors.
Last edited by casainho on Feb 19 2020 6:06am, edited 1 time in total.
- 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   10 GW

10 GW
Posts: 4099
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Feb 19 2020 6:03am

hetm4n wrote:
Feb 18 2020 6:47pm
I am asking for help from SW102 users with OSF 0.6.5. I am skipping the problem of not remembering the settings after turning it off again. How to set the temperature on the display is best step by step. I have read the 850c guide but for me the key combination does not work.
I just released a new firmware version with the solution for saving the settings. See the wiki, I updated with the information on how to change the variables, like showing the motor temperature.
- 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.

skestans   100 W

100 W
Posts: 123
Joined: Jul 12 2019 12:42am
Location: Luxembourg

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

Post by skestans » Feb 19 2020 10:17am

lvx_xvl wrote:
Feb 18 2020 4:23pm
skestans wrote:
Feb 18 2020 3:36pm
Man that sucks. Are you using a speed sensor connector, or DuPont wires with heat shrink tube at the ends? If DuPont, maybe you’re not getting a good connection and should try with a speed sensor extension cable so you get the proper connector and good contact.

If your speed sensing works correctly (ie displays the right speed on the display) and you’ve tried so many computers and dongles, the only option left is a bad connection at the plug.

You could try with a Linux live disc and see if stm8flash works there but if it didn’t work on OS X...
I'm using the speedsensor connector with the Dupont wires (4cm long) and heat shrink tubes. And you are right that might be the issue, but they really snuck in tight. So I'm assuming (very bad I know) they work. If I connect the GND, 5V and SWIM and boot the bike via the VLCD5 display then my ST Link V2 boots, so I'm fairly confident (I know very bad) that the connection is working.

I used a speed sensor extension cable at first, but a lot of people point out to the long leads being the problem.

regards,
LVX
You could shorten the cable between the connector and your dongle. Then use a USB extension to make it long enough.

Zelenaar   10 mW

10 mW
Posts: 34
Joined: Apr 11 2019 5:52am

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

Post by Zelenaar » Feb 19 2020 5:10pm

casainho wrote:
Feb 19 2020 6:03am
I just released a new firmware version with the solution for saving the settings. See the wiki, I updated with the information on how to change the variables, like showing the motor temperature.
[/quote]
Casainho,
I flashed motor en sw102 with that new firmware.
But how to enter the confiuration mene ?
On/off quick click + long press is for me shutting off the display

casainho   10 GW

10 GW
Posts: 4099
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Feb 20 2020 1:22pm

Improvement to Battery SOC

On current version of firmware, there are 2 different ways for calculating the battery SOC: 1. based on battery voltage and 2. based on Coulomb counting (counting the used watts from the battery).

Method 1. is not very precise and 2. is very good for my experience as also from the feedback from users, so, I decided to remove the 1.
2. has the disadvantage that user needs to configure the right value for his battery Wh, but nowadays it is the most well know technical characteristics of ebike batteries because of range. Also the user can very easily use the display to measure the real value of his own battery.

Also, I decided to improve the 2., by considering the power loss on the battery internal resistance (this includes the cables), here an example how this power loss on the battery is relevant:

1. my battery has 350Wh (3.6V each cell * 3.5 amps/h each cell * 14 series (52V) * 2 paralel = 3.6*3.5*14*2 = 350Wh
2. my battery has internal resistance of 250 milli ohms (I did adjusted this value on the display until the voltage keep mostly stable while riding with motor pulling max current)

Let's say I am driving with motor pulling like 15 amps from the battery, the power loss is: P = R * I * I = 0.25 * 15 * 15 = 56 watts.
Since my battery has 350Wh, 56 watts of power means a 16% loss on the battery internals!! This means this value should be considered so the SOC can be more accurate.

Also, I decied to show on the battery configuration screen the battery power loss value, this is important for debug but mainly to educate the users that want to learn more about all this and maybe optimize their battery builds and/or the amount assistance power asked from the motor.

I also changed the battery icon on SW102 to be similar to the one on the 850C.

Here some pictures, in this case on SW102 but the 850C is similar:

Image Image
- 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.

hetm4n   10 mW

10 mW
Posts: 22
Joined: Aug 29 2019 6:30am

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

Post by hetm4n » Feb 20 2020 4:19pm

Hi. Is it possible to make units on the display?

Like this :
Image

User avatar
johnybigh   1 µW

1 µW
Posts: 3
Joined: Feb 09 2020 12:29pm

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

Post by johnybigh » Feb 20 2020 7:18pm

Hi, where can I buy SW102 because PSWPower inform me that they don't know when shipment can be resumed.

Cristian   10 mW

10 mW
Posts: 21
Joined: Nov 06 2018 6:31am

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

Post by Cristian » Feb 21 2020 6:23am

I just received a 850C display from PSWPower today. I ordered it 1 week ago. You should be good to order.

Zelenaar   10 mW

10 mW
Posts: 34
Joined: Apr 11 2019 5:52am

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

Post by Zelenaar » Feb 21 2020 10:23am

Dear All,
Need some help with the sw102 0.6.7 firmware.

I was able to install succesfully the sw102-otaupdate-0.6.7.zip & TSDZ2-v0.54.0.hex (long ON/OFF press at startup is showing 0.6.7 + 0.54.0).

But I don't find the way how to enter the configuration menus :( .
According to the wiki it was changed with this release to "Enter configurations screen: ON/OFF quick click + long press"

I assume this is after a succesfull startup of the sw102 pressing once shortly on the ON/OFF (=> going to the second screen) and pressing for a longer period (1-2sec) again the ON/OFF.
But for me this is powering off the sw102.

Anybody a suggestion on what I'm doing wrong ?

2e issue :
I tried also to downgrade to sw102-otaupdate-0.6.5.zip, but this doesn't seem to work for me
After starting the upload the DFU disconnects ...

I (re)uploaded already multiple time succesfully the sw102-otaupdate-0.6.7.zip, but all downgrade attemps to 0.6.5 are failing
PS I never installed the 0.6.5 before as my previous installed version was sw102-otaupdate-0.19.11

Zelenaar   10 mW

10 mW
Posts: 34
Joined: Apr 11 2019 5:52am

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

Post by Zelenaar » Feb 21 2020 10:44am

some suggestions on the button usage on the sw102.

The extra [M] button ont the sw102 is easier accessible during the riding than the [ON/OFF] button
=> could we use the shortClick [M] to switch to the second screen (or even next screens) ?
+ (if a 2e mode would become available) longClick [M] to switch between street & offroad mode.

windburner   100 mW

100 mW
Posts: 48
Joined: Sep 24 2019 3:45pm

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

Post by windburner » Feb 21 2020 10:46am

Zelenaar wrote:
Feb 21 2020 10:23am
Dear All,
Need some help with the sw102 0.6.7 firmware.

... I don't find the way how to enter the configuration menus :( . ... ON/OFF quick click + long press[/i]" ... But for me this is powering off the sw102.
My first 15 tries also turned the power off!!!! After some muscle memory learning I finally got it. The key is, when it works on the quick click, the main1 screen does not change to main2, but remains there. If you see the panel change, it is going to power off with the long press. Believe me, I know your frustration. (But, I find that it is a very good thing that you now only go to the config menu with a different key sequence.)

Also, as I understand it, the version number can only be updated higher. If a new release is unusable, the only outs are 1) a quick fix or 2) a re-release of the prior workable version under a higher version number.
TerraTrike Rover Tandem - TSDZ2 48V 750W - 13AH Batteries - VLCD6-->SW102/v0.6.8 OSF-->VLCD6

Zelenaar   10 mW

10 mW
Posts: 34
Joined: Apr 11 2019 5:52am

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

Post by Zelenaar » Feb 21 2020 11:03am

windburner wrote:
Feb 21 2020 10:46am
Zelenaar wrote:
Feb 21 2020 10:23am
Dear All,
Need some help with the sw102 0.6.7 firmware.

... I don't find the way how to enter the configuration menus :( . ... ON/OFF quick click + long press[/i]" ... But for me this is powering off the sw102.
My first 15 tries also turned the power off!!!! After some muscle memory learning I finally got it. The key is, when it works on the quick click, the main1 screen does not change to main2, but remains there. If you see the panel change, it is going to power off with the long press. Believe me, I know your frustration. (But, I find that it is a very good thing that you now only go to the config menu with a different key sequence.)

Also, as I understand it, the version number can only be updated higher. If a new release is unusable, the only outs are 1) a quick fix or 2) a re-release of the prior workable version under a higher version number.

Tnx a lot windburner, it works indeed with a very, very quick click :wink:

skestans   100 W

100 W
Posts: 123
Joined: Jul 12 2019 12:42am
Location: Luxembourg

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

Post by skestans » Feb 22 2020 2:50am

shodr wrote:
Feb 17 2020 2:24pm
skestans wrote:
Feb 15 2020 12:40am
I flashed mine with a CH340 after accidentally frying my CP2102. I left the jumper open so I don’t know if my vcc was 3.3V or 5V on the CH340. BIT it worked without damage.

Your error has to do with windows not able to grab the com port to the serial adapter. I have a 850c with shot serial lines and the error is different in that case: you can grab the com port but it never detects the display turning on for flashing. And if you plug it back into the motor with stock firmware, the watt meter below the speed goes nuts, and the walk assist doesn’t do anything. These are the symptoms for shot serial on the 850c.

In your case it looks like a shitdows issue.
Hi,

did you use separate power for display or like in wiki.

I think I also shot my 850c serial line. Tried in win7, got same result.

In putty if I try to connect to it like in APT, it connects to it, then when I short press the power button I get "error reading from serial device", windows makes sound like I plugged in/out usb dongle, and putty freezes, with putty "inactive" on the status.

If I turn on 850c there is an error code 30h - which is related to serial connection.

Is there a way to test serial connection on 850c with computer.Don't have bafang motor to test it.

Should the RX led (on ttl dongle) be lit on when in flashing mode, voltage is only 1V (white RX line), on tx line (on ttl dongle) it is 3.3V (green line) and led is not on. There is also difference in resistance btw tx and rx line (15k ohm TX to GND vs 8k ohm on RX).

tnx.
Did you manage after all? I received a new 850C and with the same cable that worked for my other one, I can't flash this one. It won't power on while the flashing software is open and waiting, but it turns on fine when connected to power.

It also shows crazy numbers with the stock firmware when connected to the stock TSDZ2, like over 6200W power usage when the motor is idle sitting on the table on my bench.

What are the numbers engraved behind your display?

That's what it looks like: https://streamable.com/wafxa

EDIT: Nevermind, I'm an idiot... The GND wire got disconnected again and I didn't notice. When I plugged it back, it was able to flash. The 6200W usage was because the firmware loaded from the factory was for Bafang, not the TSDZ2. With the appropriate firmware image, it works properly.

skestans   100 W

100 W
Posts: 123
Joined: Jul 12 2019 12:42am
Location: Luxembourg

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

Post by skestans » Feb 23 2020 9:33am

casainho wrote:
Feb 20 2020 1:22pm
Improvement to Battery SOC

On current version of firmware, there are 2 different ways for calculating the battery SOC: 1. based on battery voltage and 2. based on Coulomb counting (counting the used watts from the battery).

Method 1. is not very precise and 2. is very good for my experience as also from the feedback from users, so, I decided to remove the 1.
2. has the disadvantage that user needs to configure the right value for his battery Wh, but nowadays it is the most well know technical characteristics of ebike batteries because of range. Also the user can very easily use the display to measure the real value of his own battery.

Also, I decided to improve the 2., by considering the power loss on the battery internal resistance (this includes the cables), here an example how this power loss on the battery is relevant:

1. my battery has 350Wh (3.6V each cell * 3.5 amps/h each cell * 14 series (52V) * 2 paralel = 3.6*3.5*14*2 = 350Wh
2. my battery has internal resistance of 250 milli ohms (I did adjusted this value on the display until the voltage keep mostly stable while riding with motor pulling max current)

Let's say I am driving with motor pulling like 15 amps from the battery, the power loss is: P = R * I * I = 0.25 * 15 * 15 = 56 watts.
Since my battery has 350Wh, 56 watts of power means a 16% loss on the battery internals!! This means this value should be considered so the SOC can be more accurate.

Also, I decied to show on the battery configuration screen the battery power loss value, this is important for debug but mainly to educate the users that want to learn more about all this and maybe optimize their battery builds and/or the amount assistance power asked from the motor.

I also changed the battery icon on SW102 to be similar to the one on the 850C.

Here some pictures, in this case on SW102 but the 850C is similar:

Image Image
I have issues with the Coulomb method. I set the reset voltage to the voltage the BMS indicates after charging 90%, but the voltage varies while using the battery and it reset the counter constantly for a while because the battery voltage osciallates above and below the voltage threshold.

Am I the only one? What did I misconfigure? If not, would it make sense for the software to keep track of the last seen voltage and unless there is a big difference with the voltage measured at next power on (i.e. the user most likely charged the battery inbetween), then don't reset the counter?

hefest   100 W

100 W
Posts: 140
Joined: Jan 11 2019 4:55am

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

Post by hefest » Feb 23 2020 12:32pm

Today finally installed and tried 0.54 version with sw102 0.6.7.
I'm not sure how the whole thing with assist levels should work but it looks like I lost a lot of power on climbing. When I'm pushing hard up the hill no matter what assist level I'm using it's not going over 450-500w. I couldn't hit 750w mark. Max current is set at 16A.

hefest   100 W

100 W
Posts: 140
Joined: Jan 11 2019 4:55am

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

Post by hefest » Feb 23 2020 12:39pm

hetm4n wrote:
Feb 20 2020 4:19pm
Hi. Is it possible to make units on the display?

Like this :
Image
I'd like to have this as well. Instead of showing human power I'd rather like to see motor temperature. I'm really interested how well my heatsink fix is working but it looks like temperature cant be seen at all on 0.6.7 sw102.

casainho   10 GW

10 GW
Posts: 4099
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Feb 23 2020 1:06pm

hefest wrote:
Feb 23 2020 12:39pm
but it looks like temperature cant be seen at all on 0.6.7 sw102.
Or you don't know how to read the instructions on the wiki.
- 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.

hefest   100 W

100 W
Posts: 140
Joined: Jan 11 2019 4:55am

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

Post by hefest » Feb 23 2020 1:17pm

casainho wrote:
Feb 23 2020 1:06pm
hefest wrote:
Feb 23 2020 12:39pm
but it looks like temperature cant be seen at all on 0.6.7 sw102.
Or you don't know how to read the instructions on the wiki.
That could be the case, going straight to wiki to try to decipher how to change the display on sw102.

hefest   100 W

100 W
Posts: 140
Joined: Jan 11 2019 4:55am

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

Post by hefest » Feb 23 2020 1:20pm

casainho wrote:
Feb 23 2020 1:06pm
hefest wrote:
Feb 23 2020 12:39pm
but it looks like temperature cant be seen at all on 0.6.7 sw102.
Or you don't know how to read the instructions on the wiki.
I just went through wiki again and can't find anything that points to the way to set sw102 display so I can see current temperature. Am I reading wrong wiki?

https://github.com/OpenSource-EBike-fir ... on-display

PS: found it!
Last edited by hefest on Feb 23 2020 1:45pm, edited 1 time in total.

Jmauld   10 mW

10 mW
Posts: 22
Joined: Feb 15 2020 8:02am

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

Post by Jmauld » Feb 23 2020 1:37pm

If I’m looking to buy a tsdz2 motor is there a recommended hardware setup that would allow the most freedom when running the open source software? I’d like to have a 750W, 48V mid-drive that will accommodate a rear coaster brake.

I’ve seen someone state that one of the 36v versions Converted to 48v may be better than buying a 48v motor? I’m also having trouble finding a 48v version with the coaster brake option. Does the coaster brake version have a power limit that’s lower than the standard version?

Post Reply