The Arduino software environment includes many helpful features to make it easier to write programs for your projects, but it can't include built-in support for every single possible piece of hardware or all software features. Instead, it supports "libraries", which are self-contained modules that can be used to extend the software environment to add specific features or hardware support.

Libraries can come from many places, often from hardware manufacturers who supply libraries to allow the Arduino IDE to support their specific hardware. For example, our Infrared Temperature Sensor Module has a matching library available called "IRTemp" that you can install in the IDE to make it easy to use the module in your projects.

Where To Get Arduino Libraries Online

If you need Arduino support for a specific piece of hardware, try checking the vendor's website for an Arduino library. You can also try the Arduino website, which lists many common libraries at Failing that, try a Google search for "Arduino library" and the name of your hardware, and see what you find.

Your Arduino Libraries Directory

All of your Arduino libraries go into a special "libraries" directory so the Arduino IDE can find them.

Recent versions of the Arduino IDE allow you to install libraries inside a special folder in the sketchbook directory, which is where your sketches are stored. That's handy because it keeps everything in one place.

If you don't know where your sketchbook directory is located, open the Arduino IDE and select the "Preferences" menu. You'll see a dialog showing various options including the path to your sketchbook:

On OS X and Linux the sketchbook directory is usually named "sketchbook" inside your home directory. On Windows it is usually named "Arduino" inside the My Documents directory.

Open the sketchbook location (as shown in the Preferences dialog) from inside your file browser, ie Windows Explorer or MacOS Finder. Inside that directory you'll see one subdirectory for each of the sketches you've saved, and also a single subdirectory called "libraries".

If the "libraries" directory doesn't exist yet, create it. The folder must have that name so that the Arduino IDE can find it.

This is the directory we'll use to install new libraries.


Downloading a new library

Libraries are usually published as a ZIP file that you can download and extract.

It's becoming increasingly common for library authors to manage and publish them using a source code management site called GitHub, so if you're already familiar with the "Git" source code management tool you can use that to clone the latest version of the library to your computer. If you're not familiar with Git, don't worry: you can download libraries directly as ZIP files from GitHub, too.

Go to the GitHub address for the library you want to download, and look for the button labelled "Download ZIP" on the right hand side toward the bottom. Here's an example for the IRTemp library github page:


Click that button, and your browser will download the library to your computer.

The downloaded file will have a slightly odd name: it will look like "".


Installing the new library

Once you have the zip file, you need to extract it to your "libraries" folder (that you found in the first step, above.)

Pay close attention to the directory structure here because this is the bit that trips many people up. Depending on how the ZIP file was extracted, you may end up with the library right there in the directory you just extracted, or you may end up with it embedded down one or more directory levels inside a sub-directory. You need to make sure you select the correct folder for installation, not simply use the extracted directory as-is.

Libraries must always be in a directory with the exact same name as the library, and right inside that directory they must have a file with the same name as the library and a ".h" extension. For example, the IRTemp library needs a directory called "IRTemp" inside the "libraries" directory, and in the "IRTemp" directory is a file called "IRTemp.h":

There will be other things in the directory as well, but the directory name and the ".h" file inside it are the critical things that tell the Arduino IDE how to access it. If the library is embedded another directory level down, or the ".h" file has the wrong name, it won't work.

When you download the library from GitHub, the directory will have a name like "IRTemp-master" once unzipped. You will then need to rename it to "IRTemp" so it matches the file inside it.

Once the library directory is in place, quit and re-launch the Arduino IDE (if you already had it open) and it will recognise that the new library has been installed.



Library Dependencies

Some libraries depend on other libraries to work properly. Make sure you check any documentation that came with the new library to see if it also needs anything else installed.

Accessing Example Sketches

Many libraries come with example sketches to show how to use them. You can access examples in the IDE through the menu File -> Examples -> library name -> example.

Examples open as new sketches but they're read-only, so if you use them as the starting point for a new project you need to save them as something else to keep them in your sketchbook.