ARDUINO DUE vs ARDUINO MEGA

Currently I have built advanced line following robot using Arduino Mega. I have 8 analog ir sensors and some sonar sensors for tunnel solving obstacle avoiding. But I have some problems detecting the sharp angles and sonar calculations. I think arduino mega is slower for simultaneous switch from line to tunnel. Will upgrading to arduino due will solve the problem as it has far more processing speed? I know the 3.3v logic limitations. Also will analogRead, analogWrite, digitalRead,digitalWrite perform faster on Arduino due rather than Arduino mega? Will upgrading to Due from mega will be worthy?

Please help me :slight_smile:

You will have a real speed upgrade by programming directly the DUE peripherals and GPIOs.

You will find numerous example sketches for programming directly the DUE peripherals and GPIOs in the DUE sub-forum of this forum (ADC instead of analogRead, PWM or DAC instead of analogWrite and PIOA/PIOB/PIOC/PIOD instead of digitalRead/digitalWrite).

I have not done measurements (I don't have a Mega), but I doubt that you could expect anything spectacular in speed enhancement by using analogRead or digitalWrite on a DUE.

I second ard_newbie.

Both the Mega and Due are excellent in their own right, but the Due is outstanding.

Even just from an Arduino point of view, the Due is effectively a supercharged Mega running around 5 times faster with more flash and RAM to play with.

Direct register programming leverages even more of the Due's power and speed.

The only notable disadvantage of the Due is that it lacks on-board EEPROM, but this can easily be overcome with external I2C or SPI EPPROM ICs.

Want to see something really funny :slight_smile: ?

The SAM3X that makes up the heart of the DUE doesn't have any EEPROM itself, but the Atmel 16U2 that is the bridge between the UART interface on the DUE and the USB programming port does (512 Bytes of EEPROM).

And here is how you can wire your DUE to leverage 512 bytes of builtin EEPROM:

https://forum.arduino.cc/index.php?topic=191298.0

Hi ard_newbie,

Thanks for the links. That's really cool, and a neat way to get access to the Due's "on-board" EEPROM, albeit in a slightly unorthodox way. The ingenuity of some projects never ceases to amaze me.

Also, thanks for all your posts on the Arduino Due forum, I've learnt a lot and really appreciate your encyclopedic knowledge of this board.