I am looking for advice on putting together a fast motor control prototyping platform.
I would like to build a smart-stepper using FOC for a robotic arm application - low speed, high torque using NEMA17 steppers. I would love to use a smart stepper board that combines a magnetic encoder with motor drivers and an MCU, like the MKS 42C, but it is closed-source.
At some point, I figure I will have to learn how to build my own PCB, but my background is in software and algorithms, so I am trying to amortize the learning curve :).
Here is my thought: stack an Adafruit RP2040 QT Py with an AS55047 (or AS5048) dev board taking one side of the pins and a Pololu motor carrier stacked on the other side of the MCU, using the other side of the MCU’s pins.
Is this plausible? Am I overthinking it?
Welcome to the forum.
Anything is possible, provided you invest enough time end effort.
Answering the narrow question, it would work. Please spend time reading through the forum, you are not the first and won’t be the last to do this, there are many other posts by people who have already done it. The forum has a search feature, use it as much as you could.
The broader question is whether this is the right hardware for the use case, and this I personally cannot comment on without knowing a lot more about your use cases, time, budget, and your skill-set.
Part of the challenge with using simpleFOC is using the software with the hardware. There are some specific things that should be configured on the hardware for software to work. For example the PWM control for motor needs to be each a unique timer channel. On RP2040, any pin can be connected to the PWM engine, but you might find that the same channel (i.e. PWM3A) is exposed on multiple pads. If you want to use StepperDriver4PWM in the software, each half-bridge should have it’s own timer. I’m not familiar with the qtpy, but you need to make sure the pins you want are exposed. It might be better to use pi pico with more pins exposed. Likewise, to use a serial (SPI or I2C) sensor, you need to connect it to pins which have supporting hardware. Not all pins on rp2040 can support an SPI bus, you can find these details in the datasheet, it’s actually laid out quite nicely on p. 13.
Something for RP2040 that is nice is that even though there are 8 PWM channels, each has ‘slice’ A & B, and B can be an independent duty cycle (but must have same frequency as A slice), effectively making 16PWM channels available since it’s not often you need to run channels at different frequencies.
Thanks! I do need to double the pin availability to make sure.