IOTHUB SOFTWARE · 03
Arduino Library Management
Library errors often look like code errors. In practice, duplicate libraries, wrong versions, and board-specific configuration files cause many failed builds.
A library is a pre-made bundle of code. It lets us read sensor data and draw text on a screen without writing all the hard parts ourselves.
How to Install
In Arduino IDE, open Tools → Manage Libraries or click the library icon on the left. Search the name and press Install.
Libraries Used Across the Series
| Library | Search keyword | Needed in | Install |
|---|---|---|---|
| Adafruit SSD1306 | Adafruit SSD1306 | Parts 2-20 (OLED) | Required |
| Adafruit GFX | Adafruit GFX | Parts 2-20 (OLED) | Required |
| TFT_eSPI | TFT_eSPI | Parts 21-22 (TFT) | Only when using TFT |
| XPT2046_Touchscreen | XPT2046_Touchscreen | Part 22 (touch) | Only for touch TFT |
| DHT sensor library | DHT sensor library | Parts 3, 6, 7, 19 | Only for DHT22 |
| OneWire | OneWire | Parts 5, 8 | Only for DS18B20 |
| DallasTemperature | DallasTemperature | Parts 5, 8 | Only for DS18B20 |
| IRremoteESP8266 | IRremoteESP8266 | Part 17 | Only for IR control |
| HX711 | HX711 | Part 18 | Only for load cells |
If you are just starting, install only Adafruit SSD1306 and Adafruit GFX. That is enough to begin Part 2. Install the others when each part asks for them.
Python Libraries
Parts 23-24 also need Python libraries. Install them in the terminal:
pip install flask requests| Library | Purpose | Used in |
|---|---|---|
flask | Web server | Part 24, AI broker |
requests | HTTP and TLS communication | Part 24, AI API calls |
When It Does Not Work
| Problem | Fix |
|---|---|
| Library does not appear in search | Check spelling. Adafruit must be typed correctly. |
| Install fails | Check internet connection. On Windows, try running Arduino IDE as administrator. |
| TFT libraries conflict | When using TFT_eSPI, remove unnecessary TFT libraries such as Adafruit_ILI9341. |
Treat libraries as project dependencies
A library is not just an installed helper. It is part of the project environment. Record the exact library name, author, and version that compiled successfully so the project can be rebuilt later.
Compile examples first
Before using project code, compile the simplest official example from the library. If the example fails, the project code is not the first thing to debug.
Practical library rules
- Install the exact library name and author used by the guide.
- Compile the official example before using project code.
- Record working library versions.
- For TFT_eSPI, document the selected driver and pin configuration.
When compilation fails
Read the first library name in the error output, verify that the example sketch compiles, and check whether Arduino IDE is using a duplicate library from another folder.