Skip to content

Motor Control View Page Source

Arduino Serial Monitor

Here I'm sending one brushless motor commands from the Arduino serial monitor. I'm using the SimpleFOC Commander interface, which is a set of commands similar to G-code.

SimpleFOC Studio

I followed the setup instructions for SimpleFOC Studio. The link to the code repo is hidden in the website title.

I got an error when trying to install the program using Anaconda.

SimpleFOC setup error

I went to the SimpleFOC Discord server and saw that one other user had encountered this problem. I asked for help and someone recommended that I update Python to the latest version. I did that, but it didn't help. Then I went back into the terminal and looked at the command that I was using:

conda create -n simplefoc python=3.6.0

But I was running a more recent Python than 3.6.0! What if I don't say anything about the Python version? I tried:

conda create -n simplefoc

and it worked!

SimpleFOC setup success

SimpleFOC StudioSimpleFOC Studio is up and running!

I reported the successful command to the SimpleFOC Discord server.

In SimpleFOC Studio, I tried changing the P, I and D values in the PID controller to see the difference that it made in the motion of the motor. Then I changed the values in the Arduino code that runs on my board. The PID controller still isn't particularly well-tuned, as SimpleFOC user AdinAck noticed in my final project presentation video.

There was one glitch in the program when I first opened it; every time I gave the motor a command to move, it immediately moved back to T0. This behavior stopped when I closed the program and opened it again. I mentioned this on this SimpleFOC Community forum thread:

There’s a ghost in my GUI - SimpleFOC Community

Design file

Here is the motor control code that runs on the SAMD21 chip and uses the SimpleFOC library. I used this code in all the other parts of the final project.

Download motor control code