Working with encoders with Arduino

I m doing a robotic project and I planned to use 3 of these motors with enoders https://www.pololu.com/catalog/product/2286 in the project. I planned to control them using Arduino Mega 2560. I have a doubt that the Arduino Mega 2560 is able to handle the 3 encoders. I found that this library can be use for the encoder interfacing http://www.pjrc.com/teensy/td_libs_Encoder.html. Is it possible to handle these 3 motors with encoders from the Arduino Mega 2560 ? Controlling of 3 stepper motors and serial communication also need to done while controlling the 3 dc motors with encoders by the Arduino. Can these all the things do by Arduino Mega 2560 ? Please someone help me.

In principle, the Mega2560 can handle three encoders. However, the real answer to your question depends on how many input pins will be available in your application for the encoders (6 are required), whether they are interrupt pins (for fastest and most reliable response) and what else the processor has to do (that is, does it have time to poll 6 inputs or service 6 interrupts). Only you can answer those questions, so try it and see!

Thank you !.
In the project Arduino is going to do serial communication with a PC ( getting data from the PC ). According to the data got from the PC. Arduino Mega 2560 need to control 3 stepper motors, and 3 dc motors with encoders (some small processing of the data is also need to done ). No any other input or outputs. Therefore 6 interrupts pin can be used for the encoders. Encoder readings and the stepper motor steps are need to store in th EEPROM. Therefore EEPROM write is also need to done. Is processing power of Arduino Mega 2560 is enough for the handling 3 encoders with high pulse rate (around 4500 pulses per second from each encoder) ?

For your type of application, the 2560 running at 16 MHz has the same processing power as any other ATmega. Here are some hints about interrupt timing and overhead; surely you can find others that deal with high speed encoders. billgrundmann.wordpress.com/2009 … nterrupts/

You certainly can’t save data to the EEPROM at 4500 writes/second, and you can only write to the EEPROM about 100,000 times total.

[quote=“Jim Remington”]For your type of application, the 2560 running at 16 MHz has the same processing power as any other ATmega. Here are some hints about interrupt timing and overhead; surely you can find others that deal with high speed encoders. billgrundmann.wordpress.com/2009 … nterrupts/

You certainly can’t save data to the EEPROM at 4500 writes/second, and you can only write to the EEPROM about 100,000 times total.[/quote]

Thanks you
Is it possible to use Arduino Due http://arduino.cc/en/Main/ArduinoBoardDue which having 84MHz ARM cpu for this task ?
Or it is better to use 3 separate micro-controllers (PIC 16F877A or something else low cost micro-controller) for controlling 3 dc motors ?

Hi RatedR,

I’ll note you found the code for encoders on PjRC, the guy there makes a great board, the teensy3.0, that is a 32-bit processor that can be safely overclocked to comparable speeds to the Due, I think default is 46mhz though. you can probably do what you’re seeking with that.

However, you have to be aware that your project might be difficult for you, depending on where you are in the learning process. If you want to learn a lot about interrupts and programming, and you have the time, go for it! But if you’re rushed and don’t have the time, I’d be wary of biting off too much. Precision applications at high speed can be tricky.