Example Code for Arduino-Calibrate Sensor

Last revision 2026/01/12

Calibrate the MPX5700AP air pressure sensor using a known ambient pressure value. Users can learn how to calibrate the sensor to improve measurement accuracy.

Hardware Preparation

  • DFRuino UNO R3 x1: Purchase Link
  • SEN0456 Gravity: I2C MPX5700AP Air Pressure Sensor(15-700kPa) x1:
  • DuPont Wires

Software Preparation

Wiring Diagram

Other Preparation Work

  • Connect the module to Arduino by the connection diagram above. You can certainly use with Gravity I/O to complete the project prototype in a more convenient and faster way.
  • Download and install DFRobot_MPX5700 library. (About how to install the library?)
  • Open the Arduino IDE, add the current ambient air pressure value into the code.

Sample Code

#include "DFRobot_MPX5700.h"
#define I2C_ADDRESS    0x16
DFRobot_MPX5700 mpx5700(&Wire ,I2C_ADDRESS);
void setup() {
  Serial.begin(115200);
  while(false==mpx5700.begin())
  {
    Serial.println("i2c begin fail,please chack connect!");
    delay(1000);
  }
  Serial.println("i2c begin success");


  mpx5700.calibration_kpa(110.0);
  Serial.println("Calibration_kpa success");
}

void loop() {
}

Result

Open the serial port monitor to get the final data.

Additional Information

You can certainly use with Gravity I/O to complete the project prototype in a more convenient and faster way.

Was this article helpful?

TOP