In this tutorial, we’ll look at how to install the Arduino IDE and CLI software on the Raspberry Pi and combine the strengths of both systems.
Check your system configuration
To know which version of the IDE to download and install, you need to know the specifics of your system. In particular, the kernel architecture (Linux kernel). There are several possible commands.
uname -a #display os and kernel info
cat /proc/version
architecture | kernel |
i386/i486/i586/i686/armv7l | 32 bit |
x86_64(Intel)/aarch64(Arm)/armv8 | 64 bit |
cat /proc/cpuinfo #cpu architecture
The most direct command is to demand how many bits a LONG variable is encoded.
getconf LONG_BIT # result is 32 or 64
Arduino IDE Legacy installation
On the Arduino download page, select the version corresponding to your system and download it.
You can perform this procedure from the command line. knowing the name of the file arduino-1.8.19-linux.tar.xz
for my aarch64 system :arduino-1.8.19-linuxaarch64.tar.xz
wget https://downloads.arduino.cc/arduino-1.8.19-linuxaarch64.tar.xz
Browse to the archive, then unzip the folder.
tar -xvf arduino-1.8.19-linuxaarch64.tar.xz rm arduino-1.8.19-linuxaarch64.tar.xz
Then install the software
cd arduino-1.8.19 sudo ./install.sh
Serial port connection problem
If you have a problem connecting to the Arduino’s serial port, you may have limited authorization.
Check serial port access rights
ls -l /dev/ttyACM*
Output
crw-rw---- 1 root dialout 166, 0 févr. 15 12:47 /dev/ttyACM0
You must then grant read and write rights to
sudo chmod a+rw /dev/ttyACM0
Arduino IDE 2.0 Installation
It appears no official builds were made for Raspberry Pi. There is a third party build than can be tested.
To be updated
Bonus: Installing Arduino-CLI on Raspberry Pi
If your system doesn’t have access to a graphical interface (headless, SSH access), you can use command lines to create, compile and upload your Arduino scripts.
Another more recent and powerful tool is Arduino-CLI, which you can install with the command
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh mv bin/* Arduino/ cd Arduino chmod a+x arduino-cli alias arduino-cli='sudo ./arduino-cli'
Update the list of supported cards
arduino-cli core update-index
Then install the card manager
arduino-cli core install arduino:avr
Check the cards connected to the Raspberry Pi and note the FQBN names.
arduino-cli board list
Creating a new sketch
arduino-cli sketch new mysketch
Modify the sketch with the desired code
nano mysketch/mysketch.ino
void setup() { Serial.begin(9600); Serial.println("System ready"); delay(1000); } void loop() { Serial.println("System running"); delay(500); }
Compile the code by specifying the name of the card (find the name under the FQBN column with
arduino-cli compile --fqbn arduino:avr:mega mysketch/
Download code to card
arduino-cli upload -p /dev/ttyACM0 --fqbn arduino:avr:mega mysketch/
Installing new libraries
arduino-cli lib install library_name
To open a serial monitor, you can use Putty
sudo apt-get install putty putty-tools
sudo putty /dev/ttyACM0 -serial -sercfg 9600,8,n,1,N &
Add URLs for managing ESP32 and ESP8266 cards
Create a configuration file
arduino-cli config init
Modify the file to add the map urls
sudo nano /root/.arduino15/arduino-cli.yaml
board_manager: additional_urls: [ "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json", "https://arduino.esp8266.com/stable/package_esp8266com_index.json" ]
Then update the manager
arduino-cli core update-index
acros2@acros2-desktop:~/Arduino$ arduino-cli core update-index Downloading index: package_index.tar.bz2 downloaded Downloading index: package_esp32_index.json downloaded Downloading index: package_esp8266com_index.json downloaded Downloading index: package_index.tar.bz2 downloaded Downloading index: package_esp32_index.json downloaded Downloading index: package_esp8266com_index.json downloaded
Installing the manager for ESP32 and ESP8266
arduino-cli core install esp32:esp32 arduino-cli core install esp8266:esp8266
To know the fqbn name to use according to the arduino-cli board listall esp32
arduino-cli compile --fqbn esp32:esp32:esp32 mysketch arduino-cli upload -p /dev/ttyUSB0 --fqbn esp32:esp32:esp32 mysketch
Not a word about the newest arduino version!!! Too bad. We are in the year 2024.
As far as I know there is no easy way to run Arduino 2.0 on Raspberry Pi yet. If you have any update don’t hesitate to comment