Time to complete: 2–10min; Level of difficulty: Beginner
In this tutorial we will learn how to install libraries written for the Arduino IDE.
For detailed, step-by-step instructions on how to install Arduino software (IDE) please visit our tutorial!
Why do we need libraries?
In general, Software Libraries are a collection of code that extend a programming language. In the case of the Arduino ecosystem, libraries make it easy for programmable devices such as microcontrollers, SoCs, etc., to communicate with sensors, displays, modules, etc. Some of them, such as the LiquidCrystal library, are packaged with the IDE and are ready to be used right after the install process. Others, however, are available on the internet for download and need to be incorporated into the Arduino IDE.
Installing Libraries from the IDE (web)
This is by far the easiest way to install a library. As of version 1.5, the Arduino IDE includes a menu option to manage the install process of libraries. This option can be found under
Sketch → Include Library → Manage Libraries…
Once you select this menu option, you will find a long list of libraries that can be installed using a single click process. Use the search field for entering a portion of the name of the library for which you're looking. Below we show an example where we find Paul Stoffregen's PPM library.
After clicking the
Install button the IDE installs the library and makes it available for use in our programs.
Installing Libraries from the IDE (.zip)
Although libraries for most of the standard electronic components and devices can be found through the Board Manager, there are instances where we want/need to install a specific library without using such process. In this case, we need to obtain the code ensuring it is structured in an Arduino IDE-compatible way. If you're searching the web for "Arduino libraries" chances are that the developer already structured the code so that it can be used in the Arduino IDE, however, if problems occur you'll need to look at working examples to try and figure out what's wrong. Contacting the developer directly is also a viable option for troubleshooting.
The most popular place for hosting software these days is on Github's website. We can obtain the code from this site by clicking on the Download ZIP button on the library's page. If you're downloading a library from any other site, you'll need to make sure that it is compressed into a .zip file.
Once downloaded, we can use the Library Manager on the Arduino IDE to install the library. After selecting the menu option
Sketch → Include Library → Add .ZIP Library… we locate the downloaded file in our system and click on install. After doing this, the library is ready for use in our programs.
Installing Libraries Manually
No matter the approach we follow the way in which the Arduino IDE manages software libraries is by creating a copy of the files in the Operating System. Typically, the IDE does this inside the Arduino/libraries directory. Both on Windows and Mac OS the Arduino directory is located inside the user's Documents directory.
For manually installing a library, we need to move the uncompressed directory to the aforementioned libraries directory!
After doing this, the library is ready for use in our programs. Depending on your Arduino IDE version, you might need to quit/re-open the IDE so that the library is recognized in your programs.
Removing Libraries from the Arduino IDE
As mentioned in the previous step, the Arduino IDE creates a copy of the library files in a specific directory of the Operating System. We simply need to delete these files in order to remove the library from the IDE. The location of the files is inside the libraries directory contained in the Arduino folder, which by default (both on Windows and Mac OS) is inside the user's Documents directory.
Using A Newly Installed Library
The first thing we do after installing a library following any of the three methods above is to open the examples included by the library's developer(s) to showcase the use/functioning of the software. As with the built-in examples, they're available through
File → Examples → Library Name → File Name.