Bafang M500/M600 thread

With Can protocol, the controller sends current, voltage, speed, battery voltage, battery %, controller temperature and motor temperature in real time.
 
With CAN protocol, voltage and current have a definition of 0.01 units.

SUPERJC said:
The ESP32 calculate the Wh with current and volt
these values (V and A) can be retrieved by any protocol (Uart, Can, ADC, other…)
On the Uart Bafang BBS protocol we only have steps current of about 0.25A or 0.5A
On the canbus M600-500 -> I dont know what are the steps of the current?
For me it's read by ESP32 with ADS1115 (for precision)
ESP32 send only Wh to Garmin wirelessly (BLE)
The Garmin having the km and the elevation can calculate Wh/km and the estimates itself
you can do your data field and your calculation by Garmin itself
app for that already exists -> Garmin IQ AppBuilder 5+
https://apps.garmin.com/en-US/apps/394941a6-4e73-4843-820b-fdcfbc877f3a
yw71.jpg


…and if you have memory
you can recording
qs63.jpg
 
CiDi said:
With Can protocol, the controller sends current, voltage, speed, battery voltage, battery %, controller temperature and motor temperature in real time.
ONLY if you have their battery with their proprietary BMS.
 
casainho said:
CiDi said:
With Can protocol, the controller sends current, voltage, speed, battery voltage, battery %, controller temperature and motor temperature in real time.
ONLY if you have their battery with their proprietary BMS.

With any battery
 
CiDi said:
casainho said:
CiDi said:
With Can protocol, the controller sends current, voltage, speed, battery voltage, battery %, controller temperature and motor temperature in real time.
ONLY if you have their battery with their proprietary BMS.

With any battery
Really? than can you please point to where the CAN commands are documented? because I could not understand that looking at our current notes: https://github.com/OpenSourceEBike/Bafang_M500_M600/tree/main/CANBUS

Oh, forget about this!! Yes, I missed that part of the notes!!

So, this is better than what I expected. For instance, original TSDZ2 firmware did not provide battery voltage nor battery current, nor motor power...

With all this information, the first development I will probably do is to adapt our DIY display to fully control the motor!! Motor firmware will not be the priority at start, as even because I need to use some time the original firmware to see how it works.

CiDi said:
With Can protocol, the controller sends current, voltage, speed, battery voltage, battery %, controller temperature and motor temperature in real time.
This all the information needed to implement the EBike ANT+ LEV wireless standard!!
 
casainho said:
CiDi said:
casainho said:
CiDi said:
With Can protocol, the controller sends current, voltage, speed, battery voltage, battery %, controller temperature and motor temperature in real time.
ONLY if you have their battery with their proprietary BMS.

With any battery
Really? than can you please point to where the CAN commands are documented? because I could not understand that looking at our current notes: https://github.com/OpenSourceEBike/Bafang_M500_M600/tree/main/CANBUS

Thanks!!

ID: 02F83200
Numbers Byte: 8
% Battery Byte 0 : 50%(32Hex) = 32
Byte 1/2/3 : 00 00 00
Byte 4 : EE
Byte 5 : 02
Level Byte 6/7 : 0 = FF FF / 1 = 40 1F / 2 = 2C 1A / 3 = EC 13 / 4 = AC 0D / 5 = 8C 0A


ID: 02F83201
Numbers Byte: 8
Speed Byte 0/1 : 25.00km/h(9C4Hex) = C4 09
Current Byte 2/3 : 10.00A(3E8Hex) = E8 03
Voltage Byte 4/5 : 53.46V(14E2Hex) = E2 14
Temp. Control. Byte 6 : 10°C = 10+40=50(32Hex) = 32
Temp. Motor Byte 7 : 20°C = 20+40=60(3CHex) = 3C
 
@CiDi, I just edited my message. Thank you!!
 
Hi Besst User,

I want to get updates via the beest software. But if I click * get a file from cloud* then a popular appears with „there is no history software in besst“
Any ideas to solve this problem? Using newest software 1.2.26 and newest hardware Uc 3.0.5

Or does this mean that a newer software isn’t available?

Thanks
8ba1850e19e740b2c3a1238a6c878290.jpg



Gesendet von iPhone mit Tapatalk
 
@SUPERJC, if you move to the NRF52840, you can still drive any display, continue to have the Bluetooth communication with Garmin Edge, and, with added feature of changing the Garmin page directly from the same remote you use to change the assist level of your motor. Garmin page change uses ANT+ Controls profile. We already have this implemented. You can get the source code on the GitHub.

You can program the NRF52840 in C/C++ or Python!!

And very good that Garmin customized data field, I was not aware of such tool!!
 
mirkoser100 said:
Hi Besst User,

I want to get updates via the beest software. But if I click * get a file from cloud* then a popular appears with „there is no history software in besst“
Any ideas to solve this problem? Using newest software 1.2.26 and newest hardware Uc 3.0.5

Or does this mean that a newer software isn’t available?

Thanks
8ba1850e19e740b2c3a1238a6c878290.jpg



Gesendet von iPhone mit Tapatalk

This BESST function has never been implemented, it uses local files and downloads the firmware from github.

https://github.com/OpenSourceEBike/Bafang_M500_M600/tree/main/Firmwares/Official/Motor
 
Hmm strange, because my besst hardware tool got the update when I plugged it in and started the besst software tool. And in the changelog of the software rhey are also taking about updates?


Gesendet von iPhone mit Tapatalk
 
mirkoser100 said:
Hmm strange, because my besst hardware tool got the update when I plugged it in and started the besst software tool. And in the changelog of the software rhey are also taking about updates?


Gesendet von iPhone mit Tapatalk

The BESST hardware update is implemented
 
casainho said:
@SUPERJC, if you move to the NRF52840, you can still drive any display, continue to have the Bluetooth communication with Garmin Edge, and, with added feature of changing the Garmin page directly from the same remote you use to change the assist level of your motor. Garmin page change uses ANT+ Controls profile. We already have this implemented. You can get the source code on the GitHub.

You can program the NRF52840 in C/C++ or Python!!

And very good that Garmin customized data field, I was not aware of such tool!!
AppBuilder is a flexible app for Garmin
You can alternate between data field every x seconds
You can have garmin sound alert for % eBike battery
we can do what we want…
The only limits to what you can build are your imagination :mrgreen:
all the information is there:
https://ciq-appbuilder.blogspot.com/p/overview.html

I hope that the work done by all of you will also be useful with Can protocol Bafang engines
when the protocol is known we can do everything we want easily
for NRF52840, I need to find a tutorial for beginners with Arduino (C++)
but for the moment I have not the time to beging from scratch
I will look later if really it is necessary

we worked a lot on the uart protocol
https://github.com/weiss-jack/Bafang/blob/master/Analyse/Bafang_Protocol-hack_3mai2018.pdf

ESP32 display is now 4 years old
and work in all conditions
1pnw.jpg


is 3d printing good for waterproofing ?

9me5.jpg
 
SUPERJC said:
I hope that the work done by all of you will also be useful with Can protocol Bafang engines
when the protocol is known we can do everything we want easily
Yes, for Bafang M500/M600 will be easy as the CAN commands are already documented and tested by the developers!! And on the display side, it is like just another similar motor, sending and receiving the same data, as also display to user, as also the configurations as wheel size or max speed.

SUPERJC said:
for NRF52840, I need to find a tutorial for beginners with Arduino (C++)
but for the moment I have not the time to beging from scratch
I will look later if really it is necessary.
If you want to reuse our code, it is in C and makes sense only if you use the same display. Yes, Arduino also works on the NRF52840.

SUPERJC said:
is 3d printing good for waterproofing ?
Yes it is!! and if your are not sure, you can always "paint" the 3D printed parts with the glue or silicone.

I use a large transparent tape and put it on top of the display in a way it will also cover the laterals. Then I put silicone on the lateral and then the cover part/top part/frame of the enclosure, that will squezze the silicone and the tape against the enclosure wall and that way make it water prof: https://opensourceebike.github.io/build_display.html
display-7.jpg


You will then need to also put silicone to cover very well the cables hole on the enclosure – the the white silicone on the next picture:
display-6.jpg


display-5.jpg
 
I need to buy extra connectors for the motor and I found on Aliexpress a shop selling them: https://pt.aliexpress.com/item/1005003656557018.html

Can someone please say how many pins are on the left connector?? Here is the picture:



And I also would like to know which other connectors (pin number) are used, like the one for speed sensor, battery, throttle, etc. Thank you. If I get this information, later I will write on the wiki for everyone.

 
casainho said:
I need to buy extra connectors for the motor and I found on Aliexpress a shop selling them: https://pt.aliexpress.com/item/1005003656557018.html

Can someone please say how many pins are on the left connector?? Here is the picture:



And I also would like to know which other connectors (pin number) are used, like the one for speed sensor, battery, throttle, etc. Thank you. If I get this information, later I will write on the wiki for everyone.


Look on GitHub, there is all the information we know.

https://github.com/OpenSourceEBike/Bafang_M500_M600/blob/main/Hardware/Board/Bafang%20M500_M600%20Connectors.pdf
 
CiDi said:
Look on GitHub, there is all the information we know.
Thanks. Although the files were there, they were not mentioned on the notes.
I added more info for the cables, with links to shops. Also added a section for how to build an EBike with Bafang M500/M600 motors. Added link to this thread.

And I bought my cables. With that I will be able to connect any CAN device to the motor, like the DIY display that I will start to develop. I will receive my motor in 1 week.

https://github.com/OpenSourceEBike/Bafang_M500_M600

image.png
 
Can someone say what is the function of this magnet in the system??

[youtube]69MAw89i7e8[/youtube]
 
So far as I can tell it is for speed (at a minimum) or angle/position(most likely) of the motor. I believe that magnet interfaces directly with the "6804" chip on the controller board. "MT6804" chip is "...a rotary angle encoder chip based on anisotropic magnetoresistance (AMR) technology" by Magnetec.

So I am guessing the "6804" chip on the controller, placed specifically above that shaft, is sensing the speed/position of the motor.

Magnetec seems to be offline at least for the moment. Here is google cache:

https://webcache.googleusercontent.com/search?q=cache:gCNDgSE0cgMJ:www.magntek.com.cn/en/list/168/494.htm+&cd=2&hl=en&ct=clnk&gl=us

and the latest picture. As always, right click, 'View in new tab' for the full scale version.
 

Attachments

  • X1 Ludicrous Controller M600 - Annotated Top V1.7.jpg
    X1 Ludicrous Controller M600 - Annotated Top V1.7.jpg
    3.8 MB · Views: 501
casainho said:
Can someone say what is the function of this magnet in the system??

[youtube]69MAw89i7e8[/youtube]
I have some important news!!

That magnet is because the M500/M600 motor controller uses a magnetic sensor to measure the angle of the motor rotor shaft, where that magnet is glued.

On the board (see picture bellow), it the integrated circuit that is the magnetic sensor is the MT6804 -- that is soldered in the center of a while circle on the board.

So, since the controller can then have the rotor position using this magnet, it should have high resolution position!! So, that is why this motor does not have hall sensors, because the hall sensors are way worst than this magnet sensor!! Also the board does not have the typical phase current sensors, needed on the motors that must implement sensorless algorithm to find the rotor position (but that is not good, because can not provide strong motor torque at startup).

At that is also why there is a calibration option for when we open and close the motor, because the magnet MUST be very well aligned with the board, so it needs a calibration.

So all this also means it will be hard to use an external controller, because it will need to be sensorless but will not provide the best torque at startup!!
So, for developing our own firmware, now I think the best is to use the original controller.

I need to put all this information on the repository.

 
So that would mean the calibration is not needed after each firmware change (i never did calibration) or even controller change (i mean by replacement or swap M600 controller to M500). That suggest the calibration may be only required when engine is reassembled.
 
4πr^2 said:
So far as I can tell it is for speed (at a minimum) or angle/position(most likely) of the motor.
Thanks.

Kyokushin said:
So that would mean the calibration is not needed after each firmware change (i never did calibration) or even controller change (i mean by replacement or swap M600 controller to M500). That suggest the calibration may be only required when engine is reassembled.
The offset value of the angle of the magnet should be saved somewhere. Maybe that value is preserved over firmware updates. And since the boards are similar, may not male a big difference - the magnetic sensor may be slightly soldered offset between boards and even when of screw the motor case where the board is -- still all this are very small values, should not make big difference for startup torque but my reduce a bit the motor efficiency and increase slightly the motor noise.

When you change for a different motor or magnet, I think it should really be needed to calibrate.
 
I need to put all the information of magnetic sensor on the repository, controller / hardware page.

I also created a new page Maintenance and Repair:

 
Great job casainho. just one recomendation. Try to have crankcases gasket in store before opening the motor, ofen it 's brokening when you open the motor.
 
patdam said:
Great job casainho. just one recomendation. Try to have crankcases gasket in store before opening the motor, ofen it 's brokening when you open the motor.
Thanks and this information could go to the maintenance and repair page.

I just added a new idea for a project: Develop our own firmware for the original motor controller



There are 2 main ideas for projects: 1 - the display to be used with original firmware; 2 - our own firmware for the original motor controller. Clearly the most quick, cheap and almost with zero risk, is the display. The firmware for the motor controller will take more time and will need developers to buy at least the original motor controller but ideally a full motor, for the development.

Let´s see if there are developers interested and we can also share the work between us, and going step by step.
 
Back
Top