BT Interface for TSDZ2 Open Source firmware - Work in progress

Electric Motors and Controllers
Post Reply
mspider65   1 mW

1 mW
Posts: 14
Joined: Aug 04 2019 2:10pm

BT Interface for TSDZ2 Open Source firmware - Work in progress

Post by mspider65 » Nov 17 2019 8:36am

Simulation test done successful.

https://youtu.be/vp3WN9OPtdk

Now i'm waiting a new spare controller to start the field test.

When done, using an Android you will be able to:
  • Monitor all the parameter sent by the controller.
  • Setup all the motor parameters.
  • Wireless update the module firmware
  • Wireless update the Controller Firmware
And much more in future...

john61ct   100 MW

100 MW
Posts: 2878
Joined: Dec 18 2018 2:06pm

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

Post by john61ct » Nov 17 2019 9:01am

The list is invisible here
mspider65 wrote: When done, using an Android you will be able to:

- Monitor all the parameter sent by the controller

- Setup all the motor parameters

- Wireless update the module firmware

- Wireless update the Controller Firmware

And much more in future...

User avatar
stancecoke   100 kW

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

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

Post by stancecoke » Nov 17 2019 10:20am

Great! Cool work! :thumb:

This stops the messing around with just three buttons of a display to adjust all the parameters!
Are you using BLE or "normal" BT for communication? Why don't you use a simple HC-05/06 or HM-10 BT-module?

regards
stancecoke

mspider65   1 mW

1 mW
Posts: 14
Joined: Aug 04 2019 2:10pm

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

Post by mspider65 » Nov 17 2019 11:02am

stancecoke wrote:
Nov 17 2019 10:20am
Great! Cool work! :thumb:

This stops the messing around with just three buttons of a display to adjust all the parameters!
Are you using BLE or "normal" BT for communication? Why don't you use a simple HC-05/06 or HM-10 BT-module?

regards
stancecoke
Hi, the interface is based on BLE.
HC-05/06 are just repeaters. ESP32 instead is a poweful MCU. WIth HC-0X it would not possible implements OTA FW update, protocol conversion between Controller and Display and the DS18B20 temperature sensor.
In future it would be possible add much more features.

User avatar
stancecoke   100 kW

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

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

Post by stancecoke » Nov 18 2019 5:59am

mspider65 wrote:
Nov 17 2019 11:02am
protocol conversion
So you don't use casinhos data protocol to commuicate with the app?! Why?

regards
stancecoke

mspider65   1 mW

1 mW
Posts: 14
Joined: Aug 04 2019 2:10pm

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

Post by mspider65 » Nov 18 2019 6:34am

stancecoke wrote:
Nov 18 2019 5:59am
mspider65 wrote:
Nov 17 2019 11:02am
protocol conversion
So you don't use casinhos data protocol to commuicate with the app?! Why?

regards
stancecoke
On the controller side you should use the Official Open Source Firmware (casinhos data protocol) and actually the ESP32 translates the messages to the OEM LCD Protocol (I have the VLCD5 display).
But there are no restrictions and you can easily change the ESP32 firmware to talk to any other LCD. As long as his protocol is known.
Maybe in the future i will add other LCD protocols an made the type of LCD selectable from the Android app

User avatar
stancecoke   100 kW

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

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

Post by stancecoke » Nov 18 2019 8:02am

OK, I see. For the VLCD5 you can use Marcoqs adaption also. But for BT-connection, you need something additional, of course.

In the Kunteng-project, Xnyle uses the modbus protocol for the communication with the mobile app.

https://github.com/stancecoke/BMSBatter ... Odisplay.c

Will you publish your work as open source?

regards
stancecoke

mspider65   1 mW

1 mW
Posts: 14
Joined: Aug 04 2019 2:10pm

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

Post by mspider65 » Nov 18 2019 9:06am

stancecoke wrote:
Nov 18 2019 8:02am

Will you publish your work as open source?
Yes

https://github.com/TSDZ-ESP32
Last edited by mspider65 on Nov 27 2019 12:11pm, edited 1 time in total.

casainho   1.21 GW

1.21 GW
Posts: 3906
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Nov 19 2019 9:55pm

mspider65 wrote:
Nov 17 2019 8:36am
Simulation test done successful.

https://youtu.be/vp3WN9OPtdk

Now i'm waiting a new spare controller to start the field test.

When done, using an Android you will be able to:
  • Monitor all the parameter sent by the controller.
  • Setup all the motor parameters.
  • Wireless update the module firmware
  • Wireless update the Controller Firmware
And much more in future...
Nice, as also because it is OpenSource.

The main project is going with SW102 display that has Bluetooth and will need an app like this.
- 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.

mspider65   1 mW

1 mW
Posts: 14
Joined: Aug 04 2019 2:10pm

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

Post by mspider65 » Nov 25 2019 5:27pm

Finally the controller is arrived!

Image

All the tests went well and, after some minor adjustments, also the firmware update of the STM8 controller from the Android app works perfectly.
I would say that at the moment I did not encounter any problems and I am confident that, once mounted on the bike, everything will work properly.

As soon as the cables/connectors arrive, and I have some time, I will start to assemble everything on the bike and i will do the first test-ride!

User avatar
stancecoke   100 kW

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

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

Post by stancecoke » Nov 26 2019 5:00am

Really cool! :-)

Do you have to change some optionbyte settings, or will the UART bootloader work from the default settings of the stock firmware for flashing?

regards
stancecoke

mspider65   1 mW

1 mW
Posts: 14
Joined: Aug 04 2019 2:10pm

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

Post by mspider65 » Nov 26 2019 5:39am

stancecoke wrote:
Nov 26 2019 5:00am
Really cool! :-)

Do you have to change some optionbyte settings, or will the UART bootloader work from the default settings of the stock firmware for flashing?

regards
stancecoke
I had to enable the STM8 bootloader using the usual "ST Visual Programmer" by changing the corresponding option byte because the bootloader is factory disabled.
But you only have to do it once, and then, you are free to OTA update from the Android app.
Care must be taken that, in normal operation, no data is sent to the controller UART during the first second after power-on, otherwise it enters in bootloader mode. But the ESP32 module also takes care of this.

This is the reference bootloader code i ported to ESP32. Big thanks to Georg Icking-Konert (alias gicking)
https://github.com/gicking/stm8gal

User avatar
stancecoke   100 kW

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

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

Post by stancecoke » Nov 28 2019 3:51am

Do you plan to write a tutorial how to use your ESP32 and app? e.g. in the wiki page of your github repo?
https://github.com/TSDZ-ESP32/ESP32_TSDZ2/wiki

regards
stancecoke

mspider65   1 mW

1 mW
Posts: 14
Joined: Aug 04 2019 2:10pm

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

Post by mspider65 » Nov 28 2019 12:41pm

stancecoke wrote:
Nov 28 2019 3:51am
Do you plan to write a tutorial how to use your ESP32 and app? e.g. in the wiki page of your github repo?
https://github.com/TSDZ-ESP32/ESP32_TSDZ2/wiki

regards
stancecoke
Yes, as soon as everything is tested and i have time i will start to add a wiki.

Post Reply