Painless Mesh on M5Stack Core2

Introduction: Painless Mesh on M5Stack Core2

About: I'm an electrical engineer with an interest in making magic happen at the push of a button. Sometimes you let the magic blue smoke out instead, though.

In this project, I combine the touch.ino example included with the M5Core2 library and the basic.ino example included with the Painless Mesh library to demonstrate the mesh network capabilities of the M5Stack Core2. The result is touchWithPainlessMesh.ino, which enables M5Stack Core2 hardware to broadcast color values based on touch point data to other M5Stack Core2 hardware on the network. Other hardware on the network will change their screen background color according to the color values they receive, and they display that value on their screens, along with the number of nodes on the network and the last touch point.

You can find documentation about M5Stack Core2 hardware (and other M5Stack products) at this link:

https://docs.m5stack.com/#/

Info about the Painless Mesh library can be found on their GitLab page at this link:

https://gitlab.com/painlessMesh/painlessMesh

If you aren't familiar with Arduino, you can get started here:

https://www.arduino.cc/en/software

Supplies

Step 1: M5Stack Core2 Setup

Follow the M5Stack Core2 Quick Start with Arduino guide at this link:

https://docs.m5stack.com/#/en/arduino/arduino_core...

Once you have completed this guide, test it out by installing and running one of the examples included under the "Examples for M5Stack-Core2" header at File->Examples in the Aurdino IDE.

If you can open, build, and run one of the examples, you're good! You can find more detail on teh M5Stack Core2 libraries at the dedicated GitHub page here:

https://github.com/m5stack/M5Core2

Step 2: Set Up Painless Mesh

Follow this guide on installing additional Arduino libraries:

https://www.arduino.cc/en/guide/libraries

and use info from the Panless Mesh GitLab page here:

https://gitlab.com/painlessMesh/painlessMesh

to install the Painless Mesh library for ESP32 devices. After installing the library, you can test it by building the basic.ino example found at File->Examples->under the "Examples from Custom Libraries" head->Painless Mesh.

But be careful! The M5Core2 board setup uses serial communications to drive the display. To get the basic.ino example to build for M5Stack Core2 hardware, you will have to comment out all of the serial lines in the file.

Step 3: Download and Test TouchWithPainlessMesh.ino

Follow the link below to my GitHub, where you can grab touchWithPainlessMesh.ino:

https://github.com/coleminer31/touchWithPainlessMe...

If you properly set up your Arduino IDE and installed the required additional libraries in the previous steps, you should be able to build this .ino file and run it on your M5Stack Core2 hardware!

Once you have the file working, you can use it as a launching point to power your M5Stack Core2 mesh networking projects. Let me know in the comments if you end up using it in anything!

Be the First to Share

    Recommendations

    • CNC and 3D Printing Contest

      CNC and 3D Printing Contest
    • Puzzles Challenge

      Puzzles Challenge
    • Lamps Challenge

      Lamps Challenge

    Comments