Arduino与Proteus仿真实例-MPL3115A2温度气压传感器驱动仿真.

MPL3115A2温度气压传感器驱动仿真.

1、MPL3115A2介绍

MPL3115A2 是一款具有 I2C 接口的紧凑型压阻式绝对压力传感器。
MPL3115 具有 20 kPa 至 110 kPa 的宽工作范围,该范围涵盖地球上的所有表面高度。
完全内部补偿的 MEMS 与嵌入式高分辨率 24 位等效 ADC 相结合,可提供准确的压力 [帕斯卡]/海拔 [米] 和温度 [摄氏度] 数据。 MPL3115A2 的内部处理消除了系统 MCU 的补偿和单位转换负载,简化了系统设计。

MPL3115A2 的高级 ASIC 具有多种用户可编程模式,例如省电、中断和自主数据采集模式,包括可编程采集周期时序和仅轮询模式。 对于稳定的 10 cm 输出分辨率,典型的有源电源电流为每测量秒 40 uA。

MPL3115A2有如下特点:

  • 校准范围:50 kPa 至 110 kPa 绝对压力

  • 工作范围:20 kPa 至 110 kPa 绝对压力

  • I2C 数字输出接口(高达 400 kHz)

  • 内部完全补偿

  • 直读:

    • 压力:20 位测量 [Pascals]
    • 海拔高度:20 位测量 [米]
    • 温度:12位测量[摄氏度]
  • 可编程中断

  • 自主数据采集:

    • 嵌入式 32-Sample FIFO
    • 使用 FIFO 最多可记录 12 天的数据
    • 1 秒到 9 小时的数据采集率
  • 1.95 V 至 3.6 V 电源电压,内部调节

  • 1.6 V 至 3.6 V 数字接口电源电压

  • 工作温度范围为 -40 °C 至 +85 °C。

  • 5 毫米 x 3 毫米 x 1.1 毫米 LGA 封装(1.25 毫米引线间距)

  • 符合 MSL 1

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-jwgsqDBE-1638796246475)(images/98-1.png)]

MPL3115A2的内部框图如下:

在这里插入图片描述

MPL3115A2的引脚功能如下:

在这里插入图片描述

2、仿真电路原理图

在这里插入图片描述

3、仿真代码实现

本次实例使用到如下开源库:

演示代码如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/
/\*!
@file Adafruit\_MPL3115A2.cpp
@author K.Townsend (Adafruit Industries)
@license BSD (see license.txt)
Example for the MPL3115A2 barometric pressure sensor
This is a library for the Adafruit MPL3115A2 breakout
----> https://www.adafruit.com/products/1893
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
@section HISTORY
v1.0 - First release
\*/
/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/

#include <Adafruit\_MPL3115A2.h>

Adafruit_MPL3115A2 baro;

void setup() {
Serial.begin(9600);
while(!Serial);
Serial.println("Adafruit\_MPL3115A2 test!");

if (!baro.begin()) {
Serial.println("Could not find sensor. Check wiring.");
while(1);
}

// use to set sea level pressure for current location
// this is needed for accurate altitude measurement
// STD SLP = 1013.26 hPa
baro.setSeaPressure(1013.26);
}

void loop() {
float pressure = baro.getPressure();
float altitude = baro.getAltitude();
float temperature = baro.getTemperature();

Serial.println("-----------------");
Serial.print("pressure = "); Serial.print(pressure); Serial.println(" hPa");
Serial.print("altitude = "); Serial.print(altitude); Serial.println(" m");
Serial.print("temperature = "); Serial.print(temperature); Serial.println(" C");

delay(250);
}

4、仿真结果

在这里插入图片描述

文章来源: https://iotsmart.blog.csdn.net/article/details/121756256