External input to timer/counter modules on Arduino Mega 2560/ADK

Hi Everyone,

I've done quite a bit of research on this and found that only timer input pins for timers 0 and 5 are brought out to headers on the Arduino Mega 2560/ADK boards (Pins 38 and 47 respectively). The input pins for the other 4 timers are not brought out onto the Arduino board.

Since timer/counter 0 is used for functions like millis and other internal timing on the board, I'm left with just timer5 that will accept external pulses on T5 (input pin to timer5). My project requires 3 timers to count external events and I'm constrained to the use of the Arduino Mega ADK.

What is the best possible way to bring out any two pins among T1,T2,T3 and T4 so I can apply external pulses to them? Or if anyone knows of a different workaround that would be really helpful too.

Thanks in advance!

Hi, welcome to the forum.

Collection of links:
Arduino Mega ADK : docs.cc
PinMapping ATmega2560 : http://arduino.cc/en/Hacking/PinMapping2560
Manufacturers page for datasheet : http://www.atmel.com/devices/atmega2560.aspx

I think you can not use the other timers. Solder some wires to them is (almost) impossible.
And it is not an FPGA chip, you can not internally redirect pins.
You could use an external timing chip or three external chips (one chip per input signal). What about using 3 extra Arduino Pro Mini boards instead of 3 chips ?
Perhaps an Mega-alike other board, like these : Cross Roads Electronics or this one : Seeeduino Mega | Seeed Studio Wiki

There are also software solutions. For example Interrupt and PinChangeInterrupt.
What kind of signals are those three signals ? What frequency ? What timing accuracy do you want ?
Should it be expandable for 10 input signals ?

Thank you for your response Peter_n.

I've considered using 3 external timing chips but the project already has quite a few external chips which is now causing time (I'll have to put in a purchase order which then has to be approved and then so on and so forth which takes more time than I can afford) and space constraints. If fabricated into a single board after the current prototyping stage, it would the easiest and cleanest option.

The signal I'm counting is encoder index signals from three different motors. The reason I can't use an interrupt to count these is that the motor is geared on the output side (160:1) and would lead to 160 interrupts for every output rotation which is every couple of seconds (depending upon speed). I think this would significantly affect the code execution especially since there is a lot of serial communication happening which gets affected by interrupts.

As of this moment I'm still convinced that using internal timers (due to the constraints I mentioned before) is the cleanest option since all the counting is handled in hardware. I'm seriously considering soldering extra wires to the timer input pins at the risk of damaging the board (!!).

If there are no other possible ways of counting these encoder index pulses without using interrupts and without missing a single pulse (here comes the need for high accuracy), I'm afraid I have to go ahead with the soldering and hope for the best.

A case of beer for any one who comes up with an alternate solution before my mediocre soldering skills take over!