Fusion of Engineering, Control, Coding, Machine Learning, and Science

Install and Run Arduino IDE on Raspberry Pi 5 or 4 in Linux Ubuntu

In this tutorial, we explain how to install and run Arduino Integrated Development Environment (IDE) on Raspberry Pi 5 or 4 in Linux Ubuntu. The YouTube tutorial is given below

Install and Run Arduino IDE on Raspberry Pi 5 and Linux Ubuntu

Motivation and Important Notes

Motivation: In a typical robotic system, Raspberry Pi 4 or 5 are used as high-level controllers running computer vision, machine learning, and model-based control algorithms. The high-level controller needs to communicate with a low-level controller that is used to control motors and receive measurements from encoders. Usually, low-level controllers are Arduino, ESP32, stm32, and Teensy microcontrollers. Arduino and ESP32 microcontrollers can be programmed by using Arduino IDE. Consequently, it is of paramount important to learn how to install Arduino IDE on Raspberry Pi.

uname -m

The output should be

aarch64

This means that your Raspberry Pi 5 is running an ARM64 architecture. You can also type this

dpkg --print-architecture

If in the future Arduino releases a version of Arduino IDE 2.0 for arm64 architectures, we will create a video tutorial on how to install it on Raspberry Pi 4 or 5.

Installation instructions

Go to the official Arduino webpage and download the installation file for the most recent version of Arduino 1.0 IDE (link is given here). In our case, it is Arduino IDE 1.8.19. Make sure that you download the ARM 64-bit version.

Download the file to the downloads folder. Then open a terminal and navigate to the Downloads folder:

cd ~/Downloads

Then, in this folder by typing

ls -la

 you should see a downloaded file (or a file with a different version – make sure that you adjust the version)

arduino-1.8.19-linuxaarch64.tar.xz

You need to decompress this file

tar -xvf arduino-1.8.19-linuxaarch64.tar.xz

This will create a folder called: arduino-1.8.19

Let us move this folder to the home folder, so that we can have it in a more secure and personalized space.

mv ~/Downloads/arduino-1.8.19 ~/ArduinoInstall

This will create a new folder called ArduinoInstall in our home folder, and move the content of the arduino folder from the downloads folder. Do not name the folder simply as “Arduino”, since then you will see this error:

Incorrect IDE installation folder: Your copy of the IDE is installed in a subfolder of your sketchbook. Please move the IDE to another folder

When you try to install Arduino.

Next, navigate to the Arduino folder, and run the installation script:

cd ~/ArduinoInstall
sudo sh install.sh

Next, we need to set the proper port permissions such that we can read and write data to the USB Arduino port. To do that, first type this

ls -l /dev/ttyACM*

This should list all the port names associated with Arduino. Usually, it is ttyACM0

crw-rw---- 1 root dialout 188, 0 5 apr 23.01 ttyACM0

To add the permissions, you need to type this with your username (my username is “ahaber”):

sudo usermod -a -G dialout ahaber

and after this, you need to reboot your system

sudo reboot

Then, we can start Arduino. Set the board, and set the port and then, run a Hello World example

void setup() {
  // open the serial port at 9600 bps:
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println("Hello World!");
}

Exit mobile version