Introduction to the Raspberry Pi 

Lesson 2

Raspberry Pi versus Arduino

In this lesson, I will discuss the  10 most important differences (and similarities) between the Raspberry Pi and the Arduino.

You can watch the video, or, if you are the "reading" type, you can read the text below.

A comparison between the Raspberry Pi and the Arduino.

Hardware

To begin with, let's consider the fact that the Raspberry Pi is a normal computer.

It just comes in a tiny package.

But, it's got everything that you'd expect a computer to have.

Think about it.

  • You can connect it to a screen.
  • You can connect it to a keyboard, a mouse.
  • You can connect it to external hard disks.
  • You can connect it to networks, including Wifi (Raspberry Pi 3 and newer boards).
  • You can connect it to Bluetooth devices (Raspberry Pi 3 and newer boards).

The Raspberry Pi 3 has all the features that you expect to have on a computer.

And it's also got respectable specifications.

The Raspbian Pi 3, for example, has a 1.4GHz processor, with four processing cores, and a full gigabyte of RAM. It can run Linux  and even Windows!

On the Arduino side: The Arduino is not a computer, as per the general use of the term.

It's a microcontroller.

Think of a microcontroller as a tiny, tiny, computer without any of the things that we expect in a desktop or a laptop computer.

The Arduino Uno, for example, has got very little RAM. Just 2 kilobytes of RAM. That is just 0.2% of the available RAM of the Raspberry Pi 3!

It can't connect to a network like the Internet without the additional components.

It doesn't have much storage for your programs, just 

The Arduino Uno only has 32 kilobytes of flash memory for such purpose, where the Raspberry Pi can use gigabytes and gigabytes of SD card to provide memory for that purpose.

Performance

The next big difference is performance.

A tiny computer with a 1.4 gigahertz CPU clock rate, four processing cores, a dedicated HD graphic processor, a gigabyte of memory and lots of gigabytes of disk space, you have serious resources at your disposal.​

You can use these resources to do very interesting things.

You can run an operating system like Linux or Windows.

You can also use it to play games or to write large applications and even run web servers.

None of that is possible with the Arduino, which is limited to what its microcontroller can do.

Right from the bat, you've got two devices that are totally different.

That's because when they were designed to be different.

A microcontroller is designed to predictable, small, and endlessly repeatable tasks, and to do them efficiently and for a very long time without supervision.

For example, if you want a gadget that measures the temperature and the humidity in a room, and then, depending on those specific two values to turn on a fan or an air conditioner, then something like the Arduino (or a microcontroller in general) will be the best technology on which you can build such a gadget.

But, if you want something that can do all of the above, plus a few more things such as to control  a security system while performing face recognition from a live video stream, while keeping a log of its activities in a database, then you need a computer, like the Raspberry Pi.

The second example involves the performance of many more tasks that need to be individually programmed, supported, and provisioned for.

The Arduino would be totally inadequate for something like that.

For that, you'd be looking at the Raspberry Pi.

So the Raspberry Pi is great for general computer stuff, whereas the Arduino is great for things that are small in complexity, small in programming size, and repeat constantly.

A great thing about the Arduino is that because of all its input and output pins and ability to connect them to actuators and sensors, things such as relays, switches and motors, it is really a good choice, for sensing and controlling the world around it.

As long as this level of sensing and controlling doesn't become too complicated.

The Raspberry Pi, on the other hand, can do a lot of what the Arduino can, plus a lot more that the Arduino definitely cannot do.

The Raspberry Pi is capable of performing a huge range of tasks.

Just like the Arduino, the Raspberry Pi does have a bunch of general purpose input output pins that you can connect to actuators and sensors.

Hardware-wise, the Raspberry Pi is more complicated also because of the amount of built-in capability that comes on board.

Where the Arduino shines

There is definitely a good case to be put forward that says that the Raspberry Pi can actually do everything that the Arduino can, therefore you don't really need the Arduino.

But there is a flip side to that.

The great thing about the Arduino, and that's why I love it personally, is that it's simple.

The fact that it has no operating system to worry about means that you don't have to gain additional skills, just to interact with basic hardware like LED and motors.

To acquire such you would need to invest a significant amount of time. It's a steep learning effort to learn how to use an operating system in order to just be able to turn the on and off or an external appliance on and off via a very simple relay wiring. If learning an OS is one of your goals, than this is not a problem, but if not, it will hinder and slow your progress.

For beginners, I always say that the best way to get started with electronics and with control applications is through the Arduino. The Arduino can help you to get the understanding, the capability and the skill to using the bare minimal infrastructure that a microcontroller provides before moving onto something more complicated.

And as a matter of fact, if you think about, it when a new person comes into the world of electronics and control their objectives tend to be fairly simple: just blinking an LCD very often is a great achievement and it is really an achievement when it is something that you've done for the first time, and then spinning a motor.

It's these simple things that you can do really quickly with the Arduino that make it the ideal learning platform for new makers.

Simplicity is where the Arduino wins big time.

Programming

In terms of programming languages, the Arduino is programmed in C/C++. The Arduino team has built its so-called "Arduino language", based on C and C++. This is another great advantage of the Arduino.

C/C++ on its own is a fairly complicated language.

C/C++ has a steep learning curve. But thanks to the simplification that the Arduino layer on top of C/C++ provides, it is relatively easy to learn the basics of, and quick to be able to be productive with the Arduino.

On the other hand the Raspberry Pi, being a full microcomputer, has a wide range of languages that you can use to program it.

Almost any language that you can use in Linux is also available for the Raspberry Pi.

By default, the Raspberry Pi, when using Raspbian, it's most commonly used operating system, comes with support for C and C++ and Python.

You can also install other languages, like Ruby, PHP and many other things.

So, make your choice. If you're familiar with in any programming language, chances are that you'll be able to use it with the Raspberry Pi.

Most of the Raspberry Pi documentation especially, for educational purposes, is written in Python, which is a high level language.

Python has a very short learning curve, so even if you've never done Python the past you'll be able to pick it fairly quickly, at least when you compare it to other languages like C and C++.

Power consumption

Finally, let's look at power consumption.

As a computer with a lot more resources and hardware to power, the Raspberry Pi requires a lot more current and power compared to the Arduino.

You need a 1 A power supply (at a minimum) to power your Raspberry Pi reliably, and more than that if you have things such as touch screens and cameras connected to it.

The Arduino, on the other hand, is very nimble.

You can power it with just 20 mA, for example.

Of course, these numbers depends on what else you have connected to your boards.

Another power feature of the Arduino and the microcontroller technology is that you can programmatically control its power consumption and reduce or increase it on schedule as needed.

You can put your Arduino to sleep, for a few hours, days, and wake up a while later to perform a task. Then, it can go back to sleep again.

It's possible to power an Arduino using small lithium batteries, for a year, operating in a low power mode. This is a very useful capability when you want to deploy an Arduino gadget at  locations where fixed power is not available.

"Raspberry Pi Getting Started" series

Ready for some serious learning?

Start right now with Raspberry Pi Full Stack - Raspbian

This is our most popular Raspberry Pi course.


This course is a hands-on project designed to teach you how to build an Internet-of-Things application based on the world’s most popular embedded computer.


Learn how to:


- Setup your Raspberry Pi as a web server using a minimal version of the Raspbian OS.


- Use only the console to interact with your PRi.


- Setup Python in a container dedicated to your web application, install the necessary modules to control the GPIOs and sensors.


- Build the web application, one level of the stack at a time, using high-performance open-source software.

Jump to another article in this series.

4: Headless and graphical (GUI) operating systems (coming soon)

6: SSH and headless configuration (coming soon)

7: Booting for the first time (coming soon)

8: Connect to your Raspberry Pi using the terminal (coming soon)

9: Header and pins (coming soon)

10: A taste of Python on the Raspberry Pi (coming soon)

11: A simple Python program (coming soon)

12: A simple circuit (coming soon)