気圧センサー BMP280
BOSCH 気圧センサー BMP280 のための Thing です。 Node-RED とノードモジュール node-red-contrib-bme280 を使用します。
#
必要なもの- ハードウェア
- Raspberry Pi 3以降
- BOSCH 気圧センサー BMP280
- ジャンパワイヤ、ブレッドボードなど
- ソフトウェア
#
配線図I2C を利用して下記の図のように接続します。
#
インストール方法ノードモジュール node-red-contrib-bme280
を検索し、パレットにノードを追加します。
#
フローの作成フローを表示
#
Thing Description の例スキーム・ホスト名・ポート番号 http://localhost:1880
を自分の使っているアドレスに置き換えて使用します。
{ "@context": "https://www.w3.org/2019/wot/td/v1", "title": "BMP280", "securityDefinitions": { "nosec_sc": { "scheme": "nosec" } }, "security": [ "nosec_sc" ], "properties": { "bmp280": { "title": "BMP280 Reading Sensor Data", "type": "object", "properties": { "model": { "const": "BMP280" }, "pressure_hPa": { "title": "Pressure (hPa)", "type": "number" }, "temperature_C": { "title": "Temperatures in degrees Celsius", "type": "number" } }, "forms": [ { "href": "http://localhost:1880/bmp280", "op": [ "readproperty" ] } ] } }}
Thing Description をダウンロード:
curl -sLO https://raw.githubusercontent.com/w3c/wot-jp-cg/main/docs/examples/bmp280/bmp280.jsonldeditor bmp280.jsonld
#
使用例上記の Thing Description の例を元にして JSON-LD ファイルを作成し、node-red-nodegen を使用してノードモジュールを作成します。
ノードを作成:
npx node-red-nodegen bmp280.jsonldnpm --prefix ~/.node-red install ./node-red-contrib-wotbmp280