Install Arduino CLI on Raspberry Pi

Arduino CLI is a software that allows the creation and upload of Arduino sketch from the command line, without using the Arduino IDE. It allows you to connect a Raspberry Pi to an Arduino, install everything you need and reprogram it remotely when you want. In this how-to we show you how to install Arduino CLI on a Raspberry Pi.

It is good to emphasize that for any in-depth study or clarification you have to read the official guides made by Arduino to the following link.

How to install it

Start a console on Raspberry Pi and download the script that will take care of Arduino CLI:

					curl -fsSL | sh

Arduino CLI consists in a single file named Arduino-CLI. Let’s move it to a folder named Arduino:

					mv bin/ Arduino/
cd Arduino/
chmod a+x arduino-cli

The first thing to do after the installation is to update the list of the boards supported with the related compilation toolchains, as well as available libraries:

					sudo ./arduino-cli core update-index
Updating index: package_index.json downloaded

Once the core update is finished, we add support to cards with AVR microprocessor, such as Arduino Uno, Arduino Nano, etc.

					sudo ./arduino-cli core install arduino:avr

If you want to list all the boards available for the installation, just type the following command:

					sudo ./arduino-cli core search

If you don’t know what kind of board you have, simply connect it to the Raspberry Pi via USB, type the following command and examine the output:

					sudo ./arduino-cli board list
Port         Type              Board Name              FQBN                 Core
/dev/ttyACM1 Serial Port (USB) Arduino/Genuino MKR1000 arduino:samd:mkr1000 arduino:samd


Compile the first sketch

Create our first sketch, the blink, with the command:

					sudo ./arduino-cli sketch new Blink

The Blink folder will be created with the Blink.ino file inside. Now we edit the ino file and put the classic code for the blink:

					nano Blink/Blink.ino

void setup() {

void loop() {
  digitalWrite(LED_BUILTIN, HIGH);
  digitalWrite(LED_BUILTIN, LOW);

Save the file with Ctrl+O and close it with CTRL+X. At this point, we can complete everything with:

					sudo ./arduino-cli compile --fqbn arduino:board_name Blink/

Assuming you have an Arduino Uno, the command will be:

					sudo ./arduino-cli compile --fqbn arduino:avr:uno Blink/

Upload the sketch

Connect your board to the Raspberry Pi via USB and you are ready to load the sketch with the following command:

					sudo ./arduino-cli upload -p /dev/ttyUSB0 --fqbn arduino:board_name Blink/

Assuming that you want to upload it to an Arduino Uno, the command will be:

					sudo ./arduino-cli upload -p /dev/ttyUSB0 --fqbn arduino:avr:uno Blink/

Install the libraries

Obviously for your sketch you will need to add more features, so you need to look at the libraries available on Arduino. To search for the library you need, execute the command:

					sudo ./arduino-cli lib search library_name

To install the library, you will use the following command:

					sudo ./arduino-cli lib install library_name

For example, if you want to check the availability of the FTDebouncer library, you can try it with the command:

					sudo ./arduino-cli lib search debouncer
Name: "Debouncer"
    Author: hideakitai
    Maintainer: hideakitai
    Sentence: Debounce library for Arduino
    Paragraph: Debounce library for Arduino
    Category: Timing
    Architecture: *
    Types: Contributed
    Versions: [0.1.0]
Name: "FTDebouncer"
    Author: Ubi de Feo
    Maintainer: Ubi de Feo, Sebastian Hunkeler
    Sentence: An efficient, low footprint, fast pin debouncing library for Arduino
    Paragraph: This pin state supervisor manages debouncing of buttons and handles transitions between LOW and HIGH state, calling a function and notifying your code of which pin has been activated or deactivated.
    Category: Uncategorized
    Architecture: *
    Types: Contributed
    Versions: [1.3.0]
Name: "SoftTimer"
    Author: Balazs Kelemen <>
    Maintainer: Balazs Kelemen <>
    Sentence: SoftTimer is a lightweight pseudo multitasking solution for Arduino.
    Paragraph: SoftTimer enables higher level Arduino programing, yet easy to use, and lightweight. You are often faced with the problem that you need to do multiple tasks at the same time. In SoftTimer, the programmer creates Tasks that runs periodically. This library comes with a collection of handy tools like blinker, pwm, debouncer.
    Category: Timing
    Architecture: *
    Types: Contributed
    Versions: [3.0.0, 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.5, 3.2.0]

At this point, if you want to install the “Ftdebouncer” library you can write:

					sudo ./arduino-cli lib install FTDebouncer

Credits for images: Craig Dennis