Go Down

Topic: Why doesn't the Arduino have more memory and processing power? (Read 267 times) previous topic - next topic

fuzzybabybunny

I've been getting my feet wet with Arduino. Coming from a background of using scripted languages, I'm having a bit of a harder time with C++.

I understand that C++ is WAY faster and more efficient than something like Ruby or especially Javascript, but in this day and age memory and processing power is cheap. It shouldn't be that much more expensive to outfit an Arduino with more memory and faster processing so that it can run higher level languages very quickly.

So I'm guessing that the main reason the Arduino has low memory and clock speed is that it saves the most power?

I guess another related question would be: why doesn't the Raspberry Pi just have tons of analog pins like the Arduino? A RPi Zero isn't that much more expensive than an Arduino Mega for example.

Robin2

A microprocessor (such as the Atmega 328 in an Arduino Uno) is intended for a very different role compared to the processors in a PC or even in an RPI. I have not yet managed to write a program that used up all the memory on an Uno.

You wouldn't buy a 60 seater bus just to drive yourself and your girlfriend / boyfriend to the movies.

The fact that an Arduino does not have an operating system allows it to be much more predictable in the time it can react to events - there is no other activity demanding attention.

This isn't the Forum for questions about the RPi. My guess is that the designers consider that what they have produced represents the best balance of features to meet the needs of most RPi users. It is very practicable to use an RPI and an Arduino together to get the best of both worlds.

The reason C++ is used on the Arduino is because it can produce code that fits on and works on a microprocessor. In a sense the speed is a side effect.

On a PC with lots of memory and a very fast CPU it is usually a much better use of expensive programmer time to use a higher level language such as Python, Ruby or Javascript unless the higher performance from C++ is essential.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

BobRob

A high level language, especially one that is interpreted at run time like a "scripted language" is massively more inefficient than C/C++, meaning orders of magnitude. Things like memory addressing, garbage collection, jit-compilation etc use massive amounts of CPU cycles and wastes memory like crazy. In PC's we've gotten to a place where this rarely matters (unless you are making advanced graphics that actually push the hardware limits), but it comes at a cost. The most inexpensive device you can get that has the power of a PC and thus runs high level languages is something like a Raspberry Pi or an Arduino Yun or Tian and while they are amazingly affordable for what they can do,  they are still way more expensive than a microcontroller on it's own can be.

You see, a platform like an Arduino UNO isn't really meant to be built into a finished, production ready product. It is meant as a tool for developing devices that make use of micro controllers, and makes doing so much more accessible than it used to be. But say you are designing a device for controlling garden water sprinklers: You use something like an Arduino Uno with a WiFi module to develop your prototype, but in the final design you'll want to migrate to a dedicated microcontroller just powerful enough to do exactly the job at hand with none of the bells and whistles of the entire Arduino board, thus bringing the cost of hardware down to a few euros. Had you instead gone with a Raspberry Pi as a controller using Python or another dynamic language you'd have to put a Raspberry in each sprinkler controller, which would, even at the low cost of a Raspberry compared to a "normal" computer make iw.

So, while it's true there are very powerful hardware available, when it comes  to embedded devices we want to make due with as little power as possible to keep the costs down, and to do that we don't want to waste CPU cycles or memory on running a high level language to make life easier for the developer.

It all comes down to application: A backend service for a Warehouse Management System is running on a modern server where CPU cycles and Memory is cheap compared to developer hours, meaning we want to use simpler languages, especially since this kind of application won't be deployed into thousands of units. But for the barcode scanners the Warehouse staff uses to interface with the WMS while working we want to keep the cost per unit down and somewhere on that scale of cost calculations there is a point where the hardware cost will surpass the development cost if we try using PC-based technology.

Go Up