TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Electric Motors and Controllers
Popo15   10 mW

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

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by Popo15 » Feb 26 2020 9:09am

Thank you very much Buba, a hug.

Rydon   100 W

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

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by Rydon » Feb 26 2020 6:44pm

Nice to hear from you Buba! Thanks for checking in. Maybe now we can get 'beta1' out of the name of this awesome v0.20.0 firmware. :)

cream   10 µW

10 µW
Posts: 5
Joined: Sep 25 2019 3:07am

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by cream » Mar 06 2020 5:12am

More hugs:) Welcome back. Awesome work with TSDZ OSF, long story short, I totally forgot I have a car :wink:

maximusdm   10 W

10 W
Posts: 90
Joined: Sep 08 2018 12:51pm

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by maximusdm » Mar 11 2020 5:40am

buba wrote:
Feb 23 2020 7:11pm
Long time, no buba... :wink:
Glad all is well! Can't wait to try some new things!

chri27.5   10 mW

10 mW
Posts: 34
Joined: Jan 25 2019 9:46am

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by chri27.5 » Mar 11 2020 3:31pm

Hello,
today I tried the Mbrusa modification to fix the overrang on lcd3.
I must say that it works very well, I posted a video made with the phone, obviously it is not the best, but the arrest is clearly visible.

https://youtu.be/r3RW_21sJTc


Ciao,
oggi ho provato la modifica Mbrusa per sistemare l'overrang su lcd3.
Devo dire che funziona benissimo, ho postato un video fatto con il telefono, ovviamente non è il massimo, però si vede bene l'arresto.

mbrusa   10 W

10 W
Posts: 97
Joined: Dec 11 2019 12:13am

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by mbrusa » Mar 12 2020 4:50am

I think it's time to try the "overrun" modification.
I start from version 20 beta 1 for LCD3, by the weekend I will release the code and the description of the fix, I am preparing it.
Obviously there will also be the version for original displays.
Attachments
TSDZ2-v0.20.1-LCD3-fix_overrun.zip
(20.6 KiB) Downloaded 44 times
Flexible OpenSource firmware for TongSheng TSDZ2 motor and VLCD5 VLCD6 XH18 displays
https://github.com/emmebrusa/TSDZ2-Smart-EBike-1

casainho   10 GW

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

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by casainho » Mar 12 2020 4:53am

mbrusa wrote:
Mar 12 2020 4:50am
I think it's time to try the "overrun" modification.
I start from version 20 beta 1 for LCD3, by the weekend I will release the code and the description of the fix, I am preparing it.
Obviously there will also be the version for original displays.
Can you please share the source code as also describe the changes you did and why? can you give technical explanation? thanks.
- 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.

mbrusa   10 W

10 W
Posts: 97
Joined: Dec 11 2019 12:13am

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by mbrusa » Mar 12 2020 4:56am

yes, I'm preparing it.
Flexible OpenSource firmware for TongSheng TSDZ2 motor and VLCD5 VLCD6 XH18 displays
https://github.com/emmebrusa/TSDZ2-Smart-EBike-1

casainho   10 GW

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

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by casainho » Mar 12 2020 4:58am

mbrusa wrote:
Mar 12 2020 4:56am
yes, I'm preparing it.
I was expecting to see the source code on that zip file, as OpenSource you also need to provide the source code and not only the HEX file.
- 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.

mbrusa   10 W

10 W
Posts: 97
Joined: Dec 11 2019 12:13am

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by mbrusa » Mar 12 2020 5:17am

Of course I will also put the source code, I am preparing the description, I seem to have been clear.
Flexible OpenSource firmware for TongSheng TSDZ2 motor and VLCD5 VLCD6 XH18 displays
https://github.com/emmebrusa/TSDZ2-Smart-EBike-1

maximusdm   10 W

10 W
Posts: 90
Joined: Sep 08 2018 12:51pm

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by maximusdm » Mar 12 2020 5:47am

mbrusa wrote:
Mar 12 2020 5:17am
Of course I will also put the source code, I am preparing the description, I seem to have been clear.
Thank you for taking the time and effort to add the change also to LCD3 version. This is highly appreciated!

mbrusa   10 W

10 W
Posts: 97
Joined: Dec 11 2019 12:13am

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by mbrusa » Mar 12 2020 9:58am

Casainho, here is the description and the source code, I hope it is also useful for the main project
I hope that after the automatic translation it is still understandable.

The code to calculate and activate the PWM deceleration ramp is in the ebike_app.c file, this introduces a significant delay when you stop pedaling.
I added other code for this function in motor.c, (PWM frequency).
I tried to do it in a simple way by minimizing the lines of code.
The added code works in parallel with the existing one that has not been deleted.

added code:
TSDZ2-20beta1-fix_overrun-1.jpg
TSDZ2-20beta1-fix_overrun-1.jpg (115.08 KiB) Viewed 1542 times
variable declaration:
"ui8_cadence_sensor_stop_flag" state of the pedals stopped.
"ui16_cadence_sensor_ticks_stop" number of pulses of the tick counter beyond which the pedals are considered stationary.

TSDZ2-20beta1-fix_overrun-2.jpg
TSDZ2-20beta1-fix_overrun-2.jpg (132.93 KiB) Viewed 1542 times
Added direct activation of the PWM deceleration ramp with "ui8_cadence_sensor_stop_flag", previously activated in ebike_app.c due to the absence of assistance.
With the pedals stopped "ui8_cadence_sensor_stop_flag", direct assignment ui16_controller_duty_cycle_ramp_down_inverse_step = PWM_DUTY_CYCLE_RAMP_DOWN_INVERSE_STEP_MIN. Previously the value was calculated as a function of the speed in ebike.c.
The PWM_DUTY_CYCLE_RAMP_DOWN_INVERSE_STEP_MIN value was used by the brake sensors but always in ebike_app.c. For this I also added "OR ui8_brake_state".
The PWM_DUTY_CYCLE_RAMP_DOWN_INVERSE_STEP_MIN value in main.h has not changed.

TSDZ2-20beta1-fix_overrun-3.jpg
TSDZ2-20beta1-fix_overrun-3.jpg (104.61 KiB) Viewed 1542 times
TSDZ2-20beta1-fix_overrun-4.jpg
TSDZ2-20beta1-fix_overrun-4.jpg (110.92 KiB) Viewed 1542 times
Calculation of the value of "ui16_cadence_sensor_ticks_stop", in standard and advanced cadence sensor mode. They are different values.
The optimal values were obtained experimentally.
Increasing them increases the overrun time, decreasing them lacks assistance at the start.

TSDZ2-20beta1-fix_overrun-5.jpg
TSDZ2-20beta1-fix_overrun-5.jpg (71.56 KiB) Viewed 1542 times
Check the state of the pedals.
When "ui16_cadence_sensor_ticks" has a valid value and "ui16_cadence_sensor_ticks_counter" exceeds the value of "ui16_cadence_sensor_ticks_stop", the pedals are considered stationary.

motor.c
(35.51 KiB) Downloaded 28 times
motor.c source code TSDZ2 20 beta 1 version only for LCD3, with overrun modification.
Flexible OpenSource firmware for TongSheng TSDZ2 motor and VLCD5 VLCD6 XH18 displays
https://github.com/emmebrusa/TSDZ2-Smart-EBike-1

casainho   10 GW

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

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by casainho » Mar 12 2020 10:09am

mbrusa wrote:
Mar 12 2020 9:58am
Casainho, here is the description and the source code, I hope it is also useful for the main project
I hope that after the automatic translation it is still understandable.
Thanks for all this details!! This is a great collaboration with all other forks/project versions.

I understand that the PWM ramp up and down plays an important role on the reaction time of the motor... the thing was that I tried a few times different and I saw the motor rotate on my bicycle frame at startup or stop, when the ramp up is to fast -- so, to have faster reaction the forces applied by the motor on the frame seem to be stronger and I was afraid to damage my frame and the motor shell... -- do you have the same felling / results?? -- like the motor is pulling the chain with a strong torque and suddenly you disable the full torque...
- 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.

mbrusa   10 W

10 W
Posts: 97
Joined: Dec 11 2019 12:13am

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by mbrusa » Mar 12 2020 10:28am

I have not changed the value of the PWM deceleration ramp, I have only reduced the time between stopping the pedals and starting the ramp.
The PWM_DUTY_CYCLE_RAMP_DOWN_INVERSE_STEP_MIN value remained 8, I have never tried to decrease it.
It is the same value used with the activation of the brakes or with an motor error.
The one calculated as a function of speed, still used with the pedals in motion, is between 8 and 40.
I am using this modification without problems.
Flexible OpenSource firmware for TongSheng TSDZ2 motor and VLCD5 VLCD6 XH18 displays
https://github.com/emmebrusa/TSDZ2-Smart-EBike-1

mbrusa   10 W

10 W
Posts: 97
Joined: Dec 11 2019 12:13am

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by mbrusa » Mar 13 2020 3:04am

A question to those who use the throttle.
Does it still work with fix overrun?
Flexible OpenSource firmware for TongSheng TSDZ2 motor and VLCD5 VLCD6 XH18 displays
https://github.com/emmebrusa/TSDZ2-Smart-EBike-1

agphil   1 mW

1 mW
Posts: 11
Joined: Jan 17 2020 1:02pm

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by agphil » Mar 13 2020 8:25am

mbrusa wrote:
Mar 12 2020 9:58am
Casainho, here is the description and the source code, I hope it is also useful for the main project
...
Does the overrun feature make the brake sensor more or less useless since you are usually not pedaling when braking?

mbrusa   10 W

10 W
Posts: 97
Joined: Dec 11 2019 12:13am

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by mbrusa » Mar 13 2020 10:26am

It is not the same, the intervention of the brake sensors is immediate and they immediately activate the PWM deceleration ramp.
When the pedals stop, there is always a delay, necessary to verify that they are stationary.
There is also a non-software aspect, it can happen to brake suddenly while you are still pedaling!
Flexible OpenSource firmware for TongSheng TSDZ2 motor and VLCD5 VLCD6 XH18 displays
https://github.com/emmebrusa/TSDZ2-Smart-EBike-1

vshitikov   1 W

1 W
Posts: 62
Joined: Mar 05 2020 7:24am

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by vshitikov » Mar 13 2020 3:34pm

Great contribution. If someone merges it into 850c 0.54 version I'm willing to test it. I'm not sure I can merge this changes myself...

mbrusa   10 W

10 W
Posts: 97
Joined: Dec 11 2019 12:13am

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by mbrusa » Mar 16 2020 3:32am

Here is the "fix overrun" update in the TSDZ2-20beta1 version, for the LCD3 display.
The files changed are 3, ebike_app.c, motor.c, motor.h
I had not considered the riding modes with stationary pedals, which consequently do not work.
Now "fix overrun" is disabled in WALK ASSIST, CRUISE, THROTTLE mode and CADENCE SENSOR CALIBRATION MODE.
For this the variable ui8_fix_overrun_enabled has been added.
TSDZ2-20beta1-fix_overrun_update-1.jpg
TSDZ2-20beta1-fix_overrun_update-1.jpg (53.18 KiB) Viewed 1277 times
TSDZ2-20beta1-fix_overrun_update-2.jpg
TSDZ2-20beta1-fix_overrun_update-2.jpg (57.32 KiB) Viewed 1277 times
TSDZ2-20beta1-fix_overrun_update-3.jpg
TSDZ2-20beta1-fix_overrun_update-3.jpg (105.98 KiB) Viewed 1277 times
TSDZ2-20beta1-fix_overrun_update-4.jpg
TSDZ2-20beta1-fix_overrun_update-4.jpg (83.32 KiB) Viewed 1277 times
Attached: HEX file and source code of the modified files.
TSDZ2-v0.20.1-LCD3-fix_overrun_update.zip
(42.96 KiB) Downloaded 40 times
I don't have LCD3, I would be happy with the confirmation of correct working.
Thank you.
Flexible OpenSource firmware for TongSheng TSDZ2 motor and VLCD5 VLCD6 XH18 displays
https://github.com/emmebrusa/TSDZ2-Smart-EBike-1

casainho   10 GW

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

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by casainho » Mar 16 2020 3:36am

vshitikov wrote:
Mar 13 2020 3:34pm
Great contribution. If someone merges it into 850c 0.54 version I'm willing to test it. I'm not sure I can merge this changes myself...
I want to get this on the firmware but currently there is a higher priority issue to solve then I will add this improvement.
- 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.

jeff.page.rides   100 W

100 W
Posts: 135
Joined: Aug 13 2019 10:16am

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by jeff.page.rides » Mar 16 2020 7:39pm

mbrusa wrote:
Mar 16 2020 3:32am
Here is the "fix overrun" update in the TSDZ2-20beta1 version, for the LCD3 display.
The files changed are 3, ebike_app.c, motor.c, motor.h
I had not considered the riding modes with stationary pedals, which consequently do not work.
Now "fix overrun" is disabled in WALK ASSIST, CRUISE, THROTTLE mode and CADENCE SENSOR CALIBRATION MODE.
For this the variable ui8_fix_overrun_enabled has been added.
TSDZ2-20beta1-fix_overrun_update-1.jpg
TSDZ2-20beta1-fix_overrun_update-2.jpg
TSDZ2-20beta1-fix_overrun_update-3.jpg
TSDZ2-20beta1-fix_overrun_update-4.jpg
Attached: HEX file and source code of the modified files.
TSDZ2-v0.20.1-LCD3-fix_overrun_update.zip
I don't have LCD3, I would be happy with the confirmation of correct working.
Thank you.
So to be able to install this overrun fix we have to be able to compile the files on our own?
We can't just install it like we can an update?
If that's the case it would be really great for someone to compile it so those that can't compile can use the overrun fix.

mbrusa   10 W

10 W
Posts: 97
Joined: Dec 11 2019 12:13am

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by mbrusa » Mar 17 2020 2:07am

In the zip file, in addition to the source code, there is also the HEX file already compiled and ready to be flashed.
Flexible OpenSource firmware for TongSheng TSDZ2 motor and VLCD5 VLCD6 XH18 displays
https://github.com/emmebrusa/TSDZ2-Smart-EBike-1

jeff.page.rides   100 W

100 W
Posts: 135
Joined: Aug 13 2019 10:16am

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by jeff.page.rides » Mar 17 2020 9:28am

mbrusa wrote:
Mar 17 2020 2:07am
In the zip file, in addition to the source code, there is also the HEX file already compiled and ready to be flashed.
There is only 1 hex file, don't we need 2 one for the LCD3 and one for the TSDZ2?

mbrusa   10 W

10 W
Posts: 97
Joined: Dec 11 2019 12:13am

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by mbrusa » Mar 17 2020 9:35am

The HEX file is for the TSDZ2 controller, only that has changed.
For LCD3, the buba 20 beta 1 version is still fine.
Flexible OpenSource firmware for TongSheng TSDZ2 motor and VLCD5 VLCD6 XH18 displays
https://github.com/emmebrusa/TSDZ2-Smart-EBike-1

Rydon   100 W

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

Re: TSDZ2 open source firmware only for KT-LCD3 (v0.19.0 / v.0.20.0beta1)

Post by Rydon » Mar 17 2020 1:18pm

mbrusa wrote:
Mar 17 2020 9:35am
The HEX file is for the TSDZ2 controller, only that has changed.
For LCD3, the buba 20 beta 1 version is still fine.
Ok, got it. Having LCD3 in the title of the hex file made us think it was for the KT-LCD3. We will try it in the motor today. Thanks!

Post Reply