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 rest of this section describes how to install and set up the development environment listed above. 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 is equipped with 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 the device driver is successfully installed, you should be able to 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 on the M5Stack main board 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 or 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-A to USB-C cable included in the box of M5Stack with a USB-C to USB-A adapter.

Setting Up Arduino IDE


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

Setting up for M5Stack

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