DIY milled board based on Xiao and SimpleFOC Mini

I like the Xiaos; here’s a board I designed to be milled in a Fab Lab:
BLDC Modular Thing
It’s based on the SimpleFOC Mini.

I’ve successfully used the Xiao SAMD21 (with @runger’s fix) and Xiao RP2040 with SimpleFOC and the DRV8313 BLDC driver.

EDIT. Topic is moved from: Adafruit QT PY or Seeed Xiao boards and simplefoc - #19 by Giant_Bee


I love it!
In the last iteration of the mini (release v1.1 and stepmini v1.0) I’ve made them stackable to a Xiao(qtpy).
But I’m seriously considering making a board similar to yours, Wich would be based on xioas and have a driver+sensor(+ maybe current sensing). I think that the Xiao’s should have just enough pins for those three. :smiley:


I could live without current sensing for those small gimbal motors. I even run hoverboard motors without it.

The stacking modules are really nice! That might be a good fit for my Fab Lab students, to experiment with steppers and BLDCs. But it seems that I need to remove some pins from the Xiao header so that I can attach these boards.

I don’t include an angle sensor on the board because I use iFlight motors with an integrated magnetic sensor.

There are three free pins on my Xiao board that could be used for current sensing!

I’m planning to make another board like this that runs on 5V USB power. I’ve made one failed attempt and I have a new game plan now.

I would be satisfied with current limiting, to avoid drawing too much current from the USB port. The DRV8313 motor driver has a comparator that you can use to automatically turn the driver off when the current goes over a threshold that you define.

I still haven’t tried proper current sensing. @Antun_Skuric, why did you start using the ACS712 current sensing IC instead of the INA240 on the SimpleFOCShield?

Hi @Svavar_Konradsson,

Yeah, in my mind this small-pakcage board goes very nice with simplefoc. As you could decide to use the mcu that you like that comes in this pacakge. (there arent that many of them but still).

For most applications with gimbal motors it makes perfect sense and it is perfectly good enough. There is no real point to go to the current sensing path as @o_lampe confirms.

Where the current sensing comes to play is when you try to search for high speed applications and especially high-torque and high-speed applications. Which is usually not the case in gimbal motors.
Another interesting aplication of the current sensing is different kinds of force control, but in static scenarios at least, voltage control approximates it very well.

The goal with the new shield is to make it as easy to manufacture as possible. So the INA240 were working very well, I had zero issues with them, howver at some point they just dissapeard from the scope as well as L6234 chip. Nowdays you can find them, but their price is still pretty high (at least for example at JLCPCB).
Finally the last issue with INAs is that they require the shunt resistor, which dimensions has to be found pretty precisely (although not that complicated to do) in order to make sure that you can measure all the currents that you wish and not to exceed the ADC voltage range.

So I opted to go to for the ACS712 sensors, first to test them out as they are much more available and less complicated to setup. I haven’t had any issues with them so far really, I see no real difference for gimabal motors. (I’ve even tried using them in the same system using one INA240 and one ACL712 and the everything still works fine :D)

The only issue with the ACS712 is that they are rated for 5V, however in my experience at least the ACS712-5B can be run at 3.3v. The reason might be that as they have 0.185V/A gian and 5A range, the max voltage they output is 2.5+0.185*5 = 3.4V so with 3.3 you lose only a tiny bit of the range.

My goal for this potential new all-in-one baord would be to enable people to start with a simple board that has all they need inside, but that they still have some flexibility, like the choice of the mcu.
The board should be able to do the real FOC, by measuring the phase currents as that is the main feature of the simplefoc and afterall this project is an educational one :smiley:
Finally, what is really cool, we could use it to control either a BLDC motor or a stepper motor (using the hybrid approach Driving two-phase (bilpolar) steppers with three-phase (BLDC) driver - Hybrid stepper motor - #38 by Copper280z)
So I feel like this could be the ultimate started board for simplefoc :smiley:

1 Like

What? You can also control a stepper? I’m going to take a look at that thread :smiley:

I agree that a small board that does real FOC and lets you choose between a few types of microcontrollers would be really nice and adaptible for lots of use cases.

For education and quick testing with small motors, I like the simplicity of powering them from the USB port. I’ve searched far and wide for a BLDC driver that can operate on a 5V supply voltage and is also in a package that is compatible with a milled board.

Unfortunately all the really low-voltage BLDC drivers are in tiny leadless packages.

So now I’m considering using three MP6610 half-bridge drivers, which I came across recently. Three of those are more expensive than a single DRV8313, but it’s much easier to mill a board for the half-bridge drivers. I know it’s a bit of a convoluted solution, but a part of being a Fab Lab is teaching people to mill PCBs.

Another benefit of the MP6610 is that it gives you analog current reporting, and you can adjust the voltage of that signal with a resistor on the ISET pin (see image above). I wonder if I could get current measurements that are good enough for FOC if I use the nice ADC on the SAMD21 Xiao. Maybe that’s not entirely realistic, but it might be worth a try when I have time to make a new board sometime after the summer.

If the MP6610 works well enough as a current sensor for FOC, then the BOM cost actually goes down compared to one DRV8313 + three ACS712.

But this is probably not the solution for you. I suspect that the ADCs on the RP2040 and ESP32 chips are not up to the task, so you probably wouldn’t be able to use those MCUs unless you put a separate ADC on the board. And you’re not milling boards, so it’s nice to stick with the DRV8313 motor driver :slight_smile:

It get’s quite confusing discussing three different designs in one thread.
There’s the original idea fron Antun,
then there’s the all_in_one stepstick sized version,
and now the milled PCB.
I don’t want to disencourage anyone. The more options we have, the better!
But please keep it clear what’s_what.

You are right, these kinds of discussions are a bit confusing, and one of the problems of having discourse type forum. better would be to create a new discussion each time when it diverges from the initial point.

The good thing about discourse though is that these discussions are completely available and all the messages are available to read through. There might be many of them though :smiley:

I’ll break this discussion in two.
This topic is moved from: Adafruit QT PY or Seeed Xiao boards and simplefoc - #19 by Giant_Bee