Introduction
This is a Arduino compatible pressure sensor module with a measuring range of 15-700kPa, which supports I2C digital output and can be calibrated according to known pressure values and allows fast and accurate measurement of pressure values in pipelines or other environments. It is suitable for pipeline air pressure detection, natural science experiments and other scenarios.
Features
- Epoxy resin integral components
- Maximum error of 2.5%
- Excellent linear output
- Compatible with 3.3~5.5V main controllers
- Polarity protection
Specification
- Detection of physical quantities: Air pressure
- Working voltage: 3.3~5.5V DC
- Power dissipation: 0.06W(5V)
- Output signal: I2C output(0~3V)
- Measuring range: 15-700kPa
- Resolution ratio: ≤1kPa
- Working temperature: 0~85℃
- Circuit board size: 32mm*43mm
Board Overview
Number | Name | Function description |
---|---|---|
1 | D | I2C data line SDA |
2 | C | I2C clock line SCL |
3 | - | GND |
4 | + | Vcc |
Tutorials for Arduino
Download the program to the UNO, and open Serial Port Monitor to view the air pressure values.
Hardware and software preparation
- Hardware
- DFRuino UNO R3 x1
- SEN0456 Gravity: I2C MPX5700AP Air Pressure Sensor(15-700kPa) x1
- DuPont Wires
- Software
- Arduino IDE
- Download and install DFRobot_MPX5700 (About how to install the library?)
Read the sensor data via I2C
Connection
Steps
- 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.
- The I2C address defaults to 0x16, corresponding to the ADDRESS_0 in the code. If you need to modify the I2C address, you can first configure the hardware I2C address via the dial-up switch on the module, and modify the definition ADDRESS_X of the I2C address in the sample code. The correspondence between the dial switch and the I2C address parameter is as follows:
- ADDRESS_0:0x16, A0=0, A1=0
- ADDRESS_1:0x17, A0=1, A1=0
- ADDRESS_2:0x18, A0=0, A1=1
- ADDRESS_3:0x19, A0=1, A1=1
- Download and install DFRobot_MPX5700 library (About how to install the library?)
- Open the Arduino IDE, upload the following code to the Arduino UNO.
- Open the serial port monitor of Arduino IDE, set the port rate to 115200, and observe the serial port print results.
/*!
* @file getPressureValue.ino
@n i2c Address select, default I2C address to 0x16, the A1 and A0 combines 4 IIC addresses.
| A1 | A0 |
| 0 | 0 | 0x16
| 0 | 1 | 0x17
| 1 | 0 | 0x18
| 1 | 1 | 0x19 default i2c address
* @n Phenomenon: serial print all data
*/
#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");
/*
*For smoothing data, it is necessary to set to obtain the average value of xx(quantity)data abc.
*If it is not set, the system will automatically get the average value of 5 samples.
*/
mpx5700.setMeanSampleSize(/*Sample Quantity*/5);
}
void loop()
{
Serial.print("Pressure Value: ");
/*
*Get the ambient air pressure. Can set whether to enable calibration.
*1:Enable calibration
*0:Not
*/
Serial.print(mpx5700.getPressureValue_kpa(1));
Serial.println(" kpa");
delay(1000);
}
Result
Open the serial port monitor to get the final data.
Calibrate the sensor
Connection
Sample code
- 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 and then upload the following code to the Arduino UNO.
- Open the serial port monitor of Arduino IDE, set the port rate to 115200, and observe the serial port print results.
#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.
FAQ
For any questions, advice or cool ideas to share, please visit the DFRobot Forum.