M5Stack is a company engaged in the production of hardware and software in the field of the Internet of Things (IoT). Their most famous product series is the stackable devices, hence the name. These devices can be microcontroller boards, development boards with screens, sensors, and more. There are various solutions available with different sizes, power, and hardware functionalities (Stack, Stick, Atom). The common feature is that they can be stacked together. This allows for ready-made solutions suitable for different needs and projects. We obtained the Core2 from M5Stack, which is a standalone and complete device.
One impressive aspect of Core2 is the availability and completeness of the hardware and software created by M5Stack...
The Core2 is a compact device, measuring approximately 54x54x16 millimeters and enclosed in a white plastic casing. At the heart of the system lies the Espresif ESP32-D0WDQ6-V3 microcontroller. This dual-core 32-bit Xtensa LX6 chip operates at a frequency of 240 megahertz. M5Stack has added additional memory, including 16 megabytes of flash memory and 8 megabytes of PSRAM.
Unlike typical ESP32 modules found in the market (with onboard antennas), the Core2 doesn't follow that form factor. Instead, it provides an interface for an external antenna, allowing the manufacturer to have flexibility in antenna design. In this case, M5Sttack have opted for a 3D antenna, which is clearly a superior solution compared to a printed antenna. The ESP32 itself can connect to Wi-Fi and Bluetooth, although only one radio can be used at a time, with both sharing the same antenna.
Core2 utilizes a USB-C interface for programming and power supply, which uses the CH9102F UART for communication with a computer and is equipped with a circuit for automatically downloading user programs. There is also a JST connector on the board for the same purpose. It is worth noting that M5Stack can be stacked, and the USB interface can be extended using a cable. Core2 can be powered by a battery, and surprisingly, it is equipped with a 390 milliamp-hour lithium-ion battery integrated into the bottom gray casing cover. The AXP192 chip is responsible for battery management, and this programmable circuit is connected to the ESP32 chip via the I2C interface. The chip controls power consumption and notifies the status through the PWR LED. Additionally, it also allows for device shutdown through software. The SY7088 is used as a boost converter. There are two buttons on the casing, 'RST' and 'PWR', with the latter connected to the AXP192. Furthermore, the Core2 casing is secured with internal hex screws and comes with an accompanying wrench with a data cable.
Core2 comes with a rich set of features, and the bottom cover is labeled with tags. Despite being small, each aspect of the device is clearly marked, including pin layouts and other identifiers. If Core2 is used as a clock, it is equipped with the BM8563 real-time clock (RTC) chip, onnected to the ESP32 via the I2C interface. We haven't utilized the RTC functionality yet, but there are corresponding libraries available on the Arduino IDE. Additionally, there is a microSD card slot, a vibration motor, and a speaker. The speaker faces the NS4168 I2S audio driver, providing excellent sound effects. The motor is directly connected to the AXP192. In Core2, the AXP192 plays a more important role, with many EN pins connected to it. This applies to the NS4168, BM8563, and even the LED.
However, the most notable feature is undoubtedly the 2-inch color screen with an integrated capacitive touchscreen (FT6336U). The screen has a resolution of 320x240 pixels and is driven by the ILI9342C driver. We are very pleased with the screen display; although it may not compare to smartphone screens, it is excellent for the purpose of a development board. If you find that the screen calibration and touch sensitivity are not satisfactory, you can download M5TOOL from the official DOCS page to upgrade the firmware. There are three clearly marked touch areas below the screen that can be programmed as needed.
Core2 is equipped with two expansion ports. The smaller four-pin Grove on the side is actually an I2C interface. Grove is a variant of Seeedstudio, similar to QWIIC, STEMMA, easyC, and others. However, unlike other listed variants, M5Stack's Grove has a wider pin spacing and is not compatible with other brands. At the bottom, there is a large 2x15 female header, which is connected to the unused pins of the ESP32. All labels are clearly printed on the bottom, and Core2 can be powered using regulated voltage through the 5V pin. This header can also be used to stack additional modules, and these modules can have any functionality. Core2 comes with a smaller base (M5GOBottom2) that can fit perfectly into the casing and act as a cover for the header. It features the MPU6886 and SPM1423 chips. The former is a motion-tracking sensor that combines a three-axis accelerometer and gyroscope, while the latter is a microphone.
All M5Stack development boards are available in the ESP32 package in the Arduino IDE. For full hardware functionality, M5Stack provides corresponding Arduino libraries. However, M5Stack recommends adding special support through the JSON software package:
which helps reduce the hassle when programming and interacting with the internal hardware of Core2. The same approach applies to libraries added for the specific hardware used, such as M5Core2, through "Include Library -> Manage Libraries...". The list of libraries to be installed is quite long. Hardware management is divided into five sections: AXP192, CORE2 LCD, Button, TOUCH, and RTC, each with its own corresponding and well-documented library available. For example, printing "Hello World" typically requires only a few lines of code:
#include <M5Core2.h>
Void setup(){
M5.begin();
M5.Lcd.print("Hello World!");
}
Void loop(){
}
The graphics API does not adhere to the familiar AdafruitGFX, but it has very detailed documentation and allows for creative freedom. It enables drawing various geometric shapes and also supports loading bitmaps from the microSD card. The documentation page (DOCS) is highly detailed, and we really have no complaints in this regard.
Arduino is not the only starting point for learning programming with this device. M5Stack offers UIFlow, MicroPython, and .NET nanoFramework as alternative options. MicroPython does not have a dedicated compiler but can utilize the general compiler of the ESP32. We are not familiar with this approach and have not had any experience with it. However, the most interesting option is undoubtedly UIFlow (www.flow.m5stack.com). This "programming language" is actually a visual "blocks" language. If you recall our discussion about BBC micro:bit and MakeCode, there are many similarities here. It's similar to MIT App Inventor as well. It's a visual block-based approach but based on Python. Above the toolbar, besides the project name, there is a tab to switch between the "block world" and the "Python world" editors. Before any programming, you need to download the M5Burner tool, which is used to load the necessary firmware and the interface for interacting with the "blocks" into the Core2, as well as local network data. We know that these parameters are not cleared when loading user programs. In addition to input parameters, M5Burner also displays the API key, which is important for establishing a connection between UIFlow and Core2.
Let's continue discussing UIFlow. The top toolbar of UIFlow contains various tools and shortcuts. Here, you can open new projects, save existing projects, and more. However, the most important option is "Settings," where you can select the device, port, and enter the API key. After that, you can choose whether to connect Core2 to the computer via a data cable or program it without connecting the data cable. Yes, Core2 supports wireless programming (Over the Air, OTA), similar to MikroElektronika's CodeGrip (although CodeGrip is actually something else). After opening Core2, three options are displayed on the screen: App, UIFlow, and Setup. We are interested in the second option, where we can choose the programming mode, either USB or Wi-Fi. We choose Wi-Fi and disconnect the USB cable from Core2. There is a detailed tutorial on the assembly of "blocks" on the DOCS page, so we won't go into detail here. The UIFlow interface consists of a left section, which can be called a graphical drag-and-drop screen designer, and the middle section is a strip of basic blocks that we can simply drag into the editor on the right. Once the "construction" is complete, the "modules" are loaded onto Core2 almost instantly (in less than a second) by clicking the "Run" button.
We are absolutely thrilled with the availability of M5Stack in terms of hardware and software. The efforts put into it have yielded significant results. It is fascinating, especially with Core2, as it can be used directly as a finished product without any modifications. For instance, it can display data from a server and more, without even requiring a case. It is evident that it can be flexibly stacked according to needs. What's even more interesting is that it can be programmed anywhere as long as it is connected to the internet. We highly recommend it without a doubt.