Controller Advice

Breville

10 mW
Joined
Jun 1, 2022
Messages
28
Location
The Southwest
I’ve been developing my own FOC firmware, but my current hardware (ST Nucleo+IHM07 and XMC4400 drive board+250 w power board) are too underpowered and I’m starting to run into their limitations.

I eventually want to design and build my own board, but current component shortages and lack of time are making that difficult. In the interim I thought a good option would be to buy an existing controller that can support 24v and around 20-30A and develop my firmware on that.

What I would need in a controller:

Based on STM32 with an FPU or an Infineon XMC4000 series MCU
Connector for a J-Link or ST-Link for loading and debugging firmware
Robust and well-designed motor phase current measurement
Connector for single-ended quadrature encoder, preferably with index

As this is purely a learning exercise for me, I have no interest in whatever firmware that may already be on such a controller as I plan to overwrite it with my own FW.

Anyone know of a controller that meets these requirements?
 
Breville said:
Based on STM32 with an FPU or an Infineon XMC4000 series MCU
Connector for a J-Link or ST-Link for loading and debugging firmware
Robust and well-designed motor phase current measurement
Connector for single-ended quadrature encoder, preferably with index

I'm probably not up on controllers enough to be sure, but I don't know of any that fit all these (regardless of voltage and current requirements). Except *maybe* for the VESC in one version or another,
https://vesc-project.com/
I'd venture to get more of them you're looking at bigger controllers that start in the few-hundred-dollar range, probably significantly larger / more capable than you're after (and I don't know that they will work down to 24v).

Aside from VESC, there are various scooter and ebike controllers that run off STMs, and probably some off XMCs, though I don't remember offhand which ones use what versions. Pretty sure some of the ones that there are OSFW projects here on ES for use STM controllers; perhaps the LS Lishui or the KT Kunteng units.

But (except maybe VESC) they don't typically have connectors on them for firmware work--they likely use a press-to-board programming method, where a connector with springloaded pins is pressed to exposed pads on the board during programming at the factory workbench, assuming they don't simply preprogram the MCUs before they're even installed in the controllers. So you're very likely to have to install the connector for this yourself.

None of the controllers I've seen, outside of high end stuff like Sevcon, and maybe now the Nanjing Fardriver, support encoders other than UVW hall method (maybe some of the Kelly models support others, like SIN/COS, etc); not sure any support quadrature, so they likely don't have connectors for them. You'll probably have to locate the MCU pins you want to use to read the encoder, and wire a connector up to those or to existing traces/pads to them.

Few controllers I've seen outside of the medium-high to higher end ones even do motor phase current monitoring, and so don't have hardware for it onboard--they just use simple shunts on the battery negative and "guess" what the phase currents might be. Some of the medium-high controllers like "sabvoton" class and such use phase current monitoring on at least a couple of the phases (not sure they monitor all three), probalby using something related to the Allegro hall current sensors. THe ASI controllers (which Phaserunner/Baserunner/Frankenrunner from Grin Tech are based on) do phase current measurements. VESC does, I think. But I doubt any of these controllers (except VESC) have the MCUs you want.
 
Thanks amberwolf, that’s a lot of useful information that I’ll follow up on.

My preference would be to design and build my own, but every time I think I’ve found the perfect components I go look on DigiKey and Mouser and they’re out of stock with a lead time of something like 63 weeks. :evil:
 
Hi again!

Amber's advice is spot on.

I can confirm the VESCs are ready to program with your own firmware.

Try a flipsky 75100, that's about as cheap as you can get for a fully functional VESC... The original 4.12 is also ok but severely hampered by only having 2 shunts. Have run both VESC and my firmware on the 75100. The biggest problem with most VESC style controllers is that they're set up to read enormous amounts of current, usually+/-500A. The VESC 6 series usually measure a smaller 160A or so but tend to be very very compact layout so tricky to work on and probe.

Or if you want to do some soldering already, the easydiyesc latest revision by casainho, badgineer, andre et all in this forum is very easy to build and works well with the "pill" series of boards. The f401 black pill uses the stm32f401 you already used.

Unfortunately I think I'm the only person so far to get it spinning (casainho got the earlier version running but i think he had soldering errors on the latter one)... Worked perfectly first time for me though.
 
Thanks, mxlemming. I’ll take a look at the flipsky 75100. Do you know if there’s a schematic available for it?

Your point about reading current on these is noted. I have a similar problem with one of my boards. It has 0.01 ohm resistors in the shunts, and with my little motor chugging along at 1/4 amp that’s a drop of only 2.5 mV, and the 12x gain on the opamp only brings it up to 30 mV. Sometimes I don’t know if I’m measuring phase currents or Johnson noise!
 
I don't think there's a schematic. You can infer it from the VESC firmware version it uses, and knowledge that it uses low side shunts.

On reflection, given the size of motor you're dealing with it might not be for you. Problem is, that motor sounds really tiny and I'm not sure what is the right one for you. The market is generally geared towards people wanting faster faster more traction go go go.

You could just get a soldering iron and modify the shunts. Most people go the other way and reduce the resistance but there's no reason not to change a 1mohm for a 10mohm shunt. Or in the case of the 75100 the pile of 3x0.5mohm shunts for a10mohm shunt which would give you 8A sensing ability...

One of the nice things with starting from a VESC controller is that the pins critical to the FOC (pwm, voltage and current sense) are almost always identical. You can basically ignore the other peripherals for now.

The hall sensor inputs have a timer input which is appropriate for encoder use. Benjamin thought hard about the pin allocation and didn't disappoint. It's 100% sensible.
 
Back
Top