Manual Installation of Arduino Libraries
Arduino IDE provides multiple ways of installing libraries. Thousands of Arduino libraries can be directly downloaded using Arduino IDE library manager but there is also a manual way of installing libraries in IDE. Manual way for installation comes handy when we need to install any open-source external library for hardware and modules or in case any library is not available inside the library manager.
Following are the two ways to install Arduino library manually:
- Importing a .zip Library File
- Adding Library in Arduino IDE Directory
Importing a .zip Library File
Most of the libraries are distributed as a Zip file or folder. Therefore, Arduino IDE has an option of including a library using a zip file. The name of the library is the same as the library zip folder name. Inside the library folder it contains .cpp, .h format files along with some text files.
Following the mentioned steps to install the Arduino library using the zip file method.
Step 1: Open Arduino IDE.
Step 2: To add a library in the IDE. Go to: Sketch>Include Library>Add ZIP Library:
Step 3: We have downloaded an Adafruit Sensor library using GitHub. Once you click Add zip library a new window will open. Now select the folder where the Arduino library is downloaded. Here in our case, we have downloaded a new library in the download folder. Select and click open to add the library zip file in Arduino IDE.
Step 4: After we open a library, respective files of that library will start installing. After successful installation Library installed message will appear in the output window of Arduino IDE.
Step 5: Now go to Sketch>Include Library menu. Here a new library file Adafruit_Sensor-master will be available at the drop-down menu with the exact same name as zip file. Now this library is ready to use in Arduino sketch. The zip file we added is expanded in the Arduino libraries directory.
After installation is completed, we can access the library using the example section but some older versions of Arduino need to be restarted before it can be used.
Adding Library in Arduino IDE Directory
To install the Arduino library manually, we need to download the library as a zip file, expand it and save it in the Arduino library directory. Zip folder contains all necessary files including example sketches if the author of that library has provided. To install Arduino library using the Arduino IDE directory, follow the steps explained below:
Step 1: First download the zip file of the library which you want to install in IDE or open the folder where the library zip file is stored.
Step 2: Extract the library zip file as a result a new folder will be created with the exact same name. Double click on that folder:
Step 3: This folder will contain all the necessary files for the library, copy this folder to paste it into the Arduino library directory:
Step 4: To get path to Arduino library directory Go to: File>Preferences or press “Ctrl + comma”:
Step 5: Copy the sketchbook location in the settings tab:
Step 6: Paste the copied location in the address bar of File Explorer then press enter. A new directory will open where we can see the Arduino library folder. open the library folder:
Step 7: Once the library directory is opened paste the extracted zip file of Adafruit-GFX library copied earlier:
Step 8: Open IDE, Go to Sketch>Include Library. Here in the library section, verify the library we just installed:
Libraries contain different codes and examples which can help to make programming experience with Arduino easier and more efficient. Here we discussed two methods through which we can add multiple Arduino libraries in IDE. One by importing the zip file and second by directly copying files in the IDE directory. Using these two methods any library can be easily installed in Arduino IDE.