Smart Cities - Arduino IDE installation

From Sensors in Schools
Jump to navigation Jump to search

Background

  • The default Arduino IDE (Integrated Development Environment) installed on the Raspberry Pi is an older version.
  • This lesson explains how to install the latest version of the Arduino IDE.
  • The current version of Arduino IDE for the Raspberry Pi is 1.8.19

Online Resources

Upgrading the existing Raspbian Operating System

  • Firstly, using the Terminal on the Raspberry Pi, updated the software library with the command sudo apt-get update.

  • Upgrade the existing operating system and software with the command sudo apt-get full-upgrade -y
  • The upgrade may take 10 to 20 minutes.

Installing the most current Arduino IDE

  • We need to download the latest version of the Arduino IDE software compatible with the Raspberry Pi.
  • You can go directly the Arduino Download site and download the Linux ARM 32 bit version.
  • Alternatively, you can use the wget instruction.

Download the Arduino IDE Software

  • Create a new folder for the Arduino IDE software.
  • In the Terminal enter the following commands.
    • mkdir Applications - make a new directory named Applications.
    • cd Applications - change directory. Enter into the directory Applications.

  • When in the directory the wget instruction can be entered to download the software.
  • The download takes approx 3 minutes.
  • Enter the following command in the Terminal
wget https://downloads.arduino.cc/arduino-1.8.19-linuxarm.tar.xz

  • Alternatively you can also go to the Arduino website and download the file directly to the Raspberry Pi.

Unpack the Arduino IDE application

  • Enter the following command to unpack the package tar -xvf arduino-1.8.19-linuxarm.tar.xz
    • x - extracts the files
    • v - verbose mode so all extraction operations will be shown in the Terminal
    • f - specifies the name of the archive file we are extracting files from, in this case arduino-1.8.19-linuxarm.tar.xz
  • Refer to this tutorial Linux tar Command Tutorial
tar -xvf arduino-1.8.19-linuxarm.tar.xz

  • Once the package in unpacked enter the newly created folder named arduino-1.8.19.
  • You can use the Tab key to complete the file name (cd arduino + Tab)

Installing the Arduino IDE Application

  • Once in the directory there is an install.sh scripting file that will complete the installation.
  • Make this file executable with the command sudo chmod +x install.sh
  • If the file is already executable you can ignore this step.

  • Start the install with the command sudo ./install.sh

Running the Arduino IDE Application

  • The installation process adds an entry into the Raspberry Pi OS drop down menu.
  • You can find the Arduino IDE entry under the Programming heading.

Setting Preferences

  • Update the Arduino preferences.
  • Select File > Preferences

  • In the Preferences window you can check the box to display line numbers
  • All preference settings are saved in a hidden file /home/pi/.arduino15/preferences.txt
  • We can modify this file to change the font preferences in Arduino to make the code more readable.
  • Note that before modifying the preferences.txt file the Arduino application must be closed (not running).

Improving Font Readability

  • Close the Arduino application.
  • Using the File Manager navigate to the /home/pi home directory.
  • If you can't see the hidden folder .arduino15 go to the View dropdown menu and ensure Show Hidden is selected.

  • Enter the .arduino15 directory.
  • Double click on the preferences.txt file to edit it.
  • You can edit the file with any text editor.

  • Find the line editor.font and change it from editor.font=Monospaced,plain,12 to editor.font=consolas,plain,14
    • consolas is a font that is more readable in the Arduino IDE
    • 14 is the font size
  • Save the changes and close the file.

  • When you restart the Arduino IDE application the new font settings will be active.