工業製造
産業用モノのインターネット | 工業材料 | 機器のメンテナンスと修理 | 産業プログラミング |
home  MfgRobots >> 工業製造 >  >> Manufacturing Technology >> 製造プロセス

スマート健康モニタリングステーション:Arduino、Bluetooth、センサーで構築

必要な部品と材料

部品数量備考
Arduino UNO1メインマイコンボード
ジャンパーワイヤー(汎用)1セット配線用
DHT11 温度・湿度センサー(3ピン)1環境温度と湿度を測定
温度センサー(DS18B20等)1防水プローブタイプ推奨
抵抗 10kΩ2プルアップ用
HC-05 Bluetoothモジュール1スマホとの無線通信用
心拍センサー1指先で心拍数を測定

使用するアプリとオンラインサービス

プロジェクト概要

複数のセンサーとBluetooth通信、スマートフォンアプリを組み合わせ、体温・心拍数・環境温湿度をリアルタイムでモニタリングする健康管理ステーションを構築します。Arduino UNOを中核に、DHT11で環境温湿度、DS18B20で体表温度、光学式心拍センサーで心拍数を取得し、HC-05経由でスマホアプリにデータを送信します。アプリ側では数値表示やグラフ化、閾値超過時のアラート機能を実装可能です。

配線と回路図

各センサーとモジュールを以下のように接続します:

詳細な配線図はプロジェクトページのSchematicsセクションを参照してください。

Arduinoスケッチ

以下のコードをArduino IDEでコンパイル・書き込みしてください。心拍検出には割り込みベースのアルゴリズムを使用し、2ms周期で信号をサンプリングしてBPMを算出します。

#include <SoftwareSerial.h>
#include <cactus_io_AM2302.h>
#define AM2302_PIN 7
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
AM2302 dht(AM2302_PIN);
SoftwareSerial Bluetooth(10, 9); // RX, TX

String Data;
int pulsePin = 0;
int blinkPin = 13;
volatile int BPM;
volatile int Signal;
volatile int IBI = 600;
volatile boolean Pulse = false;
volatile boolean QS = false;
volatile int rate[10];
volatile unsigned long sampleCounter = 0;
volatile unsigned long lastBeatTime = 0;
volatile int P = 512;
volatile int T = 512;
volatile int thresh = 512;
volatile int amp = 100;
volatile boolean firstBeat = true;
volatile boolean secondBeat = false;

void interruptSetup() {
  TCCR2A = 0x02;
  TCCR2B = 0x06;
  OCR2A = 0X7C;
  TIMSK2 = 0x02;
  sei();
}

ISR(TIMER2_COMPA_vect) {
  cli();
  Signal = analogRead(pulsePin);
  sampleCounter += 2;
  int N = sampleCounter - lastBeatTime;
  if (Signal < thresh && N > (IBI / 5) * 3) {
    if (Signal < T) { T = Signal; }
  }
  if (Signal > thresh && Signal > P) { P = Signal; }
  if (N > 250) {
    if ((Signal > thresh) && (Pulse == false) && (N > (IBI / 5) * 3)) {
      Pulse = true;
      digitalWrite(blinkPin, HIGH);
      IBI = sampleCounter - lastBeatTime;
      lastBeatTime = sampleCounter;
      if (secondBeat) {
        secondBeat = false;
        for (int i = 0; i <= 9; i++) { rate[i] = IBI; }
      }
      if (firstBeat) {
        firstBeat = false;
        secondBeat = true;
        sei();
        return;
      }
      word runningTotal = 0;
      for (int i = 0; i <= 8; i++) {
        rate[i] = rate[i + 1];
        runningTotal += rate[i];
      }
      rate[9] = IBI;
      runningTotal += rate[9];
      runningTotal /= 10;
      BPM = 60000 / runningTotal;
      QS = true;
    }
  }
  if (Signal < thresh && Pulse == true) {
    digitalWrite(blinkPin, LOW);
    Pulse = false;
    amp = P - T;
    thresh = amp / 2 + T;
    P = thresh;
    T = thresh;
  }
  if (N > 2500) {
    thresh = 512;
    P = 512;
    T = 512;
    lastBeatTime = sampleCounter;
    firstBeat = true;
    secondBeat = false;
  }
  sei();
}

void setup() {
  Bluetooth.begin(9600);
  Serial.begin(9600);
  dht.begin();
  sensors.begin();
  interruptSetup();
}

void loop() {
  sensors.requestTemperatures();
  dht.readHumidity();
  dht.readTemperature();
  if (isnan(dht.humidity) || isnan(dht.temperature_C)) { return; }
  if (QS == true) {
    Serial.print(sensors.getTempCByIndex(0));
    Serial.print(" ");
    Serial.print(dht.temperature_C);
    Serial.print(" ");
    Serial.print(dht.humidity);
    Serial.print(" ");
    Serial.println(BPM);
    Bluetooth.print(sensors.getTempCByIndex(0));
    Bluetooth.print(" ");
    Bluetooth.print(dht.temperature_C);
    Bluetooth.print(" ");
    Bluetooth.print(dht.humidity);
    Bluetooth.print(" ");
    Bluetooth.println(BPM);
    QS = false;
  }
  delay(1500);
}

スマートフォンアプリの作成(MIT App Inventor 2)

  1. App InventorにGoogleアカウントでログイン
  2. 新規プロジェクト「HealthMonitor」を作成
  3. デザイナー画面で以下のコンポーネントを配置:
    • ListPicker(Bluetoothデバイス選択用)
    • Label ×4(体温、環境温度、湿度、心拍数表示用)
    • BluetoothClient(非表示コンポーネント)
    • Clock(データ受信ポーリング用、タイマー間隔1000ms)
  4. ブロックエディターで以下のロジックを構築:
    • ListPicker.BeforePicking → BluetoothClient.AddressesAndNamesを設定
    • ListPicker.AfterPicking → BluetoothClient.Connectで接続
    • Clock.Timer → BluetoothClient.ReceiveTextでデータ受信、スペース区切りで分割し各Labelに表示
  5. 「Build」→「App (save .apk to my computer)」でAPKを生成・インストール

動作確認とトラブルシューティング

拡張アイデア

参考リンク

製造プロセス

  1. 新A6630温度モジュール、CSI 6500機械健全性モニターに振動・温度の統合洞察を追加
  2. 5ドルI2C温度センサーで作るRaspberry Pi温度ロガー
  3. Raspberry PiとDS18B20によるプロフェッショナルな温度監視
  4. Raspberry PiとPythonでリモート温度センサーを構築 – ステップバイステップガイド
  5. Raspberry Piで気象観測ステーションを構築し、日次天気データをメール送信
  6. Raspberry Piでサーバークローゼットの温度を正確に監視
  7. Raspberry PiとDS18B20でマルチセンサー温度・光監視システムを構築
  8. Raspberry Pi、MCP9808、InfluxDB、Grafanaで作る家庭温度モニター
  9. 高精度ベアリング温度センサー:正確な検知と監視
  10. DS18B20温度センサー:産業・コンシューマー向け高精度1-Wireデジタル温度計
  11. 自己加熱機能搭載ウェアラブルガスセンサーで高精度な健康・環境監視を実現