Design details added below as I edit them:
It’s all in the timing
The diagram below is helpful, but doesn’t tell the full story
Calculating t3 and t4 is easy if the electromagnet is off, but how should we estimate them for the case we’re interested in when the electromagnet is on? The Arduino firmware allows for two factors:
- An offset distance from the leading edge of the EM that the pulse starts at. Magnetic fields propagate beyond the edge of the electromagnet, so we want to ensure the electromagnet is on as the ball approaches that point. The offset distance is measured in mm.
- A tuning factor that determines how long the EM pulses on for, relative to the time the ball would travel from where the electromagnet turns on to the centre of the electromagnet if it was turned off. The tuning factor is an index, relative to 1. More information to follow.
The above two variables are designed to be independent of eachother.