non-Arduino build environments?

This is a newbie question, for sure.

All example project I see so far use Arduino IDE. Can SimpleFOC be used in other environments? Pointers?

I need this to run under maybe FreeRTOS on STM32.

Hi Chris,

We’re an Arduino Library, and use Arduino framework functions… so no, unfortunately you can’t compile without Arduino framework.

You can use other IDEs, like PlatformIO, but they have to support Arduino framework. The IDE is just the programming environment, it’s the framework that matters here.

You can run FreeRTOS on Arduino, also on STM32:

I’ve never done it myself, but based on the docs it should be possible to use a STM32 MCU + Arduino Framework + FreeRTOS for Arduino on STM32…

Note that concurrent programming on a MCU in C++ is a fairly complex topic, compared to the “single-threaded” model of Arduino’s loop() function…

What is your goal for this, if I may ask?

I believe I saw someone ported SimpleFOC to Kyle (spelling?) and another ported to ST’s Cube. I could be mistaken.

I’m not sure STM32 low end MCUs have enough processing power for that. High end H7 are expensive. I’ve never done this myself so that’s my un-educated guess here.

Why do you need FreeRTOS?


Deeper integration with ROS2/Moveit. It should be possible to run a Micro ROS node on an M4 chip.


Yes, running several tasks on a microcontroller takessome effort,this is why they invented RTOS. The other tasks are basically asynchros communications and possibly a higher-level of control.

I intend to prototypea few options. STM has their own FOC software not related to SimpleFOC. I will compare the two.

My “big picture” is a quadruped robot with 12 motors. I will almost certainly need a bus for control as I don’t want 12 serial cables running to the main control computer. So, is esential that the FOC controller also can run the bus interface. I don’t know which bus, CAN? or maybe just I2C. It needs to handle control and staus and error reporting.

The other problem is synchronized motion of 12 motors. Moveit uses the concept of “time tagged points”. Rather then sending “move to this point” it says “A time T you need to be at this point”. But “poiint” is has position, speed and acceleration components.

At this point I don’t know how I should doit. Plan is to run a robot in a simulation but with one real, physical joint. The physical joint would track one of the simulated joints

Higher level goal is a Boston Dynamics “Spot” at a $1,500 price point. Here is a fun videothat shows about 200 BLDC motors in sync.

This worksbetter forcontroll ing large numbers of motors

Boston Dynamics sells these Spots at $1500 because they take a massive loss on each unit they sell as loss leader advertisement expenditures. Also they have 30 years of research behind that dog (BD got founded in 1992). I know I keep coming across as a wet blanket however it is best that you know upfront the magnitude of what you are up against and scale your expectations accordingly.

Your goal is really inspiring, don’t get me wrong. I like it and I’m looking forward to seeing your progress.


The RTOS doesn’t change the core architecture of the MCU. Case functions is similar just prioritized.

WHAT??? BD sells these for a base price of $75,000 each. Not $1,500

My next door neighbors employer just bought one for $200,000 because they got some custom sensors and programming and paid support for a year. I don’t know if BD sell at a loss at the $75K base price but they would make it up in consulting. Because a base robot is s useless toy until you give it an actual task to do. In this case it will walk around and inspect a sewage treatment plant. They had a problem a while back where after an acident some of the plant was unsafe for humans with a mega-watt size power substation flooded in unprocees black water, The plan is to routinly use the robot for inspection and then over time they lean about it and then in an emergency it is a familar tool.

The $1,500 price point is my goal for a smaller version. These have 12 motors. I think I can find a 200 Watt quadcopter “outrunner” motor for $40 or less and then a driver board based in DRV8316 for $30 that suports a bus (maybe CAN bus). That is $70 which leaves budget for a 6:1 or 9:1 timing belt reduction system and a rotary encoder. The system would be smaller then the BD Spot be quite a lot, I thnk about 300 mm front to back

strong textI have a working prototype using hobby servos. These sevos are grossly underpowered and the (metal) gears wear out quickly but this has allowed me to work out the kinematics and overall software design. But performance is poor because of the cheap servos. The next step is to use ~30mm diameter drone motors. I expect it will take a year to test and prototype an actuator.

Currently I am just collecting data. What can SimpleFOC do and what else is there? STM has software, They claim 70% CPU utilization to run two BLDC motors with a 20kHz control loop and 6PWM output to each motor. on STM32F103. But this is from a user manual with 2018 date on it. No 1st hand experience.

Poetry in the sandglass

Apologies, yes I know. I was trying to make a point sorry for the misunderstanding. The BD robot dog price is well-known, I miss-typed my statement. “If” they sell it at $1500.

I hope you could get there.

At that point this is probably your best option, there is nothing else there which is open and you can load it and modify it.

Again, I like what you are doing and I’m looking forward to seeing your progress.


The Unitree GO1 sells for $2700:

I think the fully programmable version costs a little more, IIRC.

I’m really tempted to buy one :slight_smile: and take advantage of what I assume is a VC subsidized doggy :wink: