M5Paper Clock
2021/12/20+
初版
M5Paper Colock
M5Paper Clock
概要
M5Paperのクロック(時計)をいくつか紹介する。
ホスト環境は、ubuntu20.04とする。
なお、platformioがインストール済みのものとする。
1. m5paper-dashboard
説明:
https://github.com/estshorter/m5paper-dashboard
ビルドと書き込み:
mkdie M5P
cd M5P
git clone https://github.com/estshorter/m5paper-dashboard.git
cd m5paper-dashboard/
# Set your Wi-Fi parameters in src/WiFiInfo.h
gedit src/WiFiInfo.h
以下を自分のWiFi完了に合わせる:
constexpr auto SSID = "YOUR_SSID";
constexpr auto PASS = "YOUR_PASS";
# build&upload
pio run -t clean
pio run -t upload
以上でビルドと書き込みが終了する。
サポートデバイス:
以下をサポートしているが
(1)CO2Mini(RaspberryPi経由)
(2)ENV II Unit(@PORT-A)
(3)LED Unit
手持ちが、「ENV III Unit」だったので
それを接続したが、問題無く、動作した。
操作:
Leftボタン:シャットダウン
Middleボタン:NTP同期
Rightボタン:画面リフレッシュ
2. M5Paper Weather Station
説明:
https://www.instructables.com/M5Paper-Weather-Station/
Take notes that:
The indoor temperature and humidity are read from a built-in SHT30 sensor.
Time information is read from a RTC built-in sensor BM8563 and
it can be synchronized with NTP Time Server.
The other weather information like:
pressure, wind, sunrise & sunset time, visibility, weather icon &
description...are read from openweathermap.org
API_Key取得:
以下などを参考にAPI_Keyを取得する。
・OpenWeatherMapのAPIから気象データを取得する方法
なお、私の場合、API Keyを取得する際、なぜか、オリジナル(のAPI_Key)ではなく
再生成で新しくAPI_Keyを作らないとAPI_Keyが有効ならなかった。
ビルドと書き込み:
cd M5P
git clone https://github.com/tuenhidiy/m5paper-weatherstation.git
cd m5paper-weatherstation
以下のように日本向けにパッチをおこなう:
WiFiInto.h
# 自分のWiFi環境に合わせる:
constexpr auto SSID = "YOUR_SSID";
constexpr auto PASS = "YOUR_PASS";
#------------------------------------
main.cpp
# 以下のように日本向けの修正をおこなう:
#14行付近:
// Change to your timezone
//#define timezone 7
// JST
#define timezone 9
#19行付近:
// Set location and API key
String Location = "Isehara,JP"; // Change to your location
String API_Key = "取得したopenweathermap.orgのAPI_Key";
//String Location = "Vietnam,VN"; // Change to your location
//String API_Key = "xxxxxxxxxxxxx";
#76行付近:
//constexpr auto TIME_ZONE = "ICT-7";
constexpr auto TIME_ZONE = "JST-9";
#611行付近:(画面に表示される都市名になる)
//gfx.printf("Ho Chi Minh City, VN\r\n");
gfx.printf("Isehara City Kanagawa, JP\r\n");
#------------------------------------
pio run -t clean
pio run -t upload
以上で、ビルドと書き込みが完了する。
操作:
Leftボタン:シャットダウン
Middleボタン:NTP同期
Rightボタン:画面リフレッシュ
シャットダウン後の再起動は リセットボタンを押した後で 電源オンをするほうが確実のようだ。
platformio.ini
M5Paper-Weather-Stationのビルドには
以下のplatformio.iniを使用した:
(オリジナルのものより整理した)
platformio.ini
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:m5paper]
platform = espressif32
board = m5stack-fire
framework = arduino
board_build.flash_mode = qio
board_build.f_flash = 80000000L
upload_speed = 2000000
monitor_speed = 115200
build_flags =
-DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
; -DCORE_DEBUG_LEVEL=4
lib_deps =
m5stack/M5EPD@^0.1.1
https://github.com/lovyan03/LovyanGFX
bblanchon/ArduinoJson@5.13.4
lib_ldf_mode = deep+
3. WeatherM5Paper
説明:
weather station, indoor data are from builtin temperature and humidity sensor,
outdoor data are fetched from interet.
内蔵センサーで室内の温度、湿度、OpenWeatherMapのAPI経由で、外部の温度、湿度、風速、気圧を表示する。
注意:
「UPDATED:」で表示されている時刻は、現在の時刻ではなく、
画面をアップデートした時刻になる。
(つまり、時計としての機能は無い)
ビルドと書き込み:
# platformioの環境に入る
cd M5P
git clone https://github.com/VolosR/WeatherM5Paper.git
cd WeatherM5Paper
cp -r Weather src
# src/back.jpgをM5PaperのSDにコピーする。
# (画面のバックグランドになる)
gedit platformio.ini
# 以下の内容のものを作成する:
platformio.ini
[env:m5paper]
platform = espressif32
board = m5stack-fire
framework = arduino
board_build.flash_mode = qio
board_build.f_flash = 80000000L
upload_speed = 2000000
monitor_speed = 115200
build_flags =
-DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
; -DCORE_DEBUG_LEVEL=4
lib_deps =
m5stack/M5EPD@^0.1.1
;https://github.com/lovyan03/LovyanGFX
;bblanchon/ArduinoJson@5.13.4
https://github.com/bblanchon/ArduinoJson.git
https://github.com/taranais/NTPClient.git
lib_ldf_mode = deep+
続き:
#パッチを当てる
gedit src/Weather.ino
#5行付近(typo修正)
//#include "Orbitron44.h"
#include "orbitron44.h"
#19行付近(WiFi設定変更、日本向け修正)
const char* ssid = "YourSSID";
const char* password = "YourPasswd";
String town="Isehara";
String Country="JP";
const String endpoint = "http://api.openweathermap.org/data/2.5/weather?q="+town+","+Country+"&units=metric&APPID=";
const String key = "取得したOpenWeatherMapのAPI_Key";
#70行付近(JSTに変更する)
timeClient.setTimeOffset(32400); // JST(GMT+9)
#---------------------------------------
pio run -t clean
pio run -t upload
以上で、ビルドと書き込みが終了する。
参考情報
platformio関連:
arduinoフレームワーク用platformio.ini集
Arduino-IDE関連:
Arduino IDE environment - M5Paper
Arduino IDEのインストールと設定 (Windows, Mac, Linux対応)
M5Paper関連:
M5Paper 作業メモとリンク集
M5Paper_FactoryTest VS WeatherM5Paper
M5Paperの動作中の消費電力を削減する
M5Stack M5Paper発売
M5Paper で SD カードの JPEG 画像を表示
M5PaperにiPhoneから画像を送れるようにする
M5PaperでSDからテキストを読込んで表示する方法
M5Paperでデジタルモノクロフォトフレームを作る(前編)
初心者向けM5Stackの使い方 出荷時に簡単に戻す方法とプログラムの探し方+拡張ユニット
M5Stack製品の種類と特色紹介【最新 2020年12年 Ver】
M5Stackファミリ関連:
M5Stamp-PICO Arduino Install
M5Stamp-C3 Arduino Install
Wio-Terminal/ESP8622/ESP32ボードを共通のスケッチで動かす(NTP-CLIENT編)
Wio-Terminal/M5Atom/ESP8622/ESP32ボードを共通のスケッチで動かす(v2)(STARWARS編)
Wio-Terminal/M5Atom/ESP8622/ESP32ボードを共通のスケッチで動かす(v2)(MQTT編)
Wio-Terminal/M5Atom/ESP8622/ESP32ボードを共通のスケッチで動かす(v2)(REST-API編)
Wio-Terminal/M5Atom/ESP8622/ESP32ボードを共通のスケッチで動かす(v2)(OSC編)
その他:
スルーホール用テストワイヤ TT-200 (10本入)
以上