Arduino libraries are like cheat sheets for building cool projects. They let you borrow code someone else made, so you don’t have to start from zero but can make your things quickly with your Arduino. Also, because lots of people use them, it’s easier to get help and tips.
In this guide, you’ll learn how to install Arduino libraries. There are two ways to install Arduino libraries; manually or using the library manager in Arduino IDE.
Installing Arduino Libraries with the Arduino IDE
The easiest way to install a library is by using the library manager in Arduino IDE.
Here’s how you do it:
- Open the Arduino IDE.
- Go to Sketch > Include Library > Manage Libraries…
- The Library Manager will open and you can search for the library you want to install.
- Once you find it, click on it to select it and then click on “Install”.
That’s it!
Unfortunately, not all libraries can be found in the library manager. If that’s the case for the library you want to install, you need to install it manually.
Installing an Arduino Library Manually
If you need to install a library manually, don’t worry, it’s pretty straightforward. Here’s how you do it:
- Download the library as a ZIP file.
- Open the Arduino IDE.
- Go to Sketch > Include Library > Add .ZIP Library…
- Navigate to where you downloaded the ZIP file and select it.
- The IDE will install the library and you should be able to use it in your projects.
Including Libraries in Your Code
Once you’ve installed the library you want to use, don’t forget to actually include it in your code. To do this, you need to use the #include
statement. For example
Basic Electronics for Arduino Makers
Learn the basics that every Arduino maker should know, and it'll open you up to a world of possibilities! Sign up for my circuit tips by email and I'll send you the eBook:
#include <Wire.h>
This includes the Wire library, which is used for I2C communication.
Most Common Arduino Libraries
There are a lot of libraries available for you to use. The most common Arduino libraries used for a wide array of projects are:
- Wire – for communicating with I2C / TWI devices.
- SPI – for communicating with devices that use the Serial Peripheral Interface (SPI) Bus.
- EEPROM – for reading and writing to the permanent storage.
- Servo – for controlling servo motors.
- Stepper – for controlling stepper motors.
- LiquidCrystal – for interfacing with LCD screens.
- SD – for reading and writing on SD cards.
- WiFi – for connecting to the internet using the Arduino WiFi shield.
- Ethernet – for network connectivity through the Ethernet shield.
- GSM – for cellular communication using the GSM shield.
- Adafruit_Sensor – basis for many of Adafruit’s sensor libraries.
- NeoPixel – for controlling Adafruit NeoPixels LED.
- FastLED – for controlling LEDs and LED strips with high-performance patterns and effects.
- PubSubClient – for implementing MQTT protocol to connect to IoT servers.
- DHT sensor library – for reading temperature and humidity from DHT sensors.
- OneWire – for devices that use one-wire protocol especially DS18B20 temperature sensors.
- IRremote – for sending and receiving infrared signals with an IR remote.
- AccelStepper – for controlling multiple stepper motors with high precision.
- RTClib – for interfacing with Real Time Clock modules.
Note that some libraries are included with the Arduino IDE by default, such as Wire and SPI, and don’t need a separate installation.
More Arduino Tutorials
Basic Electronics for Arduino Makers
Learn the basics that every Arduino maker should know, and it'll open you up to a world of possibilities! Sign up for my circuit tips by email and I'll send you the eBook: