The idea is explained here: viewtopic.php?f=30&t=115535
BT Interface for TSDZ2 Open Source firmware - Work in progress
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress
TSDZ2-ESP32 Project
https://github.com/TSDZ2-ESP32/TSDZ2-ESP32-Wiki/wiki
https://github.com/TSDZ2-ESP32/TSDZ2-ESP32-Wiki/wiki
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress

Thank you for anticipating that I would ask about that

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress
I integrated the latest changes in my version and gave it a trial today (with activated torque smoothing).
I didn't notice significant differences - at least it is running smooth with no problems so far (so as intended).
I didn't notice significant differences - at least it is running smooth with no problems so far (so as intended).
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress
Today I finally started riding the bike again and I was able to test the new modification well.
Certainly the impact on the riding experience is not huge but the impression I got was positive even if it is clearly a subjective judgment.
However, analyzing the graph of the stored data, it is objectively seen that, when the torque smooth is active, the current absorbed by the motor is more constant and the current graph is flatter.
TSDZ2-ESP32 Project
https://github.com/TSDZ2-ESP32/TSDZ2-ESP32-Wiki/wiki
https://github.com/TSDZ2-ESP32/TSDZ2-ESP32-Wiki/wiki
-
- Posts: 11
- Joined: May 26 2019 9:51am
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress
Pcbway send me pictures of the board.Deadrabbit wrote: ↑Mar 30 2022 3:04amthanks a lot again for your work. I've ordered five peaces of the board.
In my point of view, i think there are some headers unsoldered.
Could someone with the knowledge check the pictures?
Thanks!
- Attachments
-
- IMG_20220412_081906.jpg (2.45 MiB) Viewed 947 times
-
- IMG_20220412_081909.jpg (4.35 MiB) Viewed 947 times
-
- 确认座子方向.png (1.29 MiB) Viewed 947 times
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress
Everything seems to be fine.Deadrabbit wrote: ↑Apr 12 2022 1:23amPcbway send me pictures of the board.Deadrabbit wrote: ↑Mar 30 2022 3:04amthanks a lot again for your work. I've ordered five peaces of the board.
In my point of view, i think there are some headers unsoldered.
Could someone with the knowledge check the pictures?
Thanks!
Headers will be soldered after confirming the correct placement of the components.
TSDZ2-ESP32 Project
https://github.com/TSDZ2-ESP32/TSDZ2-ESP32-Wiki/wiki
https://github.com/TSDZ2-ESP32/TSDZ2-ESP32-Wiki/wiki
-
- Posts: 68
- Joined: Jul 31 2020 11:55am
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress
Where would I find the "Data Graph View" data shown in the App (after swiping up)?
Where is that stored on the phone / can I export that somehow?
Where is that stored on the phone / can I export that somehow?
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress
Yesendlessolli wrote: ↑Apr 12 2022 7:53amWhere would I find the "Data Graph View" data shown in the App (after swiping up)?
In the phone app private storage but the data cannot be exported.Where is that stored on the phone / can I export that somehow?
TSDZ2-ESP32 Project
https://github.com/TSDZ2-ESP32/TSDZ2-ESP32-Wiki/wiki
https://github.com/TSDZ2-ESP32/TSDZ2-ESP32-Wiki/wiki
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress
New Version released:
Functional changes:
The new torque setting screen helps to configure and troubleshoot any torque sensor issues. About Torque smooth Thresholds i found satisfactory for Min ADC Threshold and Max ADC Threshod respectively about 4% and 9% of the max mesured ADC Delta.
N.B.!!!
Due to the new BT Interface, the ESP32 OTA update is triky:
Perform the update in the following order!
1) STM8 Controller Firmware
2) ESP32 Firmware (SEE THE FOLLOWING INSTRUCTIONS!)
3) Android App
ESP32 Firmware Update:
1) Run the normal OTA update from the Android app
2) At the end of the firmware upload, do not wait for the update end message but go back to the main screen and then exit from the Android App
3) Open System Settings, go to Bluetooth Settings and remove the ESP32 board from paired devices.
4) Install the new Android App
5) Open the new Android app and select "Bluetooth Setup" from the "Options Menu" and repeat the Bluetooth pairing process with the ESP32 board.
6) After pairing is complete, start the connection and then select "Firmware->Show Versions" from the "Options Menu". This last operation will confirm to the ESP32 that the new firmware is working correctly otherwise, when turned off, the ESP32 will revert to the previous firmware version.
The new files are in https://github.com/TSDZ2-ESP32/TSDZ2-ES ... master/bin
- Android: TSDZ2_ESP32v2.1.12.apk
- ESP32: TSDZ2-ESP32-Mainv1.2.1.zip
- STM8: TSDZ2-v16.zip
Functional changes:
- Torque Smooth (see viewtopic.php?f=30&t=115535)
- New Torque sensor setup screen
- Bluetooth interface optimization (MTU change, all real-time data sent in only one notification)
- ESP32/Controller protocol update
The new torque setting screen helps to configure and troubleshoot any torque sensor issues. About Torque smooth Thresholds i found satisfactory for Min ADC Threshold and Max ADC Threshod respectively about 4% and 9% of the max mesured ADC Delta.
N.B.!!!
Due to the new BT Interface, the ESP32 OTA update is triky:
Perform the update in the following order!
1) STM8 Controller Firmware
2) ESP32 Firmware (SEE THE FOLLOWING INSTRUCTIONS!)
3) Android App
ESP32 Firmware Update:
1) Run the normal OTA update from the Android app
2) At the end of the firmware upload, do not wait for the update end message but go back to the main screen and then exit from the Android App
3) Open System Settings, go to Bluetooth Settings and remove the ESP32 board from paired devices.
4) Install the new Android App
5) Open the new Android app and select "Bluetooth Setup" from the "Options Menu" and repeat the Bluetooth pairing process with the ESP32 board.
6) After pairing is complete, start the connection and then select "Firmware->Show Versions" from the "Options Menu". This last operation will confirm to the ESP32 that the new firmware is working correctly otherwise, when turned off, the ESP32 will revert to the previous firmware version.
The new files are in https://github.com/TSDZ2-ESP32/TSDZ2-ES ... master/bin
- Android: TSDZ2_ESP32v2.1.12.apk
- ESP32: TSDZ2-ESP32-Mainv1.2.1.zip
- STM8: TSDZ2-v16.zip
Last edited by mspider65 on May 14 2022 10:27am, edited 1 time in total.
TSDZ2-ESP32 Project
https://github.com/TSDZ2-ESP32/TSDZ2-ESP32-Wiki/wiki
https://github.com/TSDZ2-ESP32/TSDZ2-ESP32-Wiki/wiki
-
- Posts: 68
- Joined: Jul 31 2020 11:55am
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress
Hi @mspider65
Well, that update did unfortunately not work for me
- I hope I did not brick it.....
I think I followed your instructions exactly:
1. updating the tsdz2 firmware worked
2. uploading the esp32 fw worked
3. unpairing bt worked
But then I got distracted (wife called....) and the tsdz2/esp went to timeout / power down
When I powered it up again, it get erratic blinking error E-08 and in sync the battery bar goes from full to empty.
(I have the small XH-18 display)
I can then go to the BT Setup menue of the new app, scan and also see the device, but when trying to pair it fails:
("Error: Pairing failed")
I then tried to reinstall the older app version (TSDZ2_ESP32v2.1.11); but also there pairing causes the above error.
Note: I still can initiate walk assist, so it seems not completely bricked...
Do you have an idea what I can do / troubleshoot now?
Well, that update did unfortunately not work for me

I think I followed your instructions exactly:
1. updating the tsdz2 firmware worked
2. uploading the esp32 fw worked
3. unpairing bt worked
But then I got distracted (wife called....) and the tsdz2/esp went to timeout / power down
When I powered it up again, it get erratic blinking error E-08 and in sync the battery bar goes from full to empty.
(I have the small XH-18 display)
I can then go to the BT Setup menue of the new app, scan and also see the device, but when trying to pair it fails:
("Error: Pairing failed")
I then tried to reinstall the older app version (TSDZ2_ESP32v2.1.11); but also there pairing causes the above error.
Note: I still can initiate walk assist, so it seems not completely bricked...
Do you have an idea what I can do / troubleshoot now?
-
- Posts: 68
- Joined: Jul 31 2020 11:55am
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress
Never mind! It worked!!
This is really emberrassing.... I used the wrong pairing pin.......
Unfortunately, I can not test it in real live, because I had to travel back from where the bike is.
(But I took the tsdz2 with me
)
Thanks again for this great setup, @mspider65 !
This is really emberrassing.... I used the wrong pairing pin.......

Unfortunately, I can not test it in real live, because I had to travel back from where the bike is.
(But I took the tsdz2 with me

Thanks again for this great setup, @mspider65 !
-
- Posts: 68
- Joined: Jul 31 2020 11:55am
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress
I can't believe why there is no further response to @mspider65 update of his firmware & App.
Just to reiterate:
Update is NO Problem!
(It was just stupid me who entered the wrong BT pin when connecting.... Hint: Default is: 123456 - it is even stated during the update process)
Thanks again to @mspider65 for creating this firmware & App and share his continous improvements.
(I like esp. the new App setting structure with the torque sensor having its on sub-menue)
Just to reiterate:
Update is NO Problem!
(It was just stupid me who entered the wrong BT pin when connecting.... Hint: Default is: 123456 - it is even stated during the update process)
Thanks again to @mspider65 for creating this firmware & App and share his continous improvements.
(I like esp. the new App setting structure with the torque sensor having its on sub-menue)
-
- Posts: 11
- Joined: May 26 2019 9:51am
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress
Hi,
i recieved my pcbs but i'm not able to pair with my phone. Flashing went fine, but there is no Bluetooth device which i can connect to.
I've tried scanning also with the android app nrf connect, but i can't see the device.
I've also tried different power sources: Via the pin headers @ 3,3 Volt and via the main connector @ 29 Volt.
If i connect via FTDI and putty to the esp, i get the following messages:
These message is constantly repeated.
Edit: Some Update... It seems to be a problem with the power. I've replaced the FTDI with a 3,3 Volt Power Supply and i see the esp32 and i'm able to connect.
But if power the pcb with 42 Volt on the main input, i can only measure >2V on the jumper.
i recieved my pcbs but i'm not able to pair with my phone. Flashing went fine, but there is no Bluetooth device which i can connect to.
I've tried scanning also with the android app nrf connect, but i can't see the device.
I've also tried different power sources: Via the pin headers @ 3,3 Volt and via the main connector @ 29 Volt.
If i connect via FTDI and putty to the esp, i get the following messages:
Code: Select all
Brownout detector was triggered
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 188777542, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:4244
load:0x40078000,len:12740
ho 0 tail 12 room 4
load:0x40080400,len:3744
entry 0x40080620
I (46) cpu_start: Pro cpu up.
I (46) cpu_start: Application information:
I (46) cpu_start: Project name: TSDZ2-ESP32-Main
I (48) cpu_start: App version: 1.2.1
I (53) cpu_start: Compile time: Mar 7 2022 12:30:56
I (59) cpu_start: ELF file SHA256: 231775a46e0091bb...
I (65) cpu_start: ESP-IDF: v4.1-dirty
I (70) cpu_start: Starting app cpu, entry point is 0x400813d8
I (61) cpu_start: App cpu up.
I (81) heap_init: Initializing. RAM available for dynamic allocation:
I (87) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (93) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (99) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (105) heap_init: At 3FFBDB5C len 00000004 (0 KiB): DRAM
I (111) heap_init: At 3FFCE5A0 len 00011A60 (70 KiB): DRAM
I (118) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (124) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (130) heap_init: At 4009CA68 len 00003598 (13 KiB): IRAM
I (136) cpu_start: Pro cpu start user code
I (155) spi_flash: detected chip: gd
I (155) spi_flash: flash io: qio
I (156) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (163) tsdz_main: NVS init ...
I (1343) tsdz_main: Read cfg ...
I (1343) tsdz_nvs: NVS KEY = 7
I (1343) tsdz_main: UART init ...
I (1343) tsdz_main: BT init ...
I (1343) BTDM_INIT: BT controller compile version [219866f]
I (1353) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
W (1363) phy_init: failed to load RF calibration data (0x1102), falling back to full calibration
Edit: Some Update... It seems to be a problem with the power. I've replaced the FTDI with a 3,3 Volt Power Supply and i see the esp32 and i'm able to connect.
But if power the pcb with 42 Volt on the main input, i can only measure >2V on the jumper.
- Attachments
-
- s-l1600.jpg (89.39 KiB) Viewed 694 times
-
- Posts: 11
- Joined: May 26 2019 9:51am
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress
Ok, now everything is working. I thought, that the esp32 is able to enable the motor via GPIO, but after reading the schematics, i've checked that the voltage regulator XL7005A is enabled via the display on.
If i power VBatt and PW_EN everything works fine.
I think in the next days i will build it into the tsdz2.
BW
If i power VBatt and PW_EN everything works fine.
I think in the next days i will build it into the tsdz2.
BW
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress
Thank you!endlessolli wrote: ↑Apr 27 2022 10:26amI can't believe why there is no further response to @mspider65 update of his firmware & App.
Just to reiterate:
Update is NO Problem!
(It was just stupid me who entered the wrong BT pin when connecting.... Hint: Default is: 123456 - it is even stated during the update process)
Thanks again to @mspider65 for creating this firmware & App and share his continous improvements.
(I like esp. the new App setting structure with the torque sensor having its on sub-menue)
often people post on the forum to complain about something wrong or to ask for help. So if there are not many messages for me it means everything is working fine


Enjoy your rides.
TSDZ2-ESP32 Project
https://github.com/TSDZ2-ESP32/TSDZ2-ESP32-Wiki/wiki
https://github.com/TSDZ2-ESP32/TSDZ2-ESP32-Wiki/wiki
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress
Hello, I'm just about to install this and I was wondering, if I wish to try a different firmware (eg mbrusa's) at some point in the future, would I have to remove the board (I realise the Bluetooth app wouldn't work).
Thanks to everyone for all the brilliant help and support on this forum and mspider65 for keeping this firmware going.
Andy.
Thanks to everyone for all the brilliant help and support on this forum and mspider65 for keeping this firmware going.
Andy.
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress
yes, you should remove the board.
To leave it you would need a special firmware that acts as a pass through on the connection between the controller and the display.
TSDZ2-ESP32 Project
https://github.com/TSDZ2-ESP32/TSDZ2-ESP32-Wiki/wiki
https://github.com/TSDZ2-ESP32/TSDZ2-ESP32-Wiki/wiki
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress
Thanks for the speedy reply. 

Re: BT Interface for TSDZ2 Open Source firmware - Work in progress


Very excited



I thought I would share my experience of flashing the board and getting the temp sensor sorted, it's all working but along the way I made some mistakes and I'm hoping by posting them others might be helped.
I used this to flash
I got all the files in place as per the instructions, I renamed TSDZ2-ESP32-Mainv1.2.1.zip to TSDZ2-ESP32-Main.zip.
Don't miss this, I did and it's obvious and in bold

When I tried to flash I got a warning message from windows and then it wouldn't flash (you know when it's working as you can see a script running). I had to change the execution policy to allow me to flash it. I ended up doing all of this in an admin powershell, this site helped me do it.
PLEASE NOTE Changing this setting might mean that your computer will run scripts that might damage it, have a good read of the below before changing it.
https://superuser.com/questions/106360/ ... ll-scripts
Please see attachments for more details of how I did it.
All working now except for the temperature sensor, I had messed up the wiring.

All done now and thanks for all the help from everyone here, I can't wait to get it onto my bike.
- Attachments
-
- flashing part 1.jpg (250.74 KiB) Viewed 367 times
-
- flashing part 2.jpg (170.82 KiB) Viewed 367 times
-
flashing ESP32.txt
- (3.85 KiB) Downloaded 12 times
-
- Posts: 17
- Joined: Jan 26 2022 12:20am
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress
Hey everyone, Im really interested in this approach for the tsdz2, especially with a possbility of throttle and temp sensing. I wanted to see if it would be possible to run a no display setup with all of this, But I don't see anyone having tried nor anything in the wiki.
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress


(Sorry Admiralrofl, I don't know about running no display)
I have it all wired up and working (on one of the 2 boards I had there was a short between txl and gnd) the other one was fine.
I have a problem though.
It works brilliantly until I change gears and at that point it kind of stops working the connection with the phone drops out as well and then either provides no power or power in fits and starts. I then leave it for a while (a few minutes) and it works again then breaks again (when I change gear).
I have swapped out my LCD, same thing happens.
Lowered the max current.
The cables seem fine and as it works otherwise I don't think it's that.
I have tried it without the phone, put the phone on aeroplane mode, same thing.
Has anyone any ideas, my next things to do are:
Turn off Field weakening Assist without pedal rot, and lower the acceleration.
I will report back, but please if you have experienced this can you help.
Also does anyone know the wheel sizes I should use, VLCD6, I have used 230 (which should be 29" and so eMtb) but it gives me cadence mode, I will have a play with this and feed back if noone can help.
Thanks.
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress
Thanks, would shorting the tx and rx connections appropriately work, I could use a connector on the end of the current one.
Thanks (again)
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress
It is not the purpose of this project.Admiralrofl wrote: ↑Jun 06 2022 12:15amHey everyone, Im really interested in this approach for the tsdz2, especially with a possbility of throttle and temp sensing. I wanted to see if it would be possible to run a no display setup with all of this, But I don't see anyone having tried nor anything in the wiki.
In theory, however, it would be possible by modifying the firmware of the ESP32 board even if it would then be necessary to add some HW at least to turn the system on / off.
TSDZ2-ESP32 Project
https://github.com/TSDZ2-ESP32/TSDZ2-ESP32-Wiki/wiki
https://github.com/TSDZ2-ESP32/TSDZ2-ESP32-Wiki/wiki
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress
I don't see how gear shift can affect the ESP32 board operation.andyb wrote: It works brilliantly until I change gears and at that point it kind of stops working the connection with the phone drops out as well and then either provides no power or power in fits and starts. I then leave it for a while (a few minutes) and it works again then breaks again (when I change gear).
Check the connections and the power supply, there must be some problem there.
The wheel circumference must be configured with the Android app.andyb wrote: Also does anyone know the wheel sizes I should use, VLCD6, I have used 230 (which should be 29" and so eMtb) but it gives me cadence mode, I will have a play with this and feed back if noone can help.
The wheel diameter on the display is instead used to set the default assistance mode at start-up.
Read the Wiki.
If you restore the connection of the TX/RX cables as before installing the board, obviously everything works as before.andyb wrote: Thanks, would shorting the tx and rx connections appropriately work, I could use a connector on the end of the current one.
TSDZ2-ESP32 Project
https://github.com/TSDZ2-ESP32/TSDZ2-ESP32-Wiki/wiki
https://github.com/TSDZ2-ESP32/TSDZ2-ESP32-Wiki/wiki
Re: BT Interface for TSDZ2 Open Source firmware - Work in progress
Thanks for getting back to me, I admit it looks a bit confusing. Can I go back to a previous version by flashing etc or would this not work?
Thanks, just wanted to be sure.mspider65 wrote: ↑Jun 08 2022 5:45amI don't see how gear shift can affect the ESP32 board operation.andyb wrote: It works brilliantly until I change gears and at that point it kind of stops working the connection with the phone drops out as well and then either provides no power or power in fits and starts. I then leave it for a while (a few minutes) and it works again then breaks again (when I change gear).
Check the connections and the power supply, there must be some problem there.
I don't either, i can only think that the change in torque is having some effect, it's not the actual gear change as the ESP wouldn't know I have changed gear, I will check it but as it is working then not working i'm unsure what it could be.
The wheel circumference must be configured with the Android app.andyb wrote: Also does anyone know the wheel sizes I should use, VLCD6, I have used 230 (which should be 29" and so eMtb) but it gives me cadence mode, I will have a play with this and feed back if noone can help.
The wheel diameter on the display is instead used to set the default assistance mode at start-up.
Read the Wiki.
Yes, but I have been changing the wheel size on the LCD not the App and 230cm 29" doesn't give me eMtb, which is what has confused me.
If you restore the connection of the TX/RX cables as before installing the board, obviously everything works as before.andyb wrote: Thanks, would shorting the tx and rx connections appropriately work, I could use a connector on the end of the current one.