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

Electric Motors and Controllers
casainho   10 GW

10 GW
Posts: 4101
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 » Jan 27 2020 5:07am

Localhorst666 wrote:
Jan 27 2020 5:03am
casainho wrote:
Jan 27 2020 4:23am
Are you using lights? do you have lights installed? because there are issues with lights currently. Other than this, I don´t have a clue and that is very strange behavior...
Yes, I'm using lights! They are installed at Y-splitter of speed sensor. I guess, that will be the cause then.
Is it an issue with newer releases only? Could I help you to solve this issue somehow?
Try with lights disabled and if does not work, then disconnect them and try again.
- 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.

Localhorst666   1 mW

1 mW
Posts: 10
Joined: Jan 17 2020 6:51am

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

Post by Localhorst666 » Jan 27 2020 5:40am

OK, I just read this issue #65 on GitHub. When I checked speed sensor yesterday, it seems to be working without light. I was able to start motor assistance three or four times, but I did not do a real test drive. So, I think you are right!

Should I measure the battery current just of my lights? Would that be an interesting value for you to fix this issue? But I think an individual value for lights current would be fine, like you proposed on GitHub. Every bike has a different lights setup.

I'll check it this evening and inform again. Thank you very much!

casainho   10 GW

10 GW
Posts: 4101
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 » Jan 27 2020 6:17am

Localhorst666 wrote:
Jan 27 2020 5:40am
OK, I just read this issue #65 on GitHub. When I checked speed sensor yesterday, it seems to be working without light. I was able to start motor assistance three or four times, but I did not do a real test drive. So, I think you are right!

Should I measure the battery current just of my lights? Would that be an interesting value for you to fix this issue? But I think an individual value for lights current would be fine, like you proposed on GitHub. Every bike has a different lights setup.

I'll check it this evening and inform again. Thank you very much!
Yes, just do like it is written on issue #65 on Github. Measure the battery while the motor is stopped and the lights are on and report.
- 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.

ezrider1199   1 W

1 W
Posts: 64
Joined: Jul 02 2019 5:42pm

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

Post by ezrider1199 » Jan 27 2020 9:00am

@casainho Is it possible for future enhancement to save the odometer field? If i turn off using the battery switch, i think the information gets lost.

Localhorst666   1 mW

1 mW
Posts: 10
Joined: Jan 17 2020 6:51am

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

Post by Localhorst666 » Jan 27 2020 11:54am

ezrider1199 wrote:@casainho Is it possible for future enhancement to save the odometer field? If i turn off using the battery switch, i think the information gets lost.
Hi, it is saved I think. I disconnected battery for 2 days at the weekend and the value is still the same like on Friday. But I have an issue with the clock.

Maybe odometer will be saved if you turn off by using remote switch only!?

casainho   10 GW

10 GW
Posts: 4101
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 » Jan 27 2020 12:28pm

Localhorst666 wrote:
Jan 27 2020 11:54am
ezrider1199 wrote:@casainho Is it possible for future enhancement to save the odometer field? If i turn off using the battery switch, i think the information gets lost.
Hi, it is saved I think. I disconnected battery for 2 days at the weekend and the value is still the same like on Friday. But I have an issue with the clock.

Maybe odometer will be saved if you turn off by using remote switch only!?
For the values to be saved, the user need to turn off the system as usually by long press on the ON/OFF button.
- 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.

ezrider1199   1 W

1 W
Posts: 64
Joined: Jul 02 2019 5:42pm

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

Post by ezrider1199 » Jan 27 2020 12:39pm

Maybe have like a frequent (but efficient) interval to save persistent values like the odometer or other future persistent values. For those who use other methods of turning the bike off
casainho wrote:
Jan 27 2020 12:28pm
For the values to be saved, the user need to turn off the system as usually by long press on the ON/OFF button.

casainho   10 GW

10 GW
Posts: 4101
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 » Jan 27 2020 12:59pm

ezrider1199 wrote:
Jan 27 2020 12:39pm
Maybe have like a frequent (but efficient) interval to save persistent values like the odometer or other future persistent values. For those who use other methods of turning the bike off
casainho wrote:
Jan 27 2020 12:28pm
For the values to be saved, the user need to turn off the system as usually by long press on the ON/OFF button.
Please give details of why do you need, how do you use and how often?
- 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.

ezrider1199   1 W

1 W
Posts: 64
Joined: Jul 02 2019 5:42pm

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

Post by ezrider1199 » Jan 27 2020 1:09pm

casainho wrote:
Jan 27 2020 12:59pm
ezrider1199 wrote:
Jan 27 2020 12:39pm
Maybe have like a frequent (but efficient) interval to save persistent values like the odometer or other future persistent values. For those who use other methods of turning the bike off
casainho wrote:
Jan 27 2020 12:28pm
For the values to be saved, the user need to turn off the system as usually by long press on the ON/OFF button.
Please give details of why do you need, how do you use and how often?
I have a rear and front light and most of the times i just shut off the battery switch which turns everything off. The lights are wired to a 12v step down, they have their own switches in a semi-convenient location but nothing is more convenient than just shutting off the battery switch.. like maybe its possible to save persistent values every 10 seconds or something.. this one is for the suggestion box :D

thank you

casainho   10 GW

10 GW
Posts: 4101
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 » Jan 27 2020 1:36pm

ezrider1199 wrote:
Jan 27 2020 1:09pm
casainho wrote:
Jan 27 2020 12:59pm
ezrider1199 wrote:
Jan 27 2020 12:39pm
Maybe have like a frequent (but efficient) interval to save persistent values like the odometer or other future persistent values. For those who use other methods of turning the bike off
casainho wrote:
Jan 27 2020 12:28pm
For the values to be saved, the user need to turn off the system as usually by long press on the ON/OFF button.
Please give details of why do you need, how do you use and how often?
I have a rear and front light and most of the times i just shut off the battery switch which turns everything off. The lights are wired to a 12v step down, they have their own switches in a semi-convenient location but nothing is more convenient than just shutting off the battery switch.. like maybe its possible to save persistent values every 10 seconds or something.. this one is for the suggestion box :D

thank you
Ok I understand. This is not a priority to me. Put this as an issue on Github , as a enhancement, so this will not be forgotten and maybe some other developer can implement this, on the display firmware.
- 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.

Localhorst666   1 mW

1 mW
Posts: 10
Joined: Jan 17 2020 6:51am

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

Post by Localhorst666 » Jan 27 2020 1:47pm

ezrider1199 wrote:
casainho wrote:
Jan 27 2020 12:59pm
ezrider1199 wrote:
Jan 27 2020 12:39pm
Maybe have like a frequent (but efficient) interval to save persistent values like the odometer or other future persistent values. For those who use other methods of turning the bike off
casainho wrote:
Jan 27 2020 12:28pm
For the values to be saved, the user need to turn off the system as usually by long press on the ON/OFF button.
Please give details of why do you need, how do you use and how often?
I have a rear and front light and most of the times i just shut off the battery switch which turns everything off. The lights are wired to a 12v step down, they have their own switches in a semi-convenient location but nothing is more convenient than just shutting off the battery switch.. like maybe its possible to save persistent values every 10 seconds or something.. this one is for the suggestion box :D

thank you
That would be a possible solution for my "light Problem" as well... Use a step down and not switching lights by software. Image

@casainho
I just checked assistance regarding lights. My problem is caused by the lights! If they are switched on, the assist goes off. As soon as I turn them off, the motor turns on and it works very well!

Battery current = 0,2 amps (measured by display)

If you need a more exact value ,I have to use a measuring instument directly at the battery.

casainho   10 GW

10 GW
Posts: 4101
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 » Jan 27 2020 2:10pm

Localhorst666 wrote:
Jan 27 2020 1:47pm
@casainho
I just checked assistance regarding lights. My problem is caused by the lights! If they are switched on, the assist goes off. As soon as I turn them off, the motor turns on and it works very well!

Battery current = 0,2 amps (measured by display)

If you need a more exact value ,I have to use a measuring instument directly at the battery.
Let´s see if I can do something for next version, I think it may take 2 weeks at least.
- 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.

Localhorst666   1 mW

1 mW
Posts: 10
Joined: Jan 17 2020 6:51am

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

Post by Localhorst666 » Jan 27 2020 2:15pm

casainho wrote:
Jan 27 2020 2:10pm
Localhorst666 wrote:
Jan 27 2020 1:47pm
@casainho
I just checked assistance regarding lights. My problem is caused by the lights! If they are switched on, the assist goes off. As soon as I turn them off, the motor turns on and it works very well!

Battery current = 0,2 amps (measured by display)

If you need a more exact value ,I have to use a measuring instument directly at the battery.
Let´s see if I can do something for next version, I think it may take 2 weeks at least.
Thank you very much!

skestans   100 W

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

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

Post by skestans » Jan 27 2020 3:16pm

So I want to check the pinout of my motor/controller to determine how to hook up the display for flashing.

I was planning on setting the meter to 20V DC, and hooking up the black probe to an arbitrary pin. Then move the red probe to every other pin in succession to find the one that carries the battery voltage.

I am hesitant to do this because I'm worried I'll short something by not knowing which pin is GND. What if I hook up the black probe to the TXD pin for example and the red probe to the 52V pin? Will that send 52V down the TXD line and fry the controller? Or that's not how multimeters work and can safely take measurements this way?

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 » Jan 27 2020 3:34pm

Multimeters set to voltage have a very high input resistance. So measuring between +Vin and TxD shouldn't cause a problem.

You should be able to find the gnd wire by disconnecting your battery and waiting several minutes. next, measure the voltage between the battery minus connection (motor side) and one of the pins going to the display (also the motor side connector). If you are sure there is no voltage between those, measure the resistance between them. If the display pin is gnd, it should measure close to zero ohms between that display pin and battery gnd.

Once you know your gnd pin, reconnect the battery and find the pin that passes the battery voltage to the display.
If you reconnect the original display, you should have battery voltage on another pin when you turn the display on. That voltage is used to turn the motor controller on.

TXD and RXD signal might carry 3 - 5V on TXD. So the motor TXD should have a voltage and the display TXD should have a voltage.
TXD of the display should be connected to RXD of the motor and the other way around.

This doesn't give you the connections on display side. Without opening it and partially understanding how it's electronics work, those are hard to determine. If you use the wrong pin as gnd or connect more than 20V to the wrong pin, you will damage your display.

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 » Jan 28 2020 2:30am

My assumption was that since the motor and the display work together, they’re both wired to be compatible.

And if I map the pin that carries battery voltage and ground on the motor side, then I know how to wire my home made flashing device to be the same.

Then it’s a matter of finding TXD or RXD bi I believe I can try one way and swap them if it was not crossed without causing damage.

This way I wouldn’t have to take the display apart, would I?

I’m confused with the voltage changing which pin it’s on when the display is connected. Does that matter for flashing the display, or would I be able to flash if I connect the 30V booster to the pin that I measured battery voltage on when the display was disconnected, ground, and RX + TX?

dameri   100 W

100 W
Posts: 146
Joined: Sep 20 2018 10:57am

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

Post by dameri » Jan 28 2020 7:56am

850C_v0.6.4 is the best ever. I skipped the previous version due to the hurry. Big thanks to casainho. I have the odo working, I also use the lights through the speed sensor splitter and I have no problem.

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 » Jan 28 2020 2:37pm

Alright so it was a bit of a PEBKAC issue. I had switched the + and - wires at the exit of the voltage booster... my pinout (at least GND and battery voltage) are as on the photo on the previous page. The display now turns on powered from a wall adapter rather than the battery so I have the right pins. But I might have accidentally shorted the serial lines because it behaves erratically when hooked up to the bicycle (was fine before)

I’ll try flashing again this weekend because I need the bicycle functional for commuting during the week.

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 » Jan 29 2020 5:22am

Well, yes, display pinout and motor pinout should match, but the 850C is a display for bafang mid drive motors and you are using it on a TSDZ2 motor.
So originally, it's not just plug and play. If it worked before with the TSDZ2 motor, wiring should match.

Localhorst666   1 mW

1 mW
Posts: 10
Joined: Jan 17 2020 6:51am

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

Post by Localhorst666 » Jan 29 2020 7:56am

A minor issue: this (see attachment) happens sometimes when I change graph by using "-" / down. I read somewhere that another guy experienced the same.
IMG_20200128_204640.jpg
IMG_20200128_204640.jpg (32.61 KiB) Viewed 1146 times

ezrider1199   1 W

1 W
Posts: 64
Joined: Jul 02 2019 5:42pm

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

Post by ezrider1199 » Jan 29 2020 10:16am

Same here. Ive seen it too once when changing the graph.
Localhorst666 wrote:
Jan 29 2020 7:56am
A minor issue: this (see attachment) happens sometimes when I change graph by using "-" / down. I read somewhere that another guy experienced the same.IMG_20200128_204640.jpg

mrfusi0n   1 µW

1 µW
Posts: 3
Joined: Jan 25 2020 6:00pm

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

Post by mrfusi0n » Jan 29 2020 3:24pm

Hey all, so I just recently upgraded to 850C_v0.6.4 and associated motor firmware and I'm finding that the assistance does not seem to be very linear. Perhaps I need to play with it a bit more but so far the assistance seems to have a curve to it.

Prior to this update, I would generally ride on assistance level 5 which was almost exactly 1:1 with human power. If my power was 100W, the motor power was right around there too. Now, I find that if I pedal softly, the motor power is less than human power and if I pedal harder, the motor power becomes more than human power.

Is this by design? I did run through the calibration steps and enabled the feature but that doesn't seem to change this significantly for me. Correct me if I'm wrong, but I thought the calibration helps give more accurate human power values but shouldn't affect the equation to turn that into motor power.

ezrider1199   1 W

1 W
Posts: 64
Joined: Jul 02 2019 5:42pm

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

Post by ezrider1199 » Jan 29 2020 3:43pm

mrfusi0n wrote:
Jan 29 2020 3:24pm
Hey all, so I just recently upgraded to 850C_v0.6.4 and associated motor firmware and I'm finding that the assistance does not seem to be very linear. Perhaps I need to play with it a bit more but so far the assistance seems to have a curve to it.

Prior to this update, I would generally ride on assistance level 5 which was almost exactly 1:1 with human power. If my power was 100W, the motor power was right around there too. Now, I find that if I pedal softly, the motor power is less than human power and if I pedal harder, the motor power becomes more than human power.

Is this by design? I did run through the calibration steps and enabled the feature but that doesn't seem to change this significantly for me. Correct me if I'm wrong, but I thought the calibration helps give more accurate human power values but shouldn't affect the equation to turn that into motor power.

I think a few posts here have been hinting at optimizing the torque assist characteristics. For me it was that 0.02 is a bit weak and 0.03 is much too strong. In 0.03 assist it can spike to over 500w whereas in 0.02 its hard to pass 260w. So i can echo your remarks as well that it seems the jump is non-linear. Maybe we should keep track of feedback regarding the assist in a single github issue ie the one i opened #67?

mrfusi0n   1 µW

1 µW
Posts: 3
Joined: Jan 25 2020 6:00pm

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

Post by mrfusi0n » Jan 29 2020 4:38pm

ezrider1199 wrote:
Jan 29 2020 3:43pm
mrfusi0n wrote:
Jan 29 2020 3:24pm
Hey all, so I just recently upgraded to 850C_v0.6.4 and associated motor firmware and I'm finding that the assistance does not seem to be very linear. Perhaps I need to play with it a bit more but so far the assistance seems to have a curve to it.

Prior to this update, I would generally ride on assistance level 5 which was almost exactly 1:1 with human power. If my power was 100W, the motor power was right around there too. Now, I find that if I pedal softly, the motor power is less than human power and if I pedal harder, the motor power becomes more than human power.

Is this by design? I did run through the calibration steps and enabled the feature but that doesn't seem to change this significantly for me. Correct me if I'm wrong, but I thought the calibration helps give more accurate human power values but shouldn't affect the equation to turn that into motor power.

I think a few posts here have been hinting at optimizing the torque assist characteristics. For me it was that 0.02 is a bit weak and 0.03 is much too strong. In 0.03 assist it can spike to over 500w whereas in 0.02 its hard to pass 260w. So i can echo your remarks as well that it seems the jump is non-linear. Maybe we should keep track of feedback regarding the assist in a single github issue ie the one i opened #67?
Perhaps... but this seems like a different issue to me. The changelog for this last release include "changed motor control to be motor current and not battery/motor power". This doesn't seem right to me (but maybe I don't understand it). It seem to me like the most natural assistance would be controlling the motor power in relation to human power. When I'm applying 100W of power to the pedals, I want 100W of power from the motor (or some other fixed ratio depending on assistance level chosen). Motor current should simply be the means of reaching the desired motor power. Perhaps I just don't understand the changelog but power did seem to be much more linear before this last update than it is now.

casainho   10 GW

10 GW
Posts: 4101
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 » Jan 29 2020 8:52pm

mrfusi0n wrote:
Jan 29 2020 4:38pm
Perhaps... but this seems like a different issue to me. The changelog for this last release include "changed motor control to be motor current and not battery/motor power". This doesn't seem right to me (but maybe I don't understand it). It seem to me like the most natural assistance would be controlling the motor power in relation to human power. When I'm applying 100W of power to the pedals, I want 100W of power from the motor (or some other fixed ratio depending on assistance level chosen). Motor current should simply be the means of reaching the desired motor power. Perhaps I just don't understand the changelog but power did seem to be much more linear before this last update than it is now.
Previous, the motor current was always set to max value of 30 amps while the battery current was controlled. Now it is the inverse, battery current is always set to max value of 16 amps and motor current is controlled.

Looking at your feedback, maybe we should keep control the motor current BUT also the motor power in a way to limit the motor max power for it to be motor power = pedal human power * assist level factor. What do you think?

If so, then we would need 2 assist level factors for each assist level number:

1. motor current = human power * assist lever factor, for instance: motor current = 100 * 0.05 = 5 amps

2. motor power = human power * assist lever factor, for instance: motor power = 100 * 2.5 = 250 watts
- 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.

Post Reply