手機Bluetooth Terminal/Graphics

透過Bluetooth藍牙傳送數據資料到Android 手機

使用[Bluetooth Terminal/Graphics]手機app

[材料]

1. 塑膠保鮮盒,容量大者為佳。

2. 抽氣瓶或是抽氣保鮮盒,玻璃材質,容量大一點比較好用。

3. Arduino UNO主板 x 1

4. BMP280氣壓感測器 x 1 (請注意,電源要接到3V3,以免燒壞)

5. 藍牙模組 HC-05

6. 9V電池,建議不要使用鋰電池,以免因為壓力變化發生意外。


[Android 手機] 安裝app

Bluetooth Terminal/Graphics :https://play.google.com/store/apps/details?id=com.emrctn.BluetoothGraphics (價格:目前免費)

Android手機的app請更改以下設定:勾選Mutiple Graphs,Number of Graph選擇 2 graphs。


[函式庫]

BMP280:https://github.com/orgua/iLib

[BMP280 氣壓氣溫感測器 腳位]

VIN to arduino 3.3V

GND to arduino GND

SCL to arduino A5

SDA to arduino A4


[BlueTooth 藍牙模組 腳位]

VCC to arduino 5v

GND to arduino GND

TXD to arduino UNO pin10

RXD to arduino UNO pin11



/*
BMP280 氣壓、氣溫
VIN to arduino 3.3V
GND to arduino GND
SCL to arduino A5
SDA to arduino A4
*/

/*
BlueTooth 藍牙模組
VCC to arduino 5v
GND to arduino GND
RXD to arduino pin11
TXD to arduino pin10
*/
#include  <SoftwareSerial.h>
SoftwareSerial BTSerial(10, 11);

#include <Wire.h>
#include "i2c.h"
#include "i2c_BMP280.h"
BMP280 bmp280;

void setup()
{
    Serial.begin(9600);
    bmp280.initialize();
    bmp280.setEnabled(0);
    bmp280.triggerMeasurement();
    BTSerial.begin(9600);
}

void loop()
{
    bmp280.awaitMeasurement();
    float temperature;             //氣溫,單位:攝氏溫度
    bmp280.getTemperature(temperature);
    float pascal;                  //氣壓,單位:pa帕
    bmp280.getPressure(pascal);
    bmp280.triggerMeasurement();

    Serial.print("E");
    Serial.print(pascal/100);
    Serial.print(",");
    Serial.println(temperature);
    
    BTSerial.print("E");
    BTSerial.print(pascal/100);
    BTSerial.print(",");
    BTSerial.println(temperature);
}


應用:

使用保鮮盒或抽氣瓶,加壓-->絕熱壓縮,減壓-->絕熱膨脹

[實驗步驟]

1. 放入棉花糖,觀看抽氣之後的變化。

2. 換成Arduino + 氣壓計 + 藍牙模組,看看抽氣之後的氣壓、溫度變化。