How much code can an Arduino board run?

There are several "Arduinos" with memory capacities ranging from slightly less than 32k/2k/16MHz (Flash/RAM/CPUClock) ("Uno") to 512k/96k/84MHz ("Due".) In addition, there are "mostly compatible" boards that expand that range down to less than 8k/512/8MHz ("Gemma", "Digistump") and up to about 1M/256k/120MHz (TI "EK-TM4C1294XL Launchpad"), and "somewhat compatible" boards with 4G/1G/400MHz (Intel "Edison")

Whether these are sufficient for "full fledged robotics" depends on what you consider that to mean. Edison is probably the only contender if you wanted to include computer vision, for example, and it probably doesn't do that very well. ("What did you expect at ONLY 1 core at 400MHz?!")

The small Arduinos probably do not support your "very large libraries", either. For example, while the "Arduino Language" is technically C++, support for the C++ STL is not included due to limitations of the small CPUs used and their run-time environment.

32k of program memory (on the popular Uno) is sufficient for "thousands of lines of code", but I'd think robotics would tend to run toward much more than that. The small amount of RAM available on most of the flash-based microcontrollers also tends to be a serious limitation when you start looking at standard data-intensive algorithms. 32k/2k disappears quite quickly if you start implementing an extensive user interface, networking, or graphics. I would say that an Uno-class Arduino is suitable for implementing COMPONENTS of robotics systems (motor drivers, sensor management, etc), but probably not a whole robot.

A good example of large robotics-like software that runs on Arduino-class hardware can probably be found in the 3D Printer space. "Marlin" firmware runs on an Arduino Mega or equivalent (256k/8k/16MHz) (with RAMPS shield), and there are alternative driver packages that run on smaller and larger arduino-like hardware. Marlin is about 280k lines of code, according to cloc.

Most Arduino hardware does NOT have expandable memory. The AVR cpus cannot run code except from their internal Flash, and few of the other boards have any sort of memory bus that could be used for expansion.


No accepted or up-voted answers, eh? I'll try my hand. :)

How big of a project can be built using Arduino?

Depends on the model. You can go from around 4 KB of programmable memory to 256 KB, and then get into the larger models like the Due (512 KB).

Are there memory concerns?

There are always memory concerns, however when you have gigabytes of RAM (like on your PC) you tend to ignore them.

These are microcontrollers, designed for embedded applications. You will find yourself probably wishing you had more of everything (RAM, PROGMEM and EEPROM). However for many applications what they have is absolutely fine.

Can an Arduino run thousands and thousands of lines of code out of the box

Probably not. Consider the Uno with 32 KB of program memory. At from two to four bytes per machine instruction (most are two bytes), you are probably going to fit at most:

32768 / 2 = 16384

... machine instructions. So no, not hundreds of thousands. The larger models, maybe.

and if not, is there a way to add more memory for larger, more complex projects?

The Atmega2560 has expandable RAM, for example here which adds 512 KB of RAM.

How big of a project can be built using Arduino?

I have quite a few around the place here doing their own things. One lets me know if I left the garage door open accidentally. I look upon them as being useful for "helper" applications. I wouldn't try to put my SQL database on one.


Although Arduino is more of a hobbyist electronics board, it can handle complex projects depending on which board you use. The Mega has 54 input pins, so can handle loads of devices and has much more memory and storage. See the Uno - Mega specs below

The ATmega328 chip found on the Uno has the following amounts of memory: Flash 32k bytes (of which .5k is used for the bootloader) SRAM 2k bytes EEPROM 1k byte

The ATmega2560 in the Mega2560 has larger memory space : Flash 256k bytes (of which 8k is used for the bootloader) SRAM 8k bytes EEPROM 4k byte

Tags:

Memory