見出し画像

FreeStyleリブレでリアルタイム記録 (6) / M5Stack で血糖値を表示

概要

Nightscout に送られてきたグルコーチ値をリアルタイムで M5Stack の画面に表示します。

前回のスマートウォッチで血糖値を確認する方法と比べ、以下の利点があります。(もちろん併用可能です)

  • 他人も確認することができる

  • 遠隔地から確認することができる

環境

  • Galaxy Z Flip 4 : docomo Android スマホ (Android 13)

  • MiaoMiao : Freestyle リブレ用の Bluetooth ブリッジ

  • xDrip+ (Nightly build 5th Dec 2023) : 血糖値をモニタリングするためのスマホアプリ

  • Nightscout 15.0.2

  • M5 Stack Basic V2.7 + SD カード (16GB 以下)

手順

(1) PC (Windows 11) に USB ドライバーをインストール
下記のページから CP210x_VCP_Windows をダウンロード&インストールします。

(2) M5NS.ini の作成
下記の内容で M5NS.ini を作成し、SD カードのルートフォルダに書き込みます。

[config]

nightscout = http://xxxxxxxx:1337/  ; use your Nightscout site URL
token = xxxxxxxx                    ; token for access secured Nightscout site, 
                                    ; if public Nightscout site is used, delete token line and do not use it
bootpic = /M5_NightscoutMon.jpg     ; boot picture
name = xxxxxxxx                     ; display name
device_name = M5NS                  ; device name for mDNS, that can be used to  access the device from local
                                    ; intranet, use .local domain, eg. m5ns.local
disable_web_server = 0              ; To disable internal Web server enter 'disable_web_server = 1'
time_zone = 3600                    ; the time zone where you live in seconds (3600 is GMT+1, Prague)
dst = 3600                          ; your daylight saving time offset (3600s is +1 hour)
show_mgdl = 0                       ; use 0 to display values in mmol/L or 1 for mg/dl
sgv_only = 0                        ; set to 1 if you use xDrip, Spike or similar to filter out calibrations
                                    ; etc., do not use with Tomato (set 0)
default_page = 0                    ; page number displayed after startup
show_current_time = 1               ; show current time instead of last valid data time
restart_at_time = HH:MM             ; time in HH:MM format when the device will restart
restart_at_logged_errors = 0        ; restart device after particular number of errors in the log 
                                    ; (0 = do not restart)
show_COB_IOB = 1                    ; show COB and IOB, values are grayed out if COB/IOB value is 0
snooze_timeout = 30                 ; sound snooze time in minutes after press of the middle button
alarm_repeat = 5                    ; sound repeat interval in minutes (alarm repeats only if alarm/warning 
                                    ; conditions are met)
info_line = 1                       ; 0 = sensor info, 1 = button function icons, 
                                    ; 2 = loop info (Loop) + basal, 3 = OpenAPS loop info + basal
temperature_unit = 1                ; 1 = CELSIUS, 2 = KELVIN, 3 = FAHRENHEIT. Can be omitted (default Celsius).
display_rotation = 1                ; 1 = buttons down (default, can be omitted), 3 = buttons up, 
                                    ; 5 = mirror buttons up, 7 = mirror buttons down  
date_format = 0                     ; 0 = dd.mm. (default, can be omitted), 1 = MM/DD
time_format = 0                     ; 0 = 24 Hours (default, can be omitted), 1 = 12-hour AM/PM
brightness1 = 50                    ; the first (default) brightness value
brightness2 = 100                   ; the second brightness value
brightness3 = 10                    ; the third brightness value

;;;;;;;;;; following values are in mmol/L or mg/dL depending on the previous setting of "show_mgdl" key value_

yellow_low = 4.5           ; glycemia values under this value will be displayed in yellow color
yellow_high = 9            ; glycemia values over this value will be displayed in yellow color
red_low = 3.9              ; glycemia values under this value will be displayed in red color
red_high = 11              ; glycemia values over this value will be displayed in red color
snd_warning = 3.7          ; softer high beep sound will beep every 5 mins when under this value
snd_alarm = 3.0            ; strong alarm will sound every 5 min when under this value
snd_warning_high = 14.0    ; softer high beep sound will beep every 5 mins when over this value
snd_alarm_high = 20.0      ; strong alarm will sound every 5 min when over this value
snd_no_readings = 20       ; softer high beep sound will beep every 5 mins when time in minutes when last data was read 
                           ; is over this value
snd_loop_error = 1         ; 0 = no loop error alarm, 1 = stronger sound alarm to loop error
snd_warning_at_startup = 1 ; play test warning sound with its volume during startup (1 = play, 0 =  do not play)
snd_alarm_at_startup = 0   ; play test alarm sound with its volume during startup (1 = play, 0 =  do not play)
warning_volume = 20        ; volume of warning sound in range 0-100 (0=no sound, 1=silent, 100=max volume)
alarm_volume = 100         ; volume of alarm sound in range 0-100 (0=no sound, 1=silent, 100=max volume)

;;;;;;;;;; there are supported some external devices, take care and know what you are doing when you connect it

LED_strip_mode = 0         ; external RGB LED strip or internal M5Stack Fire RGB LED support
                           ; 0 = off, 1 = visualize sound, 2 = show warnings and alarms, 3 = light always
LED_strip_pin = 15         ; pin that controls LEDs, 15 = M5Stack Fire internal pin
                           ; 21 = red PORT A connector (not recommended, collides with I2C, first LEDs will blink occassionaly
                           ; 26 = black PORT B connector, 17 = blue PORT C connector
LED_strip_count = 10       ; 10 = number of M5Stack Fire internal LEDs,
                           ; 15 = 10 cm strip, 29 = 20 cm strip, 72 = 50 cm strip, 144 = 100 cm strip, 288 = 200 cm strip
LED_strip_brightness = 10  ; 1-100% brightness intesity (100 = max.) 
                           ; for more than 10 LEDs use 10%, 5% or even less otherwise loaded current will reset the M5Stack

vibration_mode = 0         ; VIBRATION MOTOR UNIT ; 0 = off, 1 = ON (vibrate during sound)
vibration_pin = 26         ; pin that controls VIBRATION UNIT motor, 26 = M5Stack Fire PORT B connector, 17 = blue PORT C connector
                           ; do not connect vibration motor to red PORT A, it will rotate always as it will be in collision with I2C
vibration_strength = 512   ; 10 bit PWM value for VIBRATION UNIT motor control, 512 = 1/2 of max. power, do not use more, full power
                           ; will reset the M5Stack, recommended range is 256-512

micro_dot_pHAT = 0         ; 0 = off, 1 = ON (display SGV and DELTA on I2C Pimoroni Micro Dot pHAT connected to I2C pins 21+22)

;;;;;;;;;;  you can connect up to 9 WiFi access points, no need to setup all, one is enough

[wlan1]
ssid = xxxxxxxx  
pass = xxxxxxxx

以下の項目は自分の環境に合わせて書き換えてください。

  • nightscout : nightscout サーバー URL

  • token : nightscout サーバー Token

  • name : 自分の名前

  • wlan1 / ssid と pass : Wi-Fi の SSID とパスワード

(4) M5Stack にファームウェアの書き込み
下記のページから最新のリリース (2023-01-09 現在の最新は v2020-10-02-01) をダウンロード&解凍。

M5Burner.exe を実行、Firmware を指定して Burn ボタン。

Firmware に M5_NightscoutMon for 4MB flash

(5) M5Stack 再起動
M5Stack を PC から外し、SD カードをセット後、電源に接続し起動します。

設定値の変更

起動後は、ブラウザから下記のアドレスにアクセスすることで、設定画面を開けます。

http://{M%Stack の IP アドレス} 

あとがき

自分はこのデバイスを仕事用デスクの上に置いていますが、自然に視界に入るため、気軽に血糖値を確認することができ重宝しています。
それまでは PC ブラウザに Nigthscout 画面を表示していましたが、画面の仕事スペースを占有されますし、PC の電源が入ってなくても見られるのが◎。
子供さんや家族の方の血糖値を確認する手段としても最適だと思います。

この記事が気に入ったらサポートをしてみませんか?