Tuesday, September 27, 2016

Raspberry Pi vs Arduino

Oh My!  It has been over 4 months since my last post and some readers may be thinking that I have fallen off the planet. Not quite, but I have been very involved otherwise. Real life is intruding a lot lately and most of my hobby time has been absorbed in supporting the local maker group with teaching robotics to kids.

The robotics has gotten me very involved using Arduino systems which I had little experience with previously. That got me to thinking that a comparison of Arduino to Raspberry Pi would be good at this point.

Microcontroller vs General Purpose Computer

This is the big difference in the two. The Pi is a fully fledged general purpose computer capable of performing most of the tasks that a PC performs. It has a complete operating system, much more memory, a storage device, and a monitor and USB devices are supported. The Pi can easily multitask, running several programs at once. It also has excellent networking support, both wired and wireless.

The Arduino is a microcontroller. It has only a small amount of memory (2K RAM and 32K Flash) and runs a single program. This allows it to provide true real-time response. There is no USB support and adding networking is difficult and very limited. The advantage is that it starts up as soon as power is supplied and won’t be corrupted if power is lost. It also uses far less power and can easily run on batteries. An Arduino will happily run on 7-12 volts while the Pi must have a regulated 5V supply.

GPIO Capabilities

This is where the Arduino really shines. The Raspberry Pi provides 28 GPIO pins, but only one that provides PWM output and none that provide analog input. The typical Arduino also has 28 GPIO pins, but six of those can provide PWM output and another six can be analog inputs as well.

The Pi provides RS-232 as well as I2C, SPI, and 1-wire buses. The Arduino supports these as well.

Form Factors
Example Arduino Boards


If we ignore the original version of the Pi (which I tend to do now) there are only two form factors available – the model 2 and the zero.  The Arduino, however, is open-source, and comes in many sizes. The Uno is by far the most common, but my preferred version is the nano. I have also become quite fond of the ESP8226-01 Arduino compatible board. It may only have 2 GPIO pins, but it is extremely cheap, low power, and has built in wifi. I am starting to use it for IoT projects with great success.

Which to Choose

There is a fair amount of overlap in the capabilities of both systems, so many tasks could be performed by either device. However, there are some things that at best done with one or the other.

If you need:

  • More than 2KB of RAM
  • A very large program or multiple programs
  • A network interface that can handle multiple clients or support more than one protocol
Then you should use a Raspberry Pi.

If you need:

  • True real-time response to inputs
  • Analog inputs 
  • PWM output for motors or servos 
  • Extremely low cost solution
  • Battery powered

Then you should use an Arduino.

Yes, you can get analog input and PWM output on a raspberry Pi, but it requires additional hardware, which adds to the cost and complexity.

Sometimes you need the best of both worlds and will use a Pi and and Arduino. I have done this on one commercial project already and it worked very well.

5 comments:

  1. Hello,
    I introduce myself, my name is Pierre and I am the creator of the website https://howtoraspberrypi.com, a website of tutorials about the raspberry pi.

    I am willing to contact you as I am currently looking for partners for this website.

    With two friends, we are rampant from Raspberry Pi and we created 3 years ago a site of tutorials about the raspberry pi, rather aimed at the French speaking public, https://raspbian-france.fr. Today, we try to propose an English version of the site howtoraspberrypi.com.

    In order to make our site more known, we seek to set up partnerships with other sites that, like yours, offer content that is complementary or close to that of our site.

    Could a partnership between our two sites be of interest to you, and if so, in what forms?

    Looking forward to your reply,
    Regards,
    Pierre Co-founder of the website howtoraspberrypi.com

    ReplyDelete
  2. Hello, i read your blog from time to time and i own a
    similar one and i was just wondering if you get a lot of spam responses?
    If so how do you reduce it, any plugin or anything you can suggest?
    I get so much lately it's driving me insane so any help is very much appreciated.

    ReplyDelete
    Replies
    1. Oh the Irony - This comment was marked as spam. I am using blogger and just let it do its normal filtering. I still get a few messages a week and I delete them manually, usually within a few hours.

      Delete
  3. Good Post Buddy.. It Increases my knowledege. Here, you will get lot of latest projects on Raspberry Pi. Engineers Garage is the community for Electrical & Electronics Engineers where everyone is sharing technical knowledge. Raspberry Pi is the important Microcontroller which is used in daily life. In this link, you will also get the source code, circuit daigram with every project.

    ReplyDelete
  4. This comment has been removed by a blog administrator.

    ReplyDelete