New TSDZ2 Open Source firmware with Bluetooth interface

mspider65

100 W
Joined
Aug 4, 2019
Messages
193
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...
 
The list is invisible here

mspider65 said:
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...

 
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
 
stancecoke said:
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.
 
stancecoke said:
mspider65 said:
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
 
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/BMSBattery_S_controllers_firmware/blob/Master/BOdisplay.c

Will you publish your work as open source?

regards
stancecoke
 
mspider65 said:
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.
 
Finally the controller is arrived!

20191125224227_20191125_223355.jpg


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!
 
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
 
stancecoke said:
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
 
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
 
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

ESP32-TSDZ2v1.jpg
 
mspider65 said:
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-firmware/TSDZ2_wiki/wiki/Interesting-forks-and-projects
 
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
 
mspider65 said:
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.
 
gomyles said:
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.
 
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?
 
casainho said:
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
 
gomyles said:
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.
 
mspider65 said:
gomyles said:
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
 
Back
Top