IoTデータ 可視化サービスAmbientにENV III UNITのデータを送る

以前から触ってみようと思ってやっていなかったIoTデータを可視化するサービスAmbientを試してみました。

https://ambidata.io/

使い方は、書籍「IoT開発スタートブック ── ESP32でクラウドにつなげる電子工作をはじめよう!」やAmbientの公式ドキュメントに詳しく書かれていますが、試した内容をメモとして残しておきます。

Githubリポジトリ ESP8266/ESP32用Arduino・Ambientライブラリー にもサンプルが掲載されているのでこちらも参考になります。

センサーは、M5Stick-C ENV III Unitを使います。

ENV III Unit with Temperature Humidity Air Pressure Sensor (SHT30+QMP6988)
ENV III SKU:U001-C Description ENV III is an environmental sensor that integrates SHT30 and QMP6988 internally to detect temperature, humidity, and atmospheric pressure data. SHT30 is a high-precision and low-power digital temperature and humidity sensor, and supports I2C interface (SHT30:0x44 , QMP6988:0x70).QMP6988 is an absolute air pressure sensor specially designed for mobile applications, with high accuracy and stability, suitable for environmental data collection and detection types of projects.Product Features Simple and easy to use High accuracy I2C communication interface HY2.0-4P interface, support platform UIFlow , Arduino 2x LEGO compatible holes Include 1x ENV-III Unit 1x HY2.0-4P Cable Applications Weather station Storage barn environment monitoring Specification Resources Parameter Maximum temperature measurement range -40 ~ 120 ℃ Highest measurement accuracy 0 ~ 60 ℃/±0.2℃ Humidity measurement range/error 10 ~ 90 %RH / ±2% Maximum measured value of air pressure/resolution/error 300 ~ 1100hPa / 0.06Pa / ±3.9Pa Communication protocol I2C: SHT30(0x44), QMP6988(0x70) Working temperature 32°F to 104°F (0°C to 40°C ) Net weight 5g Gross weight 17g Product Size 24.2*32.2*8.1mm Package Size 67*53*12mm Case Material Plastic ( PC ) ENV version scheme comparison ENV I ENV II ENV III DHT12+BMP280 SHT30+BMP280 SHT30+QMP6988 PinMap M5Core(PORT A) GPIO22 GPIO21 5V GND ENV III Unit SCL SDA 5V GND Schematic Related Link Datasheet QMP6988 SHT30 Learn M5stack based PFD (Primary Flight Display) An attempt to create a realtime “Artificial Horizon” on the M5. Matrix Shelly Thermostat: A Serverless Approach A modular WiFi smart thermostat that doesn’t need you to maintain any infrastructure: deploy it everywhere, integrate with everything. M5Stack COM. LoRaWAN Using Arduino IDE M5Stack recently released an updated LoRaWAN module. This tutorial teaches you how to connect it to The Things Network using Arduino IDE. Smart Plant with M5Stack Make your plants smart and monitor water, temperature and humidity! M5StickC with HomeKit Automation Used StickC with ESPHap library to connect to HomeKit Smart Planting System Building a smart planting system using M5Stack to monitor the lights, humidity, temperature, watering your plant automatically. 3 in 1 Sanitiser Dispenser We have devised with an innovation that dispenses hand sanitiser, measures the temperature of user, shows the count of people in vicinity. CovidStop A technology which increases efficiency in signing in or out during peak hour areas when entering the campus while the SafeEntry implies. SEAM [Safe-Entry Access Machine] An automatic system to perform the tasks of Safe Entry. It consist an adjustable Thermometer, RFID / QR Code Check in and Counting. Example Arduino ENV III Unit Test

shop.m5stack.com

No Image


“IoTデータ 可視化サービスAmbientにENV III UNITのデータを送る” の続きを読む

M5Stack ENV III Unit 温湿度気圧センサ (SHT30+QMP6988) の使い方

M5StickC ENV-HAT IIが壊れてしまい[ENV III Unit 温湿度気圧センサー (SHT30+QMP6988)]を買ったので使い方をメモしておきます。

ENV III Unit with Temperature Humidity Air Pressure Sensor (SHT30+QMP6988)
ENV III SKU:U001-C Description ENV III is an environmental sensor that integrates SHT30 and QMP6988 internally to detect temperature, humidity, and atmospheric pressure data. SHT30 is a high-precision and low-power digital temperature and humidity sensor, and supports I2C interface (SHT30:0x44 , QMP6988:0x70).QMP6988 is an absolute air pressure sensor specially designed for mobile applications, with high accuracy and stability, suitable for environmental data collection and detection types of projects.Product Features Simple and easy to use High accuracy I2C communication interface HY2.0-4P interface, support platform UIFlow , Arduino 2x LEGO compatible holes Include 1x ENV-III Unit 1x HY2.0-4P Cable Applications Weather station Storage barn environment monitoring Specification Resources Parameter Maximum temperature measurement range -40 ~ 120 ℃ Highest measurement accuracy 0 ~ 60 ℃/±0.2℃ Humidity measurement range/error 10 ~ 90 %RH / ±2% Maximum measured value of air pressure/resolution/error 300 ~ 1100hPa / 0.06Pa / ±3.9Pa Communication protocol I2C: SHT30(0x44), QMP6988(0x70) Working temperature 32°F to 104°F (0°C to 40°C ) Net weight 5g Gross weight 17g Product Size 24.2*32.2*8.1mm Package Size 67*53*12mm Case Material Plastic ( PC ) ENV version scheme comparison ENV I ENV II ENV III DHT12+BMP280 SHT30+BMP280 SHT30+QMP6988 PinMap M5Core(PORT A) GPIO22 GPIO21 5V GND ENV III Unit SCL SDA 5V GND Schematic Related Link Datasheet QMP6988 SHT30 Learn M5stack based PFD (Primary Flight Display) An attempt to create a realtime “Artificial Horizon” on the M5. Matrix Shelly Thermostat: A Serverless Approach A modular WiFi smart thermostat that doesn’t need you to maintain any infrastructure: deploy it everywhere, integrate with everything. M5Stack COM. LoRaWAN Using Arduino IDE M5Stack recently released an updated LoRaWAN module. This tutorial teaches you how to connect it to The Things Network using Arduino IDE. Smart Plant with M5Stack Make your plants smart and monitor water, temperature and humidity! M5StickC with HomeKit Automation Used StickC with ESPHap library to connect to HomeKit Smart Planting System Building a smart planting system using M5Stack to monitor the lights, humidity, temperature, watering your plant automatically. 3 in 1 Sanitiser Dispenser We have devised with an innovation that dispenses hand sanitiser, measures the temperature of user, shows the count of people in vicinity. CovidStop A technology which increases efficiency in signing in or out during peak hour areas when entering the campus while the SafeEntry implies. SEAM [Safe-Entry Access Machine] An automatic system to perform the tasks of Safe Entry. It consist an adjustable Thermometer, RFID / QR Code Check in and Counting. Example Arduino ENV III Unit Test

shop.m5stack.com

No Image

今回HATじゃなくてUNITの方にした理由としては、M5StackやATOMなどでも使い回したいという理由でUTNIにしてみました。
“M5Stack ENV III Unit 温湿度気圧センサ (SHT30+QMP6988) の使い方” の続きを読む

ESP32で回路を追加せずを使って電源電圧を計測する

電源電圧の計測方法について調べてみたところ、ESP8266であればESP.getAcc関数で電源の電圧を取得できることがわかりましたが、ESP32では使えないことがわかり代替の方法は無いか調べてみました。

結果としては、公式に公開されているAPIはないがrom_phy_get_vdd33関数をWIFIまたはBLEがオンのときに実行すると取得可能という情報を見つけて検証してみたところ、使えなくもなさそうだということがわかりました。

検証の目的としては電池駆動の際にしきい値より小さくなったら通知を送って電池交換を促す用途に使えないかを確認したかったというところです。

今回の検証には、開発ボードESPr Developer32を使用しました。

ESPr® Developer 32 – スイッチサイエンス
Wi-Fi + Bluetoothモジュール、ESP-WROOM-32とUSB-シリアル変換ICを搭載した開発ボードです。別売りのピンソケットを実装すれば、ESPr® Developer用に開発した拡張ボードをESPr Developer 32でもそのままお使いいただけます。

www.switch-science.com

No Image

以下、rom_phy_get_vdd33()の呼び出し方についてと計測した値をambientに送ってグラフ化してみた結果について解説しています。
“ESP32で回路を追加せずを使って電源電圧を計測する” の続きを読む

obniz Board 1Yで自動水やりの屋外対応版を工作してみた

昨年から夏は庭で野菜をプランターで栽培してるので家を空けたときにも心配要らないように、obniz Board 1Yを使って自動水やり装置を作ってみました。

作ってみたものはこんな感じです。

やっていることは定期的にバケツの水をポンプで汲み上げるだけです。

基本的なところはobniz公式ブログの記事「obniz Board 1Yのスリープ機能を使った省電力な水やりデバイス」をベースにし、屋外に設置可能なようにobniz Boardと電池をケースに収めて風雨対策をしています。
また、使用した給水ポンプはobnizのブログで紹介されているものとは別のもので、obniz内臓のモータードライバでは動きませんでした。そこで電池から直に電源を供給するようにMOSFETをobnizで制御して給水ポンプをOn/Offしています。
“obniz Board 1Yで自動水やりの屋外対応版を工作してみた” の続きを読む

距離センサー VL53L0X の使い方 (Arduino、ESP32)

スイッチサイエンスで、PololuのVL53L0Xモジュールを購入してArduinoとESP32で試してみたメモです。

PololuのVL53L0Xモジュールのピンアサイン

Pololuのピンホールは7つあります。

シルク 説明
VDD 電源
VIN 主電源 (基本こちらを使う)
GND グランド
SDA I2Cのシリアルデータ
SCL I2Cのシリアルクロック
XSHOT ハードウェアスタンバイ
GP01 ???

“距離センサー VL53L0X の使い方 (Arduino、ESP32)” の続きを読む

Amazon FreeRTOS ESP32-DevKit-CでMQTT Hello World (Mac版)

Amazon FreeRTOSをESP32開発ボードESP32-DevKit-Cにセットアップして、マイコンからMQTTのメッセージを送信し、AWS IoTのコンソール上で確認するHello Worldサンプルを動かしてみたので手順をまとめてみました。

FreeRTOSのセットアップ手順は公式ドキュメントの「Espressif ESP32-DevKitC と ESP-WROVER-KIT の開始方法」を参考にしています。
このドキュメントではESP-IDF v3とESP-IDF v4を利用したセットアップ方法が記載されていますが、今回は「ESP-IDF v4」の手順を選択しました。
“Amazon FreeRTOS ESP32-DevKit-CでMQTT Hello World (Mac版)” の続きを読む

ESP32のデジタル入力 プルアップ/プルダウンを検証、Arduinoとの違い

ボタンスイッチからの入力をESP32で処理する場合、プルアップ、プルダウンという言葉が出てきますが理解が怪しかったので、実機で試しつつまとめてみました。

ESP32の開発ボードは、ESPr Developer 32で試しています。

スイッチにプルアップ、プルダウンがなぜ必要か?

スイッチの回路にプルアップ、プルダウンがなぜ必要かについてですが、もし以下のようにスイッチがGNDと入力用のピンのみに接続されている回路で内部抵抗によるプルダウンなしの場合

このとき読み取られる値は直感的には0Vになりそうですが、そうはなりません。
実際にどこにも接続されていないピンをanalogReadした値は以下のようになぞの電圧が観測されます。

“ESP32のデジタル入力 プルアップ/プルダウンを検証、Arduinoとの違い” の続きを読む

M5Stick-Cで光センサユニット(LIGHT UNIT)を試す

M5Stack-Cで、光センサーのユニットLIGHTを試してみました。

LIGHT UNITの光センサは、フォトレジスタ(CdSセル)が組み込まれているモジュールで、光の強さをアナログおよびデジタルで読み取れます。

公式リファレンスのページ: Light – M5Stack Docs

プログラムは、上記の公式リファレンスのページで紹介されているサンプルを修正してみました。

Github: M5Stack/examples/Unit/LIGHT/LIGHT.ino

公式リファレンスのM5Stack Coreを利用した例と同じ様に、LIGHT UNITから読み取ったアナログとデジタルの値をLCDに表示します。


“M5Stick-Cで光センサユニット(LIGHT UNIT)を試す” の続きを読む

ESP32 MicroPython開発環境セットアップしてLチカまで

前回の記事「ESP-IDFをMacにセットアップしてESP32-DevKitCでLチカ」に続いてESP32ネタで、今回はMicroPythonによる開発手順を確認してみます。

開発環境のセットアップ手順は、MicroPython port to the ESP32に従って進めています。

この手順は、MicroPythonのファームウェアをソースからビルドしてESP32開発ボードに転送するものになります。MicroPythonファームウェアはESP32用のバイナリも配布されているので簡単に試したい方はバイナリ版 Firmware for ESP32 boards を利用したほうが良さそうです。

Toolchainのセットアップ

Toolchainのセットアップは前回のESP-IDFの記事「Toolchainのセットアップ」と同じです。

ESP32 toolchain for macOS を
https://dl.espressif.com/dl/xtensa-esp32-elf-osx-1.22.0-80-g6c4433a-5.2.0.tar.gz からダウンロードして、以下のようにファイルをespディレクトリに展開します。

$ mkdir -p ~/esp
$ cd ~/esp
$ tar -xzf ~/Downloads/xtensa-esp32-elf-osx-1.22.0-80-g6c4433a-5.2.0.tar.gz

参考: Setting up the toolchain and ESP-IDF

“ESP32 MicroPython開発環境セットアップしてLチカまで” の続きを読む

ESP-IDFをMacにセットアップしてESP32-DevKitCでLチカ

会社のテックWebマガジン コピペテック の電子工作ネタ用にESP32について調べています。

まずはHello Worldとして、ESP32用の開発環境ESP-IDFをMacにセットアップし、ESP32開発用ボード ESP32-DevKitCでLチカしてみました。

開発ボードは秋月電子通商で購入した「ESP32-DevKitC ESP-WROOM-32 開発ボード」で試しています。

ESP32の開発環境は、主にArduino IDEとESP-IDFがあり、
Arduino IDEの方が使い勝手が良いように思いますが、Arduinoと比べてESP32のメリットであるMicroPythonによる開発をするためにはESP-IDFをベースとした環境が必要になります。
そこでまずはESP-IDFによる開発手順も確認してみたので、それをまとめてみました。

(その後調べてわかったことですが、ESP32用のMicroPythonファームウェアはバイナリでも配布されているので、こちらの Firmware for ESP32 boards を使ったほうが簡単にセットアップでます。参考: ESP32でMicroPythonを試す!簡単ですぐできました!)

ESP-IDFを利用するために必要なもの

Get Started > What You Need にESP-IDFを利用した開発環境で必要となるものがまとめられています。

  1. PC
  2. Toolchain
  3. ESP-IDF
  4. テキストエディタ
  5. ESP32ボード本体とUSBケーブル

Toolchainは、ESP32用のアプリケーションのビルドツールです。
ESP-IDFは、ESP32用の基本APIとToolchainを使用するためのスクリプトを提供する開発フレームワークになります。

“ESP-IDFをMacにセットアップしてESP32-DevKitCでLチカ” の続きを読む