Arduino or Raspberry Pi?
When the Raspberry was announced some were quick to excitedly herald it an “Arduino killer”, and simple comparisons are frequently made which fail to take into account the broader benefits of each platform. More often than not these are based on headline specifications such as processor clock speed and RAM alone, and so a good place to start is with a hardware comparison.
Microcontroller vs. microprocessor
The Arduino employs an 8-bit ATmega series microcontroller whereas the Raspberry Pi is based around a 32-bit ARM processor, and the Arduino is typically clocked at between 8-16MHz and with 2-8kB of RAM available, and in contrast the Raspberry Pi can be clocked at up to 1GHz and may have up to 512MB of RAM. On top of which the Pi has a GPU and video outputs, Ethernet as standard and USB host ports. So the Raspberry Pi wins? Well, it depends upon the application.
Raspberry Pi ports (Source: elinux.org, CC BY-SA 3.0)
The Pi has a clear advantage for complex networked and high performance embedded applications, and those which involve driving a video display or USB peripherals. But when power consumption is of paramount importance the Arduino has the edge, as it will only consume microwatts when in sleep mode compared to the watts drawn by an idle Raspberry Pi running Linux. Due to the much simpler nature of a microcontroller-based approach the Arduino may also have an advantage over the Pi in applications which demand a very high degree of reliability.
An battery powered Arduino-based wireless sensor node
The Arduino comes supplied with an IDE and libraries which have been designed for ease of use and to support “non-programmers”, and within minutes of installing these you can be blinking LEDs and reading temperature sensors. The Raspberry Pi doesn't come with an official IDE but the “educational language of choice” is Python and libraries exist to enable much of what is possible from within the Arduino IDE. Alternatively C/C++ or just about any other language could be used and there are even libraries which attempt to recreate the Arduino system.
The Arduino IDE
Arduino software is written in a language similar to C++, this is compiled on a PC running the IDE and then downloaded over USB, with debugging made possible via print statements that direct their output to the IDE. Whereas the Raspberry Pi runs Linux and can host its own compilers etc. and development can be carried out using a directly attached monitor, keyboard and mouse, or via a remote SSH or VNC session. In addition to which more advanced debugging tools are available and with interpreted languages such as Python commands can be entered interactively.
Thanks to Linux the Raspberry Pi benefits from a far more flexible and powerful development environment. However, the Linux kernel alone comprises millions of lines of code and for applications where simplicity is key the operating system-less Arduino holds certain appeal.
To say that the Linux ecosystem is extensive would be a serious understatement and thanks to the Debian project and via it Raspbian, those developing for Raspberry Pi can install thousands of libraries, tools and applications with just a single command. The Arduino software ecosystem is much younger and more modest, and also reflects the fact that the Arduino is based around a micro-controller and designed for smaller and what could be described as classic embedded applications.
An Arduino prototyping shield (Source: Wikimedia Commons, Public Domain)
Prototyping and learning
Arduino is a prototyping platform, hardware designs are open source, and the ATmega micro-controllers used can be secured in low volumes and are available in packages that are easy to work with. In contrast the Raspberry Pi is, at the time of writing, not an open source hardware design, its system-on-chip is only available in high volumes and it employs package-on-package technology which requires specialist tooling.
The Raspberry Pi was designed from the outset as an aid to teaching computer science and this is where it really shines, and it can be used with a great many languages and frameworks and to learn everything from simple scripting up to network and graphics programming. The Arduino is just as approachable a platform and while much more constrained in terms of supported languages and applications, it provides a gentle introduction to embedded systems and “bare metal” development.
As is so frequently the case it's a question of the right tool for the job and, all other things being equal, each will appeal to different sensibilities. It's wise to avoid making a hasty judgement and worthwhile taking the time to better ascertain which may be better suited to a particular application, and it's probably safe to say that there is space for both in most workshops!
CommentsAdd a comment
sheriefadel, the answer to which is better (Arduino or Raspberry Pi) for building a robot depends on how fancy a robot you intend to build.
Simple line-following robots are easily within the grasp of an Arduino. A more full-featured and autonomous you intend to make your robot, the more it makes sense to have a Raspberry Pi as the brain. For example, tasks like image analysis and facial recognition need the memory resources and processing speed a Raspberry Pi can offer. While the Arduino can be expanded in many cases with 'shields', the price of the Arduino+shield rapidly increases the cost up to the same or more than a Raspberry Pi, but without the extra processing speed of the Pi.
On the other hand, for some I/O and motor control tasks, the Arduino can offer more deterministic processing, since it doesn't have the overhead of the Linux operating system. So the best choice is sometime to use both a Raspberry Pi and one or more Arduinos, with the Pi handling the high-level tasks (image/audio analysis, speech generation, location monitoring and navigation) and using the Arduino(s) to control motors, actuators, and sensors.
Raspberry Pi's focus is about bringing computing and programming to a wide audience through a cheap platform that is easily rebuilt, whilst Arduino is about bringing electronics to a wider audience.
Both are great platforms that have hidden depths and flexibility with fast growing communities. But for me the real joy is in bringing them both together, with the Pi providing the platform for high level processing (e.g, in Java or Python) with the Arduino providing the low level I/O . The Java libraries provided by processing.org provide rapid development of Java based Pi programs controlling and responding to events generated by the Arduino, written in C, with some external electronics thrown in. Nice.
thanks a lot for this informative as well as helpful description -
may one e.g. ....
- use a raspberry pi as a server for arduino/atmega/picaxe/pic/....
- arduino/atmega/picaxe/pic/.... based components/circuits
are the "real-world" connections (such as sensor in-/output processing circuits)
forwarding in-/outputs towards the "digital-world" devices (computer/server/....)
via a raspberry pi?