New TSDZ2 Open Source firmware with Bluetooth interface

Blacklite said:
Im wondering what the reasoning for the reduce to 18kHz PWM is? Is it timing given the extra instructions to read the ADC in the PWM interrupt?

Switching frequency is a tradeoff between motor speed and efficency.
The Mosfet of the TSDZ2 controller aren't so fast, and i think 18KHz colud be a good compromise to have good efficiency and at the same time to guarantee good operation when you need to use a high cadence.
 
About 2 weeks ago installed the esp32 board successfully.
Thanks for your work mspider.
New firmware v13 was interesting for me. Im getting controller communications error in app. With xh 18 its error code e03. First i thought my engine runs to hot. But it happens always at around 43 degress and after once happend it stays until engine is around 37 degress. Happens always in short intervals for half a second. Deactivate temp control doesnt helped me. Im sure its something with tx rx line, bad connection or maybe to long cables? Have to check it. My fault.
New firmware did not change this behavior for your information.
 

Attachments

  • 20210505_184957.jpg
    20210505_184957.jpg
    117.4 KB · Views: 1,820
huan said:
About 2 weeks ago installed the esp32 board successfully.
Thanks for your work mspider.
New firmware v13 was interesting for me. Im getting controller communications error in app. With xh 18 its error code e03. First i thought my engine runs to hot. But it happens always at around 43 degress and after once happend it stays until engine is around 37 degress. Happens always in short intervals for half a second. Deactivate temp control doesnt helped me. Im sure its something with tx rx line, bad connection or maybe to long cables? Have to check it. My fault.
New firmware did not change this behavior for your information.

Check the wiring between ESP32 and controller, check also the solder points on the ESP32 board in particular the 3 small integrated circuits close to the 4 pin serial connector.
 
Ive could fix my problem. Today i could put my motor to 66 degress without communcation error.
Cadence mode for my is like cruise mode without having it enabled. Motor stops to spin only with a lot of pedal pressure backwards or i change assistance mode to 0.
 
Hi,

I've not been able to side load the apk. I use a Note 4.0 running Android 9, but it isn't the Samsung firmware, it's ViperOS.

Anyhow. I have copied the apk to the downloads directory on the phone, used X-plore to locate it, clicked? on it. It says Open with Package installer and it says: "There was a problem whilst parsing the package?"

I have allowed Unknown Apps (And I have Developer options enabled)

Any ideas? I will probably download Android Studio and try using the sources.


As a totally separate theme. What is the the model of ESP 32 that you use or doesn't it matter and what toolchain are you using to develop?

edit: for instance does this do the job? https://www.ebay.co.uk/itm/224378202490?hash=item343dfba97a:g:fzwAAOSwL0pgRkCn

Great work by the way. I can't wait to get my motor and try out these mods.

Gordon
 
How odd, the source builds and then runs on my phone fine using Android Studio (Man it takes ages to download and get that ide running and updated.) So don't know what gives.

Gordon
 
gfmoore said:
I've not been able to side load the apk. I use a Note 4.0 running Android 9, but it isn't the Samsung firmware, it's ViperOS.
Anyhow. I have copied the apk to the downloads directory on the phone, used X-plore to locate it, clicked? on it. It says Open with Package installer and it says: "There was a problem whilst parsing the package?"

I once noticed the same with a custom rom on a Samsung tablet. Could have been Viper too.

I probably need to change and make the apk myself too. Hints or even a howto would be welcomed :)

gfmoore said:
As a totally separate theme. What is the the model of ESP 32 that you use or doesn't it matter and what toolchain are you using to develop?

On the developed PCB there is an ESP32 Pico which includes memory on chip. It just saves space. You should be able to take every ESP32 board with at least 4MB memory (= standard size).
Toolchain you could find at espressif - ESP-IDF, I'm using the current v4.2.1, additionally esp-idf-tools. You could use VSCode, Eclipse...

gfmoore said:
It will work.
Of course you additionally would need a DC/DC converter for power supply and a level shifter for the serial ports (ESP32 ports working at 3.3V, TSDZ2 at 5V).
 
Beli said:
Of course you additionally would need a DC/DC converter for power supply and a level shifter for the serial ports (ESP32 ports working at 3.3V, TSDZ2 at 5V).
We are using ONLY a very small DC-DC and 2 MOSFETs for turn on/off the motor controller and no level shifter at all!! The circuit is very simple, only 5 extra wires to solder other than the displays wires: https://opensourceebike.github.io/ebike_wireless_controller.html

TSDZ2_wireless_board_small-04.jpg


TSDZ2_wireless_board_small-05.jpg


TSDZ2_wireless_board_small-10.jpg


The final device is very small:
TSDZ2_wireless_board_small-12.jpg
 
casainho said:
We are using ONLY a very small DC-DC and 2 MOSFETs for turn on/off the motor controller and no level shifter at all!!
ESP32 has no protection at the IO ports and can't be used without level shifters!
 
Beli said:
casainho said:
We are using ONLY a very small DC-DC and 2 MOSFETs for turn on/off the motor controller and no level shifter at all!!
ESP32 has no protection at the IO ports and can't be used without level shifters!
Are you sure? Because I see that protections on the motor controller side. 850C, 860C, SW102 displays are all 3.3V as also our wireless board, all of them work perfectly.
 
Beli said:
casainho said:
Are you sure?
Yes:
https://esp32.com/viewtopic.php?t=877#p56956
Ok, I would no expect that "weakness" from a modern microcontroller as ESP.
Thank you for the clarification.
 
I was surprised about that too. Especially because most cheap microcontrollers tolerate 5V.
But as also mentioned at the end of the linked side: maybe it's because the ESP is so modern and highly integrated the chip die is not build to deal with higher voltages at all.
 
Beli said:
I was surprised about that too. Especially because most cheap microcontrollers tolerate 5V.
But as also mentioned at the end of the linked side: maybe it's because the ESP is so modern and highly integrated the chip die is not build to deal with higher voltages at all.

The quick and dirty solution could be to put something like a 10k resistor in series to the 3.3v ESP32 input or better a voltage divider with two resistors. Not what I would use for production or something you need to depend on but should work.
About the DC-DC converter it would be better to use one with a Power Enable input and use the Power line coming from the LCD ON/OFF signal as enable. The DC-DC converter, when switched on, acts as a short circuit due to the large input capacitors and it is easy to burn the LCD mosfet. Another possibility is to use a 100/200 Ohm resistor in series to the DC-DC converter input or use an external mosfet switch.
 
mspider65 said:
Beli said:
I was surprised about that too. Especially because most cheap microcontrollers tolerate 5V.
But as also mentioned at the end of the linked side: maybe it's because the ESP is so modern and highly integrated the chip die is not build to deal with higher voltages at all.
The quick and dirty solution could be to put something like a 10k resistor in series to the 3.3v ESP32 input or better a voltage divider with two resistors. Not what I would use for production or something you need to depend on but should work.
If that could the a solution, then it is what is used inside TSDZ2 motor controller. So, what are all that displays doing are correct.
 
New version released.
Everything should be updated, Android App, ESP32 and Controller.

The files are on Github: https://github.com/TSDZ2-ESP32/TSDZ2-ESP32-Wiki/tree/master/bin
- Android: TSDZ2_ESP32v2.1.10.apk
- ESP32: TSDZ2-ESP32-Mainv1.1.8.zip
- STM8: TSDZ2-v14.zip

This version improves the motor efficiency under high loads.

In particular, the code that calculates the "Advance Angle" (FOC angle) has changed.
The old algorithm gave an underestimated value. Now the algorithm has changed and the value is calculated once every electrical revolution within the fast PWM interrupt.
I did some tests on a reference climb with the motor constantly at 400/450Watt and with the new version the motor warms up much less.

Important note:
After the update it is necessary to change the motor configuration.
There is a new parameter "FOC angle multipl." which replaces the "motor inductance" parameter.
In the Android app select: "Bike Configuration" -> System and select 36V or 48V according to your motor.
The parameter can also be entered manually in the range 0-50. If you want to experiment you can increase/decrease by 3 or 4 each time to see if you get further improvements.

MotorSetup.png

As you can see from the screenshot I also added the possibility to disable the "Field Weakening"

Last note:
The update disables the "Torque Offset Fix", and whoever had it enabled will have to enable it again after the update.
 
Thanks for the new version. I thought I could relax because you don't plan to do updates during the next months but just use your bike? :lol:

At least you still left me bits of case 1 ui8_rx_buffer[6] for initialising OTA updates using WWDG_SWReset() :wink:
 
Beli said:
I thought I could relax because you don't plan to do updates during the next months but just use your bike? :lol:

it's true!
But here it continued to get cold and bad weather and there is still snow in the mountains. So I had some more free time.
And then there were still a couple of things that bothered me to fix :)

At least you still left me bits of case 1 ui8_rx_buffer[6] for initialising OTA updates using WWDG_SWReset() :wink:

Probably this will be the next ;)
 
mspider65 said:
But here it continued to get cold and bad weather and there is still snow in the mountains.
So your weather is not much better than north of the Alps...
On the other hand we can be happy that you continue your work :) :thumb:

Applied the (small ESP32) changes to my display version. Tests have to wait till better weather...
 
huan said:
Cadence mode for my is like cruise mode without having it enabled. Motor stops to spin only with a lot of pedal pressure backwards or i change assistance mode to 0.

Anybody else with this problem?
I played around with pedal without rotation setting.
Recommended is 10 to 15. I get a nice start with a setting of 100. Seems not right but works for me.
 
Thanks for a useful app! Looking at the list of permissions it all looks legit, but I only wonder why does it require WRITE_SECURE_SETTINGS permission?
 
Beli said:
gfmoore said:
I've not been able to side load the apk. I use a Note 4.0 running Android 9, but it isn't the Samsung firmware, it's ViperOS.
Anyhow. I have copied the apk to the downloads directory on the phone, used X-plore to locate it, clicked? on it. It says Open with Package installer and it says: "There was a problem whilst parsing the package?"

I once noticed the same with a custom rom on a Samsung tablet. Could have been Viper too.

I probably need to change and make the apk myself too. Hints or even a howto would be welcomed :)

gfmoore said:
As a totally separate theme. What is the the model of ESP 32 that you use or doesn't it matter and what toolchain are you using to develop?

On the developed PCB there is an ESP32 Pico which includes memory on chip. It just saves space. You should be able to take every ESP32 board with at least 4MB memory (= standard size).
Toolchain you could find at espressif - ESP-IDF, I'm using the current v4.2.1, additionally esp-idf-tools. You could use VSCode, Eclipse...

gfmoore said:
It will work.
Of course you additionally would need a DC/DC converter for power supply and a level shifter for the serial ports (ESP32 ports working at 3.3V, TSDZ2 at 5V).

Sorry for the late response I hadn't enabled replies. Thanks Beli et al for the reply, very helpful. My motor has now arrived and I think my board is due any day. Just need a battery :) Yes, I'll have to look at how to create an apk, now that I have Android Studio up and running. Once I have done it, I'll post the steps, but may be a couple of weeks.

I'll probably just have a few rides "as is" to see how it feels and then do the mods. Hopefully summer may start any day now... :wink:

Gordon
 
Back
Top