Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenSource DIY, simple, motor controller #34

Open
casainho opened this issue Oct 23, 2021 · 28 comments
Open

OpenSource DIY, simple, motor controller #34

casainho opened this issue Oct 23, 2021 · 28 comments

Comments

@casainho
Copy link
Contributor

casainho commented Oct 23, 2021

I want to have advanced control of the motors and full system of different EBikes motors I have and electric scooters. Over the time I saw the manufacturer changing the motor controller on the same motor, for a totally different microcontroller and then we had to start again wall the work to develop our OpenSource firmware. And it is very difficult, because sometimes the manufacturer only sells at high prices and / or use a very specific, unknown microcontroller and we need to learn everything again.

My idea is to develop a DIY, simple, motor controller that can be reused between different devices like EBikes and electric scooters, that have similar range of power on the motors. This motor controller must have space for custom hardware, to handle the differences between devices like torque sensor reading circuit of EBikes and that are not needed on the scooters.
O motor controller like this will be easier to repair and adapt to different devices, and will be future prof.

Some similar ideas:
image

image

Youtube video: https://www.youtube.com/watch?v=eMslHyssvhs

@Ornias1993
Copy link
Member

Ornias1993 commented Oct 23, 2021

This is actually a great, workable and detailed proposal :)

I also agree that this might be the best long-term solution, instead of building custom firmwares for 1001 different motor(controllers)

Biggest challenge for m500 and m600 would be also correctly supporting the HAL sensor and Torque sensor.

@casainho
Copy link
Contributor Author

This is the same logic for the display. On SW102 display, they recently changed the hardware and is almost impossible to open the display and flash our firmware.

I am working on the display first as I have motor controllers ready for my EBikes, but then I will start with the motor controller. There are other developers developing the firmware for the M365 motor controller, that I am familiar with and I will reuse that firmware and popular STM32 motor controller for this custom motor controller.

@Ornias1993
Copy link
Member

I think thats a reasonable way forward indeed.
It would also remove the need of supporting CANBUS right away (although it's the beter protocol of the two)

@casainho
Copy link
Contributor Author

casainho commented Oct 23, 2021

The question is that CANBUS although good, adds the need to have at least one or two extra chips. That adds cost and more complexity. Is CANBUS really needeed??
On EBikes and scooters as M365, only UART is used, even between the motor controller and the battery BMS. For the display, they even use 1 wire UART only!!

@Ornias1993
Copy link
Member

The question is that CANBUS although good, adds the need to have at least one or two extra chips. That adds cost and more complexity. Is CANBUS really needeed?? On EBikes and scooters as M365, only UART is used, even between the motor controller and the battery BMS. For the display, they even use 1 wire UART only!!

If you don;t want to support the stock Bafang controllers, there is no reason to support CANBUS either.
I think the thing with CANBUS is mostly the fact it's much easier to daisy-chain and lock-down.

@nick2204
Copy link

Agree that an open hardware solution is a good way to go, but think you're much better off adopting a tried and tested design such as VESC6, on a suitably sized/shaped board. There are many examples of customised solutions to learn from and will have the benefits of a starting framework. To achieve decent FOC motor control you can't go too "cheap".

@Ornias1993
Copy link
Member

Ornias1993 commented Oct 23, 2021

VESC6

No one is going to pay 200 bucks for a constroller for a 600 buck motor.

Also: Just because something is DIY designed, doesn't make it beter or worse. Nor does more expensive means beter.

@casainho
Copy link
Contributor Author

I am not a big fan of VESC because it used to handle only up to 12S battery pack while on EBikes is usually to have 13 and 14S.

I am more fan of simple FOC boards, like the one used on M365 scooter or other similar EBike and electric unicycle motor controllers.

Also VESC firmware is a bit complex for me, I plan to use a more simple one that I understand, this one: https://github.com/Koxx3/SmartESC_STM32_v3

My target is not the best FOC or the best motor controller. For me the best is the one I can easily reuse between the different devices and I can easily DIY and repair.

@nick2204
Copy link

That's cool, only a suggestion to make a quicker start. The VESC architecture is pretty flexible to different voltage/power, and I wasn't suggesting using standard VESC firmware.
I had assumed that others were keen to replace the horrible bafang controller/firmware for something with better performance and control as I am.
A controller capable of FOC is essential to achieve better performance than stock.

@Ornias1993
Copy link
Member

That's cool, only a suggestion to make a quicker start. The VESC architecture is pretty flexible to different voltage/power, and I wasn't suggesting using standard VESC firmware. I had assumed that others were keen to replace the horrible bafang controller/firmware for something with better performance and control as I am. A controller capable of FOC is essential to achieve better performance than stock.

Afaik the M500 and m600 already use FOC

@nick2204
Copy link

Afaik the M500 and m600 already use FOC
Yeah they do, so if a replacement controller is going to improve on it then a simple design as pictured earlier in the thread isn't going to cut it.

@Ornias1993
Copy link
Member

Ornias1993 commented Oct 23, 2021

Afaik the M500 and m600 already use FOC
Yeah they do, so if a replacement controller is going to improve on it then a simple design as pictured earlier in the thread isn't going to cut it.

It's an example, but another example (the stock board) is also relatively simple and does support FOC.
Actually the stock board is not much harder, it uses some quite nifty tricks to support FOC as cheap as possible :)

Even with the STM32 it's perfectly possible to do quite decent FOC. Assuming the powertrain is and sensing is done solidly.

@Ornias1993
Copy link
Member

However, what I don't really get is why @casainho is still calling the stock board expensive. It's 60 bucks excl shipping.
It's hard to do it cheaper.

@nick2204
Copy link

However, what I don't really get is why @casainho is still calling the stock board expensive. It's 60 bucks excl shipping. It's hard to do it cheaper.

Yeah I was just thinking the same thing, given the specs.
Any idea what changed from the 3.1 to 3.2 controller? Seems FLX only have stock of the 3.1 at the moment.

@casainho
Copy link
Contributor Author

I have the idea the parts for this motors are expensive and harder to buy, maybe I need to update myself.

The TSDZ2 and M365 motor controllers are 30 bucks each, both implement FOC and similar power.

@Ornias1993
Copy link
Member

Ornias1993 commented Oct 23, 2021

I have the idea the parts for this motors are expensive and harder to buy, maybe I need to update myself.

it's 80 bucks actually currently and I already send you the link to buy them 2 times, as did others

The TSDZ2 and M365 motor controllers are 30 bucks each,

m500/m600 has quite a different torque and hal sensor though.

both implement FOC and similar power

No, definately not.
The board of the m500 is able to handle 20A with relative ease and the m600 board is about 1.5-2x that limit, basically limited by battery Amps more than it's own capabilities. It's serieusly overbuild.

I Highly doubt the TSDZ2 controller is going to survive those amps.

@casainho
Copy link
Contributor Author

When I mean expensive is more based on my financial capacity, which is regular for my country Portugal. This Bafang motors may be very good but they are expensive for my reality. There are other countries where bicycles and ebikes are more popular but the average people month earning is 5x more.

Anyway, the cost to develop to the original motor controller is very expensive for various reasons, so I will not do it. And I am mainly interested on the M800, that seems to be even more expensive then the M800 or M509.

@Ornias1993
Copy link
Member

When I mean expensive is more based on my financial capacity, which is regular for my country Portugal. This Bafang motors may be very good but they are expensive for my reality. There are other countries where bicycles and ebikes are more popular but the average people month earning is 5x more.

Sad but understandable!
I also am still waiting on both financial means and more clearity what Bafang firmwares are available before buying the m500 or m510

Anyway, the cost to develop to the original motor controller is very expensive for various reasons, so I will not do it. And I am mainly interested on the M800, that seems to be even more expensive then the M800 or M509.

Maybe in that case you could return the controllers? So that maybe we could actively look into someone else to take that part on?

@casainho
Copy link
Contributor Author

I prefer to keep the controllers as I will need them to better understand how to replicate the specifics, the like the torque sensor, hall sensors, cadence sensor or such.

@Ornias1993
Copy link
Member

fair point!

@Ornias1993
Copy link
Member

Ornias1993 commented Oct 23, 2021

It might be nice if you could maybe make dump some data about the hall sensor, torquesensor and cadence sensor communication though?

@casainho
Copy link
Contributor Author

N

It might be nice if you could maybe make dump some data about the hall sensor, torquesensor and cadence sensor communication though?

No, my focus is currently on the display, later on the generic motor controller and finally I will apply all them to this and other devices, only then I will work on this project. It always depends on how many developers are helping, can be faster or slower.

@Ornias1993
Copy link
Member

Ornias1993 commented Oct 23, 2021

When even simple requests get a no, maybe don't accept hardware next time for projects you most likely are not able to do anything with within a reasonable timeframe.

Like: We all tried to contribute here and I don't think anyone expects or demands you to contribute. But when the answer is "I've no time to do anything with the hardware I recieved, even relatively simple requests" maybe thats the time not to accept donated hardware?

@casainho
Copy link
Contributor Author

casainho commented Oct 23, 2021

When even simple requests get a no, maybe don't accept hardware next time for projects you most likely are not able to do anything with within a reasonable timeframe.

Like: We all tried to contribute here and I don't think anyone expects or demands you to contribute. But when the answer is "I've no time to do anything with the hardware I recieved, even relatively simple requests" maybe thats the time not to accept donated hardware?

It was a donation without any compromise but still I had to pay some costs. There were developments meanwhile and the things changed.

I can not understand you, just previously you wrote:

However, what I don't really get is why @casainho is still calling the stock board expensive. It's 60 bucks excl shipping. It's hard to do it cheaper.

If you do not think it is expensive, so why do you care so much? why don´t you buy it??

@Ornias1993
Copy link
Member

Ornias1993 commented Oct 23, 2021

I can not understand you, just previously you wrote:

However, what I don't really get is why @casainho is still calling the stock board expensive. It's 60 bucks excl shipping. It's hard to do it cheaper.

If you do not think it is expensive, so why do you care so much? why don´t you buy it??

As you might have noticed by the fact it took months just to reorganise the hardware section, money is not the issue for me to continue or not continue development work. But that was not what I said anyway, I said it was not expensive and it was hard to do much cheaper.

That being said: Even if I had 20 controllers laying in front of me, I would still find it a bad form to take without using. My opinion on form, is not dependend on my own financial situation at all.

I'll leave it at that..

@Migli54
Copy link

Migli54 commented Dec 2, 2021

They did it, and quiet well it seems..

https://lunacycle.com/blog/luna-m600-ludicrous-v2/

@KyokushinPL
Copy link
Contributor

They did it, and quiet well it seems..

https://lunacycle.com/blog/luna-m600-ludicrous-v2/

Unfortunately they're not selling this separately, only with their bikes.

@Ornias1993
Copy link
Member

Dickmove tbh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants