Close

First Prototype

A project log for Mechaduino

Mechaduino is an affordable, open-source, industrial servo motor. Position, torque, velocity, and custom modes. Arduino compatible.

jcchurchjcchurch 05/02/2016 at 05:110 Comments

The first breadboard-level prototype. A4954, AS5047, and SAMD21 breakout boards controlling a NEMA 23 stepper motor (closed loop position control).

This was our proof of concept. We wanted to see if it would be possible to control a stepper motor like a closed loop BDC servo motor at all.

At first, we tried to use an Arduino Uno compatible Atmega328, but found that it was a little bit too slow to run the control and commutation algorithms. We also began to run out of memory, so we moved over to the bigger, faster ARM M0+ SAMD21 (Arduino Zero compatible). We looked at a number of other microcontrollers, but in the end we decided that we really wanted to maintain Arduino compatibility to keep the control algorithms as accessible as possible to users.

We experimented with a couple different magnetic encoders. We were hoping to use the "16 bit" AEAT-6600-T16. Unfortunately, if you read the datasheet very carefully, you find that the resolution is only accurate to 16 bits in "slow mode"... which happened to be way too slow for closed loop control. We experimented with the hardware, and we were able to confirm that in "fast mode" this encoder is only accurate to about 10 bits... which isn't that great.

AMS has a dozen or so different magnetic encoders, and we experimented with a few. They're all pretty similar, but offer different output configurations, resolutions, etc. In the end we chose their 14 bit AS5047 with SPI output.

As I've mentioned elsewhere, ALL of these magnetic encoders suffer from non-linearities on the order of a degree or two... which is totally unusable out of the box for our application. Consider that these stepper motors have step angles of 1.8 degrees. If our encoders can only resolve angle to within two degrees, we can't even tell which step we're on, let alone commutate sub-step! At this stage we had to see if it would be possible to develop a calibration routine. I'll get into the details of that in the next build log, but long story short, we got them to work!

We put together a custom breakout board for the A4954, and were pleased with its performance. This chip worked out great since it has two chopper controlled H bridges in one package... perfect for bipolar stepper motors, and low cost/part count for us!

In the end we were very encouraged by the performance of this crude setup. We achieved our goal of closed loop position control. The next step was to put everything on a custom PCB, and clean up the control architecture.

Discussions