Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Electric Motors and Controllers
mbrusa   10 W

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by mbrusa » Mar 28 2020 1:42am

Hi stancecoke
After several attempts, now no errors, only warnings.
NetBeans_build.jpg
NetBeans_build.jpg (240.66 KiB) Viewed 987 times
Flexible OpenSource firmware for TongSheng TSDZ2 motor and VLCD5 VLCD6 XH18 displays
https://github.com/emmebrusa/TSDZ2-Smart-EBike-1

User avatar
stancecoke   100 kW

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by stancecoke » Mar 28 2020 2:06am

mbrusa wrote:
Mar 28 2020 1:42am
After several attempts, now no errors, only warnings.
:thumb:

most warnings are imported, but not used libraries. You can simply delete those rows. So your self built GUI is working now?
I'm looking foreward to see your improved configurator!

regards
stancecoke

mbrusa   10 W

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by mbrusa » Mar 28 2020 2:57am

stancecoke wrote:
Mar 28 2020 2:06am
most warnings are imported, but not used libraries. You can simply delete those rows. So your self built GUI is working now?
I'm looking foreward to see your improved configurator!

regards
stancecoke
Yes, it works now
Flexible OpenSource firmware for TongSheng TSDZ2 motor and VLCD5 VLCD6 XH18 displays
https://github.com/emmebrusa/TSDZ2-Smart-EBike-1

thineight   100 W

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by thineight » Mar 29 2020 11:30am

Hello guys. In these days of quarantine I had chance to flash the v.20 with mbrusa overrun fix (for LCD3)
The overrun is of course improved with good results, but I experienced a delay in motor kick in while restarting pedaling.
I have to do at least a complete pedal turn prior the motor engages.
Did anyone else experience the same (with the native displays or LCD3)?

I wait some feedback.. in case I will try to go back to the previous buba "official" beta1.

Thanks
MTB KTM Ultra 29" - City bike DAYTONA 28"

mbrusa   10 W

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by mbrusa » Mar 29 2020 1:25pm

mbrusa wrote:
Mar 21 2020 2:11am
....
I want to highlight that by increasing the calculated value of "ui16_cadence_sensor_ticks_stop", increases the overrun time, decreasing it lacks startup assistance.
I had reports of too fast stops and a case of lack startup assistance.
For this reason, in the next full version I will slightly increase the calculated values.
"ui16_cadence_sensor_ticks_stop = (ui16_cadence_sensor_ticks + (ui16_cadence_sensor_ticks >> 3)));" in standard mode,
"ui16_cadence_sensor_ticks_stop = (ui16_cadence_sensor_ticks + (ui16_cadence_sensor_ticks >> 1));" in advanced mode,
or maybe I'll add editable parameters in the config.h file.
Hi thineight
I had reported it in a previous post.
Flexible OpenSource firmware for TongSheng TSDZ2 motor and VLCD5 VLCD6 XH18 displays
https://github.com/emmebrusa/TSDZ2-Smart-EBike-1

SchwinnBoy63   10 µW

10 µW
Posts: 5
Joined: May 22 2019 2:33pm

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by SchwinnBoy63 » Mar 29 2020 8:19pm

Where do you find the option byte on/for the motor?

HughF   100 W

100 W
Posts: 111
Joined: Jan 23 2020 6:13pm

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by HughF » Mar 30 2020 8:48am

I have been over in the 'other' thread for a while having fitted an SW102 to my bike, anyway I am not enjoying the assistance that is provided by that firmware fork on my single speed bike and want to go back to the VLCD6 using the Marcoq fork. Does anyone have a link to the latest version of his Java configurator, I think it was running FW0.20?
Single speed 700c frame, 36v TSDZ2, 13s battery, SW102 display
Genesis iOiD Alfine8 Hard tail MTB, soon to be TSDZ2, SW102 display

Elinx   100 W

100 W
Posts: 233
Joined: Aug 09 2019 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by Elinx » Mar 30 2020 11:42am

HughF wrote:
Mar 30 2020 8:48am
..... go back to the VLCD6 using the Marcoq fork. Does anyone have a link to the latest version of his Java configurator, I think it was running FW0.20?
No, the last release of Marcoq was based on fw v0.19 and the Java configurator v3.7
You can download this version here

The latest release based on fw v0.20b1 is from mbrusa. Stancecoke has made a java configurator for basic settings.
You can find that version on stancecoke's github
Last edited by Elinx on Mar 30 2020 4:44pm, edited 1 time in total.

HughF   100 W

100 W
Posts: 111
Joined: Jan 23 2020 6:13pm

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by HughF » Mar 30 2020 1:04pm

Thanks for the information.
Single speed 700c frame, 36v TSDZ2, 13s battery, SW102 display
Genesis iOiD Alfine8 Hard tail MTB, soon to be TSDZ2, SW102 display

jeff.page.rides   100 W

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by jeff.page.rides » Mar 30 2020 7:42pm

emr wrote:
Mar 26 2020 2:54am
emr wrote:
Mar 06 2020 7:41am

I found this item, which appears to be what we need for the Gear shift sensing as it connects to the existing VLCD5 brake sensor sockets, but it doesn't appear to use 5v source. Unsure how it can work without the 5v. It also has brake sensors suitable for hydraulic brakes...
https://www.aliexpress.com/item/33060254663.html

Image

I purchased one of these gear sensors and have fitted it near the gear changer on the handlebar. I haven't tested on the road but I can confirm it does turn the motor off momentarily (maybe 0.5 of a second (estimated)) when changing gears on the workstand. I suspect it will be the solution to the IGH issue of needing to stop pedalling to allow the hub to change gears.

GearSensor_1.jpg

GearSensor_2.JPG
I installed my shift sensor and wow does it shift great. The second I push my shift button the motor stops it shifts fast, smooth, and quiet. Now the problem is it powers off for about 2 seconds and about 2 revolutions at 75 RPM before the power comes back on, that's a long dead-spot.
Is there a way in the firmware that we can speed up this power back on, to only a half a second?

emr   1 W

1 W
Posts: 55
Joined: Apr 22 2018 5:37am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by emr » Mar 31 2020 4:08am

jeff.page.rides wrote:
Mar 30 2020 7:42pm
emr wrote:
Mar 26 2020 2:54am
emr wrote:
Mar 06 2020 7:41am

I found this item, which appears to be what we need for the Gear shift sensing as it connects to the existing VLCD5 brake sensor sockets, but it doesn't appear to use 5v source. Unsure how it can work without the 5v. It also has brake sensors suitable for hydraulic brakes...
https://www.aliexpress.com/item/33060254663.html

Image

I purchased one of these gear sensors and have fitted it near the gear changer on the handlebar. I haven't tested on the road but I can confirm it does turn the motor off momentarily (maybe 0.5 of a second (estimated)) when changing gears on the workstand. I suspect it will be the solution to the IGH issue of needing to stop pedalling to allow the hub to change gears.

GearSensor_1.jpg

GearSensor_2.JPG
I installed my shift sensor and wow does it shift great. The second I push my shift button the motor stops it shifts fast, smooth, and quiet. Now the problem is it powers off for about 2 seconds and about 2 revolutions at 75 RPM before the power comes back on, that's a long dead-spot.
Is there a way in the firmware that we can speed up this power back on, to only a half a second?
I wonder if part of the delay is due to the time taken for the motor to start assistance as MBrusa mentioned in a previous post. Maybe the next MBrusa version will reduce the delay.
mbrusa wrote:
Mar 21 2020 2:11am
....
I want to highlight that by increasing the calculated value of "ui16_cadence_sensor_ticks_stop", increases the overrun time, decreasing it lacks startup assistance.
I had reports of too fast stops and a case of lack startup assistance.
For this reason, in the next full version I will slightly increase the calculated values.
"ui16_cadence_sensor_ticks_stop = (ui16_cadence_sensor_ticks + (ui16_cadence_sensor_ticks >> 3)));" in standard mode,
"ui16_cadence_sensor_ticks_stop = (ui16_cadence_sensor_ticks + (ui16_cadence_sensor_ticks >> 1));" in advanced mode,
or maybe I'll add editable parameters in the config.h file.

revher   10 mW

10 mW
Posts: 32
Joined: Dec 19 2019 5:14pm

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by revher » Mar 31 2020 6:32am

For connecting the Bafang gear sensor directly to the Y connector of the Tonghsheng speed sensor.

If one of the Y branch is used by the lights (it was not the case for my first bike viewtopic.php?f=30&t=98281&start=825#p1533489), we have to build a new connector with 3 cables as described on this (new) photo (TSDZ2 wires are described for example here and Bafang there). Image

Preparing the Y Tongsheng (female) -Tongsheng (male) - Bafang female connector.
Sometimes the Tongsheng extension cables have different colors, here the white (the 2) is yellow.
Image

Be careful with the heat shrinking tubes: Image

And here the connector ready to be connected.
Image
And there connected:
Image
Last edited by revher on Apr 03 2020 3:03am, edited 3 times in total.

jeff.page.rides   100 W

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by jeff.page.rides » Mar 31 2020 6:06pm

revher wrote:
Mar 31 2020 6:32am
For connecting the Bafang gear sensor directly to the Y connector of the Tonghsheng speed sensor.

If one of the Y branch is used by the lights (it was not the case for my first bike viewtopic.php?f=30&t=98281&start=825#p1533489), we have to build a new connector with 3 cables as described on this photo. Image

Preparing the Y Tongsheng (female) -Tongsheng (male) - Bafang female connector.
Sometimes the Tongsheng extension cables have different colors, here the white (the 2) is yellow.
Image

And here the connector ready to be connected.
Image
Thanks, if I can't find a firmware fix I'll try using the speed sensor instead of the brake sensor.

revher   10 mW

10 mW
Posts: 32
Joined: Dec 19 2019 5:14pm

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by revher » Apr 01 2020 8:56am

jeff.page.rides wrote:
Mar 31 2020 6:06pm
revher wrote:
Mar 31 2020 6:32am
Thanks, if I can't find a firmware fix I'll try using the speed sensor instead of the brake sensor.
I made an error in the photo which has been fixed on the new photos (the green wire,+5V is numbered 4 on Tongsheng 6 pins). I added the references. Sorry,

New edit: Regarding the firmware fix, I guess you mention the recent improvements made by mbrusa. It is a real improvement and the overrun is much shorter.

However, when biking in a city (not these days, because Paris is empty and bikes are allowed inside a distance of less than 1 km from home) with a lot of people sometimes crossing at the red lights, that is not enough and I really appreciate my installation of the gear shift sensor. I just need to downshift the gears and the engine stops immediately.

Also, I really appreciate a much easier way to shift gear while pedaling (I have an internal gear hub with 8 speeds).

If this is new with the TSDZ2, it was not new with the Bafang BBS which has a new gear sensor output cable directly from the motor.

Unfortunately the Tongsheng (Higo mini-A) connectors are not sold or you need to buy 500+pcs.

Until this type of special connector is available from a seller, we must buy extension cables and perform soldering as I did.

Revher
Last edited by revher on Apr 01 2020 12:18pm, edited 1 time in total.

bingo5   10 mW

10 mW
Posts: 27
Joined: Jul 04 2019 12:37am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by bingo5 » Apr 01 2020 11:21am

I have now purchased 2 "BAFANG Hydraulic Brake Sensor" as recommended by casinho. On his wiki page he shows how to solder/connect the 2 contacts of the sensor to the 6pin LCD cable.

Now I'm thinking about how to do this analog on the VLCD5. There are already 2 ports on the display for the brakes. I don't know how the brake function was implemented in the firmware for the VLCD5, but can I connect the two brake sensors directly to the display ports? Or do I also have to connect them to the 6pin LCD cable?

update://
Now I understand that the gear sensor works just like the brake sensor. As I understood Emma, she connected her gear sensor directly to the VLCD5 display, so I'll try that with my brake sensors as well - thanks.

jeff.page.rides   100 W

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by jeff.page.rides » Apr 02 2020 3:27pm

revher wrote:
Apr 01 2020 8:56am
jeff.page.rides wrote:
Mar 31 2020 6:06pm
revher wrote:
Mar 31 2020 6:32am
Thanks, if I can't find a firmware fix I'll try using the speed sensor instead of the brake sensor.
I made an error in the photo which has been fixed on the new photos (the green wire,+5V is numbered 4 on Tongsheng 6 pins). I added the references. Sorry,

New edit: Regarding the firmware fix, I guess you mention the recent improvements made by mbrusa. It is a real improvement and the overrun is much shorter.

However, when biking in a city (not these days, because Paris is empty and bikes are allowed inside a distance of less than 1 km from home) with a lot of people sometimes crossing at the red lights, that is not enough and I really appreciate my installation of the gear shift sensor. I just need to downshift the gears and the engine stops immediately.

Also, I really appreciate a much easier way to shift gear while pedaling (I have an internal gear hub with 8 speeds).

If this is new with the TSDZ2, it was not new with the Bafang BBS which has a new gear sensor output cable directly from the motor.

Unfortunately the Tongsheng (Higo mini-A) connectors are not sold or you need to buy 500+pcs.

Until this type of special connector is available from a seller, we must buy extension cables and perform soldering as I did.

Revher
Thanks for the correction, I'll let you know if I try this if the firmware updates don't fix the problem.

emr   1 W

1 W
Posts: 55
Joined: Apr 22 2018 5:37am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by emr » Apr 02 2020 6:33pm

bingo5 wrote:
Apr 01 2020 11:21am

Now I'm thinking about how to do this analog on the VLCD5. There are already 2 ports on the display for the brakes. I don't know how the brake function was implemented in the firmware for the VLCD5, but can I connect the two brake sensors directly to the display ports? Or do I also have to connect them to the 6pin LCD cable?

update://
Now I understand that the gear sensor works just like the brake sensor. As I understood Emma, she connected her gear sensor directly to the VLCD5 display, so I'll try that with my brake sensors as well - thanks.
Just be aware that the gear sensor requires 5v to run the electronics in the sensor. The standard brake sensors that come with the motor are purely a Closed/Open switch and the brake sensor plug has only 2 of the 3 slots populated (see image below). The VLCD5 brake sensor sockets do have all 3 pins available however, and one of the pins has 5v. You will need a plug that has all 3 slots populated.

I couldn't find anywhere to purchase the specific plugs to fit the brake sensor sockets in the VLCD5, so purchased the gear sensor that came with the appropriate plugs with all 3 slots populated.
https://www.aliexpress.com/item/33060254663.html

Below is the standard brake sensor plug showing the location of the missing terminal that will be required to get the 5v from the socket.
2020-04-03_1048.png
2020-04-03_1048.png (234.25 KiB) Viewed 494 times

HughF   100 W

100 W
Posts: 111
Joined: Jan 23 2020 6:13pm

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by HughF » Apr 03 2020 9:36am

Do I need to do anything special to flash down from the latest Casainho code to 0.20beta? I have setup up my Windows machine with stvp, sdcc and the jre and have the configurator working but it refuses to flash the option byte. I know the programmer works, I used it the other day from Linux to flash up the latest 0.56 code.

Can I grab the output from the compilation stage, move it over to my Linux partition and flash with stm8flash?
Single speed 700c frame, 36v TSDZ2, 13s battery, SW102 display
Genesis iOiD Alfine8 Hard tail MTB, soon to be TSDZ2, SW102 display

User avatar
stancecoke   100 kW

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by stancecoke » Apr 03 2020 9:50am

HughF wrote:
Apr 03 2020 9:36am
I have setup up my Windows machine with stvp, sdcc and the jre and have the configurator working but it refuses to flash the option byte.
can you post the output of the terminal window with the error messages, please?

regards
stancecoke
Last edited by stancecoke on Apr 03 2020 9:54am, edited 1 time in total.

HughF   100 W

100 W
Posts: 111
Joined: Jan 23 2020 6:13pm

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by HughF » Apr 03 2020 9:51am

Give me 30 mins...
Single speed 700c frame, 36v TSDZ2, 13s battery, SW102 display
Genesis iOiD Alfine8 Hard tail MTB, soon to be TSDZ2, SW102 display

HughF   100 W

100 W
Posts: 111
Joined: Jan 23 2020 6:13pm

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by HughF » Apr 03 2020 10:02am

Capture.PNG
Capture.PNG (55.38 KiB) Viewed 434 times
I suppose it is possible I have broken my programming cable since I used it a few days ago to program from Linux? I will try and re-flash with 0.56 from Linux and see if that goes through OK.

Edit: Not the programmer, I can flash from Linux fine...
Single speed 700c frame, 36v TSDZ2, 13s battery, SW102 display
Genesis iOiD Alfine8 Hard tail MTB, soon to be TSDZ2, SW102 display

User avatar
stancecoke   100 kW

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by stancecoke » Apr 03 2020 10:11am

HughF wrote:
Apr 03 2020 10:02am
Edit: Not the programmer, I can flash from Linux fine...
can you see any problem in the Windows device manager? (yellow triangle at any device?)

regards
stancecoke

HughF   100 W

100 W
Posts: 111
Joined: Jan 23 2020 6:13pm

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by HughF » Apr 03 2020 10:46am

No, and the device appears OK in device manager as an stlink. It is not a big issue, I am out running the 'other' code at the moment with the sw102 and that behaves just like 0.20beta in pure torque mode.
Single speed 700c frame, 36v TSDZ2, 13s battery, SW102 display
Genesis iOiD Alfine8 Hard tail MTB, soon to be TSDZ2, SW102 display

7lucky7   100 µW

100 µW
Posts: 9
Joined: Apr 04 2020 10:52am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by 7lucky7 » Apr 04 2020 3:54pm

I'm really struggling to find a good guide to installing this on my tsdz2 with vlcd5 display. Can anyone please point a poor noob in the right direction.

bingo5   10 mW

10 mW
Posts: 27
Joined: Jul 04 2019 12:37am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by bingo5 » Apr 04 2020 4:09pm

emr wrote:
Apr 02 2020 6:33pm
Just be aware that the gear sensor requires 5v to run the electronics in the sensor. The standard brake sensors that come with the motor are purely a Closed/Open switch and the brake sensor plug has only 2 of the 3 slots populated (see image below). The VLCD5 brake sensor sockets do have all 3 pins available however, and one of the pins has 5v. You will need a plug that has all 3 slots populated.

I couldn't find anywhere to purchase the specific plugs to fit the brake sensor sockets in the VLCD5, so purchased the gear sensor that came with the appropriate plugs with all 3 slots populated.
https://www.aliexpress.com/item/33060254663.html

Below is the standard brake sensor plug showing the location of the missing terminal that will be required to get the 5v from the socket.

2020-04-03_1048.png
I don't know if I got you wrong or you got me wrong. I didn't and don't want to install a gear sensor, I just want two brake sensors. I don't see any sense in gear sensors, respectively I personally have no problem with the overrun fix.

Anyway, I understood the manual of casainho ( https://github.com/OpenSource-EBike-fir ... ke-sensors ) that the Bafang brake sensor has and needs only two cables. Then it would have worked great with the brake plug with 2 pins. But unfortunately this did not work. After a lot of trial and error I noticed that it works if you short-circuit the white and the red cable of the Bafang sensor.

But I didn't find the way elegantly and wanted to do without soldering anyway (for optical and stability reasons). Therefore I crimped all 3 cables of the Bafangsensor (with XH 2,54) and plugged them into the white connector of the TSDZ2 mechanical brake. So I made a fully populated connector by myself.

So it works fantastic :D. Thanks for your help

Post Reply