Example Code for Arduino-Read Pressure Temperature Altitude
Last revision 2025/12/17
This article provides a step-by-step guide to using an Arduino along with the ICP 10111 sensor to measure pressure, temperature, and altitude. It includes necessary hardware and software preparations, wiring instructions, and a full example code to help users easily implement the project. The tutorial is designed for beginners interested in learning about environmental monitoring with Arduino.
Hardware Preparation
- DFRduino UNO R3, SKU: 838, Quantity: 1, Purchase Link: DFRduino UNO R3
- Fermion ICP 10111 Pressure Sensor, SKU: SEN0516, Quantity: 1, Purchase Link: Fermion: ICP-10111 Barometric Pressure Temperature Sensor
- Jumper wires, Quantity: Several, Purchase Link: Not specified
Software Preparation
- Arduino IDE
- Download and install the DFRobot_ICP Library. (About how to install the library?)
Wiring Diagram
Connect the module to the DFRduino UNO main board (via the I2C interface) as shown in the figure below.

Other Preparation Work
Copy the following code to Arduino IDE and burn it to DFRduino UNO.
Note: Altitude is calculated from air pressure. As air pressure is affected by weather, season, airflow, etc. so altitude data can change.
Sample Code
/*!
* @file readData.ino
* @brief This demo is for SEN0516. Run it to get sensor temperature, air pressure and altitude.
* @copyright Copyright (c) 2021 DFRobot Co.Ltd (http://www.dfrobot.com)
* @license The MIT License (MIT)
* @author [TangJie]([email protected])
* @version V1.0
* @date 2021-11-05
* @url https://github.com/DFRobot/DFRobot_ICP10111
*/
#include <DFRobot_ICP10111.h>
DFRobot_ICP10111 icp;
void setup(void)
{
Serial.begin(115200);
while(icp.begin() != 0){
Serial.println("Failed to initialize the sensor");
}
Serial.println("Success to initialize the sensor");
/**
* @brief Set work mode
* |------------------|-----------|-------------------|----------------------|
* | api | mode |Conversion Time(ms)|Pressure RMS Noise(Pa)|
* |icp.eLowPower | Low Power | 1.8 | 3.2 |
* |icp.eNormal | Normal | 6.3 | 1.6 |
* |icp.eLowNoise | Low Noise | 23.8 | 0.8 |
* |icp.eUltraLowNoise| Ultra-low Noise | 94.5 | 0.4 |
*/
icp.setWorkPattern(icp.eNormal);
}
void loop(void)
{
Serial.println("------------------------------");
Serial.print("Read air pressure:");
Serial.print(icp.getAirPressure());
Serial.println("Pa");
Serial.print("Read temperature:");
Serial.print(icp.getTemperature());
Serial.println("℃");
Serial.print("Read altitude:");
Serial.print(icp.getElevation());
Serial.println("m");
delay(1000);
}
Result
Open the serial monitor and you will see the barometric pressure, temperature, and altitude of the current environment.
Was this article helpful?
