Skip to content

M5Stack Arduino

Getting Started

Installing the USB Driver

  • Download the SiLabs CP2104 Driver but do NOT use the Windows 10 Universal (v10.1.1) driver! If you happen to download the Universal version, you may need to manually revert to 6.7.1 on a regular basis as Windows will repeatedly use the newer, incorrect driver after each Windows update.
    (Note:If you cannot upload, please try the legacy v4 driver below. Note you will need to uninstall the v5 driver.And try to use the low band: 115200)
    

Installing the ESP32 Arduino Core

Download Library

Using the Arduino IDE Library Manager

  1. Choose Sketch -> Include Library -> Manage Libraries...
  2. Type m5stack into the search box.
  3. Click the row to select the library.
  4. Click the Install button to install the library.
  5. Click "File-> Examples". Here are some test programs in "M5Stack->"

Using Git

cd ~/Documents/Arduino/libraries/
git clone https://github.com/m5stack/M5Stack.git

API

See API.

Examples

See Arduino examples folder.

Hardware

Schematic.

Pinout

Peripheral Devices ESP32
ILI9341 RST GPIO33
ILI9341 DC GPIO27
ILI9341 CS GPIO14
ILI9341 MOSI GPIO23
ILI9341 CLK GPIO18
ILI9341 LIGHT GPIO32
TFCARD MOSI GPIO23
TFCARD MISO GPIO19
TFCARD CLK GPIO18
TFCARD CS GPIO4
BUTTON A GPIO39
BUTTON B GPIO38
BUTTON C GPIO37
SPEAKER GPIO25
MPU9250 SDA GPIO21
MPU9250 SCL GPIO22
GROVE SDA GPIO21
GROVE SCL GPIO22

LoRa module

Peripheral Devices ESP32 RA-02 Note
MOSI GPIO23 MOSI shared with TFCARD
MISO GPIO19 MISO shared with TFCARD
SCK GPIO18 SCK shared with TFCARD
RFM95_CS GPIO5 NSS pull up before M5.Begin()
RFM95_RST GPIO36 RST incorrectly labeled GPIO26 in some places
RFM95_INT GPIO26 DIO0 incorrectly labeled GPIO36 in some places

M-BUS

image

Lessons

Lesson 1. Let's start! Hello world

Lesson 2. BUTTONS. Menu

Lesson 3. Wi-Fi. Scanner

Lesson 4. Serial. Card game Durak

Lesson 5. TF. Markdown web server

Lesson 6. SPEAKER. Play Jingle Bells

Lesson 7. MPU9250. Game "SPACE DEFENSE"

Lesson 8. Servo. Analog clock