How to get a low inductance motor (0.04Ω) to move even a little with SimpleFOC?

Hi, all!
I’ve come really far in my journey in making a BLDC-powered “super blender” only to be thwarted by some Arduino code.

It seems the build flag -D PIO_FRAMEWORK_ARDUINO_ENABLE_CDC in this B-G431B-ESC1: Beginner guide + I2C guide by @ultra.robotics and this SimpleFOC 2.0 Tuning Guide - Part 1 by @Owen_Williams breaks my code. I tried just getting the LED on my wonderful B-G431B-ESC1 to blink, and I succeeded once I commented out this build flag. And I checked that the Serial Monitor works, too, which it does. Since those guides were written, the B-G431B-ESC1 has become officially supported by PlatformIO, so maybe no build flags are needed whatsoever. I don’t know how particular the compilation process for this board is. That’s one thing I’d like some clarity on. Moving on.

Once more following the brilliant SimpleFOC 2.0 Tuning Guide - Part 1, I was able to set up the Serial Monitor for read and write as per the guru’s instructions. Getting hall sensor readings worked without a hitch, too (link to section in video).

My problem was in the next section, getting the motor to spin with MotionControlType::velocity_open_loop. Nothing. Tried with closed loop. Nothing. Tried blank code with SimpleFOCStudio. Nothing. Admittedly, my “trying” is better described as “stumbling”, so I won’t go into the specifics of what I’ve tried, so I’m just including this here link to my github repo with simplfoc platformio project(s)platform.ini files and main.cpp files are relevant, and if there is a .gitignore template I am missing, please do let me know.

I wondered if the key difference might be that @Owen_Williams in his guide uses hub motors with, perhaps, 10x or 100x higher phase resistance than my 0.0361Ω, 170KV, 40A, 7-40V, hall-sensored BLDC (Maytech MTO 5065-HA-C). I’ve confirmed the resistance and impedance using my VESC SIX EDU (miracle hardware) and VESC TOOL (miracle software)–which gives line resistance and line impedance, in case anyone tries to do the same.

I’ve got no choice but to keep trying, but I think it would really help me and future users to have an example of getting going with SimpleFOC on a B-G431-ESC1 and a low-inductance/low-resistance BLDC, as I think this is the ideal setup for any medium power motor application–the ESC costs $20 and you get an almost flat torque curve across the whole RPM range of your motor with no gearbox/transmission when you use three phase brushless commutation and sensors. I, myself, am making a blender/dough mixer/food processor to end all blenders/dough mixers/food processors, in case anyone was wondering :slight_smile:

My hope is that I get my programs running and my repo can get merged them into the hardware-specific-examples folder of the Arduino-FOC library. Really don’t want anyone else to go through the same difficulty as myself this early in their development process. I’ll try to do the same for SimpleFOCStudio; it’s a GUI, there’s so much there, and the design is great, but it doesn’t give feedback as to whether one has connected to it correctly, and it seems I need motor.monitor printing stuff to my platformio terminal at the same time as the GUI, which seems quite counterintuitive to me? Actually, now that I think back to it, motor.monitor doesn’t work for me, either :smiling_face_with_tear: Definitely want clarity on this, too, and as many examples as possible. I’m rambling, now, sorry. Might continue in a new thread.


As a side note, I think a VESC is an amazing investment for anyone prototyping with BLDC’s. You can use it to profile seemingly any BLDC and generate a C header file listing every parameter the TOOL has for the motor and for the control algorithm it has generated. I’ve uploaded my own header file to this same github repo that my platformio project is in. I think in the future I’ll try to make a sort of transcriber that takes this header as input and spits out a main.cpp file for SimpleFOC. I’ll need to get quite a bit more literate in both softwares before that happens. Moving on…

Wow, thanks for your detailed and thoughtful feedback! Lots of people have been having issues with their B-G431-ESC1s recently, I think the driver shortage has made more people buy this model… so I agree we should give it some more attention…

Your suggestions make sense, but perhaps (if you want) we can coordinate a little bit, as some of the things you mention are already being worked on…

Man, I look forward to seeing this in action!!!

Please don’t expect too much from the B-G431-ESC1… its just a sample design, and the idea is (I think) that is gets installed in flying drones where it has forced air cooling through the propellers and drone’s motion. Even so, I think it needs heat sinks.
I doubt very much that it could do 40A without melting.

Your main issue will be keeping the currents under control - the way the board is set up it doesn’t have hardware protections, unless you implement them on the MCU… :-/
For testing, I would try to use a PSU with current limiting, although that might not be fast enough to save the driver if things go wrong.

May I ask if you also have a less “challenging” motor to test with? It can be really helpful to get everything working in a more simple setup (like with a high ohm gimbal motor), convince yourself that setup and software are working as expected, and then attack the more tricky configuration? But perhaps you’re already beyond this point.

In any case, we look forward to hearing more!

The B-G431-ESC1 will blow up with smoke and fire long before you spin up that motor full load. You need something rated around 70A minimum as a driver and good cooling to get it running.

Just use Arduino IDE.

Cheers,
Valentine

I’ve switched to a smaller motor for now. Still packs a punch. 0.025Ω, 1500KV, 408W, running it with a 12V power supply this time that can do 42A.

Anyways, I’ve done more reading and written some working code, at last. The motor did a “jiggle” instead of going 200rpm, or 21rev/s, like it was supposed to…but then I increased current…and it MOVED! I’m so happy. The SimpleFOCDocs turn out to be so good! Great resource for learning about brushless DC motors and their control methods in general. Just brilliant. I fought with the toolchain by STMicroelectronics, and…well, I’m surprised STM has claim to such a poorly working software suite. Open source for the win.

I’ve updated my repo. Thanks to all who have helped so far.

I’ll be sticking to PlatformIO because my SerialMonitor is finally behaving and because setting up STM32Duino will have its own problems, I’m sure. Upload process seems like a big hassle.

Anyways, I’ve updated my repo. So many things working, now. I’d really like SimpleFOCStudio to work, too, to make for a better tuning experience, but I can’t figure out how to make it connect. I’d greatly appreciate any suggestions. UART and I just can’t get along, it seems. Some screenshots:




1 Like

Hey, so glad it is working now!!

COM ports are point to point, so you can’t have it open in PlatformIO and Studio at the same time. You have to close the Serial Monitor in VSCode and then SimpleFOCStudio should be able to connect, I think…

Hi, I’m running your open loop velocity codes with a B-G431-ESC1 board, the motor I’m using has hall sensor but I didn’t connect it, the motor is rated at 24V and only 70W continuously and I connect 12V to the board. This is what I receive from the Monitor:
“MOT: Monitor enabled!
MOT: No sensor.
MOT: Init FOC failed.
MOT: Init not possible, driver not initialized
setup done”
Any idea why? There’s no movement of the motor at all.

Well it says the driver is not initialized.