LegStrong - Open-Source HW/SW controller (FOC + Bluetooth)

Get all your technical information about electric bikes here.
User avatar
machado88
1 mW
1 mW
Posts: 15
Joined: Aug 30, 2015 4:10 pm
Location: Portugal
Contact:

LegStrong - Open-Source HW/SW controller (FOC + Bluetooth)

Post by machado88 » May 13, 2017 2:49 pm

There is being a while since I started this project and now that the first prototype is running, I felt the necessite to start sharing back everything that I've learned and the final result of it.

The controller has a different concept from most controllers available, it uses OBD/ELM327 protocol to communicate with any Bluetooth device. I also tried to use the latest technology for the power electronics, so it drives the motor trough Field Oriented Control, does not need any sensor and can recognize the motor parameters with only the most basic inputs.

The first version still has some minor issues in the hardware design (regarding sensors support, connectors and board size) but it works very well.I'm using in two Mountain bikes (26" and 27.5") with a Rear Bafang 36V G05-350W. The battery pack is a 14s2p LG 18650MJ1 (3.6V 3500mAh), this peaks the voltage at almost 59V. I'm using between 7A to 16A (depending on the ride) of maximum current in the motor winding (Id current) and the controller does not even gets warm to the touch.

It has the best mosfets that I could find for this application (CSD18535KCS or CSD19505KCS, much better them the irfb4110). It uses a very fast and reliable micro-controller from Texas Instruments (TMS320F28027FPTT). It has a dc-dc converter for the high-voltage bus (max. 60V) to the auxiliary 5V, so it is very efficient and can power other 5v devices. Includes current sensing and the next board should have even more support for a lot of analog inputs.

The communication via Bluetooth is the most open as can be for a vehicle, it uses the ELM327 protocol and OBDII-pids and should work with any OBD app for smartphones. For now is only tested with Torque for Android. There is a lot of apps, free or paid, even for symbians and blackberries. Most of them are very customizable and full of nice features (graphs, log, camera with gauges information, multiple themes, ...)

The name for the controller is LegStrong and it is available in GitHub (code and Wiki) and CircuitMaker (board design).

Features:
Operating voltage range from 12V to 60V;
Bluetooth technology to use with any smartphone/tablet (Android, iOS, Windows, Blackberry, Symbian);
OBD-II PIDs standard codes to request data and change parameters;
Wide range of data available for the user to keep tracking;
Works sensor-less and with any brush-less motor;
Higher motor efficiency at low speed (compared to non-FOC controllers);
Torque based throttle (multiple mappings);
PAS Sensor as input using special mappings to match power output with cyclist cadence;
Efficient auxiliar 5V output for USB power devices (needs hardware improvement);
Fully programmable parameters (under software development, only JTAG for now);
Battery State of Charge and Low cutoff (needs software improvements);
Torque Sensor or Analog Throttle (under software development);
Field Weakening allows you to run motors faster than normal back-emf limit (under software development);
Thermal Rollback (under software development).

Links for the project:
https://github.com/machadofelipe/LegStrong/wiki
https://github.com/machadofelipe/LegStrong
https://circuitmaker.com/Projects/Detai ... /LegStrong

Pics:
Image
Image
Image


Let me know who is interested in helping this project (in any way).
I need people to test, build, code, give opinion, spread the word with other makers or even just to give thumbs up.
I'm in Portugal, so help here or in Europe is very welcome, as it is easier to ship stuff. My goal is to improve the controllers that are now in the market, improve the technology and maybe see controllers like this being sold at chinese prices in a near feature.
LegStrong - Open-Source HW/SW controller (FOC + Bluetooth)
https://endless-sphere.com/forums/viewt ... =2&t=88285

casainho
10 kW
10 kW
Posts: 939
Joined: Feb 14, 2011 2:43 pm

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by casainho » May 13, 2017 4:28 pm

Great all that you achieve alone!!!

Let's talk by video chat, since we are in the some country, could be easy any possible collaboration.
Developer of OpenSource firmware for EBike BMSBattery S/Kunteng KT motor controllers: https://opensourceebikefirmware.bitbucket.io/

User avatar
machado88
1 mW
1 mW
Posts: 15
Joined: Aug 30, 2015 4:10 pm
Location: Portugal
Contact:

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by machado88 » May 17, 2017 2:30 pm

A new idea is taking shape: Re-spin the board with a new micro-controller!

Reasons why:
- The TMS320F28027 is running out of memory (and the code is growing), the best TMS320F2802x is 32K Flash / 6K SARAM
- Texas Instruments chips are expensive
- It is not easy/cheap to program, the JTAG is very hard to find and expensive (bad for DIY)
- No USB available in the chip
- Never manage to find a good open source real time OS (FreeRTOS or ChibiOS/RT)
- Compiler does not have a good C++ support

Risk to go outside Texas:
- Loose the InstaSPIN FOC (It is really good, well proven and does not eat processing time).
- Loose the well tested firmware for motor controller
- Board is already developed/tested with the actual architecture, I might encounter some unknown issues with a new one.

WINNER:
- STM32F303CB - Mainstream Mixed signals MCUs ARM Cortex-M4 core with DSP and FPU, 128 Kbytes Flash, 72 MHz CPU, MPU, CCM, 12-bit ADC 5 MSPS, PGA, comparators
- FPU :)
- Good size memory (let's see for how long)
- Several 5 V-tolerant
- Operational amplifiers
- 4x 12-bit ADC (independent)
- CHEAP!! Half of the TI price
- Small (LQFP-48)
- Timer with Pulse Counter (good for PAS and Speed sensor)

Summing up, I really liked some of the STM options, I already used one STM32F once in the past and I have friends saying good thins about it. I also took a look on the STM32F4 but is seems a lot power for just a motor. But I'm still not sure how much the FOC algorithm is going to use of this processor.
LegStrong - Open-Source HW/SW controller (FOC + Bluetooth)
https://endless-sphere.com/forums/viewt ... =2&t=88285

casainho
10 kW
10 kW
Posts: 939
Joined: Feb 14, 2011 2:43 pm

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by casainho » May 17, 2017 3:42 pm

I am joining this project as long as it uses STM32F102 or 303 or any STM4. And the board is cheap as possible!! Must also have Bluetooth UART module for send/receive data and also firmware update (using STM33 built in bootloader).

I can port my FOC firmware to this board and also do/adapt Android EGG app OpenSource that my girlfriend did for electric unicycle.

I am being talking with machado88, we are both in Portugal and that makes it easy to collaborate.
Developer of OpenSource firmware for EBike BMSBattery S/Kunteng KT motor controllers: https://opensourceebikefirmware.bitbucket.io/

bamitsram
1 mW
1 mW
Posts: 19
Joined: Apr 20, 2013 10:40 am

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by bamitsram » May 18, 2017 1:52 am

Are you planning on keeping this a low power controller?
As the TI DRV8302 are very integrated similar 60v rated controllers are very common (see vedder esc).

I would be interested in contributing to a 100v+ 100A+ controller project using a more discrete solution.

casainho
10 kW
10 kW
Posts: 939
Joined: Feb 14, 2011 2:43 pm

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by casainho » May 18, 2017 2:58 am

bamitsram wrote:Are you planning on keeping this a low power controller?
As the TI DRV8302 are very integrated similar 60v rated controllers are very common (see vedder esc).

I would be interested in contributing to a 100v+ 100A+ controller project using a more discrete solution.
Hi bamitsram. How would you be able to contribute?

The decision of 100v+ 100A+ is for machado88 as he is doing the hardware.

IMO, since there isn't any OpenSource version yet of EBike controller that does FOC, I like the idea to start with something that is doable and also cheap. Like Tesla is doing by start with the most simple version of Model 3 and just after with improved version like 4WD.
Developer of OpenSource firmware for EBike BMSBattery S/Kunteng KT motor controllers: https://opensourceebikefirmware.bitbucket.io/

bamitsram
1 mW
1 mW
Posts: 19
Joined: Apr 20, 2013 10:40 am

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by bamitsram » May 18, 2017 4:21 am

I am an EE with a lot of experience in high power analog design.
I can competently design a flexible discrete high power stage, with a decent high voltage regulator (isolated or not), to provide power to the drive and digital circuitry, high speed analog protection features, basically just leaving the actual motor control and user level configuration.

However;
If you are considering sticking with low power design, i do implore you to look at options for drivers, such as the MP6534 from Monolithic.

User avatar
machado88
1 mW
1 mW
Posts: 15
Joined: Aug 30, 2015 4:10 pm
Location: Portugal
Contact:

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by machado88 » May 18, 2017 4:26 am

bamitsram wrote:Are you planning on keeping this a low power controller?
As the TI DRV8302 are very integrated similar 60v rated controllers are very common (see vedder esc).

I would be interested in contributing to a 100v+ 100A+ controller project using a more discrete solution.
@bamitsram, at the end, changing for 100v decreases efficiency and raise price of components.
I have plans to make a version 3 with higher voltage, but first I think we have to stabilize a lower one and have a good firmware.

Now, 100A continuos is another ballgame. We still can use the same brain (controller and firmware) for all those versions, but my approach for such amperage would be to make something more similar to the electric vehicle industry or the ASI controller. This means new case styling, heats ink strategy also different, current measurement and so on. We are talking about 10kw, nice for some "motorbike", karts and even some very light and small vehicle.

I would love to do such a project, but I have an idea of the price would cost to prototype and test it everything and this holds me off. For that we would need support from some university on parts and testbench.Image
LegStrong - Open-Source HW/SW controller (FOC + Bluetooth)
https://endless-sphere.com/forums/viewt ... =2&t=88285

User avatar
machado88
1 mW
1 mW
Posts: 15
Joined: Aug 30, 2015 4:10 pm
Location: Portugal
Contact:

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by machado88 » May 18, 2017 9:05 am

bamitsram wrote:I am an EE with a lot of experience in high power analog design.
I can competently design a flexible discrete high power stage, with a decent high voltage regulator (isolated or not), to provide power to the drive and digital circuitry, high speed analog protection features, basically just leaving the actual motor control and user level configuration.

However;
If you are considering sticking with low power design, i do implore you to look at options for drivers, such as the MP6534 from Monolithic.
MP6534 looks good, although looks a bit less powerful them the Texas and very hard to find.
The hard to find part is the one that I don't like. Have you use it? Where do you get from?

Sent from my ONEPLUS A3003 using Tapatalk
LegStrong - Open-Source HW/SW controller (FOC + Bluetooth)
https://endless-sphere.com/forums/viewt ... =2&t=88285

bamitsram
1 mW
1 mW
Posts: 19
Joined: Apr 20, 2013 10:40 am

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by bamitsram » May 18, 2017 9:28 am

I haven't used the MP6534 specifically, I have used the MP6530 though, and I got it from Mouser, very cheap, only $6000 for a reel.
If you wish to make small, efficient, cheap FOC controller, you don't need a very strong gate drive, you aren't driving huge FETs.

User avatar
machado88
1 mW
1 mW
Posts: 15
Joined: Aug 30, 2015 4:10 pm
Location: Portugal
Contact:

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by machado88 » May 18, 2017 2:47 pm

bamitsram wrote:I haven't used the MP6534 specifically, I have used the MP6530 though, and I got it from Mouser, very cheap, only $6000 for a reel.
If you wish to make small, efficient, cheap FOC controller, you don't need a very strong gate drive, you aren't driving huge FETs.
Yeah, no way. The least amount that I found to buy was 500 units. It's more them my month salary in one component. :shock:
Also the QFN package is not friendly (not the the DRV8301 score much more points on that)

We need things that are very easy to find. Preferably with option for samples. That way it can be a more open project and easily DIY anywhere.

What's your point against the DRV8301? It has such nice features. It even has 2 PGA configurable via SPI, makes things very flexible.
I know that is not the cheapest one for mass production, but I'm a bit far from that right now.
LegStrong - Open-Source HW/SW controller (FOC + Bluetooth)
https://endless-sphere.com/forums/viewt ... =2&t=88285

lizardmech
100 µW
100 µW
Posts: 7
Joined: May 19, 2017 4:16 am

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by lizardmech » May 19, 2017 5:32 am

You can probably reuse most of my controller if you want a high power version, it's built around STM32f4 and VESC firmware but it conforms to instaspin requirements, vbus + phase vsense and 3x current sense. While developing it I actually played around with instaspin extensively but I couldn't get anywhere due to lack of programming ability. In comparison the VESC already had a functional GUI and code for throttle and every basic function. The only real issue I have is the STM32 MCUs have some limitations I ran into while trying to make high power and high voltage hardware. Even the high end STM32F7 do not have high res PWM meaning switching speeds needed to drive some motors are not possible. The other issue was all the lower end STM32 lack delta-sigma hardware or differential analogue inputs which most of the best current sensors need.

Have you considered using a f28069m? One other interesting thing I discovered, the newest F2837X delfino MCUs have a completely open source FOC firmware hidden away in the control suit package, all it lacks is the motor detection code and online Rs calculation. While the F28377S is cheaper than F28069M despite being much more powerful. I only had a basic look at it as I couldn't find anyone with c2000 experience.
Attachments
si4.jpg

bamitsram
1 mW
1 mW
Posts: 19
Joined: Apr 20, 2013 10:40 am

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by bamitsram » May 19, 2017 11:00 am

If i recall correctly, the f334 series have high res pwm much more suited.
Additionally, if you want a decent ADC, you have to use an external ADC, there are limits to what you can do on a fab process designed for logic vs a fab process for analog, you will pretty much never find a high spec ADC on a microcontroller.
Differential inputs can easily be taken care of with an opamp, converting differential to single ended.
Also, what EDA package was your board laid out in?
I personally use Altium Designer. The use of CircuitMaker is what attracted me to this project as I can import from circuit maker to AD.

The TMS320 based systems are VERY good for this application, at work we use them for industrial VFDs, i also know a few other motor controller manufacturers that use them in products too.
However, i still would suggest the F334, simply due to price - You can optimise software and use a cheaper micro to do the same job, but you can't optimize hardware and use a higher Rds(on) mosfet to do the same job.

lizardmech
100 µW
100 µW
Posts: 7
Joined: May 19, 2017 4:16 am

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by lizardmech » May 20, 2017 2:58 am

The problem I found with the STMf3 is from what I can tell you can't even buy one MCU with all the features. One model is just like slower and cheaper stm32f4 another has high res PWM, then another has delta-sigma filters but not high res PWM. I built another board with isolation everywhere, using delta-sigma converters with a differential analogue output that was converted to single ended by an op amp. It worked very well but in terms of cost and PCB complexity just having a MCU with delta-sigma hardware would have been so much better. I also looked at a few Analogue Devices and infineon M4 based MCUs but the documentation wasn't so great.

At the moment I have 4 or 5 designs I made in kicad, the previous isolated high voltage one with modular MCU, the previous version of the one in my post, basically the same but with removable MCU module and the completed one with everything on board. I made small boards that have a STM32F4, they share the same connector layout as the ti instaspin launchpad boards, so I can swap between MCUs in seconds. My most recent one is limited to 80V due to current sense (ina240) generally I found this to be the biggest issue, most of the higher voltage current sense options are slow, underwhelming in accuracy or both. While all the suitable options require differential or delta-sigma. You can always take the inferior current sense options but it will heavily reduce the types of motors the controller can handle.

bamitsram
1 mW
1 mW
Posts: 19
Joined: Apr 20, 2013 10:40 am

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by bamitsram » May 20, 2017 10:25 pm

That is fine though, you don't need all of those features. High res PWM alone is enough, a M4 core with a decent clock speed will get you everything else you need.

On high power motor controllers you use Closed-loop hall current sensors, meaning dc-150khz frequency response, 0.5% accuracy, 0.1% linearity, no issues with common mode voltage or transients, no issues with power dissipation or noise at low currents, since there is no self heating, there is very low temp-co etc.
Sure, they're a little pricey, say $15 ea, but then again, a very low ohms shunt, and an amplifier are pretty pricey too.

User avatar
machado88
1 mW
1 mW
Posts: 15
Joined: Aug 30, 2015 4:10 pm
Location: Portugal
Contact:

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by machado88 » May 21, 2017 5:10 am

:facepalm:
I totally forgot the High-res PWM when choosing the controller. I have to re-think that for a moment.

Now the candidates are:
- back to TI (really expensive and more pins to get better);
- STM32F334C8 (48pins, best memory available: 64/16KB).
- Go for a more powerful Cortex-M4 (might be the case).
LegStrong - Open-Source HW/SW controller (FOC + Bluetooth)
https://endless-sphere.com/forums/viewt ... =2&t=88285

User avatar
machado88
1 mW
1 mW
Posts: 15
Joined: Aug 30, 2015 4:10 pm
Location: Portugal
Contact:

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by machado88 » May 21, 2017 5:12 am

lizardmech wrote:You can probably reuse most of my controller if you want a high power version, it's built around STM32f4 and VESC firmware but it conforms to instaspin requirements, vbus + phase vsense and 3x current sense. While developing it I actually played around with instaspin extensively but I couldn't get anywhere due to lack of programming ability. In comparison the VESC already had a functional GUI and code for throttle and every basic function. The only real issue I have is the STM32 MCUs have some limitations I ran into while trying to make high power and high voltage hardware. Even the high end STM32F7 do not have high res PWM meaning switching speeds needed to drive some motors are not possible. The other issue was all the lower end STM32 lack delta-sigma hardware or differential analogue inputs which most of the best current sensors need.

Have you considered using a f28069m? One other interesting thing I discovered, the newest F2837X delfino MCUs have a completely open source FOC firmware hidden away in the control suit package, all it lacks is the motor detection code and online Rs calculation. While the F28377S is cheaper than F28069M despite being much more powerful. I only had a basic look at it as I couldn't find anyone with c2000 experience.
I would love to check some design examples. Do you have that published somewhere?
LegStrong - Open-Source HW/SW controller (FOC + Bluetooth)
https://endless-sphere.com/forums/viewt ... =2&t=88285

lizardmech
100 µW
100 µW
Posts: 7
Joined: May 19, 2017 4:16 am

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by lizardmech » May 24, 2017 7:49 am

bamitsram wrote:That is fine though, you don't need all of those features. High res PWM alone is enough, a M4 core with a decent clock speed will get you everything else you need.

On high power motor controllers you use Closed-loop hall current sensors, meaning dc-150khz frequency response, 0.5% accuracy, 0.1% linearity, no issues with common mode voltage or transients, no issues with power dissipation or noise at low currents, since there is no self heating, there is very low temp-co etc.
Sure, they're a little pricey, say $15 ea, but then again, a very low ohms shunt, and an amplifier are pretty pricey too.
The latest delta-sigma modulators are just too much better, the hall sensors are large, leave you with analogue signals on the PCB and still has to go through an ADC. The modulator signal can be dynamically processed to trade resolution or bandwidth, most MCUs with support allow multiple outputs from the same sensor so you can have a lower resolution with very high bandwidth for fast reaction to overcurrent while using the slower high res output for motor detection or just closely monitoring things on a second slower loop that measures stator resistance. Price should be about the same, the more expensive hall sensors and larger PCB will probably outweigh a more expensive MCU. There's a really good article on Analogue Devices website somewhere discussing modulators for motor control.
machado88 wrote: I would love to check some design examples. Do you have that published somewhere?
I cleaned up the files and put them on github, still largely a huge mess aside from the newest one.
https://github.com/lizardmech

bamitsram
1 mW
1 mW
Posts: 19
Joined: Apr 20, 2013 10:40 am

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by bamitsram » May 24, 2017 8:08 am

lizardmech wrote:
bamitsram wrote:That is fine though, you don't need all of those features. High res PWM alone is enough, a M4 core with a decent clock speed will get you everything else you need.

On high power motor controllers you use Closed-loop hall current sensors, meaning dc-150khz frequency response, 0.5% accuracy, 0.1% linearity, no issues with common mode voltage or transients, no issues with power dissipation or noise at low currents, since there is no self heating, there is very low temp-co etc.
Sure, they're a little pricey, say $15 ea, but then again, a very low ohms shunt, and an amplifier are pretty pricey too.
The latest delta-sigma modulators are just too much better, the hall sensors are large, leave you with analogue signals on the PCB and still has to go through an ADC. The modulator signal can be dynamically processed to trade resolution or bandwidth, most MCUs with support allow multiple outputs from the same sensor so you can have a lower resolution with very high bandwidth for fast reaction to overcurrent while using the slower high res output for motor detection or just closely monitoring things on a second slower loop that measures stator resistance. Price should be about the same, the more expensive hall sensors and larger PCB will probably outweigh a more expensive MCU. There's a really good article on Analogue Devices website somewhere discussing modulators for motor control.
https://github.com/lizardmech
You need something to feed the ΔΣ, usually a current shunt with an appropriate low pass filter or a hall effect sensor...
At high currents, a shunt is out of the question. Because its huge (bigger than a closed loop hall for the same current), has a terrible accuracy (worse than halls), terrible tempco, and needs some kind of isolation.

lizardmech
100 µW
100 µW
Posts: 7
Joined: May 19, 2017 4:16 am

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by lizardmech » May 24, 2017 11:22 am

Have a look at some of the latest reference designs from Ti and Analogue designs, they have been moving away from Lem hall sensors on the newest designs. They have modulators with built in isolation, they come in +/-50mv sensitivity so shunts as low as 0.1 and 0.2 mOhm can be used.
http://www.ti.com/tool/TIDA-00171

bamitsram
1 mW
1 mW
Posts: 19
Joined: Apr 20, 2013 10:40 am

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by bamitsram » May 24, 2017 4:24 pm

I am familiar with the recent design trends, I work in the industry and my employer provides an excellent continual improvement program.

Yes, i am aware that they have them with built in isolation, but then there is no price difference between a shunt + modulator with isolation and a closed loop hall sensor.

And at 400 phase amps and 0.1/0.2mohm shunt, say acc from stop on a small motorbike, either your current shunt has desoldered itself and started sliding across the board, or its accuracy has gone out the window because of tempco, or the shunt is as big as a hall sensor.

The biggest problem with shunts is power loss is proportional to the square of current but only directly proportional to the resistance.

Shunt based sensing works great up to around 100A or slightly higher at lower duty cycles.

lizardmech
100 µW
100 µW
Posts: 7
Joined: May 19, 2017 4:16 am

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by lizardmech » May 25, 2017 1:41 am

I was thinking more of cases where you want to run 150-300V at around 100-150 amps. There's a lot of interesting motor designs around that aren't used in ebikes much because the controllers aren't good enough such as coreless axial flux and some inrunners with extreme ERPM values. Once you have a controller capable of high PWM frequency, higher voltage limits and very accurate current sense many new motor topology become possible to use.

Tesla seems to use resistive current sense on their inverter they just cut a busbar and weld a small piece of metal between them. I have never been able to find a picture of which IC they use though, only pictures of the shunt.

User avatar
machado88
1 mW
1 mW
Posts: 15
Joined: Aug 30, 2015 4:10 pm
Location: Portugal
Contact:

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by machado88 » May 27, 2017 5:20 am

About the controller, I think before I do another PCB, it is better to run some tests using some of the LegStrong boards that I still have. I still have 7-8 boards without components.

Now I have to re-think the pins connections and try to port some basic motor controller code for that STM32F334.

I will be using this to start the development:
Image
LegStrong - Open-Source HW/SW controller (FOC + Bluetooth)
https://endless-sphere.com/forums/viewt ... =2&t=88285

User avatar
machado88
1 mW
1 mW
Posts: 15
Joined: Aug 30, 2015 4:10 pm
Location: Portugal
Contact:

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by machado88 » May 27, 2017 5:23 am

lizardmech wrote:You can probably reuse most of my controller if you want a high power version, it's built around STM32f4 and VESC firmware but it conforms to instaspin requirements, vbus + phase vsense and 3x current sense. While developing it I actually played around with instaspin extensively but I couldn't get anywhere due to lack of programming ability. In comparison the VESC already had a functional GUI and code for throttle and every basic function. The only real issue I have is the STM32 MCUs have some limitations I ran into while trying to make high power and high voltage hardware. Even the high end STM32F7 do not have high res PWM meaning switching speeds needed to drive some motors are not possible. The other issue was all the lower end STM32 lack delta-sigma hardware or differential analogue inputs which most of the best current sensors need.

Have you considered using a f28069m? One other interesting thing I discovered, the newest F2837X delfino MCUs have a completely open source FOC firmware hidden away in the control suit package, all it lacks is the motor detection code and online Rs calculation. While the F28377S is cheaper than F28069M despite being much more powerful. I only had a basic look at it as I couldn't find anyone with c2000 experience.
How does your SMD FETs handle heat dissipation? Should I think on some SMD solutions for the transistors or continue on the TO-220? I don't really know much about heat dissipation in SMDs.
LegStrong - Open-Source HW/SW controller (FOC + Bluetooth)
https://endless-sphere.com/forums/viewt ... =2&t=88285

casainho
10 kW
10 kW
Posts: 939
Joined: Feb 14, 2011 2:43 pm

Re: LegStrong - Open-Source HW/SW controller (FOC + Bluetoot

Post by casainho » May 27, 2017 5:26 am

machado88 wrote:Now I have to re-think the pins connections and try to port some basic motor controller code for that STM32F334.
You need to test the 6 channels PWM and ADCs. I would say just basic testing. When you have the first working boards in terms of hardware, I can join to help the firmware the development.
Developer of OpenSource firmware for EBike BMSBattery S/Kunteng KT motor controllers: https://opensourceebikefirmware.bitbucket.io/

Post Reply