0% found this document useful (0 votes)
8 views6 pages

Arduino Library Overview and Examples

The document provides a comprehensive list of built-in libraries for Arduino, categorized into core, sensor, display, communication, motor, real-time, file system, audio, other, and miscellaneous libraries. It also includes a summary of built-in functions such as basic, digital I/O, analog I/O, math, time, serial communication, trigonometry, random, and bitwise functions. Additionally, it suggests potential capstone project ideas like a delivery drone and automating crop cutting.

Uploaded by

ebaak884
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views6 pages

Arduino Library Overview and Examples

The document provides a comprehensive list of built-in libraries for Arduino, categorized into core, sensor, display, communication, motor, real-time, file system, audio, other, and miscellaneous libraries. It also includes a summary of built-in functions such as basic, digital I/O, analog I/O, math, time, serial communication, trigonometry, random, and bitwise functions. Additionally, it suggests potential capstone project ideas like a delivery drone and automating crop cutting.

Uploaded by

ebaak884
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

All Arduino Built-in libraries:

Core Libraries

1. Arduino.h – The main core library for all Arduino sketches.


2. Wire – I2C communication.
3. SPI – SPI communication.
4. SoftwareSerial – Software serial communication on other digital pins.
5. EEPROM – Reading and writing to EEPROM memory.
6. Servo – Control for servo motors.
7. LiquidCrystal – For character LCDs.
8. SPI.h – Low-level SPI communication.
9. SD – For accessing SD cards.
10. Time – Time management functions.
11. WMath – Mathematical functions.
12. Math.h – Standard math functions.
13. Keypad – For interfacing with keypad matrices.
14. Wire.h – For I2C communication.
15. SPI.h – For SPI communication.
16. Stream – Stream class for input/output operations.

Sensor Libraries

1. Adafruit_Sensor – Unified sensor library for various Adafruit sensors.


2. DHT – DHT11/DHT22 temperature and humidity sensor.
3. Adafruit_BMP280 – BMP280 Barometric Pressure and Temperature sensor.
4. Adafruit_GPS – For interfacing with GPS modules.
5. Adafruit_LSM303 – For LSM303 Accelerometer and Magnetometer.
6. Adafruit_TCS3200 – Color sensor library (TCS3200).
7. OneWire – For OneWire devices like DS18B20 temperature sensors.
8. NewPing – Library for ultrasonic sensors like HC-SR04.
9. Adafruit_MPU6050 – Accelerometer and Gyroscope (MPU6050 sensor).
10. VL53L0X – Time-of-Flight distance sensor.
11. HX711 – Load cell amplifier library for weighing scales.
12. Ultrasonic – For ultrasonic sensors (e.g., HC-SR04).

Display Libraries

1. Adafruit_GFX – Graphics library for use with various displays.


2. Adafruit_SSD1306 – For controlling OLED displays based on SSD1306.
3. TFT – For controlling TFT screens.
4. LiquidCrystal_I2C – For controlling LCD screens over I2C.
5. U8g2 – Universal graphics library for multiple displays.
6. Adafruit_ILI9341 – TFT display library.
7. TFT_eSPI – A library for using ESP32/ESP8266 with TFT displays.

Communication Libraries

1. WiFi – For Wi-Fi communication with ESP8266/ESP32.


2. WiFi101 – For Wi-Fi communication with the Wi-Fi shield 101.
3. GSM – For GSM communication using the GSM shield.
4. Ethernet – For Ethernet shield communication.
5. LoRa – For LoRa communication.
6. XBee – For XBee radio communication.
7. BLE – Bluetooth Low Energy communication.
8. RFID – For RFID communication.
9. Firmata – A library to control Arduino from a computer via serial communication.
10. NTPClient – For getting time over the network using NTP protocol.
11. Adafruit_MQTT – MQTT library for communicating with brokers.

Motor Libraries

1. AccelStepper – Advanced stepper motor control.


2. Stepper – Basic stepper motor control.
3. DCMotor – Control for DC motors.
4. Adafruit_Motor_Shield_V2 – Motor control using Adafruit Motor Shield V2.
5. Servo – For controlling servo motors.

Real-Time Libraries

1. Time – A library for time-related functions.


2. RTClib – For interfacing with RTC (Real-Time Clock) modules like DS3231.
3. TimerOne – For Timer1 on Arduino boards for precise timing.
4. TimerThree – For Timer3 on Arduino boards.
5. Metro – For time-based task scheduling.

File System Libraries

1. SD – For accessing SD cards (SD card file system).


2. SPIFFS – For using the SPI Flash File System, common with ESP8266 and ESP32.

Audio Libraries

1. Tone – For generating sound using tone generation.


2. Mozzi – A sound synthesizer library for Arduino.

Other Libraries

1. FastLED – A library for controlling RGB LEDs like WS2812 (Neopixels).


2. Adafruit_NeoPixel – A library for controlling individually addressable RGB LEDs.
3. IRremote – For receiving and transmitting infrared signals.
4. Adafruit_LIS3DH – For 3D accelerometer control.
5. Adafruit_NFCShield – For NFC/RFID modules.
6. Bounce2 – For debouncing buttons.
7. PID_v1 – A PID control library for feedback systems.
8. AccelStepper – For advanced stepper motor control.
9. DFPlayerMini_Fast – For controlling the DFPlayer Mini MP3 module.

Miscellaneous Libraries

1. Adafruit_ServoMotor – For controlling servos.


2. SimpleDHT – A simple library for DHT sensors (DHT11/DHT22).
3. Adafruit_BNO055 – For interfacing with the BNO055 (9-axis sensor).
4. Adafruit_VL53L0X – For the VL53L0X distance sensor (time-of-flight sensor).
5. Adafruit_TemperatureSensor – For working with temperature sensors
analogRead(A0)- used to read that value of voltage at A0 pin

0 means 0V

1023 means 5V

int a;

a=analogRead(A0); //means the value of analog voltage at pin A0 is stored in a.

-o -

map() is a built-in Arduino function that scales a number from one range to another.

map(value, fromLow, fromHigh, toLow, toHigh)

 value → The number to scale (e.g., a from analogRead(A0))


 fromLow & fromHigh → The original range (e.g., 0 to 1023)

 toLow & toHigh → The new range (e.g., 0 to 255)

List of All Arduino Built-in Functions

1️⃣ Basic Functions

 setup() → Runs once at the beginning.


 loop() → Runs repeatedly after setup().

2️⃣ Digital I/O Functions (For reading and writing digital pins)

 pinMode(pin, mode) → Sets a pin as INPUT, OUTPUT, or INPUT_PULLUP.


 digitalWrite(pin, value) → Sets a pin HIGH (5V) or LOW (0V).
 digitalRead(pin) → Reads a digital input (HIGH or LOW).

3️⃣ Analog I/O Functions (For reading and writing analog values)

 analogRead(pin) → Reads a value (0-1023) from an analog pin.


 analogWrite(pin, value) → Writes a PWM signal (0-255) to a pin (only on PWM pins ~).

4️⃣ Math Functions

 map(value, fromLow, fromHigh, toLow, toHigh) → Scales a number from one range
to another.
 constrain(value, min, max) → Limits a number within a range.
 min(x, y) → Returns the smaller number.
 max(x, y) → Returns the larger number.
 abs(x) → Returns the absolute value.
 pow(base, exponent) → Raises a number to a power.
 sqrt(x) → Returns the square root.

5️⃣ Time Functions

 delay(ms) → Pauses the program for ms milliseconds.


 millis() → Returns the number of milliseconds since the program started.
 micros() → Returns the number of microseconds since the program started.

6️⃣ Serial Communication (For Printing Data to PC/Monitor)

 [Link](baudRate) → Starts serial communication (e.g., [Link](9600);).


 [Link](value) → Prints a value in the Serial Monitor.
 [Link](value) → Prints a value with a new line.
 [Link]() → Reads incoming data.
 [Link]() → Checks if there is incoming data.

7️⃣ Trigonometry & Random Functions

 sin(x), cos(x), tan(x) → Trigonometric functions.


 random(min, max) → Returns a random number in a range.
 randomSeed(seed) → Seeds the random generator.

8️⃣ Bitwise Functions (For Advanced Control)

 bitRead(x, n), bitWrite(x, n, b), bitSet(x, n), bitClear(x, n) → Manipulate


specific bits.
 shiftLeft(x, n), shiftRight(x, n) → Bit shifting operations.

Capstone idea-

1)delivery drone

2)automating crop cutting


3)

4)

Common questions

Powered by AI

Arduino provides built-in library support for both I2C and SPI communication, essential for interfacing with various peripherals. The `Wire` library facilitates I2C communication, allowing multiple devices to be connected to the same bus using two wires, SDA and SCL . In contrast, the `SPI` library supports SPI communication which uses a four-wire interface (MOSI, MISO, SCLK, SS) enabling faster data rates compared to I2C . I2C is more suited for connecting multiple peripherals with a limited pin interface, whereas SPI offers higher speed for fewer devices.

The Arduino `Servo` library is essential in robotics for controlling servo motors, which are vital in creating movable joints, such as arms or wheels, due to their precise control over angular positioning. PWM (Pulse Width Modulation) is used to define angles by altering the duration of the pulse, allowing for fine-tuned control over the motor’s position . This is crucial in applications like robotic arms where accurate movement is necessary to perform tasks such as picking, placing, or assembling components.

The `FastLED` library offers comprehensive control over RGB LEDs, allowing for advanced color mixing, animation effects, and high-performance operations . It supports numerous LED types and integrates features such as color corrections and predefined palettes, which simplify creating dynamic lighting effects. FastLED's optimization for speed enables smoother animations even with large numbers of LEDs, which is crucial in applications like ambient lighting or interactive displays where visual expression is paramount.

The `WMath` library in Arduino includes basic mathematical functions, such as random number generation and constraints (e.g., map, constrain) which are often used in sensor data processing to scale or limit data values . On the other hand, `Math.h` provides standard C math functions like power calculations and square roots that enable more complex mathematical computations . Projects involving sensors can harness these libraries to perform both simple data normalization using `WMath` and advanced calculations like statistics or geometry with `Math.h`.

The `Adafruit_Sensor` library provides a unified interface for interacting with a wide range of Adafruit sensors, abstracting common functions like value reading and scaling into a standard API . This allows developers to switch sensors or add new ones without rewriting code, as it ensures consistency in function calls and structures. Working directly with specific libraries often requires unique setup and function calls for each sensor, increasing complexity and reducing code portability.

The `SoftwareSerial` library allows for serial communication on any of the digital pins of an Arduino, extending the microcontroller’s ability to communicate with multiple serial devices simultaneously, beyond the single hardware serial port provided . This is particularly useful for projects with numerous sensors or modules requiring serial interfaces, like GPS or RFID modules. The `SoftwareSerial` library addresses the limitation of hardware serial ports, although it typically supports slower baud rates compared to hardware serial.

The `LiquidCrystal` library is used for controlling character LCDs, requiring at least 6 digital pins to manage the display . In contrast, the `LiquidCrystal_I2C` library minimizes pin usage by operating over the I2C bus, which uses only two wires, SDA and SCL, plus power and ground . This reduced pin requirement is advantageous in projects with limited space or many connected components, as it frees more pins for other functionalities. Thus, the I2C variant is preferred in compact and highly integrated designs.

The `EEPROM` library in Arduino is utilized for reading and writing to the onboard EEPROM memory, which retains data even after the Arduino is powered off . This capability is crucial for projects like data logging or configuration settings storage, where information, such as sensor thresholds or device settings, needs to persist across sessions. Using the `EEPROM` ensures that essential data is not lost, thereby making devices more autonomous and reliable.

The `Adafruit_MQTT` library provides a simplified interface for implementing MQTT communication, a lightweight messaging protocol designed for IoT applications . It facilitates efficient data exchange between devices and cloud services, essential for real-time monitoring and control in IoT setups. By supporting secure connections via SSL and offering extensive examples for different scenarios, the library addresses common IoT challenges like reliable data transmission, security, and power consumption. Its design aligns well with constrained environments typical of Arduino-based IoT devices.

`RTClib` allows Arduino systems to interface with RTC modules that keep track of the current time even when the microcontroller is off . When combined with the `Time` library, which handles time-related functions within the Arduino, these libraries enable precise scheduling and time-based automation. The synergy ensures accurate timekeeping and event triggering, crucial for applications like data logging where timestamps are needed, or systems requiring precise event execution, such as lighting control or timed task automation.

You might also like