Installing and Setting Up Arduino with ROS Kinetic (Raspberry Pi 3)

This guide will walk you through how to install and setting up an Arduino board to work with Raspberry Pi 3 having in common ROS Kinetic.

To walk through this guide, you must have a Raspberry Pi 3 with ROS Kinetic installed, an Arduino UNO board connected via the USB port to Pi, and some Linux knowledge.

Arduino is an open-source development tool very easy to use both as hardware and software. This development board simplifies the robot construction process and is therefore used together with Raspberry Pi and ROS to control sensors, motors or any other component that can be controlled with a microcontroller.

The Arduino microcontroller can only run one ROS node at a time.

Install the Arduino IDE

Arduino is connected to Raspberry Pi 3 through the USB port. To program Arduino, you need to install the Arduino IDE on the Pi.

To install the Arduino IDE on the Ubuntu Mate operating system, use the following commands in the Linux terminal.

sudo apt-get update

sudo apt-get install arduino arduino-core

Install rosserial

After installing the Arduino IDE, the next step is installing the package that allows communication between ROS and the serial port of the Arduino board. The package is called rosserial_arduino and allows the node that will run on the Arduino to publish or subscribe to the nodes running on Raspberry Pi 3. The rosserial package contains three other packages: rosserial_msgs, rosserial_client, and rosserial_python.

sudo apt-get install ros-kinetic-rosserial-arduino

sudo apt-get install ros-kinetic-rosserial

After installing the Arduino IDE and the rosserial package, we will first check the IDE, but not before giving Administrator privileges to the current user for the Arduino Permission Checker.

The command is:

sudo usermod -a -G dialout your_user_here

To open the Arduino IDE, write the following command in the Ubuntu terminal:


Once we have checked the installation of the IDE, the next step is to close it and continue the setup operations. To close, use the Ctrl + C keys.

If you give the command ls in the Ubuntu terminal, you will find a new sketchbook directory. If you do not want to change your location or name, all Arduino sketches will be saved in this directory.

To write Arduino sketches for ROS, we need the ros_lib library.

Install the ros_lib library

The link between ROS and Arduino is through the ros_lib library. This library will be used as any other Arduino library.

To install the ros_lib library, type the following commands in the Ubuntu terminal:

cd sketchbook/libraries

rosrun rosserial_arduino .

If you browse the sketchbook/libraries/ folder, you will find a list of examples that can be used in ROS projects. One of these examples is Ultrasound. In another tutorial, I will use this example to control one or more HC-SR04 ultrasonic sensors with ROS and Arduino.

The ros_lib examples

The ros_lib examples

Before checking the latest IDE settings, you must rename the ‘’ folder. The Arduino IDE does not allow the use of points in the name of the libraries. So the name of the bookstore will become ‘make_library’.

Check the Arduino IDE settings

To check the settings made, we will open the Arduino IDE again. To launch the application, we will use the command:


After opening the IDE, check if you have access to the ros_lib examples: File -> Examples -> make_library -> ros_lib



Check the serial port:
Tools-> Serial Ports

Arduino's serial port

Arduino’s serial port

These are the steps to install and setup the Arduino IDE on Raspberry Pi 3 with ROS Kinetic.

14 comments » Write a comment

  1. These instructions are more or less correct, assuming you have already set up ROS kinetic (look for ubuntu instructions on the web). The second paragraph pretty much spells this out. The only issues I’ve run into with this install is that the rosrun rosserial_arduino command should be rosrun rosserial_arduino That and there is no longer a folder. just go straight to ros_lib.
    Thank you for getting me started with ROS and arduino.

  2. awesome .. thanks for this! i have checked it, it works only with ubuntu mate , i have installed it on ubuntu mate 16.04.02 , it does not work for raspbian , there is another work around for the raspbian and ros kinetic which is given in the ros arduino oscilloscope project website on ros wiki .. do have a look .

  3. I also epxerience problems:

    “Did you run “apt-get update” after setting up the ROS sources.list and keys?
    Please check this article also:
    This helped me, double check to have to right sources and keys

    “I’m sure that you’ve figured this out by now, but for others who have not, there’s a subtle mistake in the instructions here – “ros-kinetic-rosserial-arduino” should instead be “ros-kinetic-rosserial_arduino” (an underscore rather than a hyphen).”
    This didnt help since I rosserial_arduino doesnt exist either.

    I found this tutorial:

    “Note: you have to delete libraries/ros_lib in order to regenerate as its existence causes an error.

    cd /libraries
    rm -rf ros_lib
    rosrun rosserial_arduino .

    This did help me, so first delete the stuff there and then create it. Dont know why but I had first a somehow wrongly created ros_lib folder in there

  4. Thanks for this manual! Helped me a lot!! However i had to reinstall a newer version of the Arduino IDE, in order to use the arduino ide in a terminal.

Leave a Reply to Aaron Cancel reply