Mimic
Mimic copied to clipboard
One ard to mind them. One ard to sense them all and to their angles bind them.
[flashback music] The original plan was always to have a single Arduino control all of the motors. That's not what we're doing now.
The challenge here is that we have 10 DC motors, each with a dual-channel Hall-Effect sensors to track position. These 20 signals must be read w/o missing a blip, or we will lose track of where we are.
Hardware interrupts were the only reliable method we found to do the sensing. Software interrupts would miss sometimes. The trouble is, typical Arduinos only have a limited number of HW interrupts available. Uno's have 2. Mega's have 6. Others boards report that "any pin can be a HW interrupt" which is true, but you can only have so many in use at once (not very many).
We are currently using Adafruit's Metro M0 Express, which provides enough interrupts for 4 motors. So we have three of these boards in use to cover our 10 DC motors (plus 2 servos).
The Artemis ATP (https://www.sparkfun.com/products/15442) may be promising for lotza HW interrupts, but so far we have not had time to dig deep into it. When the board was first released, there wasn't support for the encoder library we use and a quick ask didn't yield results. https://forum.sparkfun.com/viewtopic.php?t=51850
Another option is to use a multiplexer to read all 20 signals and report status via I2C to an ard. Looked into it, but haven't tried it.
This problem seems solvable!
Collateral damage: If we succeed with a single Ard board, we'd have to change our custom HDMI (just for compact cabling -- not sending video) connector shields to have all connectors on a single board or stackable rather than the three shields (one on each Metro M0) that we currently use. We would also need to stack our motor driver shields, which is not an issue.
*Issue title credit goes to SWGlassPit
The Adafruit M4 boards, including the tiny Feather version, include more discrete interrupt pins. Here's the M4 Feather pinout: https://learn.adafruit.com/assets/101972
I think there are ~11 interrupt pins available to us that don't share a pin with a vital function (I2c communication, TX/RX, etc.). So, this is not enough to cover the 20 interrupt pins we'd need to read encoders from all 10 DC motors, but we could possibly remove the SARJ/TRRJ Metro (TRRJs don't require encoders since driven by servos).
Or, we could cram these little M4 feathers plus motor controller FeatherWing shield into the outboard truss, so that only power and two serial data lines would have to go up the tree. But, would make debugging harder.
This will not be part of the current architecture. If we replace the entire mechatronics approach (such as with Robotis motors if they produce a smaller one) then this will effectively be realized.