LoginSignup
30
30

More than 5 years have passed since last update.

においセンサー(TGS2450)✖️ Arduinoの情報取得

Last updated at Posted at 2015-04-25

事前準備

においセンサー(TGS2450)を利用したデバイスの実験

・TGS2450(においセンサー)
・Arduino Nano
・RN42(Bluetoothモジュール)
・2SC1815(トランジスタ)
・1kΩ 抵抗 4個
・100Ω 抵抗 4個
・DC12Vアダプタ 

すべて、秋月電子で購入可能です。

回路設計

まず、以下のサイトを参考にして設計する。
http://tadahiko.justhpbs.jp/arduino/arduino_TGS2450.htm

tgs2450.png

25Ωの作り方は、100Ωの並列にして合成抵抗にすれば作れます。
(25Ω= 1/100Ω + 1/100Ω + 1/100Ω + 1/100Ω)

配線作業

とりあえずはBluetooth接続なしで配線します。

IMG_0604.JPG

プログラムと実験

int val = 0;

void setup() {
    pinMode(3,OUTPUT);
    pinMode(4,OUTPUT);
    Serial.begin(115200);
}

void loop() {
    for (int i = 0; i <= 3; i++){
        delay(242);
        digitalWrite(4,HIGH);
        delay(8);
        digitalWrite(4,LOW); 
    }     
    delay(237);
    digitalWrite(3,HIGH);
    delay(3);
    val = analogRead(5);
    delay(2);
    digitalWrite(3,LOW);
    digitalWrite(4,HIGH);
    delay(8);
    digitalWrite(4,LOW); 
    val = 1023 - val;
    val = val * 5;
    Serial.println(val);
    // 3msec loop
    delay(3000);
}

プログラム実行すると、シリアルモニターに数値が出ます。
数値は 0 ~ 5000。

数値が安定するまで待ちましょう。

 通常は600前後

何かを燃やして当てる1300前後の数値になったので、センサーは正しいってことかな。。。。

ただし、「数値が高い = においが強いで」あり、不快な匂いではないようです。

Bluetoothでの接続

Bluetoothでの接続はRX,TX(UART)をモジュールに繋げるだけ。

IMG_0607.JPG

あとはMacなどでペアリングしてSCREENでみれば、数値がかえってきます。

LCDを追加した完成品
IMG_0610.JPG

30
30
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
30
30