« Arduinoで作ろう(43) WeMos D1とAmbientの連携 | トップページ | Arduinoで作ろう(44)  WeMos D1でNTP時計 »

2020年4月 7日 (火)

ガイガーカウンタ GC10(6)空間放射線量データをAmbientへ送信する

Wemos_gc10_ambient_

Gc10_wemos_d1

 WeMos D1(ESP8266)につないだガイガーカウンタGC10で測定した空間放射線量データをAmbientに送信してグラフを作ってみました。

// WeMos D1(ESP8266) + GC10 による空間放射線量測定 → Ambientに送信

#include <ESP8266WiFi.h>
#include "Ambient.h"
const char* ssid = "あなたの無線LANのSSID";
const char* password = "あなたのパスワード";
WiFiClient client;
unsigned int channelId = 12345; // あなたのチャネルID
const char* writeKey = "123456789abcde";//あなたのライトキー
Ambient ambient;

void setup(void){
  Serial.begin(9600);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
  ambient.begin(channelId, writeKey, &client);
}

void loop(void){
  String cpm="";
  if (Serial.available()) {
    cpm="";
    cpm = Serial.readStringUntil('\r');
    Serial.flush();
    cpm.trim();
    delay(1000);
  }
  if (int(millis()/1000%600) == 0){ //10分ごとに
    ambient.set(1, cpm.toFloat()); // CPMをデータ1に
    ambient.set(2, cpm.toFloat()/165); // μSv/hをデータ2に
    ambient.send(); // Ambientに送信
  }
}

Ambientに作ってもらったグラフがこれです ↓

20200406

 現在1分間隔で測定中です。
この公開チャネルをご覧ください→ https://ambidata.io/ch/channel.html?id=12425

| |

« Arduinoで作ろう(43) WeMos D1とAmbientの連携 | トップページ | Arduinoで作ろう(44)  WeMos D1でNTP時計 »

Arduino」カテゴリの記事

ESP8266 , ESP32」カテゴリの記事

高校物理」カテゴリの記事