

The M5Stack Core 2 is a versatile development board manufactured by M5Stack Technology Co., Ltd. (Part ID: SKU K010). It is powered by the ESP32 chip and features a 2-inch touchscreen display, built-in sensors, and a variety of interfaces, making it an excellent choice for IoT projects, rapid prototyping, and educational purposes. Its compact design and modularity allow developers to quickly build and deploy applications.








| Feature | Specification |
|---|---|
| Microcontroller | ESP32-D0WDQ6-V3 (dual-core, 240 MHz, Wi-Fi, and Bluetooth 4.2) |
| Display | 2-inch IPS touchscreen (320x240 resolution) |
| Flash Memory | 16 MB |
| RAM | 8 MB PSRAM |
| Power Supply | 5V via USB-C or 3.7V via built-in 390 mAh LiPo battery |
| Connectivity | Wi-Fi 802.11 b/g/n, Bluetooth 4.2 |
| Built-in Sensors | IMU (MPU6886), RTC (BM8563), microphone, vibration motor |
| Expansion Ports | GPIO, I2C, UART, SPI, and M-Bus (modular interface for stacking extensions) |
| Dimensions | 54 x 54 x 16 mm |
| Operating Temperature | -20°C to 70°C |
The M5Stack Core 2 provides a GPIO header and an M-Bus interface for connecting peripherals. Below is the pin configuration:
| Pin Number | Pin Name | Functionality |
|---|---|---|
| 1 | GND | Ground |
| 2 | 5V | 5V Power Output |
| 3 | GPIO21 | I2C SDA |
| 4 | GPIO22 | I2C SCL |
| 5 | GPIO23 | SPI MOSI |
| 6 | GPIO19 | SPI MISO |
| 7 | GPIO18 | SPI SCK |
| 8 | GPIO33 | ADC / GPIO |
| 9 | GPIO32 | ADC / GPIO |
| 10 | GPIO25 | DAC / GPIO |
| 11 | GPIO26 | DAC / GPIO |
| 12 | GPIO27 | GPIO |
| Pin Name | Functionality |
|---|---|
| GND | Ground |
| 5V | 5V Power Output |
| TX | UART TX |
| RX | UART RX |
| I2C SDA | I2C Data Line |
| I2C SCL | I2C Clock Line |
Powering the Device:
Programming the Device:
Connecting Peripherals:
Touchscreen and Built-in Sensors:
Below is an example of how to use the M5Stack Core 2 to display text on the touchscreen and read data from the built-in IMU sensor:
#include <M5Core2.h> // Include the M5Stack Core 2 library
void setup() {
M5.begin(); // Initialize the M5Stack Core 2
M5.Lcd.setTextSize(2); // Set text size for the display
M5.Lcd.setCursor(10, 10); // Set cursor position
M5.Lcd.println("Hello, M5Stack Core 2!"); // Display text on the screen
// Initialize the IMU sensor
if (M5.IMU.Init() != 0) {
M5.Lcd.println("IMU initialization failed!");
} else {
M5.Lcd.println("IMU initialized successfully!");
}
}
void loop() {
float accX, accY, accZ;
M5.IMU.getAccelData(&accX, &accY, &accZ); // Read accelerometer data
// Display accelerometer data on the screen
M5.Lcd.setCursor(10, 50);
M5.Lcd.printf("Accel X: %.2f, Y: %.2f, Z: %.2f", accX, accY, accZ);
delay(500); // Wait for 500 ms before updating
}
Device Not Detected by Computer:
Touchscreen Not Responding:
IMU Sensor Not Working:
Battery Not Charging:
Q: Can I use the M5Stack Core 2 with MicroPython?
A: Yes, the M5Stack Core 2 supports MicroPython. You can flash the MicroPython firmware and use the M5Stack libraries for Python.
Q: What is the maximum current output of the GPIO pins?
A: Each GPIO pin can source or sink up to 12 mA. For higher currents, use external drivers or transistors.
Q: Can I stack additional modules on the M5Stack Core 2?
A: Yes, the M-Bus interface allows stacking compatible M5Stack modules, such as GPS, LoRa, or relay modules.
Q: Is the M5Stack Core 2 compatible with Arduino libraries?
A: Yes, it is fully compatible with most Arduino libraries, especially those designed for the ESP32 platform.