View on GitHub

Advanced System Software

M5Stack How-To

M5Stack is an open-source modular toolkit for IoT devices. This tutorial explains how to set up a development environment for M5Stack on your PC.

M5Stack and ESP32

About M5Stack

An M5Stack module is an enclosed device that consists of an ESP32 SoC and several peripheral components, including three buttons, an LCD, and a speaker.

About ESP32

ESP32 is a series of low-cost, low-power SoC microcontrollers with integrated WiFi and Bluetooth capabilities, created and developed by Espressif. Apart from M5Stack, many ESP32-based modules and development boards are available.

Development Environments for M5Stack


Tools and libraries required for developing M5Stack applications are as follows.

  1. Toolchain (C/C++ Compiler and other utilities)
  2. ESP-IDF (official development framework for ESP32 distributed by Espressif)
  3. Arduino Core for ESP32 (library for developing applications using Arduino framework)
  4. M5Stack Library (library for developing applications that use M5Stack hardware components)

You may chose several options.

The reset of this section describes how to set up a cross-development environment for M5Stack in which you can upload your programs via USB cable. Other options, for example, setting up cloud-based development environments or methods for uploading programs via WiFi are skipped for now.

Installing USB-UART Driver

M5Stack has a Silicon Labs CP2014 USB-UART adapter as the communication interface to the host PC. Download an appropriate device driver for your PC from the following link and follow the instructions along with the driver.

If successfully installed, you can find the following USB-serial port when you connect M5Stack to your PC via a USB cable.

You can easily check using shell command ls /dev/cu.* or ls /dev/tty*.

Notes on Cabling

If you cannot find the above port when you connect your PC to the M5Stack device, try to change the orientation of the USB-C plug connected to the device. USB-C connectors are usually known to be reversible (no orientation). However, the wiring of the USB-C connector of M5Stack body may be bit weird and have orientation.

Another possible trouble about cabling may occur when you are using a USB-C to USB-C cable. If your PC has only USB-C ports (like recent MacBook and MacBook Pro), you would like to connect to M5Stack using such cables. In my experience, a few instances of M5Stack Core have a connection trouble with some USB-C to USB-C cables. In this case, reversing the connector orientation does not help. When you come across such trouble with your cable, it is better to give up to use the cable and use USB-C to USB-A adapter and the USB-A to USB-C cable included in the box of M5Stack Core.

Setting Up Arduino IDE


Download an appropriated Arduino IDE application from the following link and install it in your PC.

Setting up for M5Stack

Method 1

You can easily install the required toolchain, framework and libraries using the board manager and library manager of Arduino IDE.

Method 2