How to Install Arduino Libraries
Free Arduino Course
Installing Arduino libraries
Libraries add more power and functionality to your Arduino and the code you write. The video below shows you 2 different ways to download and install Arduino libraries. Below the video is a transcription for your convenience.
Become the Maker you were born to be. Try Arduino Academy for FREE!
What are Arduino Libraries?
And welcome to Arduino tutorial number seven. This time, we’re going to talk about installing additional Arduino libraries. Now, once you’re comfortable with the Arduino software and the IDE, you may want to extend the ability of your Arduino with additional libraries and libraries are just a collection of code that make it easy for you to do things like, say, connect to a sensor, display, etc. For example, the built-in Liquid Crystal Library makes it easy to talk to character LCD displays.
Libraries will increase the functionality of your Arduino and the code you write. There are hundreds of additional libraries available on the internet for download mostly for free at sites like Adafruit and others and there are some built-in Libraries. The built in libraries and some of these additional ones that are available are listed in the Arduino reference and once you get really good you may even be able to create your own libraries. That’s a little bit beyond the scope of this video, so we’re not going to talk about that, but just know that you could do that.
To use additional libraries, you’ll need to install them first and that’s what we’re going to talk about.
How to Install an Arduino Library
Now, there’s really two ways that you’re really going to use to install libraries in the Arduino IDE. The first way is by using the library manager. This is pretty easy to do but there is one little caveat to use the library manager — you need to be using IDE version 1.8.0 or above
And you can see here, I’m running 1.8.5, which at the time of this recording is the latest, so I’m good. If you’re not using the latest IDE version or at least 1.8.0, please update the software. This is probably a good idea anyway to keep it up to date. So, we’re going to go ahead and open the IDE which we’ve already done. We’re going to go to sketch and click it and then we’re going to go to include library and then manage libraries.
The library manager will open and you’ll find a list of libraries that are already built in. Some of these are already installed and we can see here we can browse by type with this drop down menu. We can also search by topic: we have communication, data storage, display, other, etc. and we can also filter with a search and type in something. I’m going to go ahead and type in servo.
And here we see a list of servo libraries — quite a few of them — and we can see these two are already installed because we see the installed tag right here.
I’m going to go ahead and I’m going to install another one.
How about this one by Adafruit?
We’re going to go ahead and click on it. And then here you’ll notice there’s different versions. It’s usually a good idea to install the most up-to-date version. Now, sometimes only one version of the library is available if the version selection menu here doesn’t appear. Don’t worry, it’s normal. So, we have the right version selected click install.
And then boom we’re done.
That’s really all there is to it and once it installs, we see here we have the installed tag added next to it and we can also see the library here.
And here it is right here. It’s been added to the include Library menu with all the built-in libraries.
Another way to Install Arduino Libraries
Now, the second way to install a library in the Arduino IDE is through a zip file and you’ll often find libraries as zip files.
The name of the folder is a name of the library.
So inside of the zip file, you’ll find a couple different types of other files and folders and I just want to show you really quick what this looks like now, normally you wouldn’t want to do this, but I have a zip file here and I’ve already unzipped it and it popped this folder out. We see a .cpp, a .h, keywords.txt and some other things. So again, normally you wouldn’t do this, but this is just for illustration. I wanted to show you guys what is inside of those folders.
Okay. So here we are back at the Arduino IDE and to install first of all — like I said to install do not try to unzip the zip folder, just leave it alone — so to install the zip Library, we’re going to go ahead and install one right now.
We’re going to go back to sketch include library, then we’re going to go to add zip Library. You got to browse the location next, and I know where it is. I showed you the inside of the keypad library. That one is already installed. But I have this other Library here in the zip file called stepper for working with stepper motors. So, I’m going to select that library and then click open.
And here we see at the bottom Library added to your library’s check include Library menu. So, let’s go and let’s do that. Here’s the include library and then here we see stepper.
Now those are the two most common approaches to installing libraries. There is also a third way I didn’t really tell you about and this involves manually installing the libraries. This is something you really shouldn’t do or really shouldn’t even need to do actually so I’m not really going to cover this but just note that manually installing libraries is another option. But why would you do that when it’s so easy to do with the other two ways? That wraps up tutorial seven and I hope to see you again in tutorial 8.
Homework:
Install at least one Arduino library using each of 2 ways the video describes.