Close

Arduino Brushless FOC Controller - Development

A project log for 3D Printed Robot Actuator

A high speed and high torque robotic actuator using low-cost brushless motors, custom controller, 3D printed parts and bearings.

paul-gouldPaul Gould 10/20/2018 at 08:084 Comments

The Cypress PSOC4 Controllers are not very common in the maker community. As I would like more makers to be able to use/modify/improve this Actuator, I am designing an Arduino version. It will be based around the MKR Zero with the SAM D21.

Earlier I got the Centered Aligned PWM working for controlling the MOSFETs for driving the Brushless motor. Next was the SPI for reading the Magnetic Absolute encoders for the motor and joint positions. The SPI on the SAMD21 only has a single buffer which is not time efficient for this application. It does have a DMA on the SPI which is much more complex but the most efficient for operation. The problem is that it is not a standard feature for the Arduino system. 

I started with the following information.

https://forum.arduino.cc/index.php?topic=344029.0

Now the Adafruit Zero DMA library makes it too easy

https://github.com/adafruit/Adafruit_ZeroDMA

and can now be installed by the standard Arduino IDE --> Sketch --> Include Library --> Manage Libraries

It also support Interrupts "dma_callback" to tell when the transfer has completed.

Discussions

Paul Gould wrote 12/26/2018 at 15:17 point

One encoder is for the motor commutation and the other is for the joint position. (There is also another one for spring defection distance.) I looked at other systems but they were either too expensive or did not have a holding torque at 0RPM. Sensor based brushless motors and their controllers are very jumpy at low RPM. 

  Are you sure? yes | no

imperator-maximus wrote 12/24/2018 at 13:29 point

I wanted to play around with AS5147 and Arduino as well but Digi-Key wants to charge 18(!) EUR for delivery plus 11,16 EUR for one sensor. So it would be 34,70 € at all (inc. tax) which is ridiculous. The AS5048A might be an alternative which comes already soldered with cables and magnet for  around 20 EUR from Aliexpress. There is also an thread about how to use it with Arduino: https://forum.arduino.cc/index.php?topic=155238.0

  Are you sure? yes | no

Paul Gould wrote 12/26/2018 at 15:10 point

I am currently making my own boards and buying the chips in quantity of 25. The price is ok. I am trying to use SPI with DMA (as to not to load the CPU) but it is taking a while to get it running. 

  Are you sure? yes | no

Artem Kashkanov wrote 12/17/2018 at 12:31 point

Why you want to use two encoders? You want to use one for speed/acceleration control and second for position setting?

Did you investigate already existed hw-based opensource motor-control systems? 

  Are you sure? yes | no