5

I'm getting back up and running with microcontrollers after about 5 years of hibernation time, and I am trying to understand a lot of different things. I have been experimenting with Arduinos for the past few weeks and am having a ton of fun. I'm a software engineer by day and a hardware hacker / manufacturer by night. At my day job, I write scripts and applications that are thousands of lines long and highly complex, using external libraries of thousands more lines of code, etc. These are full-fledge, professional software applications.

So, here is my question. Is the Arduino capable of running full-fledged robotics and other large, complex hardware applications, or is it more of a tinkering, hobbyist tool?

How big of a project can be built using Arduino? Are there memory concerns? Can an Arduino run thousands and thousands of lines of code out of the box, and if not, is there a way to add more memory for larger, more complex projects?

7

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.

  • (Ahem) The Intel Edison is dual-core @ 500MHz... – John Burger Jun 23 '16 at 9:38
  • Ah; it's the Galileo that is 400MHz... – WestfW Aug 2 '16 at 5:47
  • These days the ESP8266 and ESP32 are more or less arduino compatible and they have huge amounts of RAM and storage. Consider these as well. – HixField Sep 15 at 7:52
4

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.

  • The AVR machine instructions are all two-byte long, except for jmp,call, lds and sts, which are 4 bytes each. – Edgar Bonet Jun 22 '16 at 17:18
  • Ach, I was thinking of clock cycles, which are what is documented in the main datasheet. Thanks for the correction, I amended my answer. – Nick Gammon Jun 22 '16 at 21:00
  • @NickGammon "There are always memory concerns, however when you have gigabytes of RAM (like on your PC) you tend to ignore them." And alas, today's programmers (whippersnappers the lot of 'em!) have lost that realisation... If they could put a bit more effort in optimisation, they'd halve the size of many programs - if not more! – John Burger Jun 23 '16 at 9:43
  • Well, I wasn't counting myself in that group *grin* - my first computer had 512 bytes of RAM (which was also used for code) so I had to program conservatively. I agree though, that thinking you have unlimited memory, and unlimited speed to spare, can lead to careless programming. – Nick Gammon Jun 23 '16 at 20:57
2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.