You are on page 1of 11

M5_NightscoutMon

M5Stack Nightscout monitor

This document aims to give instructions on how to realize the project from Martin Lukasek, as
presented in Github (using a Windows computer). Please read it before getting started in order
to make sure you feel comfortable with the knowledge and material required before starting.
https://github.com/mlukasek/M5_NightscoutMon

Once you’ve built it, I would recommend following the authors suggestion and leave a tip 😊

https://paypal.me/8bity
1. Get the hardware
You need an M5Stack. You can find it easily on Amazon, eBay, Banggood, AliExpress, …
Look for the ESP32 Basic, price range is from US$28 to $45.

You’ll also need a Micro SD memory. Since it’s only used to save the configuration file and a few
pictures, small capacity is OK (8/16/32GB), the cheaper the better.
Make sure you have the required hardware to put it on your computer in order to copy the files
(i.e. Micro to SD converter, USB card reader, …).

An USB charger and an USB-C cable. The battery included is only 150mAh and doesn’t fit our
needs. Unless you modify the M5Stack with a bigger battery, you’ll need to keep it plugged. The
cable provided is very short and you’ll need a longer one for a desk use.
2. Arduino
This section is from the original documentation.
(https://docs.m5stack.com/#/en/quick_start/m5core/m5stack_core_get_started_Arduino_Windows)

2.1 Download Arduino IDE


Open your browser, enter the official website of Arduino. (https://www.arduino.cc/en/Main/Software)
Click Windows ZIP file for non admin install for downloading Arduino IDE.
NB: If you want to use Arduino on a regular basis, you can download and install the Windows Installer,
but at this point you probably don’t need this procedure.

Click just download.

In the Downloads folder, extract the .zip file on C:\


2.2 Download and install the USB driver
Open your browser, enter the address of SiLabs https://www.silabs.com/products/development-
tools/software/usb-to-uart-bridge-vcp-drivers and choose the version matching your operating system.

If you don’t know


what your platform
is, right click your
computer and get its
properties.

In the Downloads folder, extract the .zip file

Open the extracted folder and run the installer for the correct platform type for the driver.
Next, Accept, Next, Finish.

NB: If you have previous versions of SiLabs drivers you might need to remove them in order to
see the M5Stack serial port.
3. Download M5_NightscoutMon project
Browse to the project page https://github.com/mlukasek/M5_NightscoutMon.

Select Clone or download, and download ZIP

In the Downloads folder, extract the .zip file

Once extracted, rename the project folder removing “-master” (VERY IMPORTANT)
4. Setup Arduino for M5Stack
Navigate to your Arduino folder C:\arduino-1.x.x. and run arduino.exe

Unless necessary, you do not need to give Java access to Public networks.
Open the M5_NightscoutMon project

4.1 Install ESP32 Boards Manager


Open File → Preferences → Settings

In the Additional Boards Manager add a new URL


Add the following path below existing paths (if any):
https://dl.espressif.com/dl/package_esp32_index.json

Open Tools → Board: “…” → Boards Manager

Write esp32 in the search bar and once displayed select it, click install, wait

highest

and close once complete.


Open Tools → Board: “…” → browse down to M5Stack-Core-ESP32 and select it
4.2 Install libraries
Open Sketch → Include Library → Manage Libraries…

Type m5stack in the search bar and browse down to find the official library as shown below,
install it.

Type json in the search bar and browse down to find the ArduinoJson library by Benoit
Blanchon, install it and close the Library Manager.

4.3 Compile the project


Now you can try to compile the project to check Arduino is setup correctly.
5. Program the M5Stack
Plug you M5Stack to the PC with the USB plug provided (or a better one if you have it).
The device runs a self-test and stops at this screen:

Open the device manager and check 1. M5Stack is there and 2. What COM port it uses

Setup Arduino to use the same port if necessary: Tools → Port → COMx (with x from above)

Upload to M5Stack
6. Setup the micro SD
Plug your memory to the PC either directly or through an adapter and verify it’s formatted
FAT32.

Copy all files from the project folder C:\Users\...\Downloads\M5_NightscoutMon-


master\M5_NightscoutMon\SD to the memory (don’t copy the folder: just files)

Edit the file M5NS.ini to match your needs:


[config]
nightscout = yoursite.herokuapp.com your NightScout site, no http, no /
bootpic = /M5_NightscoutMon.jpg
name = YourName your name to display
time_zone = 3600 (https://www.epochconverter.com/timezones)
dst = 3600

show_mgdl = 0 set to 1 for mg/dL

yellow_low = 4.5
yellow_high = 9
red_low = 3.9 thresholds for colors
red_high = 11
snd_warning = 3.7
snd_alarm = 3.0

brightness1 = 50
brightness2 = 100
brightness3 = 10

[wlan1]
ssid = ssid1 your WiFi name
pass = pass1 and password

[wlan2]
ssid = ssid2 if you have other access points
pass = pass2 else leave them like that

[wlan3]
ssid = ssid3
pass = pass3

Place the memory in the M5Stack slot, press the red button and wait.
After the NightScout logo, it should connect to your WiFi

And then start displaying

More to come!