BT Interface for TSDZ2 Open Source firmware - Work in progress

Electric Motors and Controllers
mspider65   10 W

10 W
Posts: 69
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 GW

100 GW
Posts: 6645
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: 1312
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   10 W

10 W
Posts: 69
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: 1312
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   10 W

10 W
Posts: 69
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: 1312
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   10 W

10 W
Posts: 69
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   10 GW

10 GW
Posts: 4696
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 OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, 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 to help my developments: paypal.me/jorgecasa

mspider65   10 W

10 W
Posts: 69
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: 1312
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   10 W

10 W
Posts: 69
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: 1312
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   10 W

10 W
Posts: 69
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.

mspider65   10 W

10 W
Posts: 69
Joined: Aug 04 2019 2:10pm

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

Post by mspider65 » Mar 03 2020 9:51am

Since the tests went well I decided to move on to phase 2 of the project which provides for a better integration of all the electronics inside the motor.

Finally, despite the delays for COVID-19, the PCBs arrived from China.

The small PCB board will be placed over the controller inside the motor.

As soon as I have time I move on to assembly and the final test.
I hope I have not made mistakes in the design of the board

Project homepage (WIP):
https://github.com/TSDZ2-ESP32

Image

casainho   10 GW

10 GW
Posts: 4696
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Mar 04 2020 3:40am

mspider65 wrote:
Mar 03 2020 9:51am
Since the tests went well I decided to move on to phase 2 of the project which provides for a better integration of all the electronics inside the motor.
Nice to see!!

I put a link to this project on my project wiki page: https://github.com/OpenSource-EBike-fir ... d-projects
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, 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 to help my developments: paypal.me/jorgecasa

mspider65   10 W

10 W
Posts: 69
Joined: Aug 04 2019 2:10pm

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

Post by mspider65 » Apr 21 2020 5:50pm

A small update on the project.
The test of the first version of the PCB Board went quite well.
Some small problems have emerged in the design of the PCB board that I have already corrected and I have just ordered the new version with the necessary modifications.

The board also is open source and it will be possible for everyone to order the board assembled directly from a PCB manufaturer.
I'm using PCBWay at he moment and the ordering process is much simpler than you might think. (I will add also this on the wiki)
The first 3 samples cost me 90$ but obviously the cost decrease if you order more boards. I have ordered 10 boards for the new version and, if after the test someone is interested, i could sell some of them for the cost i have paid.

In any case, even with the current version I was able to continue with the tests of the SW part.
At the moment all functions are working correctly but i will need some more ride tests (the current lokdown in Italy does not allow me to use the bike)
At the moment all the following functions are implemented and working correctly on the Android App:
- Monitor of all the controller operating parameters (update frequency configurable from 1s to 1/5sec. Speed, cadence, battery volt/current, power, torque, motor temperature, pcb temperature, motor ERPS, ecc...)
- Configuration of all the controller FW parameters.
- ESP32 firmware OTA update
- STM8S Controller firmware OTA Update
- Controller data History Log (All data sent by the coontroller is stored with a sample rate of 1sec. Log data retention is 7 days )
- History log data Charts visualization (up to 3 series on the same chart, with pan, zoom, scroll)

As soon i have spare time i will start to update the wiki.

The home page of the projet is:
https://github.com/TSDZ2-ESP32

gomyles   100 mW

100 mW
Posts: 38
Joined: Nov 13 2019 12:54pm

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

Post by gomyles » Apr 25 2020 6:56am

mspider65 wrote:
Apr 21 2020 5:50pm
A small update on the project.
The test of the first version of the PCB Board went quite well.
Some small problems have emerged in the design of the PCB board that I have already corrected and I have just ordered the new version with the necessary modifications.

The board also is open source and it will be possible for everyone to order the board assembled directly from a PCB manufaturer.
I'm using PCBWay at he moment and the ordering process is much simpler than you might think. (I will add also this on the wiki)
The first 3 samples cost me 90$ but obviously the cost decrease if you order more boards. I have ordered 10 boards for the new version and, if after the test someone is interested, i could sell some of them for the cost i have paid.

In any case, even with the current version I was able to continue with the tests of the SW part.
At the moment all functions are working correctly but i will need some more ride tests (the current lokdown in Italy does not allow me to use the bike)
At the moment all the following functions are implemented and working correctly on the Android App:
- Monitor of all the controller operating parameters (update frequency configurable from 1s to 1/5sec. Speed, cadence, battery volt/current, power, torque, motor temperature, pcb temperature, motor ERPS, ecc...)
- Configuration of all the controller FW parameters.
- ESP32 firmware OTA update
- STM8S Controller firmware OTA Update
- Controller data History Log (All data sent by the coontroller is stored with a sample rate of 1sec. Log data retention is 7 days )
- History log data Charts visualization (up to 3 series on the same chart, with pan, zoom, scroll)

As soon i have spare time i will start to update the wiki.

The home page of the projet is:
https://github.com/TSDZ2-ESP32

Well I'm very excited. I would buy a board off of you once you don't need it anymore.

Just to clarify, would this enable the throttle to be used while simultaneously using the temperature sensor on the motor and being able to operate at safe temperatures?

Thank you for your contributions! This looks very exciting.

mspider65   10 W

10 W
Posts: 69
Joined: Aug 04 2019 2:10pm

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

Post by mspider65 » May 08 2020 2:09am

gomyles wrote:
Apr 25 2020 6:56am
Well I'm very excited. I would buy a board off of you once you don't need it anymore.

Just to clarify, would this enable the throttle to be used while simultaneously using the temperature sensor on the motor and being able to operate at safe temperatures?

Thank you for your contributions! This looks very exciting.
Yes with the new board it will be possible to have both the throttle and the motor temperature control. The ESP32 fw will send to the controller new max current value based on motor themperature value.

The final (i hope) board is arriving from PCBWay. As soon it arrives i will do a final test and update the wiki.

In the meantime i have also added to the board FW the BT 4.0 Cycling Power profile and now you can connect the bike to an app like Oruxmaps.

casainho   10 GW

10 GW
Posts: 4696
Joined: Feb 14 2011 2:43pm

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

Post by casainho » May 08 2020 2:15am

I have the firmware on SW102 sending and receiving data over Bluetooth UART, Would be nice if at sometime we could make SW102 work with your app - would you be interested to have this on your mobile app?
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, 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 to help my developments: paypal.me/jorgecasa

mspider65   10 W

10 W
Posts: 69
Joined: Aug 04 2019 2:10pm

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

Post by mspider65 » May 08 2020 7:13am

casainho wrote:
May 08 2020 2:15am
I have the firmware on SW102 sending and receiving data over Bluetooth UART, Would be nice if at sometime we could make SW102 work with your app - would you be interested to have this on your mobile app?
Hi Casainho ,
I have no plans to buy the SW102, my eyes like the big characters of the VLCD5 :( .
I'm working now to make the current version stable. It is based on the v20 controller firmware with some small improvements like slower ADC conversion speed (like i suggested to you some days ago), UART TX interrupt based and some other small things.
Then i have in plan to switch to your current Firmware implementation as soon it becomes final.

Massimo
Last edited by mspider65 on May 08 2020 7:24am, edited 1 time in total.

mspider65   10 W

10 W
Posts: 69
Joined: Aug 04 2019 2:10pm

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

Post by mspider65 » May 08 2020 7:24am

gomyles wrote:
Apr 25 2020 6:56am
Well I'm very excited. I would buy a board off of you once you don't need it anymore.
Yes i will receive few extra cards (the cost difference between 10 board was only 20% more than 5 and i'we ordered 10 boards) , and I gladly give them at the cost I paid.
But I would like to clarify that I am not going to sell the boards directly or to create a business about it.
It's just a hobby for me.
In any case, ordering the boards directly on a site like PCBWay is much easier than you might think.
It is sufficient to fill in some fields, upload 3 files that are present on the Github repository and pay with PayPal. Once this is done, you will receive the boards already assembled and ready for use.
I will add also a guide on this on the Wiki.

gomyles   100 mW

100 mW
Posts: 38
Joined: Nov 13 2019 12:54pm

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

Post by gomyles » May 09 2020 7:10am

mspider65 wrote:
May 08 2020 7:24am
gomyles wrote:
Apr 25 2020 6:56am
Well I'm very excited. I would buy a board off of you once you don't need it anymore.
Yes i will receive few extra cards (the cost difference between 10 board was only 20% more than 5 and i'we ordered 10 boards) , and I gladly give them at the cost I paid.
But I would like to clarify that I am not going to sell the boards directly or to create a business about it.
It's just a hobby for me.
In any case, ordering the boards directly on a site like PCBWay is much easier than you might think.
It is sufficient to fill in some fields, upload 3 files that are present on the Github repository and pay with PayPal. Once this is done, you will receive the boards already assembled and ready for use.
I will add also a guide on this on the Wiki.

Glad to hear it's that easy. That's awesome. Thank you again! Looking forward to the project and its development :D


gomyles   100 mW

100 mW
Posts: 38
Joined: Nov 13 2019 12:54pm

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

Post by gomyles » May 18 2020 11:58am

Can you sell me a board?

Post Reply