Bafang M500 and M600 motors

ficorama

Active member
Oct 9, 2021
378
303
Croatia
Hello everyone. I have a Bafang m500 motor for sale. in the set: motor, cranks 170mm, display and shifter dp c240, hub speed sensor and all cables necessary for connection (motor, battery, screen, sensor) I will post pictures later and price please message. the engine was used for 700-800 km. completely correct and functional.
 

Dado

Active member
Jun 28, 2022
692
463
Bratislava
Now some user from USA contacted me, he has M600 with latest firmware 46.9 and stating he see max power of 750W and even can not holds with Brose motor.

So looks like Bafang did again a stupid thing and limiting current? Anybody also with such an experience?

I am getting crazy about Bafang developers, every firmware has some catch or bug. :(
 

Waynemarlow

E*POWAH Master
Dec 6, 2019
1,108
889
Bucks
Now some user from USA contacted me, he has M600 with latest firmware 46.9 and stating he see max power of 750W and even can not holds with Brose motor.

So looks like Bafang did again a stupid thing and limiting current? Anybody also with such an experience?

I am getting crazy about Bafang developers, every firmware has some catch or bug. :(
Dado most of what the USA guy is saying has yet to be proven ( I'm not sure but he is saying his display max's out at 750W, that may not mean that the motor doesn't produce more ). He has problems understanding that the M600 needs to have a higher cadence than the Brose motor he is comparing it to. Lets not make assumptions based on one user.
 

Dado

Active member
Jun 28, 2022
692
463
Bratislava
He sad he can not holds with kids motor - Brose ;) - which is strange. Thats right, doesnt matter what max power bar is LCD showing.
I have asked him to check current limit in controller, lets see if it is 18 Amps.
 

vext

Member
Aug 11, 2022
70
40
Los Angeles
Dado most of what the USA guy is saying has yet to be proven ( I'm not sure but he is saying his display max's out at 750W, that may not mean that the motor doesn't produce more ). He has problems understanding that the M600 needs to have a higher cadence than the Brose motor he is comparing it to. Lets not make assumptions based on one user.
I'm that user.

To be clear guys I do not have problems understanding the cadence issues. ;) I fully understand that the cranks need to spin faster to make power when compared to the Brose. Also I have a deep understanding of EV systems and have built electric motorcycles from scratch and even won land speed record with them at the Bonneville salt flats in 2008. I say that only to remove the belief that I'm somehow "confused".

If I have failed in some manner, it is to explain the issue I'm seeing (which may or may not be related to firmware.)

What I know is this: In VERY steep sections of climb I can't keep up with another rider on a Levo. I am in shape and he is recovering from valve replacement surgery and is 80. I get up the hill fast. Just not as fast as him.

I have found I need to drop down a couple gears from his cadence to dig into the motor's power band (yes by spinning the cranks faster! ;) ) and in doing so I simply end up moving slower up the steep sections and see the motor putting out about 400w. I CAN increase wattage to like 650w by further lowering gears but then I lose more speed.

I would not even think something is wrong except all I hear is "The m600 beats everything all the time" (that's a paraphrase but you catch my meaning) and mine apparently does not.

Yes, I get it... you say "pedal harder" I AM pedaling plenty hard. We all can agree that if someone pedals hard enough they could beat him up the hill, even without a motor. All I'm saying is if beating him requires some peak or even high athletic output then the m600 fails to fit into the "The m600 beats everything all the time" category.

So I started asking you knowledgeable folks if you think something might be broken or set wrong and during that process I learned I have a new' firmware ( I shared on this board the 64.9 bin I managed to get and I trust @Kyokushin will put it up in the git for all to use ). Part of that process showed that my DPC18 display is capped (only visually) at 750w and for others it goes up to 1500w. I'm NOT saying the display limits the wattage - I'm only saying it looks different.

I will test the hill again with the weak-hearted octogenarian on a Levo with 2 changes,
a) 64.7 firmware
b) a throttle to artificially boost watts and just see what happens ( I have never ridden with the throttle)

A quick test on the flats left me feeling no obvious difference between 64.7 and 64.9. And to be clear I would not be surprised if firmware ends up being NOT the issue. For all I know there could easily be another problem.

Sorry for the TL : DR - my goal is only to help us M600 owners enjoy our builds more.
 

Kyokushin

Active member
Mar 28, 2021
332
195
Sol
What is the throttle behaviour in coparison between 46.7 and 46.9 ?
I am asking because i have noticed a 46.7 have around 30% of throttle threshold before it starting to engage.

The max current that i can observe on display on 46.7 is around 20Amps. @vext could you check your peak Amps?

Is the 46.9 firmware a 'stock' that you have received with the Motor? is the 46.9 number on the motor sticker?
 

vext

Member
Aug 11, 2022
70
40
Los Angeles
What is the throttle behaviour in coparison between 46.7 and 46.9 ?
I am asking because i have noticed a 46.7 have around 30% of throttle threshold before it starting to engage.

The max current that i can observe on display on 46.7 is around 20Amps. @vext could you check your peak Amps?

Is the 46.9 firmware a 'stock' that you have received with the Motor? is the 46.9 number on the motor sticker?
Yes 46.9 is stock and came with the motor from the factory. I'll test the other elements and get back to you.

I may be limited by my odd version of the DCP18 display. My range of watts and amps is capped visually and it does not have bluetooth.
 

patdam

Well-known member
Jan 17, 2019
902
601
france
I'm that user.

To be clear guys I do not have problems understanding the cadence issues. ;) I fully understand that the cranks need to spin faster to make power when compared to the Brose. Also I have a deep understanding of EV systems and have built electric motorcycles from scratch and even won land speed record with them at the Bonneville salt flats in 2008. I say that only to remove the belief that I'm somehow "confused".

If I have failed in some manner, it is to explain the issue I'm seeing (which may or may not be related to firmware.)

What I know is this: In VERY steep sections of climb I can't keep up with another rider on a Levo. I am in shape and he is recovering from valve replacement surgery and is 80. I get up the hill fast. Just not as fast as him.

I have found I need to drop down a couple gears from his cadence to dig into the motor's power band (yes by spinning the cranks faster! ;) ) and in doing so I simply end up moving slower up the steep sections and see the motor putting out about 400w. I CAN increase wattage to like 650w by further lowering gears but then I lose more speed.

I would not even think something is wrong except all I hear is "The m600 beats everything all the time" (that's a paraphrase but you catch my meaning) and mine apparently does not.

Yes, I get it... you say "pedal harder" I AM pedaling plenty hard. We all can agree that if someone pedals hard enough they could beat him up the hill, even without a motor. All I'm saying is if beating him requires some peak or even high athletic output then the m600 fails to fit into the "The m600 beats everything all the time" category.

So I started asking you knowledgeable folks if you think something might be broken or set wrong and during that process I learned I have a new' firmware ( I shared on this board the 64.9 bin I managed to get and I trust @Kyokushin will put it up in the git for all to use ). Part of that process showed that my DPC18 display is capped (only visually) at 750w and for others it goes up to 1500w. I'm NOT saying the display limits the wattage - I'm only saying it looks different.

I will test the hill again with the weak-hearted octogenarian on a Levo with 2 changes,
a) 64.7 firmware
b) a throttle to artificially boost watts and just see what happens ( I have never ridden with the throttle)

A quick test on the flats left me feeling no obvious difference between 64.7 and 64.9. And to be clear I would not be surprised if firmware ends up being NOT the issue. For all I know there could easily be another problem.

Sorry for the TL : DR - my goal is only to help us M600 owners enjoy our builds more.
thank you for sharing your knowledge. I have one question the brose of your friend is limited to 25 km/h ?
 

vext

Member
Aug 11, 2022
70
40
Los Angeles
What is the throttle behaviour in coparison between 46.7 and 46.9 ?
I am asking because i have noticed a 46.7 have around 30% of throttle threshold before it starting to engage.
Do you mean the amount of rotational travel before the motor kicks in? Like your thumb rotates 30% of the whole travel before power is felt?

Let me know and i'll check it.

Question for you - do you happen to know what the resistance values are for the throttle potentiometer, at off and at full?
 

Kyokushin

Active member
Mar 28, 2021
332
195
Sol
Do you mean the amount of rotational travel before the motor kicks in? Like your thumb rotates 30% of the whole travel before power is felt?

Let me know and i'll check it.

Question for you - do you happen to know what the resistance values are for the throttle potentiometer, at off and at full?
yes, thats about rotational travel.
unfortunately i do not know the resistance values
 

patdam

Well-known member
Jan 17, 2019
902
601
france
Do you mean the amount of rotational travel before the motor kicks in? Like your thumb rotates 30% of the whole travel before power is felt?

Let me know and i'll check it.

Question for you - do you happen to know what the resistance values are for the throttle potentiometer, at off and at full?
it's not an potentiometer in the throttle (to use it in walk mode) but an active component (i haven't noted what :confused:) i have tried to modified it to adapt throttle for efficient walk mode. I couldn't. the solution found is to limit mechanically the throttle range to have at max 6km/h
 

Kyokushin

Active member
Mar 28, 2021
332
195
Sol
@vext how you could compare the assistance levels 1 and 5 between 46.7 and 46.9?
as far i remember a people complained the lvl1 is too strong.
 

vext

Member
Aug 11, 2022
70
40
Los Angeles
yes, thats about rotational travel.
unfortunately i do not know the resistance values
Yes the 30% "slop" or "play" is present in the throttle in the 64.9. If you ask me it's there for safety so that the bike does not jump at the slightest touch.

My motorcycle had zero play in the throttle and it was kind of dangerous because people would grab the bike and not know, nudge it and it could move (fast) if it was on.

This is the "bike" on the salt.

IMG_2439 (1).jpg


And then after paint - when I used it on the street for a while. And @Waynemarlow note the gears ;). it's a fast swap single reduction jack shaft for changing gearing between runs on the salt.

IMG_4633.PNG
 

vext

Member
Aug 11, 2022
70
40
Los Angeles
it's not an potentiometer in the throttle (to use it in walk mode) but an active component (i haven't noted what :confused:) i have tried to modified it to adapt throttle for efficient walk mode. I couldn't. the solution found is to limit mechanically the throttle range to have at max 6km/h
Why does the stock walk mode not work for you?
 

Equilibrium

Member
Apr 25, 2021
2
0
US
What I know is this: In VERY steep sections of climb I can't keep up with another rider on a Levo. I am in shape and he is recovering from valve replacement surgery and is 80. I get up the hill fast. Just not as fast as him.

What is your and the vado guy's cadence? How steep and long are these sections ?
 

patdam

Well-known member
Jan 17, 2019
902
601
france
Why does the stock walk mode not work for you?
Not ergonomic, not efficient. Sometime on mountain we have long walking part. I prefer using throttle limited to 6 km/h max. It's one of the major reason why i prefer the bafang to the other motors
 

casainho

Active member
May 27, 2022
44
142
Portugal
I just installed the EBike board on the Bafang M500 motor, but for now, only on the desk and not yet on my EBike -- soon I will :D

Here is a picture, note the EBike board powered on with his LEDs. All that wires/cables are final, and I put a 4 wires connector to the VESC UART and 5V and GND wires, this way I can quickly disconnect the VESC from the EBike board, to make easy for final installation:



Here is a video:


And here are screenshots from my phone, accessing wireless to the EBike board, I can edit here the firmware, save it and it will run:



And here the firmware outputting the torque sensor torque raw value, the calculated weight kgs and the cadence. Interestingly, when the motor runs as seen on the video, there is cadence value:



And here is the EBike board, with short wires and carefully soldered. On this side, we see the ESP32-S3 board:



On this side, we see the MCP2515 CAN module board that let us read the torque sensor values:



So, for now, the EBike board reads the torque sensor and control the motor by sending commands to VESC. What is missing? is missing the brake sensors connection; wheel speed sensor connection and display connection.

Wheel speed is not a priority, I will leave for the end of the project. Display, it is not a priority for now as I can see the EBike data sent wireless to my phone, that is enough for now. To have my EBike working, I just need to "plug" to torque sensor value to the VESC motor current - and I also need the brake sensor working, this is a must!!
 

casainho

Active member
May 27, 2022
44
142
Portugal
I wired the brakes signal to the EBike board. Unfortunately, ESP32 has weak internal pull-ups and so I had to add and resistor on EBike board from the 3.3V to the brake signal ESP32 input pin.

This were quick early tests, but here a video of me pushing the pedals with my hand, and the motor reaction to it:
The piece of code that reads the torque sensor weight value in kgs and maps to the motor current:



NOTE: the code is missing the current ramp, to keep the current increase in control and slow, to avoid damage of the gears, etc. Still, I did some very short rides and it seems to work very well, It made me happy!! and as you can see, both motor start and stop, is not noisy, it is similar to original motor firmware, which is good!!

The firmware as also a task code to output some useful data, I get this in real time in my phone:
1. torque weight value in kgs
2. cadence
3. brake state
4. motor current (read from VESC)



My next step is to implement the motor current ramp. Then probably I will connect the display and start riding my EBike while I will be tweaking the firmware to have the motor response I am looking for. In begin of February I will have some MTB events, so by then I hope to have all the system ready, this means also everything water resistant!

Code and other information are on Github: GitHub - OpenSourceEBike/EBike_EScooter_app_pyhton: EBike and EScooter app developed in CircuitPython, to output control commands to the VESC motor controller and read various input sensors as throttle and torque sensors
 

thaeber

Well-known member
Jan 26, 2021
887
769
Bruchsal, Germany
Would be interesting to know if this also works with M510. The torque sensor signal seems to be different- my display does not show any kalories counting with M510 any more….
 

casainho

Active member
May 27, 2022
44
142
Portugal
Would be interesting to know if this also works with M510. The torque sensor signal seems to be different- my display does not show any kalories counting with M510 any more….
If you are interested, go and ask to the sellers as GreenBikeKit. For what they show on their site, I expect Bafang motors M40x, M50x, M60x and M80x, all use CAN torque sensors or even if is UART, is similar easy to read the value.

Screenshot from 2022-12-24 13-58-22.png


Screenshot from 2022-12-24 14-00-49.png


Screenshot from 2022-12-24 13-59-58.png
 

thaeber

Well-known member
Jan 26, 2021
887
769
Bruchsal, Germany
Thanks mate, smart explanation! If there is ony one kind of torque sensor available…
Then assumption is only the firmware does not support kalorie counting anymore. Thanks for all the time You spend with Your development work! Happy Holidays!
 

temon10

Well-known member
Feb 8, 2022
675
562
Malang, Indonesia
Thanks mate, smart explanation! If there is ony one kind of torque sensor available…
Then assumption is only the firmware does not support kalorie counting anymore. Thanks for all the time You spend with Your development work! Happy Holidays!
one note, M510 torque sensor has different shape from M500/M600. I have 1 in trouble now still waiting replacement from Bafang. Already a month and still no information from them :(
 

patdam

Well-known member
Jan 17, 2019
902
601
france
one note, M510 torque sensor has different shape from M500/M600. I have 1 in trouble now still waiting replacement from Bafang. Already a month and still no information from them :(
Please could you explain the trouble and how you have identified that this is the torque sensor who are fails ? it seem that sotware 3.1-cs have solved the problem of cutoof of the M510 for lot off people. Not me, they are less intrusive but it still occur on my M510 and i'm asking if it's not a problem of torque sensor ?

Other question, you are able to exchange directely with bafang ? you are purchaser of lot of motors ?
 

temon10

Well-known member
Feb 8, 2022
675
562
Malang, Indonesia
Please could you explain the trouble and how you have identified that this is the torque sensor who are fails ? it seem that sotware 3.1-cs have solved the problem of cutoof of the M510 for lot off people. Not me, they are less intrusive but it still occur on my M510 and i'm asking if it's not a problem of torque sensor ?

Other question, you are able to exchange directely with bafang ? you are purchaser of lot of motors ?
Motor can turn on but no pedal assist at all, throttle also normal. Already calibrating and change firmware with besst tool still no assist.
I bought from bafang reseller, they help to claim after sales to bafang.
 

patdam

Well-known member
Jan 17, 2019
902
601
france
Motor can turn on but no pedal assist at all, throttle also normal. Already calibrating and change firmware with besst tool still no assist.
I bought from bafang reseller, they help to claim after sales to bafang.
Ok. Don't hesitate to share the result, it's very difficult to find reseller who provide efficient support after sale
 

casainho

Active member
May 27, 2022
44
142
Portugal
I got the VESC working with the magnetic encoder sensor, just like the original motor controller and firmware does.

Previously, after I tried the motor current ramp up, I could understand the HFI sensorless do not provide a soft motor startup. Even later I tried to follow the VESC tutorials for setup the HFI values and for some reason it does not work on this motor (motor specifics?? Flipsky 75100 issues ??).

So I received yesterday the AS5047D magnetic encoder board, did some tests to learn how to use it and finally I were able to make it working with VESC. I found that this board can be far away from the magnet and it will still work well, even with some misalignment related to the magnet.

To get the AS5047 magnetic encoder working with Flipsky 75100, I had 2 issues:
1. The SPI wires to read the AS5047 are the same for the hall sensors and so the low pass filters (capacitors and resistors) on the hall sensors circuit (inside the Flipsky 75100), had to be removed. After this, the hall sensor / SPI wires can only read 3.3V signals, so I had to configure the AS5047 board to work with 3.3V (I took the 3.3V to power the AS5047 board, from the EBike board).
2. Two hall sensor wires are incorrect labeled on Flipsky 75100 documentation - HALL 3 should be swapped with HALL 1 (what would be SPI SCK and SPI CS wires, need to be swapped).

So, here are the low pass filters on hall sensors circuit -- original Flipsky 75100:


I had to remove the capacitors and resistors as seen on the image. Plus, at red, I had to remove that resistor and solder a small wire / shunt. That is the path of SPI CLK and I saw the signal a bit deformed with the original resistor, but without it, after soldering that wire / shunt, the signal is good:


And here is the 3D printed cover, with the AS5047 magnetic encoder board in placed (I used thin double tape to glue the board):


And here is the cover in place:


What were the results??

Testing on the VESC tool, I can see the magnetic encoder read angle relative to the motor rotor shaft, at the values seem perfect.

Seems to me the motor startup is good. I tested what was the minimum motor power for motor to be able to run, I used a constant duty-cycle on VESC tool, and I got a minimum of about 0.08 duty-cycle (8%) to keep the motor running and in this case it uses about 1W of power (1.5A of motor current, 0.35A of battery current, on a 30V battery voltage).

I expect to need a minimum of 25W of motor power, anything less will probably be to much lower. So, if motor can runs with a minimum 1W, that is great!!

But next I need to install all this on my EBike and do the real tests. Let's see how it will go!!

Here is a video of VESC tool showing the motor running at max power it draws, on my bench, without any load. I also tested the min power needed for it run. Also we can see the read angle from the AS5047 magnetic encoder board:

 

Waynemarlow

E*POWAH Master
Dec 6, 2019
1,108
889
Bucks
Caisanho, phew that looks to be a lot of detective and electronics work going on there.

On the printed cover, is there a possibility of stepping out that cover to create a larger void inside the motor, even 5 - 10mm maybe enough to get a full Mini VESC setup in there.

Good luck with the actual real time trials on your bike.
 

casainho

Active member
May 27, 2022
44
142
Portugal
It feels perfect!!

Finally I got the EBike board installed on my EBike and using the AS5047 magnetic encoder board to detect the motor rotor position, just like the original motor controller does. See here how it behaves with me pedaling with hand:
It is raining and so I can not test it very well but I did some very short rides and it fells very good. But you can also check the startup noise I had here when using sensorless / not using the AS5047 board - listen the startup noise of motor gears at begin of the video:
Assist level

On the current state, I only have the torque sensor and brakes sensors connected, I am missing the display. Still, as I can quickly edit the Python code on my phone, created the variable "assist_level_factor" where I can set a value like 1.0, 0.5, 3.0 or such (see next screenshot from my phone). This value simple multiplies the torque sensor value, that will be mapped linearly to the motor current / motor torque, like: 10kgs on torque sensor will set 10Amps of motor current, and 20kgs on torque sensor will set 20Amps of motor current.
And as you can see, I can also quickly tune some parameters as motor max current, torque sensor min value, etc:



So, this is my final EBike board + the 3D printed motor cover with the AS5047 board (behind the black tape):



But I found hard to put all inside... I had to cut part of the cover otherwise I would not be able:



And here is the final result, not water prof for sure :lol:


And for the curious to learn, here is the main EBike code, that I consider almost finished and easy to understand:

 

EMTB Forums

Since 2018

The World's largest electric mountain bike community.

556K
Messages
28,097
Members
Join Our Community

Latest articles


Top