• Hello ES! We could use some help to get us past the finish line on building the new knowledgebase for the forum.
    Can you donate? Please see our fundraising page. Thank you!

VESC for Bafang M560

Status
Not open for further replies.
But the K1 modules are the IP of K1. The VESC is Open Source. If you use it commercially, you have to publish your code. That was the reason, why Innotrace doesn't exist any more...

" The developer (Krasnodar Jandrijevic) has quit Innotrace in January, shutting down the servers as he left. Rico was alone since then. Krasnodar was not willing to share his code and Rico suspected he would use VESC. This has now been confirmed after the controller was examined more closely. Actually, this means something good: From now on there is a possibility to work on the official development state of VESC. Everyone can collaborate and contribute to it. The benefit of OpenSource."
Source
 
Or he can design 2 separate units, a basic VESC controller PCB with default VESC firmware and an overhead PCB with proprietary firmware which processes the Bafang sensors inputs and communicates with the Bafang display and just commands the VESC controller through standard VESC inputs. Doing so he has no obligation to post any firmware or algorithms he uses on the overhead PCB and he has the right keep it proprietary. And the setup on the video looks exactly like that - two boards, the VESC controller board and the overhead board. Anything on the overhead board can be kept in secret.
 
Last edited:
overhead PCB with proprietary firmware
The Bafang display works with the already published Luna M600 code, the quadrature PAS also. I guess you could process the analogue torquesignal by a LISP script also, so no additional hardware would be needed. I don't know, if LISP scripts have to be open source also.
But the much more straight forward way is to change the way of reading the torque right in the VESC code (and publish it in your fork ;)), that's what I suggest for your project.
 
Last edited:
It looks like we got a serious competition here withing the controllers for Bafang M560 motor!

VESC Labs vs EXFORCE vs K1 vs BAFANG.

[ moderator note: this is not a VESC labs controller ]

Who do you think is gonna win guys?

[ trademark infringing image removed ]
 
Last edited by a moderator:
All the SMD components have been soldered!

That meant it is time to test if we can flash the firmware on this bad boy!

[ trademark infringing image removed ]
 
Last edited by a moderator:
Soldered the USB circuits resistors on the PCB and plugged the USB wires to check if the VESC Tool application can connect to it. And it works! So far so good! We can keep moving guys!

[ trademark infringing image removed ]

[ trademark infringing image removed ]
 
Last edited by a moderator:
The bulk capacitors and the leads have been soldered!

[ trademark infringing image removed ]

[ trademark infringing image removed ]

Here is the process.

Bend the capacitors legs making sure the proper polarity



Cut a piece of heatshrink

[ trademark infringing image removed ]


Assemble the capacitors in the heat shrink tube and shrink it with heat gun

[ trademark infringing image removed ]

Solder the capacitors on the PCB making sure the proper polarity. Trim the legs of the capacitors after soldering.

[ trademark infringing image removed ]

Solder the leads on the PCB

[ trademark infringing image removed ]
 
Last edited by a moderator:
Soldering the connectors guys. We are closer than ever!

[ trademark infringing image removed ]
 
Last edited by a moderator:
The VESC Labs for Bafang M560 motor controller is complete!

What is your betting guys? Is it about to spin or it is going to fail miserably?

[ trademark infringing image removed ]

[ trademark infringing image removed ]


[ trademark infringing image removed ]


Bafang VS VESC Labs, which one would you prefer?

[ trademark infringing image removed ]

[ trademark infringing image removed ]
 
Last edited by a moderator:
Soldered a fuse terminal on the battery leads. 1 A fuse is probably a good start. We don't want 80A explosion in case of shoot-through

1763183408022.png

1763183441642.png
 
Guys, we are so ready!

The controller has been installed in the test rig. The harness is connected. The VESC Express is connected. The torque sensor in not connected (because of we do not have firmware for it).

If you have any concern about this setup you better speak out loud right now or silence forever! Because I am about to connect all the frantic 52V 80A 4000W battery power to this tiny little piece of carbon and if anything is wrong we are about to evaporate one and only VESC Labs for Bafang M560 controller in the world!

[ trademark infringing image removed ]

1763185266412.png

1763185353459.png
 
Last edited by a moderator:
Woops! The 1A fuse popped like a grape! Drama is coming!

Let's hope it was just bulk capacitors charging current or something insignificant and raise the stakes to 5A shall we!

1763186571223.png
 
Last edited:
It's alive! The display works! The speed sensor works! 5A fuse holds like a champ!

It's time to see if we can connect it to VESC Tool application through the VESC Experss dongle and calibrate the rotary encoder!

1763187156558.png
 
Last edited:
Guess what guys? We did it again! It works! Woohoo!

Now we can squeeze all the power out of the Bafang M560/510!

Thanks to everyone who participated in this enormous effort! Now we have full collection of open source VESC controllers for Bafang M620, Bafang M600/M500, and now for Bafang M560/M510! Today we certainly deserve to go celebrate this huge milestone!

[ trademark infringing video removed ]
 
Last edited by a moderator:
Great work and great news!
My M510 has a blown-up controller board, and would very much like to try one and get back on the road. I have a replacement Bafang board on order, but down the track I would like a Plan B, and a drop-in board would be the holy grail. Will they be manufacturing soon? Please let us know..
 
It looks like we got a serious competition here withing the controllers for Bafang M560 motor!

VESC Labs vs EXFORCE vs K1 vs BAFANG.

Who do you think is gonna win guys?

View attachment 380488
Hello mate.

Thanks for add. I am not here in a race though. ;) Had such an idea 2y back, to reverse Bafang controller and code there my own firmware. Cleanest solution.

Have not noticed you doing a controller and found this thread just now. Your controller looks great.
That board in a picture is just testboard without FOC (was surprised, my own power on/off circuit worked on first attempt). Dont have much time for it, so going just slowly. My goal at the end is to code my own FOC algorithm. It is interesting.
 
Last edited:
As long as the torquesensor is not working, the controller is quite useless ;)
We need to figure out how to make it works. The PAS/torque sensor is connected as described here


You said here that the Luna code needs to change one line to make the torque sensor works


Is there manual which line to change and how to change that line? When click in any line from the links you posted and click Backspace button on the keyboard it says "Read Only". So I can not even delete text from those lines.

1763321617481.png
 
So I can not even delete text from those lines.
Of course you can't edit directly in Benjamins or my repo. You have to fork it to your own github account first.
For my Flipsky project I've written down some lines (mainly to remember myself weeks/month/years later :ROFLMAO:) how to edit and compile the VESC code in the STM CubeIDE, as the "how to" from the github readme works of course, but I'm much more familiar with the Cube IDE.
 
Account on GitHub · Change is constant. GitHub keeps you ahead. has been created! Will see if we can make this torque sensor works!

I guess we have to copy that "hv_luna_m600_core.c" file from this link


to my account and replace that line 411 with some magic words like "get_value_from_pin_PB0" or something?

And how do we disable the brake function from the pin PB0? As I understand the Luna firmware uses that pin for brake function?

1763332369967.png


1763333202618.png
 
Last edited:
Status
Not open for further replies.
Back
Top