SimpleFOC hardware tuner

I’ve been challenged when tuning motor parameters using comms, especially when speed is required, as well as the ability to instantaneously “feel” the result of tuning a combination of parameters. I know, there is the SimpleFOCStudio, however, I find it a lot more intuitive to turn knobs and not wait for the loop to read the values from the Studio especially when the loop is doing things outside, as well as the need for an entire external computer connected to the motor. Also, tuning a hard to reach motor while attaching an external laptop is sometimes not feasible.

This is my current solution. It’s in development stage. I’ll post more as I continue to improve it.

If anyone has ideas to further improve it, I’m open.

You can tune up to 8 simultaneous parameters attached to analog knobs. I’m planning also to attach an external LCD display so it’s entirely self-contained.



Wow, you actualy BUILT a hardware controller. I’m lazy and would just have used a MIDI controler like this

Mine cost me about $10, built to specs, very narrow and specific use case.

Also, how do you use the MIDI controller, I mean, how do you interface? Mine has the entire dedicated interface to control the closed loop motor in one box? I’ve never worked with MIDI controllers.

Prototype almost done, box and LCD screen added. Kind of basic for now, but when I get the time I will definitely improve the design.

Obviously doesn’t include the cost of the bluepill board.

I said I was lazy not which is best. MIDI is a standard that goes over USB like serial or mass storage. Linux/Window and Mac has this built-in. It is not unlike using a gamepad controller. You ge callbacks.

The device is not really a musical instrument. it is used for mixing audio.

My goal is to cut everything out and get a standalone plug-n-play device. No external computers. I’m a huge fan of hardcore back to basics.

Hey @ChrisA ,

I use this one:

Cost me about $40, plugs into USB.

I then use pD (pure data) to read the MIDI, apply some math, and send commands to SimpleFOC via serial. For someone who has a bit of familiarity with this world I think it is a nice “low-code” way to make a GUI or control application, and tie together different components into a working system.

pD is a bit idiosyncratic, but actually very powerful. Here’s a super-simple pD sketch for MIDI to SimpleFOC, in this case using the UDP WiFi of an ESP32:

The main disadvantage I find is that this type of MIDI controller is effectively 7-bit, you get values from 0-127, which is a bit “coarse”… I deal with this by using 2 knobs, one for bigger steps, and one for fine control.


You still need an external computer?


Yeah, for sure, with the above sketch I need a Laptop/Computer with WiFi to run pD, a WiFi Network (router, etc) within reach of Laptop and ESP32, the ESP32 to read UDP and write I2C and finally the STM32 based motor board board which is running SimpleFOC. ESP32 and STM32 communicate using the I2CCommander…

Quite a different setup to connecting the motor board directly to hardware tuner…

But each has its advantages/disadvantages, and its good if our ecosystem has both types of setups, and more…

Kind of related to this thread, but also separate: has anyone done an implementation of some MIDI controller or other USB HID with simpleFOC or some other driver software, to implement haptic textures? I see a lot of the stuff on haptic textures here but mostly it’s self contained, not interacting with PC. I would like to build one of these tuning boards also, but with some small motors I found on Ali. (actually, the same ones @Karl_Makes_Music is using for some smartknob projects currently)

There were couple guys on this board implemented an interactive “intelligent” rotating knob, with textures, and LCD screen, pretty nice. Probably sound, too, but don’t remember.

OK found it