Modular, Multi-Platform, 300A ESC

badgineer

10 W
Joined
Sep 21, 2021
Messages
96
Location
Transylvania
Hello ES

I've been working for the pas 2-3 month on an ESC and want to publish it here.
I am also grateful to mxlemming for his support - sometimes hands on, sometimes opinions and advice.
We're calling it the MP2 ESC. Multi Platform, Modular and Powerful ESC.

The design aims were the following:
  1. Modularity. Takes "pill" modules, instead of MCU as in bluepill, blackpill, etc. DC-DC are also modules.
  2. Wide compatibility. Should actually be able to take both pills, despite the slightly different footprints
  3. All standard footprint parts. No proprietary fancy parts. Part shortage? No problem, everything is easy to replace.
  4. Power. 18 to220 FETs, should, if everything is super well done, be able to take 300 Phase A for short periods of time.
  5. Low cost. Uses mostly low cost parts, or is low-cos-part compatible. PCB is 100mm wide, should be cheap on JLCPCB.
  6. DIY Friendly. Has SMDs on only one side, can be ordered with SMDs pre-assembled. Only TH parts need to be soldered by hand.

Additional features:
  • Easy to access debug pads for probes.
  • Hardware overvoltage protection vor VBus
  • Hardware overcurrent protection for phases
  • Designed for 20s 72V batteries, easily customizable to 16s or 30s.


And what is good hardware without good software?
So the nicest feature of all might just be the fact that the "multi-pill" compatibility should make it usable with quite a few existing open source projects.

I think it is mostly done now, hopefully soon to exist physically. But im still fiddling with it. Cant. Stop. Microoptimising.

Link: GitHub - badgineer/MP2-ESC: Multi-Platform, Modular, Powerful ESC

Here Some Pics.
3d_pcb_front.png
3d_pcb_backside.png
pcb.png


Update 13.11.2022:
New v0.3 released with multiple small improvements. (more caps - both mlcc and electrolytic, also now solderjumper configurable for 16, 20s and 30s batteries. For 30s batteries mlcc caps need to be replaced.)

Update 13.09.2023
New v0.5 released (merged to main but not tagged yet) with multiple small improvements and changes

Feedback is appreciated.

Br,
 
Last edited:
I'm pretty happy with this as a first iteration. Hopefully should have one in hand within a few weeks to test.

I think the main thing we've all learnt over the last year is that part availability is crucial. I think that's the best thing about this board... There will always be to220 MOSFETs, always be soic14 quad opamps (though there are specific criteria for them), the gate drivers have the ir2181 pinout and there are replicas from on semi, Fairchild, diodes inc and various Chinese substitutes. The DCDC converters for 100V have plagued ESC stuff the last year, but this allows you to attach a wide range of modules with 4 wires and some double sided tape... And there's also 2 compatible isolated 160V modules that fit nicely.

The inductances on this are pretty tight. Essentially the only source of parasitic inductance is the FET legs themselves so I'm hoping for some decent switching. The sensing and gate drive lines are routed differentially and sympathetically to the high current paths, which are power planes reinforceable with large copper lumps.

The other thing to bear in mind is the cost. BoM estimates I put at about 40-50$ so it's like... 1/8th of a VESC 75100 or 100250, 1/4 as much as an equivalent Chinese decent controller (fardriver?) and about 2/3 the list price of a single axiom gate driver...

If you think of this as being basically 3x flipsky 75100 in parallel (the same MDP10N027 is the default recommended FET for this) you can guess at the realistic power rating.

Crossing my fingers for this one. Looking forward to porting my FOC code to it.

Edit, a list of sensible parts:
MOSFETS
Primary concern is the Ciss/Crss ratio, which governs the self turn on and tendency towards oscillation... Look for >100
Secondary concern is voltage rating
Third concern RdsOn
100V
CRST030N10N (Initial boards built with these, preferred, no significant ringing until ~200A, no problematic ringing until hitting the hardware overcurrent)
MDP10N027 (another initial board built with these)
NCEP039N10 - One unexplained failure when using these MOS.
IPP026N10NF2S
DMTH10H005SCT - Edit, these are pretty bad, ring like a bell, flimsy legs. Do not use. Even if desperate, I blew several.
150V
CRST073N15N
NCEP15T14
NTP5D0N15MC
SUP70042E
... Many many more...

Drivers:
Basically replicas of the IR2181 (in rough order of preference):
NCP5183/NCV5183 (On Semi)
FAN7390 (Fairchild)
FAN7191 (Fairchild)
DGD2190M (Diodes Inc)
TF2190 (Chinese replica, initial boards built with this, try to use on semi ones if you can)
IR2181
NCP51530A (not B unless desperate, this is a good part but has absolutely no input filtering)

Opamps:
Key thing with these is that they have: rail to rail input and output and 5MHz+ GBW
NCS20034 (original build made with these, On Semi)
COS724 (many builds made with these, no issues with the opamp, cheap)
TSV914 (ST)
TLV9054 (TI)
... Many many more...
Standard package so ubiquitous.

Diodes for "over" protection
1N5819WS - These are ubiquitous, but it is important you use these due to very low forward voltage. Using anything else will probably result in hardware overcurrent not working.

Diodes for bootstrap
XX4007 in SOD123 found to get a bit warm, need to use Schottky if atall possible. Anything with 100V+ or 150V+ will work... but generally many 1kV diodes are available, so use them. US1M DO214AC used in later versions. High speed are preferable, but really most diodes will work...

Busbars
Add lumps of copper across the exposed rails top and bottom, typically 0.5mm+ x 6mm.

Electrolytic Capacitors
Whatever you can get... Rated for voltage. Minimum of 1500uF
Low ESR is preferable. Initial boards built with random caps from my desk and
Ymin LKMJ3552A102MF
Ymin LKMJ2002A471MF

DCDC converters
Standard footprint module used...
110V-12V
Isolated... Recommended
PQDE6W-Q110-S12-D preferred (CUI devices)
RD5-110S12W (Rui Da Kang)
HLK-10D11012 (HiLink)
RDE20110S12 (XP Power)
THN 10-7212WIR (TRACO Power)
Unisolated,
P7805-500 (CUI)


12-5V
This is a standard TO220 7805 series regulator or switching regulator replacement. Literally hundreds of options available.
VXO7805-500 (CUI)
VX7805-500
7805SR-C (Murata)

Or just kludge on your favourite AliExpress crap DCDCs if desperate...
Capacitor options.png
 
Last edited:
This looks really well thought out and well done. It's got to be one of the more power dense controllers for its size. The code flexibility is really great!

Things I'm seeing / not seeing:
- only ceramic capacitors?
- how do you solder the battery +/- ? Would it be worth adding a large plated hole for each?
- if you move the 5v trace away from the edge or to a different layer you might be able to use this in a card edge case without worrying about shorting the 5v trace out over time.
- are the 3 plated holes per phase for 3 wires each?
- would it be worth doing a larger plated through hole or a plated slot (that can fit the next sized wire up when ovaled) to allow larger phase wires to be connected?
- any worry about fet mounting hardware shorting out on traces / pads?
- would it be worth adding a smd pad next to the through hole resistors so you could easily swap between either method?
- worth renaming the test points so you don't have to hunt for what they are?
- worth adding a resistor per fet to leave options open if you find you need gate resistors on each? Can use 0R jumpers in the first batch.

There are some vias on / in pads and overlapping keep out areas. The via bump can cause a component to rock and not solder well. If it's a higher power device it won't make as good of a connection (through solder vs close copper to copper) as it would if it was just a flat pad. I'm not sure if it would do anything undesirable in a solder jumper pad.

There are a few ground plane dead ends / voids that probably aren't a big deal. They don't look too bad to clean up if it's worth it to you.

Googling
GD32F303CG pill Netzpfuscher mod
comes up empty. I had searched during the shortage and wasn't aware vesc could run on any other mcu's.

No need to reply, just a list of considerations (or my misunderstandings.)

I'm excited to see this come to life and progress!
 
Hi Jrbe!

Jrbe said:
No need to reply, just a list of considerations (or my misunderstandings.)

Of course I will reply, that's why I posted in the first place. I love talking about it :)
And thanks for taking the time to look at it and for the feedback. So, point by point:
Jrbe said:
- only ceramic capacitors?
definitely not. there is space on the upper front for 3 electrolytic caps, of max size about 18x30, so 3 470uF 100V should fit easily. You can also mount 2 longer caps, 2x 18x45 max size, so 2 1000uF 100v caps would probably fit too.
Jrbe said:
- if you move the 5v trace away from the edge or to a different layer you might be able to use this in a card edge case without worrying about shorting the 5v trace out over time.
yes, but: this is designed for fets to be bolted in an aluminium plate/heatsink. finding a card edge case where the fets touch the bottom when the edge isin the slot will be challanging. So that was not a design target.
Jrbe said:
- are the 3 plated holes per phase for 3 wires each?
- would it be worth doing a larger plated through hole or a plated slot (that can fit the next sized wire up when ovaled) to allow larger phase wires to be connected?
300A require a lot of wire. my initial thought was to split the large diameter phase wire in 3 strands and drive one through each hole. This way the resistance between the left most and right most fets and phase wire is smaller than in a single hole configuration. And the TH pads make the thing also pretty robust mechanically. Such a fat wire could have ripped the copper foil off the PCB in a pure surface pad configuration. You could of course also use 3 wires per phase for a total of 9 wires, at least until the connector to the vehicle phase wires
Jrbe said:
- any worry about fet mounting hardware shorting out on traces / pads?
.
Actually I do. now that you say it i do even more. My main concern is the head of the screw + insulation will not fit in between the fet tab and PCB. that would make assembling fets + heatsink much harder. I could have measured but I have no plastic washers for to220 around, so lets see when we get it.
Jrbe said:
- would it be worth adding a smd pad next to the through hole resistors so you could easily swap between either method?
2 things here, first - the TH resistors i used just for the footprint, the lower one is actually a NTC for the fets, the left one is a connector for an on off switch (that cuts power to the DCDC). But now that you say it, the left TH pads should all be used as sufrace mount only. because the part protruding on the other side will interfere with the FET positioning. (i hope to have all fets lying flat touching the PCB. TH pad bumps ruin that. Point taken for next design iteration.
Jrbe said:
- worth renaming the test points so you don't have to hunt for what they are?
Definitely. For me, after so much fiddling with the design, it's clear what the TestPoints are by their position. But we haven't done it just for us, we've published it open source, didn't we? So that is a bad reason not to label them :). Also, we thought to remove them once testing is done, but i kind of like them now, and want to keep them around. Will do next iteration.
Jrbe said:
- worth adding a resistor per fet to leave options open if you find you need gate resistors on each? Can use 0R jumpers in the first batch.
Honestly never understood why individual fet gate resistors would be needed. VESCs can do power without that... Mxlemming was also sceptical regarding the reasoning he saw mentioned around for this. If you do understand the benefits, please share :).
Jrbe said:
There are some vias on / in pads and overlapping keep out areas. The via bump can cause a component to rock and not solder well
Hmm never thought of that. I did try to keep vias outside of pads (so solder doesn't get sucked inside causing bad connections) but never thought about bump. This is a concern only for the shunts i guess. Hmmm. need to think how else I could get that precious shunt current signal very precisely from the shunt pads. And need to see how big the via bumps actually are. I'm new to this stuff so didn't have much opportunity to notice via bumps.
Jrbe said:
GD32F303CG pill Netzpfuscher mod comes up empty.
He's working on ESC firmware for the G32F303CG chip. Not explicitely for the GD bluepill, but that bluepill has that chip so :).
Have no Ideea where/if he shared this. Hope I did not spill the beans on a secret project :D
Jrbe said:
here are a few ground plane dead ends / voids that probably aren't a big deal.
I did clean those up at least twice already, but then redesigned parts again and again and forgot to do a cleanup. Don't think its a big deal either.

Jrbe said:
- how do you solder the battery +/- ? Would it be worth adding a large plated hole for each?
So i left this for last because it's the juicyest bit :)
First - SMD Pads, because the TH bump on the other side would force us to mout the FETs far from board - which is not what I hope.
Secondly.... Talk about the Dunning Kruger effect, only to discover it in the friggin mirror.
My ideea was to put the pads in the middle of the GND and VBAT bus bars. Reason being to split the battery current in 3, so each side sees battery current only for a group of fets.
Which is a downright retarded reason to do it! the bus bars see the whole friggin Phase Current, which in 95% of cases is much bigger than the battery amps. So a good way to do bus bars it is fat uninterrupted bus bars from first to last fet. VBat wires anywhere on/near the bus bars.
I realised this only after order for the first batch went out. But this has no real effect other than moving the "more vias" areas to the future SMT pads of the vbat wires, which is a minor thing. Will do it though for next iteration.

Thanks again for the feedback :)

Br,
 
spinningmagnets said:
Excellent idea! Thanks for posting this on this forum.

Hi!
Thanks!

ES gave me so much interesting and fun stuff to read about since ~2015 when I discovered the forum, so how could I not post to ES?

By the way - I discovered ES thanks to one of your articles on electricbike.com, so I take this opportunity to thank you for bringing me to this forum. Love it :).

Br,
 
Replying on my phone, there's no way I'll be able to format it well.

The first thing I thought of when I saw it was that you could mount the fets straight up and put a block of aluminum between them to get the heat out. This could then screw to a heatsink case top or bottom. If the fet legs make contact at the thick section I'd imagine they could supply a bit more power without the thin area acting like a fuse. Could open up some room for connections too.
The io connectors could be 90° and go through the end of the case. One of the strange / interesting things of designing things is other people see different uses / different ways of using / building it.
I have not built a 3 phase controller yet. My understanding of the gate resistors is to help balance out the turn on power to each fet. Using 1 resistor might mean that the first fet gets more turn on power than the last in line. Individual resistors might be unnecessary but for my first batch / my first build I'd include them just to be able to try them. I try to equate electricity to water. I see it like having a restrictor to the water supply a few houses down. Your water pressure at the far end would probably suffer. But maybe that's not the best analogy or this is close enough that it won't matter.

For the phase wires you could use a plated through hole that is surrounded by vias to help keep it attached to the board. I believe Kicad has these in the footprint library but they're in an odd spot (near the bottom of the list iirc.) The 3 wire method will probably be easier to solder too. Soldering thick wires is something I'd want to avoid, it's a pita.
There are some different options for board connections, copper pems, through hole, solder, press fit, etc. I think you have some room to poke through towards the fets a bit if you wanted to try different options to not have to solder. Then it's a cost / quality / value decision.

Via bumps can lift one pad / leg of a smt device and make the device and the other pads float / not make contact or intermittent contact. I don't see any that are likely problematic on this. Some are on the edge and likely ok. More a note for next time.

Someone should make a Lebowski controller in a blue/blackpill footprint to try!
 
Jrbe said:
The first thing I thought of when I saw it was that you could mount the fets straight up and put a block of aluminum between them to get the heat out. This could then screw to a heatsink case top or bottom. If the fet legs make contact at the thick section I'd imagine they could supply a bit more power without the thin area acting like a fuse.
I've been wondering about this and a water block between the rows...

Jrbe said:
I have not built a 3 phase controller yet. My understanding of the gate resistors is to help balance out the turn on power to each fet. Using 1 resistor might mean that the first fet gets more turn on power than the last in line. Individual resistors might be unnecessary but for my first batch / my first build I'd include them just to be able to try them. I try to equate electricity to water. I see it like having a restrictor to the water supply a few houses down. Your water pressure at the far end would probably suffer. But maybe that's not the best analogy or this is close enough that it won't matter.
This is one we debated. The conclusion reached was that the MOSFETs actually have typically 1-3 ohm gate resistance internally so they have a moderate amount of balancing anyway. The differential routing essentially eliminates the track impedance between them but nevertheless it's one of the things I'll be looking out for.

Jrbe said:
Via bumps can lift one pad / leg of a smt device and make the device and the other pads float / not make contact or intermittent contact. I don't see any that are likely problematic on this. Some are on the edge and likely ok. More a note for next time.
Do you have an example of this? Genuinely interested. I've been absolutely plastering the mounting pads of smt MOSFETs with vias on other projects and I'll never be able to tell if there being lifted... Bare boards I've ever seen via bumps on.
Jrbe said:
Someone should make a Lebowski controller in a blue/blackpill footprint to try!

I wish but unfortunately lebowski requires phase shunts. Could still use the power stage with external sensors perhaps.

The VESC on gd32 blue pill is here
https://github.com/Netzpfuscher/VESC_GD32
It's not completely complete but getting close to having all the features.

It requires that you remove the stm32 chip from the blue pill and re solder a gd32f303cg chip. An easy mod for anyone with a hot air gun.

If you're not keen on hot air guns, the blue pill will still run the kind of VESC compatible smart esc v2 firmware which uses stFOC library.
 
Jrbe said:
Via bumps can lift one pad / leg of a smt device and make the device and the other pads float / not make contact or intermittent contact. I don't see any that are likely problematic on this. Some are on the edge and likely ok. More a note for next time.

mxlemming said:
Do you have an example of this? Genuinely interested. I've been absolutely plastering the mounting pads of smt MOSFETs with vias on other projects and I'll never be able to tell if there being lifted... Bare boards I've ever seen via bumps on.

I couldn't find a reference of a via lifting / rocking a component. For clarity I meant it as 1 or a few vias in pads with the rest as just pads. It may have been in a Trinamic pdf but I couldn't find it. This may have been old school thinking before pcb manufacturers started filling, capping, and flattening vias in pads too.

In searching for a reference I found tombstoning, https://www.eurocircuits.com/pcb-assembly-guidelines/tombstoning/ they have a short video showing what can happen with a via too close to a pad. I was not aware of this unexpected behavior.
Also of interest is the note about a solder mask dam to help prevent this.

There's a note about "legend under component" that lifts a small component up quite a bit from the silkscreen thickness. This is similar to what I mentioned about vias rocking a component when the vias aren't polished flat - kind of illustrating what I posted but not at all apples to apples.
Thermal vias evenly under heatsink pads won't rock the component (should be roughly all elevated) but they can wick away solder if they are not capped, https://www.7pcb.com/blog/via-in-pad-guidelines.php
https://blog.screamingcircuits.com/2008/02/led-via-in-pad.html

These guys mention flattening & filling vias under pads but unfortunately they don't get into the why besides a generic mention of reliability https://www.protoexpress.com/blog/via-in-pad-pcb-design-manufacturing/ I've been trying to find an explanation of "reliability" without success. I'll keep looking randomly and post back if I can find a good (or maybe out of date) reference.

It wouldn't be too hard to spin up a next color pill board with a gd32f303cg chip. JLC has a bunch of these in stock currently. Maybe this will evolve in that direction once all the functionality is functional.

A Lebowski brain board that overhangs the blue/blackpill board outline but same pinout could work. 3 added connectors for external current sensors wouldn't be that bad.

I was originally seeing this as a 3kw controller, not the 30kw (25kw?) controller that it is. Water might be necessary, I guess you guys will find out soon enough. Galp had 2 computer fans on his 30kw controller. Not sure how capable those were keeping the controller cool in his setup but it seemed to work well.
 
Hi Jrbe

We'll see about the via bumps very soon. The first board set arrived.

Jrbe said:
I was originally seeing this as a 3kw controller, not the 30kw (25kw?) controller that it is. Water might be necessary, I guess you guys will find out soon enough. Galp had 2 computer fans on his 30kw controller. Not sure how capable those were keeping the controller cool in his setup but it seemed to work well.

Well 25kW sounds really optimistic to me. At 300A each tiny design mistake explodes in your face (maybe even physically). I expect more short bursts f 300A, before it overheats.

Jrbe said:
Using 1 resistor might mean that the first fet gets more turn on power than the last in line.

Hmm, if by this you meant that the difference in track length (and thus difference in track resistance) is the reason, then i find it unconvincing.
First of all, the difference in track length is about 11mm per fet. as in fet 2 has another 11 mm and fet 3 has another 22 mm compared to fet 1. that results according to a quick calculation (0.2mm track inner layer) in about 0.06 ad respectively 0.12 ohm which is tiny.
Then, the difference in track length will probably still be there in case of individual resistors, unless you do something about it.
And lastly, we can and maybe should also do something in our case too about this - make the track wider in between the FETs.

Anyway, not saying this can't be true, just because I don't understand how something is supposed to work, does not mean it does not work :D

amalik said:
Is this a controller project?
Yeah, ESC is a popular term for controller.


Br,
 
Well I'll be brief because it's kinda 2am... But...

The board works. I've only built it up with 6/18 MOSFETs but it's been spinning the motor. No little wires :lol:

With not enough MOSFETs the switching is brutal. 20ns rise time and ringing at 70mhz, though that's all damped out within 250ns. The extra capacitance of the other MOS should help a lot. It's all pretty clean though on the signal lines even with this and I haven't even started playing with snubbers yet. This is the first through hole board I've ever worked on (except sdobbie board I had a while back for a day or two) so crossing my fingers I can tame things.

Few notes from questions etc above...

You can't multiply 300A by the 100V MOSFET rating to get power. There's the headroom so max 84V/20s and the power is then given by battery amps which is always smaller than phase amps.

At max speed you might get 84Vx... 150,200...A battery. Maybe 15kW for short bursts.

It'll basically be 3/4 of galp's besc because... 3/4 as many MOSFETs. I don't think it's realistic to call the besc a 30kW controller, loaded with 150V FETs it might do that for a few seconds.

Anyways, looking promising.
 

Attachments

  • IMG_20220806_014527729_HDR.jpg
    IMG_20220806_014527729_HDR.jpg
    4 MB · Views: 2,056
  • IMG_20220805_201831784.jpg
    IMG_20220805_201831784.jpg
    3.3 MB · Views: 2,059
  • IMG_20220805_202412683.jpg
    IMG_20220805_202412683.jpg
    3.2 MB · Views: 2,055
I nearly finished my MP2. The DCDC is still missing.

Used the NCEP01T15 (100V 150A) MOSFETs and soldered a GD32F303CG on a bluepill board. 8)

IMG_20220829_213343.jpg
IMG_20220829_212602.jpg
IMG_20220829_180029.jpg

https://www.youtube.com/shorts/tz28_tZS0kw


Sensorless startup.
IMG_20220828_214206_699.jpg
 
I have been playing with my one for a few hours this afternoon, I can only dream of neat tidy wires like Netzpfuscher... instead I have settled for a mess of 17AWG cables that have turned slightly brown from heat.

Anyway, I have been gradually ramping up the power, by running an open loop protocol pushing up to 200A phase, powered from a 40V power supply. I also took it up to 72V by putting my two PSUs in series... but could not push much power since one of them is only good for 60W... the openloop at 200A required 560W.

All been done driving my 150kV CA120 motor, which is ~5uH and ~5mohm. I like this motor for testing, it seems to be completely indestructible.

Using CRST030N10 MOSFETs which have quite high input capacitance, but are beautifully behaved.

Tested over voltage protection by putting a resistor across the voltage divider top to simulate a high voltage - shut off immediately. Have yet to find a way to emulate overcurrent...

Switching waveforms at 200A below. Not much else to say, for a through hole board I am perfectly happy with it.
200A phase openloop.png
200A switch on .png
200A switch off.png
Gate traces at 200A.png
Gate traces are quite variable with current, but there is nothing particularly bad. It was hard to trigger on some that had some slight ringing (nothing major, nothing of much concern) I managed to get this one which is indicative of the Miller bounce. After seeing this, I realised I needed to up the dead time from 750 ish ns to 1us.

Thermals are OK. I had to put a desk fan next to it to deal with the phase cables melting, which helped.
Thermal image 90A 5 mins.png
Eventually settled at 58 degrees at the high side mosfets (hottest part) after 5 mins at 100A. Ambient here is about 18 degrees.

Heatsink is a 6mm plate, and the heatsink under that is just placed there, I put a drop of water between them to aid heat transfer.
Kapton tape (generic) with thermal transfer compound on top between tape and MOSFET. Nothing special.

There was one casualty towards the end - the black pill regulator bit the dust suddenly and with no apparent reason. I THINK it was probably because I had connected the STlink 3v3 to it as well. Nothing else was harmed as a result, I just had to pop it off and put a 78M33 regulator on the black pill pins which is... ugly but effective.
 
I've been reading advancement on this DIY ESC quite often because I was looking for something capable of some good power. So first of all, thank you for sharing this badginer and thanks to all the people contributing to this !

I've recently ordered some boards ( V0.2 at the time) and assembled one of them with CRST030N10N mosfets and TF2190M-TAH gate drivers.

MP2.jpg

Now I'm in the process of making it turn something but struggle a bit with the firmware part.

My prefer choice of firmware would have been VESC because I've worked with it for a while and the communication and configuration software is quite handy. So my first try have been to swap a GD32 onto a Bluepill and run netzpfuscher Vesc implementation but so far without success. I've successfully compiled from repository then flash on the board, but no connection to vesctool with a UART to USB adaptor (Vesc report no firmware detected). I think The firmware is running since I hear the buzzing at boot. Do someone have an idea what could make vesc tool not communicate with it ? (I have already tried the rx/tx swap without better luck)

Since I had some black pills I gived a try today at Mxlemming MESC firmware but without better luck. I tried to use the live expressions on STM32CubeIDE with a STlink V3 but for whatever reason they doesn't want to update. I haven't found another easy way to figure out what's happening. Electricaly I can see the switching starting when I twist the throtle but no current is flowing and can't figure out in wich mode the firmware is at that point. Is there a way to enable Uart live data transfer ?
 
Thecoco974 said:
I've been reading advancement on this DIY ESC quite often because I was looking for something capable of some good power. So first of all, thank you for sharing this badginer and thanks to all the people contributing to this !

I've recently ordered some boards ( V0.2 at the time) and assembled one of them with CRST030N10N mosfets and TF2190M-TAH gate drivers.

MP2.jpg

Now I'm in the process of making it turn something but struggle a bit with the firmware part.

My prefer choice of firmware would have been VESC because I've worked with it for a while and the communication and configuration software is quite handy. So my first try have been to swap a GD32 onto a Bluepill and run netzpfuscher Vesc implementation but so far without success. I've successfully compiled from repository then flash on the board, but no connection to vesctool with a UART to USB adaptor (Vesc report no firmware detected). I think The firmware is running since I hear the buzzing at boot. Do someone have an idea what could make vesc tool not communicate with it ? (I have already tried the rx/tx swap without better luck)

Since I had some black pills I gived a try today at Mxlemming MESC firmware but without better luck. I tried to use the live expressions on STM32CubeIDE with a STlink V3 but for whatever reason they doesn't want to update. I haven't found another easy way to figure out what's happening. Electricaly I can see the switching starting when I twist the throtle but no current is flowing and can't figure out in wich mode the firmware is at that point. Is there a way to enable Uart live data transfer ?
If you want VESC, build the f405 pill. https://github.com/davidmolony/F405_pill

Shame you can't get the swd to read the variables on MESC. Since it's programming, that's surprising but cubeide can be odd.

If you're basing the variable names off the video I posted beware the latest master branch has had the variables renamed to enable multiple motors.

Usually the reason for pwm starting but not pushing current is that for some reason the PI gains are zero. Usually this is because it's initialised with no motor parameters defined, hence zero R and L, which becomes zero gain. I think there might be a bug in the master branch where MESC is initialised before the motor parameters., https://github.com/davidmolony/MESC_Firmware/blob/afb3e205b5f0cb22a1fac63bbf3d1ae0cfd506cc/MESC_F401CC/Core/Src/main.c#L140 swap MESC init and motor unit there. This is, I think, an error just on the f401 project. Sorry... Also, overwriting the L R lambda parameters like in the f401 main doesn't work, that needs to go before the MESCinit as well. Currently working on another branch where this is fixed, but there are other issues there because me and Netzpfuscher are actively changing all sorts to enable automatic HFI calibration and mode switching and so on.

Netzpfuscher has been adding a UI to MESC over serial which enables setup and storing variables but it's on the f411 version of the black pill (will be ported later to f401 and f405 he promises).

You might also be able to activate the simple comms I wrote which just throws a few variables down the serial line 4x a second.
 
Thank you mxlemming, just made it work by putting the MESC init after the motor init as you said !
Also have the live expressions now (I was as you also said using the wrong expressions, motor1 was needed instead of foc_vars).

I had a few trouble playing with it (burned the blue pill regulator the same way you did I think with a ground loop with STlink connected and a USB oscilloscope on my computer) but it actually run my DIY motor better than my little 75100 Vesc !

After a little hesitation it start without issue sensorless. MESC might be my new go to :D

I just jumped from my 5 AMP CC power supply to a small lipo. Now that I don't get cuttout I found the noload spool-up a bit slow, I bumped the ABS_MAX_PHASE_CURRENT from 50 to 100A but found no changes. I might need to look at RMS phase current but haven't found the variable yet.

Also looking over the MP2 settings I see 0.00033Ohms as R_SHUNT and 10.5 as OPGAIN. On V0.2 I have 3 parallel 0.005 Ohms shunts per phase and 47K loopback and 2.2K serial resistor on the opamps should I set those values respectively to 0.00166 and 21.37 or am I missing something ?
 
Thecoco974 said:
Thank you mxlemming, just made it work by putting the MESC init after the motor init as you said !
Also have the live expressions now (I was as you also said using the wrong expressions, motor1 was needed instead of foc_vars).

I had a few trouble playing with it (burned the blue pill regulator the same way you did I think with a ground loop with STlink connected and a USB oscilloscope on my computer) but it actually run my DIY motor better than my little 75100 Vesc !

After a little hesitation it start without issue sensorless. MESC might be my new go to :D

I just jumped from my 5 AMP CC power supply to a small lipo. Now that I don't get cuttout I found the noload spool-up a bit slow, I bumped the ABS_MAX_PHASE_CURRENT from 50 to 100A but found no changes. I might need to look at RMS phase current but haven't found the variable yet.

Also looking over the MP2 settings I see 0.00033Ohms as R_SHUNT and 10.5 as OPGAIN. On V0.2 I have 3 parallel 0.005 Ohms shunts per phase and 47K loopback and 2.2K serial resistor on the opamps should I set those values respectively to 0.00166 and 21.37 or am I missing something ?

Glad you got it working! One day maybe more people will use MESC.

The variable for the current is the
Code:
"#define MAX_IQ_REQUEST 30.0f"
(or whatever you have set) in the MP2 header.

Code:
"#define ABS_MAX_PHASE_CURRENT 50.0f"
is the current at which it trips and goes to error state. As a general rule, you should set abs max as 1.5x the set point or ~50A above the set point. If you set it too high, there is a chance it never trips as it pushes loads of current into the motor resistance, and things get very hot. Don't set it above what the ESC can actually read.

Regarding the shunts and opamp gains, you can swap them, but since the shunt is half the resistance and the opamp is very close to 2x the gain... overall there is no difference. MESC calculates the overall gain in amps/ADC count so it all cancels out for the two MP2 variants.

Unfortunately, I have found the black pill regulators very fragile. Fortunately, the ones Owen has put on the F405 pill are much more robust, and that also runs MESC :D
I fixed my black pill like this:
Replacement reg.png
 
I've set up ABS_MAX_PHASE_CURRENT to 150 and MAX_IQ_REQUEST to 100, that's a lot better :lol:
However I trigger the max current error state accelerating at now load sometimes, I think the switching frequency might be a bit low for the low inductance my motor have. Probing the phase current give something very noisy with high current spike when switching (around 1.75 time average current I think)

current_noload.PNG

I've tried 30000 and 25000 for PWM_FREQUENCY but neither would run, just making noise. What would be the max switching frequency F401 and F405 could achieve ?

I also just received some F405 pills from JLCPCB, are they worth trying in place of the F401 ?

F405_pill.jpg

I really like the regulator fix !
 
Thecoco974 said:
I've set up ABS_MAX_PHASE_CURRENT to 150 and MAX_IQ_REQUEST to 100, that's a lot better :lol:
However I trigger the max current error state accelerating at now load sometimes, I think the switching frequency might be a bit low for the low inductance my motor have. Probing the phase current give something very noisy with high current spike when switching (around 1.75 time average current I think)

current_noload.PNG

I've tried 30000 and 25000 for PWM_FREQUENCY but neither would run, just making noise. What would be the max switching frequency F401 and F405 could achieve ?

I also just received some F405 pills from JLCPCB, are they worth trying in place of the F401 ?

F405_pill.jpg

I really like the regulator fix !

You can run up to about 35000 on the F401 and the F405 will commute up to about 65000 BUT the hardware is rarely able to cope with that speed; the noise on the current measurements gets silly. Practically, going above 50kHz is a bit futile. Bear in mind those numbers represent double the VESC switching frequency, 30000 is the same as VESC 60000.

You can set an MP2 up with higher abs max values, from the ESC's perspective 300A should be no problem, but whether you want to depends significantly on why you are hitting current limits. If the ripple because of inductance is too high the upping the abs max is the only way to go. If the reason is loss of control, you will just get ever higher current faults until at some point it can no longer actually reach the limit because of resistance and then something burns or you get violent stops which can wreck motors.

The F405 is better in every way than the F401, except that the old, first generation F405 pill wasted a lot of output pins, there was no SPI available, contention between CAN and the broken out pins... etc... If you are just using a throttle and spinning a motor, use the F405. OWhite is making a new version with a much better pin combination broken out.

The overshoot on current you are seeing might be for a number of reasons, but I am not actually sure what you are probing. One thing that is certain though; the short spikes will not be fixed with a higher frequency PWM, you will just get more spikes. This looks to be an external probe since it is not low side shunt signal. If your probe is an inline resistor with opamp, investigate whether the opamp has settling issues, if it is an inductive clamp type, it is probably real and probably just because of the low inductance of your motor, the way switching and dead time works and just something you have to live with. Low inductance motors are problematic.

They should not be affecting the control algorithm, since it samples in the middle of this.

Beware that with low inductance motors, it is tricky to tune the control loop, you might have to fiddle the R and L and possibly lambda values. Can you share the motor parameters you have entered and a picture of said motor? Is it the axial ironless one you posted about ages ago? Did you run a MESC detection and record the values, copy the values from VESC tool or manually measure them?

Lastly, if you swap to the F405 pill, beware the dead time might need changing, it is currently at 500ns by default. I need to make this settable from the header file now there are so many targets supported. This is a parameter set in CUBE IDE and dates back to a previous power stage I built. It works fine for my MP2 MOSFETs but they are not the CRST ones and I don't know what you have used...

IMG_20230118_235525324_HDR.jpgIMG_20230118_235519444_HDR.jpg
 
Well wow!

I had not realized how busy everyone has been on https://github.com/badgineer/CCC_ESC !

I subscribed to github notifications for the project when I found it in Aug22', but did not get any, oh well, I am on board now!

Just spent couple hours pouring over the new documentation, beautiful work!

I forked the repository, made a pull request for some broken links I found.
 
Do you get any other emails from GH? If not, your email provider or program/app might be filtering them as spam...I've had that kind of thing happen to a number of websites that send out a lot of emails in general (forums, GH-type sites, etc).
 
Back
Top