Go Down

Topic: Missing Timer Input Pins?%!&# (swearing omitted) (Read 894 times) previous topic - next topic


I set out to create a motor speed control design for an RC car project I'm working on and ran into an unexpected limitation in the Arduino Mega hardware design.  Specifically, I wanted to implement a closed loop speed control on the drive motor on my car and thought I'd use one of the 16 bit timers to count revolutions of the motor using a hall effect sensor.  But, after much searching, I was surprised to learn that the Mega Arduino design only bothers to bring out the input pin to Timer 5 to an edge connector.  The input pins to the other 16 bit timers, timer 1, timer 3 and timer 4, are left completely unconnected...  So, OK, fine.  I thought I'd use timer 5.  But, then I discovered that doing this would break my use of the Servo library, as it depends on Timer 5.  Argh...

So, it seems that someone decided that using timers as counters was a rather unimportant feature in the design of the Arduino Mega.  Frankly, this seems incredibly short sighted to me.


Coding Badly

T0 is available.  You would have to move millis to a different timer.

ICP4 is available.

ICP5 is available.  The Servo library would have to run the timer at a constant frequency and leave it running.


You should be able to use any of the attachInterrupt() pins and count with an ISR - or even use pin-change interrupts and then any pin can be used.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


    I don't know a whole lot about hall effect sensors, but I have an RC Car on the table next to me, where on earth are you planning on mounting the sensor ? wont it be saturated by the motor magnets ? and wont it upset the balance of the motor ?

My suggestion - find an easily accessible slow moving gear or shaft and count the revs with light.

As others have suggested, any interrupt pin will do for this.

Duane B

Read this
then watch this



Hall effect sensors cannot saturate, they are not ferromagnetic.  (Well some sensors may add ferromagnetic materials to increase sensitivity, but your basic Hall effect sensor is just a piece of semiconductor with a bias-current flowing.)
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131