Do you think it is necessary to add control interface to simpleFOC?

While simpleFOC is getting more useful and powerful it is time to give it the control interface that it can be controlled by central control unit. In my plan the central control unit controls and coordinates many simpleFOC device in the same time, so CAN bus or SPI in daisy chain are suitable. What do you think?

Within the library there is already a rudimentary control interface
BLDCMotor::command(String user_command)
where you can send commands as string. It is straightforward to expose this over UART or bluetooth serial and could be used as the basis for other interfaces (can, i2c and spi)

I’m ambivalent about adding any of these interfaces to simplefoc/Arduino-FOC.
Pros: A bunch of us want to control more than one motor and/or want to control motors remotely. Why not try to standardise an approach?
Pros: We could hide some of the complexity of controlling over CAN,spi, etc. e.g. we could provide client libraries.
Cons: We are using a variety of different hardware, which would make standardisation difficult.
Cons: Scope creep - the simeplefoc/Arduino-FOC library aims to do one thing well (Arduino + FOC) and may lose focus if it tries to widen it’s scope.

Personally, the last argument wins out, but there is another possibility…
@Antun_Skuric has made simplefoc a github ‘organization’, it is possible to create related projects e.g simplefoc/Arduino-FOC-Control under the simplefoc banner. What often works best with this type of thing is to collaborate in personal github repos until a certain level of maturity/scrutiny has been achieved and then consider migrating it in.

simpleFOC already had the control interface but in a motion control system one motor moves depends on the others, that means it is better for a simpleFOC to report its status to a central controller, the central controller will instruct the other simpleFOC to take action.

simpleFOC is something like a most used 3D printer stepper drive module such as A4988 module, it has a step/dir control interface that equivalent to BLDCMotor::command(), it still needs a controller such Marlin to send command throught the control interface to coordinate all the motor movement in a system.

Hey @zhangzq71,

Its not up to me, but personally I see a controller (like Marlin) or a control interface, as out of scope for the core part of SimpleFOC.
People use the library in different ways, for many different applications. Some run it in quite constrained hardware, so its important to keep the SimpleFOC core focussed, small and clean.

Its interface is a C++ API, so its not hard to hook up the control system of your choice. For example, I use OSC as a control interface, that makes it easy to use pre-existing software to do the control or make simple UIs. Others might prefer a REST API. But this kind of high level control interface more or less assumes IP networking, which most microcontrollers don’t have.

Other people will prefer something like CAN-Bus, SPI, or RC-receiver (PWM) inputs. But each of these will require their respective hardware, and certain pin-outs to work correctly, not to mention a configuration interface to set things up. At each level there are many choices for the implementation.
How should SimpleFOC know which of these choices is appropriate for your use case, and your choice of board?

I think something like a STM-based, FD-CAN controlled ESC firmware is something that could be done on top of SimpleFOC, using the SimpleFOC library as its motor driving core, and building on that for control functionality and configuration to a specific choice of hardware.

But I am not sure I would put it inside of SimpleFOC, as it is only one use-case of many…

Regards from Vienna,


@runger, I prefer STM-based, FD-CAN controlled way for using SimpleFOC. As you said each people has their preferred way, as I can see in this community there are many people using ESC32 IP networking way. But that is not the matter because SimpleFOC based on Arduino platform. What I most want is a CAN/FD-CAN interface based on SimpleFOC, and I have made a hardware to do this.


Zhang Zhi Qiang

1 Like

Hey guys,
This is an interesting topic.

Some time ago I’ve made a java based serial(terminal)monitor application that should be portable on most of the operating systems. It is a very simple application which I commonly use for simpler serial debugging with my devices.

I am not sure if some of you are interested to collaborate on it to extend it to simplefoc specific interface for calibration. It already implements the serial communication, and the simplefoc already implements the motor commands.

I think it would be very cool to have an interface to tune the pids and similar stuff with just a few sliders and graphics. I certainly think that this might be a step we will take in future but at the moment we are concentrating on current sensing and torque control and the interface will have to wait a bit.

So this is a sort of open invitation to anyone that might interested to collaborate on this topic. Any related info is welcome as well!

1 Like

It is a good idea to have an application for calibration, but what I really want is the interface to sent motion control command to simpleFOC such as what the LM6470 did, it uses SPI daisy chain interface, CAN interface will be a good option for simpleFOC for adding motion control interface.


Hi there!

Speaking of CAN, I just found this one:

It has a STM32 microcontroller and powerful driver in a small board with CAN interface. Assuming there is a way to re-flash it, it would probably be a good platform for SimpleFOC.

Looks like a nice board, but SOOO expensive! Anyway, maybe a source of inspiration for a CAN-based design.