New TSDZ2 Open Source firmware with Bluetooth interface

The controller was flashed with emmebrusa firmware V20.1C.2. I was unable to update it through the app. The RX an TX connections were wired as in this image:
May be the level shifters on your board are faulty / dead? Or pcbway did something systematically wrong with your order? Do you know if any of the boards from your batch had worked?
 
It can't work if you use a firmware other than the one provided by the project.
Thanks for your response. So you cannot use the app to update the firmware if a different OSF version was already installed? I was under the impression that as long as I had the bootloader enabled that I would be able to flash the new firmware through the app.
 
So you cannot use the app to update the firmware if a different OSF version was already installed?
No - as I already mentioned earlier.
The firmware of this project is especially prepared for the update. This is not included (and intended) by the emmebrusa firmware. And all software (including ESP32 and smartphone) have to be reasonable up to date for fitting together for doing the update.
 
The controller was flashed with emmebrusa firmware V20.1C.2. I was unable to update it through the app. The RX an TX connections were wired as in this image:
Hi,

I just saw your post. Please don't give up, you were almost there (you got the PCB flashed correctly and the app was correctly communicating with the PCB).
As mspider mentioned before: you can NOT use the mbrusa controller firmware. This firmware is not compatible with this project.

You need to use this software & firmware combination (which is working 100%, because this is what i'm also using):
App: FW version: 2.1.12
esp32: FW version: 1.2.1
TSDZ2 controller) FW version: 16 (TSDZ2-v16.hex)

Please flash the controller with the 'TSDZ2-v16.hex' firmware, hookup the battery and tell me what error code you see on the display.
We then try to solve your problem from there.

Best regards,
Ray

BTW: thanks again for sending me one of your v4 pcb's for free.
 
Tried to install the bluetooth board today but no success. The board connects to the phone and I can see the temperature sensor is working. When I try to install the firmware to the bike, it does not finish. I have selected Bike firmware update, select file, TSDZ2-V16.hex.. The app shows "waiting upload" then after a while, "Rebooting" but never finishes. There is a red triangle at the top of the app that says "Error Controller Communication error."
Any suggestions as to what to try?
Reading your posts again:
I also had problems uploading the controller firmware using OTA (but this was because i'm using the SW102 display).
You might need to flash the 'TSDZ2-V16.hex' to the controller manually using a cheap ST-LINK V2 programmer (see aliexpress)
 
I have the St Link V2 and have used it to flash the controller before with OSF. I assumed I would be able to update firmware through the app as long as I had the bootloader enabled which was incorrect. I bricked my controller and had to buy another one which just arrived. I hope to try again soon to install the bluetooth board after I get the controller working.
 
I have the St Link V2 and have used it to flash the controller before with OSF. I assumed I would be able to update firmware through the app as long as I had the bootloader enabled which was incorrect. I bricked my controller and had to buy another one which just arrived. I hope to try again soon to install the bluetooth board after I get the controller working.
Sorry to hear that your controller got bricked. Imported thing now is to understand why the controller got bricked, so it won't happen again with the new controller when you try to connect/solder the pcb wires.
Could it be that you made a mistake with soldering the wrong wires? Please check.

Addon: maybe your old controller is still good. Connect the ST Link WITHOUT the battery attached and try to read the firmware with ST Visual Programmer
 
Last edited:
The controller problem had nothing to do with this project. I decided while I had things apart, I would change the battery connector to a xt90 type. I turned off and disconnected the battery from the controller and then cut the old bullet connectors off of the wires going to the controller. I made the mistake of cutting both wires at once not thinking that there might be charge in a capacitor, long after the battery was disconnected. There was a spark and a little pop and the motor would not run after this. Since the controller is potted, there was no way to see or test which components may have failed so I just ordered a new controller.
 
Last edited:
Came across this thread whilst researching crank drive motors for a new bike build.

Why not implement the OSF firmware algorithms on the ESP32, disable the controller MCU, and manage the controller IO and external sensors directly from the ESP32?
Use generic displays / keypads connected to ESP32 for user interface.
Use a browser to connect to ESP32 web server for parameter configuration.
 
I have tried again to get the bluetooth interface working with the TSDZ2 without success. I have installed the latest software on the new controller, updated phone to the latest app version, and double checked all connections I am able to see and pair with the bluetooth module and read temperature of the motor. The app shows the following errors: Controller communication error and LCD communication error.
I am using android app TSDZ2_ESP32v2.2.0.apk
TSDZ2 controller) FW version: 16 (TSDZ2-v16.hex)
and esp32: FW version: 1.2.1

Any thoughts as to what to check from here?
 
I have tried again to get the bluetooth interface working with the TSDZ2 without success. I have installed the latest software on the new controller, updated phone to the latest app version, and double checked all connections I am able to see and pair with the bluetooth module and read temperature of the motor. The app shows the following errors: Controller communication error and LCD communication error.
I am using android app TSDZ2_ESP32v2.2.0.apk
TSDZ2 controller) FW version: 16 (TSDZ2-v16.hex)
and esp32: FW version: 1.2.1

Any thoughts as to what to check from here?
Can you describe in more detail your setup and what works and what not?
I.e. Do you have it setup on the bike or is it just a bench test setup?
What is your display on the bike showing? (I.e. Speed showing when backwheel is spinning?)
Does the motor give support and if so, does it react on the power level on the display?
Another thought: Maybe they changed the wiring color on your controller.. -> Can you verify w/ pics from the internet that you picked the correct wires (esp RX & TX) to connect to?
PS: Unfortunately I did not have the time yet to check, if the board you send to me works ( to rule out a faulty board batch)
 
Last edited:
This is installed on the bike. The display boots up fine but does not show battery level or speed. It does shown odometer from past rides.
up/down buttons work to change level. Throttle does nothing. Cranks are not installed so I cannot test torque response. I checked the wiring from the LCD connector all the way to the tracks on the board. It is wired correctly. I used this diagram:
 

Attachments

  • 1680123589709 (1).png
    1680123589709 (1).png
    167.5 KB · Views: 15
So, from what you describe the ESP32 works and the App works both communicate properly
(i.e. showing temperatures measured by the ESP32)
But - the communication between ESP and display and ESP and controller does not work.

So, the only thing I can think of is that the 8 Pin version (yours) has a different wire color coding than the 6 pin (i.e. mine) version.
The picture you posted originates to my knowledge from mspiders github page:
and refers to the 6 pin Version - NOT the 8 Pin Version.

You need to identify the correct RX / TX wires for the 8 pin setup....
I can not help there, as I only have 6 pin Versions...
Edit: I found this color coding description in my files - see attatchment 'PinOut'. maybe that helps.
(Also wire colors for 'orange', 'yellow' and 'brown' vary quite a bit and are easily mixed up)

... on the other hand you wrote you followed the wires up "to the tracks on the board...
than everything I wrote is not helping and I have no clue whatis going on....

Edit II: I took a photo of my backup controller - see 'controller.pdf'.
To the best of my knowledge:
The white circled area are the RX/TX lines.
The LEFT one is Controller-RX (in this case an orange cable)
The RIGHT one is Controller-TX (in this case a brown cable)
 

Attachments

  • PinOut.pdf
    117.3 KB · Views: 12
  • Controller.pdf
    184.5 KB · Views: 10
Last edited:
I have given up and removed the Bluetooth board. I will flash with the previous working firmware.
 
That is so sad. You must be either very close to have it setup properly or there is a hardware-problem on your board (i.e. Level shifter ic‘s broken). Do you have any feedback, if other boards from the batch you bought work proerly?
 
HI everyone. Just got my ESP32 installed and everything works, the motor, adjusting settings with the app and so on. The one thing I can't get working is the Bluetooth cycling power profile. The esp32 does not show up in wahoo. Also nRF toolbox when trying to connect to the esp32 just disconnects because "required services are missing" when trying the cyclic speed and cadence profile. This is the result with the app running in the background and without. So has this feature been removed or was it never implemented or do I have some weird HW problem or something disabled in my phones developer settings?

The versions I'm using are as following:
App: v2.2.0
ESP32 FW: v1.2.1
Motor controller: v16

And my phone is OnePlus Nord 2 5G running Android 13
also tried with Nokia X30 5G running Android 13, the app connection works fine but no BT cycling profile
 
HI everyone. Just got my ESP32 installed and everything works, the motor, adjusting settings with the app and so on. The one thing I can't get working is the Bluetooth cycling power profile. The esp32 does not show up in wahoo. Also nRF toolbox when trying to connect to the esp32 just disconnects because "required services are missing" when trying the cyclic speed and cadence profile. This is the result with the app running in the background and without. So has this feature been removed or was it never implemented or do I have some weird HW problem or something disabled in my phones developer settings?

The versions I'm using are as following:
App: v2.2.0
ESP32 FW: v1.2.1
Motor controller: v16

And my phone is OnePlus Nord 2 5G running Android 13
also tried with Nokia X30 5G running Android 13, the app connection works fine but no BT cycling profile
It is available the Cycling Power Service (UUID 0x1818)
Screenshot_20230706-164207_nRF Connect.jpg
 
Hello guys :cool:

I'm new here, I'm from France, and I recently made my first electric bike.
I've been building bikes for a long time, and I wanted to try an electric bike.
So I modified one of my custom bikes with a TSDZ2 (w/ coaster brake version).

I wanted the most discreet integration possible, so I chose a SW102, but the stock version from Enerprof (native UART compatible : Enerpower SW102 Display UART Tongsheng compatible 6-Pins).

I saw that the SW102 from Eco-Cycles was compatible with the TSDZ2-ESP32, but is it the same with the Enerprof?

For information, I tested my setup with Mbrusa's last OSF for stock displays, and I had a lot of bugs...
For now I had to revert to the original firmware version, and everything works fine.

And just to illustrate, here is a picture of my bike :

20230716_194240.jpg

Thanks ;)
 
Hi !
Maybe people missed my question... So I'll put it back 😌

Does anyone know if the SW102 stock display from Enerprof is compatible with the ESP32 mod ?

Thx a lot !
I'm just waiting for a confirmation before ordering a batch of ESP32 from PCBWay.
 
It is available the Cycling Power Service (UUID 0x1818)
View attachment 336184
Oh, my bad. Should have checked which services are advertised. I've now gotten it to report power to OpenTracks by turning off the filter for supported sensors. I'm guessing Wahoo just won't work because it's looking for some supported device identifier or something.
Nonetheless I now have an tracker app that sees the power measurement but it seems to be the motor power not pedal power. It reads zero when assist is off and with it on it seems to be what I would expect the motor providing. Is this intended or am I still missing something?
I'll have a look in the esp32 code if I can figure out an easy way to chance the reported measurement to that of the pedal power.

Thanks
 
but it seems to be the motor power not pedal power. It reads zero when assist is off and with it on it seems to be what I would expect the motor providing. Is this intended or am I still missing something?
I'll have a look in the esp32 code if I can figure out an easy way to chance the reported measurement to that of the pedal power.

It's the motor power and you will not get a reasonable human power reading, there were only some approaches in other open source versions (standard non ESP32) but for this purpose the sensor in the TSDZ2 is not really good for.
 
Back
Top