Overview
While consulting on a large multidisciplinary project in the early proof-of-concept phase, we offered support to another team beyond our initial remit.
Here, we investigated a misbehaving multi-axis motion control system, delivering a working solution despite harsh constraints.
Situation
ODrive S1 controllers were employed, and would frequently disengage due to an error detecting the axis position.
We established that the controller was connected to a remote encoder via approximately 1.5 metres of individual thin wires.
Approach
Electromagnetic Interference (EMI) was the prime suspect, with the main aggressor likely to be long motor phase wires running in parallel to the encoder signals.
Due to the tight design and extreme time constraints, we proposed switching to RS-485, emulating the supported AMT21 series encoders, and shortening the SPI link to less than 10cm.
We ordered new components for next-morning delivery, and began the design and implementation.
Hidden Requirement
With the parts assembled and initial firmware loaded, we discovered that the ODrive was throwing an immediate MISSING_ESTIMATE error.
Unfortunately, we had overlooked the AMT21’s very tight 3 µs turnaround time - had we spotted it earlier, we might have selected a faster MCU.
Solution
The ATmega4809 running at 20 MHz has no chance of calculating and sending the response in time, let alone querying the SPI encoder too (3 µs is just 60 CPU cycles).
To resolve this, we rewrote the firmware with careful scheduling and aggressive optimisations.
Result
The result was a very robust encoder, which fully resolved the issues experienced by our colleagues, meeting the deadline without requiring new wiring or integration of a different encoder.
The time elapsed from agreeing a plan of action to delivering a solution was under 24 hours.