Reading from Five (5) Encoders with Arduino Mega

Hello,
I am working on a university robotics project involving the control of multiple DC motors with quadrature encoders. My question regards how I can control many (5) encoders using one Arduino. I am currently using the encoder library from PJRC (Encoder Library, for Measuring Quadarature Encoded Position or Rotation Signals), which relies on the use of interrupt pins, however, the Arduino Mega only has 6 available (10 are required for our purposes). Here are some approaches we are considering to increase the number of interrupt pins available:

  • Using the PinChangeInterrupt or PinChangeInt libraries to convert regular digital pins to interrupts
  • Using some sort of external counter chip interfaced to the Arduino
  • Choosing an alternative microcontroller, however, for this project, it must operate with 5V logic levels

Any insight enabling us to read from multiple (5) encoders would be greatly appreciated. Thank you.

Using the PinChangeInterrupt or PinChangeInt libraries to convert regular digital pins to interrupts

This works well.
No "conversion" is required, interrupt-on-change is simply a feature of digital input pins that you can enable and use.

Look into a MUX to combine all the individual signals into one digital clock signal with an IC.

No need for a Mux, a PCINT interrupt covers all bits (pins) of the same port.

But due to the Arduino pin numbering, the relationship between Arduino and controller pin numbers and port bits vary among controllers and boards.