IRLib Tutorial part 3d: Installing the Arduino IDE on a Raspberry Pi

As we mentioned in part 3c, this section of the tutorial doesn’t have anything to do with IRLib specifically, however if you have not already installed the software necessary to run the tutorial part 3b then you will have to follow these instructions. In this section we will install the Arduino IDE on a Raspberry Pi. If you’re not using Raspberry Pi as a host machine but are using Windows like we did in part 3c then you do not need this tutorial at all.

Note: This article has only been tested with Arduino IDE version 1.0.x and not with the beta version 1.5.x. We cannot guarantee these procedures will work with the new version which may have a totally different structure since it is a fairly big upgrade.

We are assuming that you are using a plain vanilla Raspbian Wheezy OS on your Raspberry Pi. We cannot guarantee any of these instructions will work on other versions of the operating system. We are also assuming that your Raspberry Pi has Internet access for downloading updates. If your Raspberry Pi is not connected to the Internet you’ll have to figure out how to get the necessary files onto your system by an alternate means.

Raspbian Wheezy is actually a version of Debian Linux and according to the following reference the Arduino IDE has already been prepackaged for easy installation. Go to a command prompt and type the following command
sudo apt-get install arduino
Breaking this command down for those of you who may not be familiar with Linux commands… The “sudo” stands for “Super User Do”. Access to the root directory and installation on your machine requires superuser privileges. This command temporarily gives you those privileges. And what are you going to do with them? You’re going to run the “apt-get” command. This is a system already set up in most Linux distributions to get various programs from a central repository. And the command that we passed this program is “install arduino”. I take the time to explain all of that because when I was new to Linux and didn’t know what I was doing, I would ask a question on the support forum and they would give me some obscure line of text type and I had absolutely no idea what I was doing or why.

This process not only installs the necessary Arduino components it also installs and/or updates various Java components necessary to run the Arduino IDE. If you do not have Internet access and did not use the “apt-get” command to install the package but simply copied the programs over to your Raspberry Pi, then you do not have the full package. The process of getting those additional Java packages is beyond the scope of this tutorial.

When the installation is completed most of the software is installed in the folder “/usr/share/arduino” and the folders inside that include “hardware”, “lib”, “libraries”, and “tools”. There is also an alias for the “examples” and “reference” folders however these folders are actually stored in “/usr/share/doc/arduino-core/”.

Also upon completion you will discover that your GUI start menu now has a new folder and it called “Electronics” which contains a link to the Arduino IDE as seen here.
If you would like a shortstop on your desktop, the easiest way to do it is to collect up on the start but do not actually click on it. Instead do a right-click and there will be an opportunity to “Add to desktop” as seen here.
You now have an Arduino IDE shortcut on your desktop. For future reference your desktop icon is at /usr/share/pixmaps/arduino.xpm
If you double-click on the desktop icon on select it from the start menu the Arduino IDE the first thing you will want to check is the version number. As of this writing the pre-packaged version of Arduino was only at version 1.0.1 however the most recent version was 1.0.4 which among other things added support for other Arduino boards such as the Arduino Esplora and Arduino Micro. If the above installation process did not get you the latest version then you will have to manually updated yourself. We successfully used the procedure below to update from 1.0.1 up to 1.0.4 and a week or so later ran the process again to get up to 1.0.5.

We’re going to assume you are starting out in a directory called “/home/pi” where “pi” is your username. If you’re logged in under a different username that will be different naturally. We recommend that you create a directory for downloading programs. At the command prompt type
mkdir downloads
Which obviously makes a directory called “downloads”. Then type…
cd downloads
Which changes your current directory to the downloads directory or folder. Then you should type the following command
The “wget” command gets a file from the web. If you are installing something newer than 1.0.5 you will have to change the filename. If you are uncertain of the filename, call up a web browser in your computer and go to and then right-click on the 32-bit Linux link and copy shortcut. Then paste that text somewhere so that you can see the proper filename for the most recent version.

We will now use the “tar” utility to unzip the archive that we have downloaded. Issue the following command.
tar zxvf arduino-1.0.5-linux32.tgz
This will create a folder under your downloads folder called “arduino-1.0.5”. Then change to that folder with this command.
cd arduino-1.0.5
We now want to get rid of the “hardware/tools” folder inside the unzipped distribution. That is because the version that we have downloaded is compiled for an Intel x86 or AMD x86 processor and not the ARM chip that is in your Raspberry Pi. We will use the “rm” command to “remove” that folder.
rm -rf hardware/tools
Now we will copy using “cp” to copy the other files into their proper locations. We will go through the subfolders and overwrite any existing files.
cp -ru lib /usr/share/arduino
cp -ru libraries /usr/share/arduino
cp -ru tools /usr/share/arduino
cp -ru hardware /usr/share/arduino
cp -ru examples /usr/share/doc/arduino-core
cp -ru reference /usr/share/doc/arduino-core

Note some readers of this blog have reported that they needed to pre-append “sudo” to these commands above. If you are having difficulty with these commands you should try using “sudo cp -ru… etc.” instead.
Now if you launch the Arduino IDE you will see that the version has been updated. In this image we had only updated it to 1.0.4 but you can see it does have the additional boards that were missing from the 1.0.1 installation.
One last item… If you were doing this in order to run the IRLib tutorial part 3b on your Raspberry Pi then you will also need Python, PySerial, and Pygame. Fortunately Python and Pygame are already installed on your system. Be sure to use the Python 2 and not Python 3. You will however have to install the PySerial module with the following command.
sudo apt-get install python-serial
That should be all you need.

19 thoughts on “IRLib Tutorial part 3d: Installing the Arduino IDE on a Raspberry Pi

  1. Great tutorial. Only comment I had was that I had to do sudo rm [command] and sudo cp [command] for it to work for me.

    Thanks again!

  2. hi, ı am come up with some problems ,

    I ınstalled 1.0.1 IDE with
    $ sudo apt-get update
    $ sudo apt-get install arduino
    commands but ı have to update 1.5.2 IDE and tried your commands line by line …. whıle try to ”cp” commands lınes , ıt says that cannot create regular file and permısson denied in every step. so still my arduino version is 1.0.1

    how can ı solve thıs problem?

    Thank you,

    • Some people have reported They needed to put “sudo” in front of the cp copy commands. Also note that this is only been tested with IDE version 1.0.x and not with 1.5.x which technically is a beta version. It’s considerably different than the 1.0 version and may have a different structure. I’m not yet tried using the 1.5.x IDE so I can’t guarantee this will work.

  3. I opened some code which is already running on my arduino uno on the pi… it can’t compile the sketch because of the missing serial.h. Running the same code on my mac will just compile it fine using the same Arduino 1.0.5 IDE.

    So how do I get serial.h to work on the pi?

    • I’m sorry I don’t have a solution for your problem. I’ve not been able to re-create it on my system. I’ve been able to successfully use serial ports on the Arduino IDE under Raspberry Pi. Perhaps someone else seeing this comment and have a suggestion for you or try some of the various Linux Arduino support forums.

      • For some reason I had a include serial.h in my code. Commented that out, compiled just fine. Runs fine w/o including serial.h
        I have no clue why I included serial.h in the first place…

  4. Brilliant article – know next to nothing about LInux , have PI / Arduino set up so this saved me a lot of time and bother. THANK YOU VERY MUCH !!!

  5. Hi,

    unfortunately this did not work for me. I updated fine and the ide is updated, however, when I try to compile Blink e.g. I get

    “usr/share/arduino/hardware/tools/avr/bin/avr-g++ Line 3:

    usr/share/arduino/hardware/tools/avr/bin/…/bin.gcc/avr-g++: No such file

    usr/share/arduino/hardware/tools/avr/bin/avr-g++ Line 3:

    usr/share/arduino/hardware/tools/avr/bin/…/bin.gcc/avr-g++: Success

    usr/share/arduino/hardware/tools/avr/bin/avr-g++ returned 126”

    • I’m sorry I cannot help you with this. When I follow the procedures outlined in this article everything works for me and I really don’t know that much about Linux to be able to figure out what’s going wrong. I was lucky to get this working myself.

    • Last I heard the Arduino IDE 1.5.x is still in beta testing and so I’m not bothered to figure out the procedures. It would probably require you to completely uninstall 1.0.5 and try to find a way to install 1.5.x from scratch.

Leave a Reply

Your email address will not be published. Required fields are marked *