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

Electric Motors and Controllers
Joebill   10 µW

10 µW
Posts: 5
Joined: Oct 13 2019 8:08pm

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

Post by Joebill » Oct 15 2019 1:41am

casainho wrote:
Oct 10 2019 8:32am
elfnino wrote:
Oct 10 2019 2:08am
I have just flashed 850C_v0.4.2-bootloader.bin with home made bootloader box successfully and display turns on however the vertical screen flip is still present.
Also seems that I cannot flash it anymore as the display is not reacting to flashing signals from USBUART module as before.

Is there a chance that 0.4.2 could brick the UART/TTL capability of the display ?
About the vertical flip, follow the wiki instructions:

Bafang 850C: information and configuration
NOTE: some 850C displays have a different LCD inside and one of them will make the image flipped, in this case, go to configurations, LCD vertical flip, and change from default to invert. Next time you power up the display, the image should not be flipped anymore.

About the bootloader, usually the bootloader locks his own memory space at boot, so the firmware that runs after, can't change the bootloader memory and so the bootloader is protected.
I can't say there is no issue with the 850C bootloader...
I didn't quite follow the last part about the bootloader. Does that mean it can only be flashed once? (Sorry if I'm a bit slow)

User avatar
elfnino   100 mW

100 mW
Posts: 48
Joined: Mar 06 2019 5:09am

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

Post by elfnino » Oct 15 2019 2:28am

Joebill wrote:
Oct 15 2019 1:41am
casainho wrote:
Oct 10 2019 8:32am
elfnino wrote:
Oct 10 2019 2:08am
I have just flashed 850C_v0.4.2-bootloader.bin with home made bootloader box successfully and display turns on however the vertical screen flip is still present.
Also seems that I cannot flash it anymore as the display is not reacting to flashing signals from USBUART module as before.

Is there a chance that 0.4.2 could brick the UART/TTL capability of the display ?
About the vertical flip, follow the wiki instructions:

Bafang 850C: information and configuration
NOTE: some 850C displays have a different LCD inside and one of them will make the image flipped, in this case, go to configurations, LCD vertical flip, and change from default to invert. Next time you power up the display, the image should not be flipped anymore.

About the bootloader, usually the bootloader locks his own memory space at boot, so the firmware that runs after, can't change the bootloader memory and so the bootloader is protected.
I can't say there is no issue with the 850C bootloader...
I didn't quite follow the last part about the bootloader. Does that mean it can only be flashed once? (Sorry if I'm a bit slow)
I must admit I was wrong and when I checked all the cables I found broken Rx line. After fixing it I was able to re-flash the display again.
So there is nothing wrong with 0.4.2 it will not brick UART functionality on 850C display.

You can flash the display with UART multiple times.. I tested all the 0.4.x versions and no issues

Hope we can see 0.20.0 version for the 850C soon :?:

casainho   10 GW

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

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

Post by casainho » Oct 15 2019 4:59am

elfnino wrote:
Oct 15 2019 2:28am
Joebill wrote:
Oct 15 2019 1:41am
casainho wrote:
Oct 10 2019 8:32am
elfnino wrote:
Oct 10 2019 2:08am
I have just flashed 850C_v0.4.2-bootloader.bin with home made bootloader box successfully and display turns on however the vertical screen flip is still present.
Also seems that I cannot flash it anymore as the display is not reacting to flashing signals from USBUART module as before.

Is there a chance that 0.4.2 could brick the UART/TTL capability of the display ?
About the vertical flip, follow the wiki instructions:

Bafang 850C: information and configuration
NOTE: some 850C displays have a different LCD inside and one of them will make the image flipped, in this case, go to configurations, LCD vertical flip, and change from default to invert. Next time you power up the display, the image should not be flipped anymore.

About the bootloader, usually the bootloader locks his own memory space at boot, so the firmware that runs after, can't change the bootloader memory and so the bootloader is protected.
I can't say there is no issue with the 850C bootloader...
I didn't quite follow the last part about the bootloader. Does that mean it can only be flashed once? (Sorry if I'm a bit slow)
I must admit I was wrong and when I checked all the cables I found broken Rx line. After fixing it I was able to re-flash the display again.
So there is nothing wrong with 0.4.2 it will not brick UART functionality on 850C display.

You can flash the display with UART multiple times.. I tested all the 0.4.x versions and no issues

Hope we can see 0.20.0 version for the 850C soon :?:
Thanks for reporting.
- 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.

User avatar
elfnino   100 mW

100 mW
Posts: 48
Joined: Mar 06 2019 5:09am

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

Post by elfnino » Oct 15 2019 6:45am

Joebill wrote:
Oct 15 2019 1:36am
elfnino wrote:
Oct 10 2019 2:08am
I have just flashed 850C_v0.4.2-bootloader.bin with home made bootloader box successfully and display turns on however the vertical screen flip is still present.
Also seems that I cannot flash it anymore as the display is not reacting to flashing signals from USBUART module as before.

Is there a chance that 0.4.2 could brick the UART/TTL capability of the display ?
Any chance you can share any information on your successful set up? I'm looking to do the same.
No problem this is my final well working set up using "step up buck" instead of ebike buttery as power source..
The colors should match with bafang display cable

bafang extension cable - I recommend male to male (one end for bootloader box other for connecting display with TSDZ2)
https://www.aliexpress.com/item/32861639327.html

USBtoUART adapter - recomend this type as other was sensitive to AC power supply of laptop
https://www.aliexpress.com/item/32288431622.html

Step Up buck - DC booster
https://www.aliexpress.com/item/32807600304.html
Attachments
bootloader_box.jpg
bootloader_box.jpg (106.29 KiB) Viewed 3210 times
IMG_7266.jpg
IMG_7266.jpg (67.43 KiB) Viewed 3210 times

casainho   10 GW

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

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

Post by casainho » Oct 15 2019 7:01am

elfnino wrote:
Oct 15 2019 6:45am
Joebill wrote:
Oct 15 2019 1:36am
elfnino wrote:
Oct 10 2019 2:08am
I have just flashed 850C_v0.4.2-bootloader.bin with home made bootloader box successfully and display turns on however the vertical screen flip is still present.
Also seems that I cannot flash it anymore as the display is not reacting to flashing signals from USBUART module as before.

Is there a chance that 0.4.2 could brick the UART/TTL capability of the display ?
Any chance you can share any information on your successful set up? I'm looking to do the same.
No problem this is my final well working set up using "step up buck" instead of ebike buttery as power source..
The colors should match with bafang display cable

bafang extension cable - I recommend male to male (one end for bootloader box other for connecting display with TSDZ2)
https://www.aliexpress.com/item/32861639327.html

USBtoUART adapter - recomend this type as other was sensitive to AC power supply of laptop
https://www.aliexpress.com/item/32288431622.html

Step Up buck - DC booster
https://www.aliexpress.com/item/32807600304.html
Can you help to improve the wiki with this information?
- 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.

User avatar
elfnino   100 mW

100 mW
Posts: 48
Joined: Mar 06 2019 5:09am

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

Post by elfnino » Oct 15 2019 10:32am

casainho wrote:
Oct 15 2019 7:01am
Can you help to improve the wiki with this information?
Yes I will try.

casainho   10 GW

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

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

Post by casainho » Oct 15 2019 1:37pm

elfnino wrote:
Oct 15 2019 10:32am
casainho wrote:
Oct 15 2019 7:01am
Can you help to improve the wiki with this information?
Yes I will try.
I went and pasted your notes and images. If you think it can be improved, please go ahead and edit the wiki:

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.

h27   10 mW

10 mW
Posts: 23
Joined: Aug 28 2019 5:55pm

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

Post by h27 » Oct 15 2019 4:39pm

Has anybody been experimenting with turn signals/blinkers? I would like to add some to my tsdz2 because I am often riding at night on steep roads with lots of traffic and I don‘t like to let go the handlebar in this situation to signal a turn. I think adding electric turn signals would be a bit of a challenge because there is hardly enough power for the regular lights.

casainho   10 GW

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

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

Post by casainho » Oct 15 2019 6:04pm

h27 wrote:
Oct 15 2019 4:39pm
Has anybody been experimenting with turn signals/blinkers? I would like to add some to my tsdz2 because I am often riding at night on steep roads with lots of traffic and I don‘t like to let go the handlebar in this situation to signal a turn. I think adding electric turn signals would be a bit of a challenge because there is hardly enough power for the regular lights.
Hmmm, the signals could be some external system to TSDZ2, right?? There are no dependencies from the TSDZ2...

Maybe you can do something with an Arduino...
- 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.

h27   10 mW

10 mW
Posts: 23
Joined: Aug 28 2019 5:55pm

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

Post by h27 » Oct 16 2019 5:39am

casainho wrote:
Oct 15 2019 6:04pm
h27 wrote:
Oct 15 2019 4:39pm
Has anybody been experimenting with turn signals/blinkers? I would like to add some to my tsdz2 because I am often riding at night on steep roads with lots of traffic and I don‘t like to let go the handlebar in this situation to signal a turn. I think adding electric turn signals would be a bit of a challenge because there is hardly enough power for the regular lights.
Hmmm, the signals could be some external system to TSDZ2, right?? There are no dependencies from the TSDZ2...

Maybe you can do something with an Arduino...
External signal would be fine and Arduino would be nice as you could have control over blink rate etc. What I had in mind was a more fool proof solution such as an adaption of some existing system for motor bikes (combustion/scooters). There are many of these on the market, some need a relay, some seem to have the electronics included.
(https://www.ebay.com/itm/12-LED-Mini-Mo ... VQUgW6S_ww)

Also there are switches for the bar handle for the left/right signals, some including a button for a horn and light switch. Many of them work on 12 or 24 volt. It would be more elegant and safe to integrate something like this than adding some homemade electronics (at least in my case). Also there seem to be some legal requirements in some countries (it must give optical or acoustical signal to the driver if it is not working properly). Maybe it would be an idea to do something together with stronger head and tail lights running on 12 or 24V.

perryscope   100 W

100 W
Posts: 106
Joined: Jan 06 2019 4:29pm
Contact:

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

Post by perryscope » Oct 16 2019 7:32am

h27 wrote:
Oct 16 2019 5:39am
casainho wrote:
Oct 15 2019 6:04pm
h27 wrote:
Oct 15 2019 4:39pm
Has anybody been experimenting with turn signals/blinkers? I would like to add some to my tsdz2 because I am often riding at night on steep roads with lots of traffic and I don‘t like to let go the handlebar in this situation to signal a turn. I think adding electric turn signals would be a bit of a challenge because there is hardly enough power for the regular lights.
Hmmm, the signals could be some external system to TSDZ2, right?? There are no dependencies from the TSDZ2...

Maybe you can do something with an Arduino...
External signal would be fine and Arduino would be nice as you could have control over blink rate etc. What I had in mind was a more fool proof solution such as an adaption of some existing system for motor bikes (combustion/scooters). There are many of these on the market, some need a relay, some seem to have the electronics included.
(https://www.ebay.com/itm/12-LED-Mini-Mo ... VQUgW6S_ww)

Also there are switches for the bar handle for the left/right signals, some including a button for a horn and light switch. Many of them work on 12 or 24 volt. It would be more elegant and safe to integrate something like this than adding some homemade electronics (at least in my case). Also there seem to be some legal requirements in some countries (it must give optical or acoustical signal to the driver if it is not working properly). Maybe it would be an idea to do something together with stronger head and tail lights running on 12 or 24V.
I actually built a wireless Arduino based set of indicators/ rear light flasher and brake light for my 'Bike Train' which is a E-bike towing a recumbent trike.

I am happy to share the Arduino code (sorry never really finished it or used Github) its actually based around two Arduino nano boards using the HC12 TX/RX module as I needed it to be wireless, But you could easily simplify it and use just the receiver part and hard wire in a 3 way toggle switch for indicators and even link into the e brake for brake lights.
I 3D printed my own indicator switch and led indicator housing to make it a clean install on the bars. (This was an early example) I found it very usefull to have a visual indication on the bars to let you know if you had left the indicators on.
diy indicator.JPG
diy indicator.JPG (68.34 KiB) Viewed 3073 times
The receiver unit was a second Arduino nano that controlled some NeoPixel RGB leds housed in the indicator pods. These were nice as they run off 5v and being RGB easy to use as indicators or brake lights at will. It was just a case of change the patterns in the code.

If there is any interest into this I may revisit it and at least write-up what I did and share the code as it currently is.
I recorded a short video about it recently to give an idea of how it looked when we were discussing the TSDZ2 controlling the rear flashing lights.

Empowered people support rider and trustee
www.empoweredpeople.co.uk

jeff.page.rides   100 W

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

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

Post by jeff.page.rides » Oct 16 2019 6:18pm

I've been using version 20 Alpha 10 on one handcycle and version 20 beta 1 from Buba's original version on his drive on the other handcycle. We just Flashed the TSDZ2 that had Buba's original version with version 20 beta 1 from the official site. We didn't reflash that LCD3 with the different version 20. The problem I'm having is that the cadence doesn't work well anymore. On the other 2 versions it seems to be very accurate now with the new official version 20 beta 1 on the TSDZ2 but not the LCD3 it jumps around as far as 40 points at a time it's not accurate at all anymore. What I'd like to know is if it's not accurate because I only flashed the TSDZ2 or if some other problem is causing it not to be accurate anymore?

h27   10 mW

10 mW
Posts: 23
Joined: Aug 28 2019 5:55pm

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

Post by h27 » Oct 17 2019 2:52pm

perryscope wrote:
Oct 16 2019 7:32am
h27 wrote:
Oct 16 2019 5:39am
casainho wrote:
Oct 15 2019 6:04pm
h27 wrote:
Oct 15 2019 4:39pm
Has anybody been experimenting with turn signals/blinkers? I would like to add some to my tsdz2 because I am often riding at night on steep roads with lots of traffic and I don‘t like to let go the handlebar in this situation to signal a turn. I think adding electric turn signals would be a bit of a challenge because there is hardly enough power for the regular lights.
Hmmm, the signals could be some external system to TSDZ2, right?? There are no dependencies from the TSDZ2...

Maybe you can do something with an Arduino...
External signal would be fine and Arduino would be nice as you could have control over blink rate etc. What I had in mind was a more fool proof solution such as an adaption of some existing system for motor bikes (combustion/scooters). There are many of these on the market, some need a relay, some seem to have the electronics included.
(https://www.ebay.com/itm/12-LED-Mini-Mo ... VQUgW6S_ww)

Also there are switches for the bar handle for the left/right signals, some including a button for a horn and light switch. Many of them work on 12 or 24 volt. It would be more elegant and safe to integrate something like this than adding some homemade electronics (at least in my case). Also there seem to be some legal requirements in some countries (it must give optical or acoustical signal to the driver if it is not working properly). Maybe it would be an idea to do something together with stronger head and tail lights running on 12 or 24V.
I actually built a wireless Arduino based set of indicators/ rear light flasher and brake light for my 'Bike Train' which is a E-bike towing a recumbent trike.

I am happy to share the Arduino code (sorry never really finished it or used Github) its actually based around two Arduino nano boards using the HC12 TX/RX module as I needed it to be wireless, But you could easily simplify it and use just the receiver part and hard wire in a 3 way toggle switch for indicators and even link into the e brake for brake lights.
I 3D printed my own indicator switch and led indicator housing to make it a clean install on the bars. (This was an early example) I found it very usefull to have a visual indication on the bars to let you know if you had left the indicators on.
diy indicator.JPG

The receiver unit was a second Arduino nano that controlled some NeoPixel RGB leds housed in the indicator pods. These were nice as they run off 5v and being RGB easy to use as indicators or brake lights at will. It was just a case of change the patterns in the code.

If there is any interest into this I may revisit it and at least write-up what I did and share the code as it currently is.
I recorded a short video about it recently to give an idea of how it looked when we were discussing the TSDZ2 controlling the rear flashing lights.

Nice job, perryscope! I would be very interested in your code and some more details of your build. I‘m not sure if I understood everything you wrote: Did you do an Arduino controlled version and a TSDZ2 controlled version? Where did you plug it in? Battery? TSDZ2 cable? Separate battery?

ezrider1199   10 W

10 W
Posts: 77
Joined: Jul 02 2019 5:42pm

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

Post by ezrider1199 » Oct 17 2019 4:16pm

Hi,

I received a 850c from pswpower and am trying to flash it. I noticed it doesnt fit into my 4-1 cable because it came with a female end so i attempted to put on a new male connector (luckily had a spare). Cut it up and see that the colors are off and the pin positions dont match with what tsdz2 is expecting. So I tried to figure out and match up the pins according to this Image.

Here's where I am now

Image.


Currently I am able to plug an unflashed 850c to my controller and see it start up but I can't get it to flash... is there anything i can verify? I assume that because the 850c can startup that my wiring should be ok. The APT program doesn't show much in the way of errors. Thanks

Tsdz2 display --> 850c
Gnd, Black --> black
Batt V+, Red --> purple
Rx, Yellow --> white
Tx, Green --> green
5v, Blue --> orange

ezrider1199   10 W

10 W
Posts: 77
Joined: Jul 02 2019 5:42pm

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

Post by ezrider1199 » Oct 17 2019 7:15pm

So i got it to work since my last post...just tried everything all over again and pressed the power button vigorously to start the flashing and the progress bar came on

So far seems similar in functionality. I was expecting a bit of speed up with navigating menu and button responses compared to the LCD3 but its ok. I actively toggle the PAS so sometimes ill jump from lvl 2 to lvl 5 and with the lag it gets a bit frustrating..

perryscope   100 W

100 W
Posts: 106
Joined: Jan 06 2019 4:29pm
Contact:

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

Post by perryscope » Oct 18 2019 4:03am

h27 wrote:
Oct 17 2019 2:52pm
Nice job, perryscope! I would be very interested in your code and some more details of your build. I‘m not sure if I understood everything you wrote: Did you do an Arduino controlled version and a TSDZ2 controlled version? Where did you plug it in? Battery? TSDZ2 cable? Separate battery?
This was a separate project for our 'Bike Train' (before I even knew about the TSDZ2, so the tow bike is running a bafang BBS02)
so there is no integration with the TSDZ2 or indeed the Bafang motor I have on this bike.

It's based on two units.

1) A Transmitter on the handlebars made from an Arduino Nano and HC12 radio module and powered from the USB power from my Bafang Controller ( it only gets power from the display) This transmits a packet to the receiver every 300ms or so to indicate the status of the switches ( left, right,brake)

2) A Receiver on the trailing recumbent bike made from a second Arduino and HC12 radio module this is currently powered by a separate 3 cell LIPO battery (via a 5v Dc-dc converter) to power the Arduino and all the LEDs ( these take a surprising amount of power at 5v! they are a string of 40 I think) This Arduino listens for the packets and triggers the LED patterns as needed.

I made it as I needed a way to control the indicators on the rear bike from the front bike and i didn't want to have a cable between the two as I commonly have to disconnect the rear bike.

Maybe a photo of the setup would help as it is a little unusual I know :)
rear.JPG
rear.JPG (259.96 KiB) Viewed 2831 times

(h27) I will pm you the code as it stands, its not very tidy at this point, but it works. I would like to revisit it at some point to tidy it up and make a simple single unit for one bike that does not have the radio link and works of a single Ardunio nano. This would simplify things for anyone that just wants a separate unit controlled from a switch on the handlebar, but again separate from the TSDZ2 it may just draw power from the e bike battery.
Empowered people support rider and trustee
www.empoweredpeople.co.uk

Rydon   100 W

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

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

Post by Rydon » Oct 18 2019 4:39pm

jeff.page.rides wrote:
Oct 16 2019 6:18pm
I've been using version 20 Alpha 10 on one handcycle and version 20 beta 1 from Buba's original version on his drive on the other handcycle. We just Flashed the TSDZ2 that had Buba's original version with version 20 beta 1 from the official site. We didn't reflash that LCD3 with the different version 20. The problem I'm having is that the cadence doesn't work well anymore. On the other 2 versions it seems to be very accurate now with the new official version 20 beta 1 on the TSDZ2 but not the LCD3 it jumps around as far as 40 points at a time it's not accurate at all anymore. What I'd like to know is if it's not accurate because I only flashed the TSDZ2 or if some other problem is causing it not to be accurate anymore?
Jeff, the way you wrote this is a little confusing. Let me clarify:

v20 alpha 10 had steady and reliable cadence readings on the KT-LCD3 display
v20 beta 1 cadence jumps around by as much as 40 and is not steady.

This makes me wonder if there was a code change in the cadence low-pass filter in v20 beta 1

h27   10 mW

10 mW
Posts: 23
Joined: Aug 28 2019 5:55pm

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

Post by h27 » Oct 19 2019 7:14am

perryscope wrote:
Oct 18 2019 4:03am
h27 wrote:
Oct 17 2019 2:52pm
Nice job, perryscope! I would be very interested in your code and some more details of your build. I‘m not sure if I understood everything you wrote: Did you do an Arduino controlled version and a TSDZ2 controlled version? Where did you plug it in? Battery? TSDZ2 cable? Separate battery?
This was a separate project for our 'Bike Train' (before I even knew about the TSDZ2, so the tow bike is running a bafang BBS02)
so there is no integration with the TSDZ2 or indeed the Bafang motor I have on this bike.

It's based on two units.

1) A Transmitter on the handlebars made from an Arduino Nano and HC12 radio module and powered from the USB power from my Bafang Controller ( it only gets power from the display) This transmits a packet to the receiver every 300ms or so to indicate the status of the switches ( left, right,brake)

2) A Receiver on the trailing recumbent bike made from a second Arduino and HC12 radio module this is currently powered by a separate 3 cell LIPO battery (via a 5v Dc-dc converter) to power the Arduino and all the LEDs ( these take a surprising amount of power at 5v! they are a string of 40 I think) This Arduino listens for the packets and triggers the LED patterns as needed.

I made it as I needed a way to control the indicators on the rear bike from the front bike and i didn't want to have a cable between the two as I commonly have to disconnect the rear bike.

Maybe a photo of the setup would help as it is a little unusual I know :)
rear.JPG


(h27) I will pm you the code as it stands, its not very tidy at this point, but it works. I would like to revisit it at some point to tidy it up and make a simple single unit for one bike that does not have the radio link and works of a single Ardunio nano. This would simplify things for anyone that just wants a separate unit controlled from a switch on the handlebar, but again separate from the TSDZ2 it may just draw power from the e bike battery.
Thank you very much, perryscope, for the explanations and the code. This will be very helpful, when I try to build my turn signal/blinker and brake lights (I think I will go with the simpler hardwired version).
Your bike-train is a very nice project and build! :thumb:

jeff.page.rides   100 W

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

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

Post by jeff.page.rides » Oct 20 2019 9:07pm

Rydon wrote:
Oct 18 2019 4:39pm
jeff.page.rides wrote:
Oct 16 2019 6:18pm
I've been using version 20 Alpha 10 on one handcycle and version 20 beta 1 from Buba's original version on his drive on the other handcycle. We just Flashed the TSDZ2 that had Buba's original version with version 20 beta 1 from the official site. We didn't reflash that LCD3 with the different version 20. The problem I'm having is that the cadence doesn't work well anymore. On the other 2 versions it seems to be very accurate now with the new official version 20 beta 1 on the TSDZ2 but not the LCD3 it jumps around as far as 40 points at a time it's not accurate at all anymore. What I'd like to know is if it's not accurate because I only flashed the TSDZ2 or if some other problem is causing it not to be accurate anymore?
Jeff, the way you wrote this is a little confusing. Let me clarify:

v20 alpha 10 had steady and reliable cadence readings on the KT-LCD3 display
v20 beta 1 cadence jumps around by as much as 40 and is not steady.

This makes me wonder if there was a code change in the cadence low-pass filter in v20 beta 1
Version 20 alpha 1 cadence worked.
Version 20 beta 1 from Buba's own drive cadence worked.
Version 20 beta 1 from Buba's drive on that LCD3 with the official version 20 beta 1 on the TSDZ2 cadence does not work.

jeff.page.rides   100 W

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

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

Post by jeff.page.rides » Oct 21 2019 4:20am

jeff.page.rides wrote:
Oct 20 2019 9:07pm
Rydon wrote:
Oct 18 2019 4:39pm
jeff.page.rides wrote:
Oct 16 2019 6:18pm
I've been using version 20 Alpha 10 on one handcycle and version 20 beta 1 from Buba's original version on his drive on the other handcycle. We just Flashed the TSDZ2 that had Buba's original version with version 20 beta 1 from the official site. We didn't reflash that LCD3 with the different version 20. The problem I'm having is that the cadence doesn't work well anymore. On the other 2 versions it seems to be very accurate now with the new official version 20 beta 1 on the TSDZ2 but not the LCD3 it jumps around as far as 40 points at a time it's not accurate at all anymore. What I'd like to know is if it's not accurate because I only flashed the TSDZ2 or if some other problem is causing it not to be accurate anymore?
Jeff, the way you wrote this is a little confusing. Let me clarify:

v20 alpha 10 had steady and reliable cadence readings on the KT-LCD3 display
v20 beta 1 cadence jumps around by as much as 40 and is not steady.

This makes me wonder if there was a code change in the cadence low-pass filter in v20 beta 1
Version 20 alpha 1 cadence worked.
Version 20 beta 1 from Buba's own drive cadence worked.
Version 20 beta 1 from Buba's drive on that LCD3 with the official version 20 beta 1 on the TSDZ2 cadence does not work.
I just read my post, I ment version 20 Alpha 10 not 1

thineight   100 W

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

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

Post by thineight » Oct 21 2019 9:05am

Hello, Just some considerations about the street mode.
At the moment we have couple of parameters to set on the street mode: power (typically 250W) and speed (typically 25 km/h).
The Power cuts precisely at 250w then and does not allow any peak value above that, except some +25W of rounding.
We all know that native bikes allow peak power much greater than 250W, does anybody know the logic behind?
Is extra power allowed for maximum X seconds after which it is faded down to 250W?
It should be nice to discover that logic in order to transfer it also on the OSF->street mode, what do you think?
MTB KTM Ultra 29" - City bike DAYTONA 28"

bwb   10 mW

10 mW
Posts: 20
Joined: Jun 23 2019 7:07am

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

Post by bwb » Oct 21 2019 11:10am

thineight wrote:
Oct 21 2019 9:05am
Hello, Just some considerations about the street mode.
At the moment we have couple of parameters to set on the street mode: power (typically 250W) and speed (typically 25 km/h).
The Power cuts precisely at 250w then and does not allow any peak value above that, except some +25W of rounding.
We all know that native bikes allow peak power much greater than 250W, does anybody know the logic behind?
Is extra power allowed for maximum X seconds after which it is faded down to 250W?
It should be nice to discover that logic in order to transfer it also on the OSF->street mode, what do you think?
I didn't limit the power in street mode and it works/limits smootly. It is not like a lot of other e-bike that it's suddenly shuts off.
Last edited by bwb on Oct 22 2019 10:59am, edited 1 time in total.

Uturn   1 W

1 W
Posts: 58
Joined: Jun 06 2018 10:09am

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

Post by Uturn » Oct 22 2019 12:29am

I flashed the 'official' beta 0.20.0 beta1 on my LCD3. I feel much backwards turn resistance. I can activate power assist and 3 levels, and also E-MTB assist. Cadence assist does not appear on screen. On all modes there is no assist at all, in E-MTB the motor will turn for a second then stall. Setup in LCD 3 seemed to work well, also sensor calibration for advanced mode.
Now what could be the reason? Should I try Buba's pre 0.20.0 beta1? Where else to start to fix? Reflash the motor, too?

andrewgateway   1 mW

1 mW
Posts: 17
Joined: Sep 05 2019 5:11pm

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

Post by andrewgateway » Oct 22 2019 12:53am

The motor should also be flashed with ver 20.

Uturn   1 W

1 W
Posts: 58
Joined: Jun 06 2018 10:09am

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

Post by Uturn » Oct 22 2019 1:35am

andrewgateway wrote:
Oct 22 2019 12:53am
The motor should also be flashed with ver 20.
Of course, the motor also has 0.20.0 beta1 on it. I'm just assuming the error might be on the LCD rather.

Post Reply