I did finalize the installation of the small VESC motor controller + EBike board, inside my Bafang M500. It works well as I expected, just like it did on my previous version with the external VESC FLIPSKY 75100.
The final result is this one:
And how is it inside?? Here it is, without that black plastic 3D printed cover:
And more details. Here is the DIY EBike board + the VESC FLIPSKY Mini FSESC6.7:
That DIY EBike board is based on ESP32-S3, that is running the Pyhton EBike firmware and that I program wireless by Wifi. I am sharing the firmware, schematics, photos, etc, here: https://github.com/OpenSourceEBike/EBike_EScooter_app_pyhton
Here is the schematic:
After testing that every EBike sensor reading were working, I put silicone to make all that wires robust, including the connectors. The idea is to make everything robust and avoid breaking due to the vibrations while I am riding on the mountains:
And finally, I used kapton tape that is very robust and resists to high temperatures:
BUT, there is also some not good news. With all that wires and tight space, it is not possible to have the magnetic encoder sensor working. So, in the end I configured VESC to run sensorless and it works well as I tested before on my previous version with the external VESC FLIPSKY 75100.
Here is picture of the magnetic encoder sensor board. From my tests, I found that no wires can be near and between the magnetic encoder board and the round part of the motor case. But as you can see, I could not do it. Maybe someone can improve the wire routing but I decided to stop here. And a picture of the 3D printed cover with the magnetic encoder board, that I tried to make working:
Conclusions
Build with VESC FLIPSKY Mini FSESC6.7:
This build with VESC FLIPSKY Mini FSESC6.7 is the most clean possible. I think no one will understand that VESC is inside, that your EBike is running Pyhton firmware and that you can program / develop / debug your motor firmware directly by wifi wireless using your phone or PC.
But there are two disadvantages:
1. this FLIPSKY Mini FSESC6.7 supports only 48V / 13S batteries
2. due to the space limitations, motor is running sensorless and while the motor startup is good, it is not as good as on the original motor controller
Build with VESC FLIPSKY 75100:
This build with VESC FLIPSKY 75100 is the most powerful possible, because this VESC can handle batteries up to 75V and 100Amps currents, so theoretically can handle 7.5kw!! Also, as this VESC is placed outside, there is space to install the magnetic encoder board and so the motor startup is the best possible.
But there is one disadvantage: this VESC FLIPSKY 75100, although small, there is not space available inside for it and so it must be placed outside, attached to your EBike frame.
Next steps: I am yet to decide if I will use the most clean build or the other. My best battery is a 52V / 14S battery and I would need to rework to make it to 48V / 13S, to work on this most clean build.
I need to improve the display firmware, as currently it displays very basic information.