I am very interested in your Bricktronics Megashield. In looking over your schematic (v1.01), it appears that for each motor only one TACH line is connected to an interrupt line. This cuts in half the accuracy we could achieve by getting an interrupt on each TACH line.
In a future revision of the board, would you consider routing the two TACH lines for each motor to an XOR gate and then the output of the XOR gate to the interrupt line. As long as TACH2 status is still available as a digital input then direction could still be determined on each interrupt based on the current state and one previous state of the TACH2 line.
Hi Tony, thanks for the feedback. The Arduino Mega 2560 only has six interrupt pins so we could only allocate one per motor. Fortunately, even if we only interrupt on one TACH line’s changes, we can still tell which way the motor has turned and how many ticks it has moved. It’s true that there is a bit of time delay as we don’t get interrupts from the other TACH line, but the next line level change on the primary TACH line will get us back in sync. When using position control of the motor, we also suggest calling the update() function as often as possible, which also manually updates the encoder’s position. Overall we haven’t seen or heard of any issues related to the single-IRQ encoder interface.
That’s a cool idea to add an XOR gate to get interrupts on a single input from both TACH lines. I’ve added it to the list of things for the next board revision!