Skip to main content Skip to local navigation

Trying out the M5Stack

M5Stack Core2 AWS module with one of the "out of the box" screens.
M5Stack Core2 AWS module with "out of the box" screen settings.

My colleague, Eric Prandovszky, has been discussing the M5Stack system with me for a while and acquired a few modules to us to try out. Today I tried out the M5Stack Core 2 AWS module. My objective is to see if we can program it using the legacy Arduino 1.x IDE on macOS with Apple Silicon chips as they are popular within the university community.

The Arduino instruction page for the M5Stack says that I will require the installation of a specific USB driver. But it's not clear if it's the

  • CP2104, or the
  • CH9102

variant that is required. Actually, according to the Core2 AWS page it's the CP2104. Yes. It's confirmed in my computer's system report:

system report on macOS shows I have a CP2014 USB driver already installed.
This module has a CP2014 USB chip in it... and it appears that I already had the driver installed, as per my macOS system report.

I believe that that driver was either already present on the Mac or it was installed when I installed the driver for the Grove Beginner Kit for Arduino, which apparently uses the same driver. According to the documents for the board we can have both drivers installed, so if in doubt install both.

Next up, it's time to update the Arduino IDE as per the M5Stack page. There's actually a specific page for the Core2 AWS module.

In Settings or Preferences, we set a new lookup page for source files:

Adding the webpage for the source files related to this family of boards via the "additional boards manager URL" setting.  We added this link: Added: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/arduino/package_m5stack_index.json
The support files for M5Stack don't come with the Arduino IDE by default, nor are they in the standard set of download options. So we have to add a link to a "third party" source of files. Added: https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/arduino/package_m5stack_index.json

And then Tools -> Boards -> Boards Manager

then search for m5stack:

M5Stack support files found in Boards Manager.
M5Stack... getting ready to download...

Downloading...

Downloading the M5Stack files
installing..

and installed.

M5Stack files installed. But there's more to be done...

and now I can spot the M5 board options in the Tools -> Board menu:

Once I select an M5 board, I can then use the examples found in File -> Examples, as we can see here:

But now I need to get specific files for the M5Stack Core 2 board. So, I open up the Arduino Library Manager and type in m5core2:

Within the Library Manager I search for files specifically related to the M5Core2.

which generates a very, very long window that I can't navigate because it's taller than my 14" screen:

the menu is so long that I can't read the bottom (or select the "ok" button that I assume is there...)

I couldn't see the bottom, so, in desperation, I then pressed tab-space or space-tab and maybe enter and then it started downloading...

download of the M5Stack Core2 files started...
download of the M5Stack Core2 files done.

I then opened a blank Arduino project and pasted in the following sample code from the Core2 page:


#include <M5Core2.h>

/* After Core2 for AWS is started or reset
the program in the setUp () function will be run, and this part will only be run once.
在 Core2 for AWS 启动或者复位后,即会开始执行setup()函数中的程序,该部分只会执行一次。 */
void setup(){
  M5.begin();  //Init Core2 for AWS.  初始化 Core2 for AWS
                    /* Power chip connected to gpio21, gpio22, I2C device
                      Set battery charging voltage and current
                      If used battery, please call this function in your project */
  M5.Lcd.print("Hello World"); // Print text on the screen (string) Print text on the screen (string)
}

/* After the program in setup() runs, it runs the program in loop()
The loop() function is an infinite loop in which the program runs repeatedly
After the program in the setup() function is executed, the program in the loop() function will be executed
The loop() function is an endless loop, in which the program will continue to run repeatedly */
void loop() {

}

Once pasted in I then chose the right serial port via the Tools->Port menu:

USB port selected.

compiled...

compiling...

and then uploaded to the board....

program upload ...

and it worked.

Hello World appears on the screen.

Conclusion

The M5Stack is a really, really interesting system. Lots of compelling features. I can see why hobbyists, engineers and students will want to use it. That said, at this stage, this is a whole lot more work than a regular Arduino to get set up and is, as I've seen in intro videos online, not an appropriate "first board" for novices. There are too many finicky steps where things can go wrong. That said, the steps are clear for someone with experience. They're doable. And it's cool that it works. Hats off to the M5Stack people for making this work in the Arduino IDE.

I'm really looking forward to seeing how this can be integrated into some other projects. The ESP32 at the core of the M5Stack is really something else. The potential for LoRA projects, for music projects, for weather stations and things that integrate with Lego Technic... wow.

I'm jazzed about the potential for M5Stack. They're filled with features, are priced competitively and integrate with both existing tools and new ones.


a pen

James Andrew Smith is a Professional Engineer and Associate Professor in the Electrical Engineering and Computer Science Department of York University's Lassonde School, with degrees in Electrical and Mechanical Engineering from the University of Alberta and McGill University.  Previously a program director in biomedical engineering, his research background spans robotics, locomotion, human birth and engineering education. While on sabbatical in 2018-19 with his wife and kids he lived in Strasbourg, France and he taught at the INSA Strasbourg and Hochschule Karlsruhe and wrote about his personal and professional perspectives.  James is a proponent of using social media to advocate for justice, equity, diversity and inclusion as well as evidence-based applications of research in the public sphere. You can find him on Twitter. Originally from Québec City, he now lives in Toronto, Canada.