You are on page 1of 11


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.

Once you’ve built it, I would recommend following the authors suggestion and leave a tip 😊
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.

2.1 Download Arduino IDE

Open your browser, enter the official website of Arduino. (
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
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

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

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):

Open Tools → Board: “…” → Boards Manager

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


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

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:

nightscout = your NightScout site, no http, no /
bootpic = /M5_NightscoutMon.jpg
name = YourName your name to display
time_zone = 3600 (
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

ssid = ssid1 your WiFi name
pass = pass1 and password

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

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!