News
M5Stack News.

On November 18, 2024, M5Stack opened its doors to individual visitors for the first time. More than 70 visitors from all around the world attended the event, with some showcasing their projects built with M5 products or sharing their stories with M5Stack.M5Stack Open Day 2024The event began at 3:00 PM, with many visitors checking in and receiving their gifts—custom T-shirts featuring the M5Stack logo. After a group photo, the first agenda kicked off: The Factory & Office Tour.

M5Stack Factory and Office Tour

The visitors were divided into three groups, with introductions provided in Chinese, English, and Japanese. M5Stack operates an all-in-one facility where product design, production, packaging, quality control, marketing, and shipping are seamlessly managed under one place. Visitors could take a close look at the whole flow.Factory of M5StackIn the show board area, we display all the products we've created so far, including the classic 5x5 stack series—such as M5Basic Core, M5Core2, M5Core3, and Stick series—like the M5StickC, along with the Stamp Series (M5Cardputer, M5StampFly), and the Atom series (M5Atom Echo), among others. M5Stack’s CEO, Jimmy Lai, also explains "What is M5Stack?"M5Stack product show boardM5Stack is an open-source hardware IoT solution provider, primarily focused on products built around the ESP32. We also offer a range of accessories and our own visual programming platform, UIFlow. The "M" in M5Stack stands for Module, "5" represents the 5x5 cm size, and "Stack" refers to their stackable design. 

M5Stack is committed to delivering convenient, stackable and easy-to-use development components and tools, with at least one new product every Friday, we launch over 50 new products every year. We provide not only standard products, also customized products. Our partner includes Amazon, Microsoft, Arduino, SONY, etc.

Projects or Stories with M5Stack

 After the tour, it’s time for the Meetup. This year, we have 9 speakers. Jimmy began by sharing the company’s history, followed by presentations from the speakers. TAKASU Masakazu shared the success stories of M5Stack in Japan, where the Japanese market accounts for 35% of M5Stack’s global sales. Many companies and schools in Japan use M5Stack products, and you can even find books on how to use M5Stack products on Amazon. TAKASU Masakazu share the M5Stack's successful story in JapanOther speakers introduced their innovative projects, including the Creative Dot Matrix Clock, the M5Unified Library, M5Cuffbox, and the Blue Tears Incubator, how to make stack-chan bigger, etc.speaker shows his 3 projects using M5stack's productIt was a truly enjoyable experience to come together with M5Stack fans from all over. We appreciate everyone’s enthusiasm and participation, and we’re already looking forward to welcoming you again next year. See you then!M5Stack Open Day 2024

2024-11-28

Time flies, and 2023 has come to an end. M5Stack's products and services have accompanied users worldwide throughout the year. 2023 was a year of continuous innovation for M5Stack, with 76 new products released at a rate of one per week. As we set sail for 2024, let's look back at the brilliance of the past year and unveil the top 10 best-selling products of 2023!

 1. ATOM LITE

Once again, Atom Lite tops this year's list of best-selling products, following on from last year's success. Launched in 2020, Atom Lite's outstanding features and enduring vitality have won over a wide range of users worldwide.

Atom Lite user case @Peter Neufeld

Atom Lite is a compact development board, measuring only 24 * 24mm, which provides more GPIO pins for users to customize freely. It is particularly suitable for embedded smart hardware development.

This development board uses the ESP32-PICO-D4 solution as the main controller, integrating Wi-Fi module and built-in 3D antenna. It has 4MB of SPI flash memory, as well as Infra-Red (IR) infrared, RGB LED, buttons, and GROVE/HY2.0 interfaces. Additionally, the onboard Type-C interface enables fast program uploading and downloading, and there is an M2 screw hole on the back for fixation.

2. ATOM ECHO

Also released in 2020, Atom Echo has undoubtedly become a dark horse product this year. In 2023, with the power of Home Assistant and ChatGPT, the Atom Echo has sold out again and again. The ability to connect to ChatGPT, act as a personal voice assistant with customisable wake words, and do it all for just $13 makes it a must-have smart home device.

Atom Echo voice assistant use case @Home Assistant

Atom Echo is a programmable smart speaker. Despite its small size of only 24 * 24 * 17mm, it boasts impressive functionality. With the built-in wireless capabilities of the ESP32, it can easily connect to devices such as smartphones and tablets for seamless music playback. It can also stream specified media music via Wi-Fi.

To facilitate voice functionality, Atom Echo integrates an STT (Speech-to-Text) service internally. Users only need to burn specified firmware to enable this feature and perform various operations through voice commands. Users can also write code to integrate Atom Echo with cloud platforms like AWS and Google, utilizing the built-in microphone and speaker for voice interaction, enabling certain AI capabilities, such as voice control, intelligent conversations, and IoT functionalities.

The speaker has a built-in RGB LED (SK6812) that visually displays the connection status. In addition to being used as a smart speaker, it still retains the control capabilities of the ATOM series and can be connected to external devices via the GROVE interface. The M2 screw hole on the back facilitates secure installation.

3. M5STICKC PLUS

M5StickC Plus is a powerful, portable and expandable development board. Since its release in 2020, it has consistently been at the top of various best-seller lists. At the end of 2022, we welcomed M5StickC Plus2 and officially said goodbye to M5StickC Plus.

M5StickC Plus is a powerful microcontroller module that is compact and easy to carry. Despite its small size, M5StickC Plus integrates rich hardware resources, including infrared, RTC, microphone, LED, IMU, buttons, buzzers, and PMU.

M5StickC Plus is equipped with the ESP32-PICO-D4 processor, providing powerful computing and communication capabilities. It features a 1.14-inch color TFT display that can show images, text, and user interfaces, offering a good interactive experience. Additionally, M5StickC Plus has a built-in battery for standalone use, eliminating the need for an external power source.

The module is equipped with various sensors, including an accelerometer, gyroscope, and magnetometer, enabling it to sense and measure object motion and environmental conditions. It also has Wi-Fi and Bluetooth connectivity, allowing data transmission and remote control with other devices. The interface supports HAT and Unit series products. This compact and exquisite development tool inspires endless creative possibilities.

4. M5CORE2

M5Core2 is the second-generation host of the M5Stack Core series, featuring an ESP32 chip and a touchscreen. It is known for its easy stacking, expandability, and rapid development capabilities. Since its release in 2020, Core2 has consistently been a hot seller in both domestic and international markets, loved by a large number of users. Amazon Web Services (AWS) and M5Stack have collaborated to launch Core2 for AWS. Now, we have the Core2 V1.1 version.

M5Core2 is a versatile development kit with a 2-inch IPS touchscreen display. It is built around the ESP32 microcontroller, which provides Wi-Fi and Bluetooth connectivity. The Core2 module offers a variety of built-in features, including an accelerometer, gyroscope, magnetometer, speaker, microphone, and more.

The development kit supports UIFlow, a graphical programming interface, as well as Arduino and MicroPython. This allows users to choose their preferred programming language and easily develop applications. The modular design of M5Core2 enables stacking of additional modules, called Units, on top of the base module, expanding its capabilities and creating custom projects.

M5Core2 also includes a built-in 390mAh battery, enabling portable and standalone use. It has a USB Type-C interface for charging and programming, as well as an SD card slot for extended storage.

5. ULTRASONIC I2C Unit

Ultrasonic I2C Unit is an ultrasonic ranging sensor with an I2C communication interface. The hardware features the RCWL-9620 ultrasonic ranging chip paired with a 16mm probe, enabling precise ranging within a range of 2cm to 450cm (with an accuracy of ±2%). As an I2C slave device, the sensor can share the bus resources with other I2C devices, allowing for efficient use of IO pins. It is ideal for applications such as obstacle avoidance in robots and liquid-level detection.

 

6. ENVIII Unit

ENV III is an environmental sensor that integrates the SHT30 and QMP6988 sensors, used for detecting temperature, humidity, and atmospheric pressure data. The SHT30 is a high-precision, low-power digital temperature and humidity sensor that supports the I2C interface (SHT30: 0x44, QMP6988: 0x70). The QMP6988 is an absolute pressure sensor designed for mobile applications, known for its high accuracy and stability, making it suitable for environmental data collection and monitoring projects.

 

7. AtomS3

AtomS3 is a highly integrated programmable controller based on the ESP32-S3 main controller. It features an ESP32-S3 main controller with built-in Wi-Fi capability and an 8M onboard flash memory. The controller also includes a 0.85-inch IPS screen with programmable buttons below it. Additionally, it is equipped with a 5V to 3.3V circuit, a 6-axis gyroscope sensor (MPU6886), an onboard Type-C interface (for power and firmware download), an HY2.0-4P expansion port, and six GPIO pins and power pins reserved at the bottom for easy expansion of various applications.

With a product size of only 24x24x13mm, the AtomS3 is perfect for various embedded smart device applications. It provides powerful functionality and flexible expandability, making it suitable for developing a wide range of embedded systems and smart devices.

8. PIR Motion Unit

PIR Motion Unit is a human infrared sensor unit. It belongs to the "passive infrared detector" category and works by detecting the infrared radiation emitted or reflected by humans or objects. When infrared radiation is detected, it outputs a high-level signal and maintains a delay for a certain period (keeping the signal high and allowing for repeated triggering) until the trigger signal disappears (returns to a low level). The PIR Motion Unit is suitable for various applications that require detecting human activity and motion, including security, automation, energy management, and people counting.

9. BASIC V2.7

Basic is the first-generation host of M5Stack, offering high cost-effectiveness and a rich collection of case resources. Through continuous optimization and development, it has now iterated to the V2.7 version.

Basic V2.7 features a 2.0-inch color TFT LCD screen with a resolution of 320x240, which can display graphical interfaces and text information. It is also equipped with three programmable buttons, a programmable touchscreen, a speaker, and a set of expansion pins to support the connection and expansion of various peripheral devices.

This development board uses the ESP32 Internet of Things chip, integrates Wi-Fi capability, and has 16MB of SPI flash memory. As a low-power dual-core processor, it performs exceptionally well in various application scenarios.

10. ATOM U

ATOM U is a compact and flexible Internet of Things voice recognition development board. It uses the Espressif ESP32 main control chip with two low-power Xtensa® 32-bit LX6 microprocessors, operating at a high frequency of up to 240MHz. ATOM U integrates USB-A interface, IR emitter, and programmable LED lights, allowing for plug-and-play convenience for program uploading, downloading, and debugging. It also includes a Wi-Fi module and a built-in digital microphone (SPM1423 PDM) for clear audio recording, making it suitable for various IoT human-machine interaction and speech-to-text (STT) input recognition scenarios.

ATOM U supports low-code development and provides features such as UIFlow graphical programming platform, script programming, no-compilation execution, and cloud pushing. It is fully compatible with mainstream development platforms such as Arduino and ESP32-IDF.

ATOM U has a high level of integration, including USB-A programming/power interface, IR emitter, programmable RGB light, and buttons. The professionally tuned RF circuit ensures stable and reliable wireless communication quality.

M5Stack's success is inextricably linked to our community's support, and we thank you for it. We wish you a Happy New Year! We will continue to provide more and better services to meet your needs in the coming year.

2024-01-03

 The Build2gether Inclusive Innovation Challenge, hosted by Europe's top university ETH Zurich and organised by the world-renowned hardware community Hackster.io, recently concluded. The competition, in collaboration with partners M5Stack, Google, Blues, PCBWay and Useful Sensors, offered a total prize pool of $40,000.

This global competition aimed to encourage people to use innovative technology to help individuals with physical disabilities overcome challenges in their daily lives and build a more inclusive and equitable future. The competition received a total of 194 submissions, with many participants choosing M5Stack products. In this blog post, we have selected some of the award-winning projects to explore the development stories behind them!

 1.Haptic Vision Assist

This project uses M5Stack's controllers and sensors to provide simple, cost-effective and efficient obstacle warnings using infrared laser and haptic technology to visually impaired users to aid their mobility.

The author, Colonel Panic, witnessed the daily challenges faced by visually impaired people while living with his fiancée and her son, both of whom have inherited Retinitis Pigmentosa, a genetic eye disease. Motivated to help improve the lives of visually impaired people, Colonel Panic learned to use M5Stack products and UIFlow within a year. To quickly become proficient in the use of M5Stack, he challenged himself to create a prototype for a new idea every day.

Project link: https://www.hackster.io/colonelpanic/haptic-vision-assist-ac670f

 

2. Wall Early Warning System for Swimming Laps

This project uses Bluetooth beacon technology to warn visually impaired users when approaching the pool wall, preventing accidental collisions due to poor visibility while swimming.

Have you ever hit a wall while swimming? What about doing the backstroke? Ouch! Now imagine having poor eyesight; everything becomes even more challenging! Inspired by personal experience and discussions with disabled mentors after joining a competitive group, author David Barrett came up with the idea for this project.

Project link: https://www.hackster.io/3DPrinterDoctor/wall-early-warning-system-for-swimming-laps-4ba356

 3.Intercom and Smart Controller Mounted on Wheelchair and Roll

This project allows people who use wheelchairs or walkers to receive real-time doorbell notifications via Telegram, see who is at the door, and remotely control door access.

Imagine hearing the doorbell ring and feeling nervous. You might even rush to open the door. These actions may seem simple for able-bodied people, but they are inconvenient for people who use wheelchairs. This project effectively addresses this pain point.

Project link:

https://www.hackster.io/ecasti/intercom-and-smart-controller-mounted-on-wheelchair-and-roll-9a4691

 4. Motion Controller for People with Limited Arm Function

This project focuses on developing a motion controller for gaming purposes specifically designed for individuals with limited arm function due to conditions such as muscular dystrophy. For PC gamers, the mouse is a crucial peripheral device. However, mice require a flat surface to function properly and demand users to sit in front of a desk, constantly extending their arms, which can be challenging for some individuals with disabilities.

Therefore, Yahya Khalid created a simple controller using the compact AtomS3, which can effectively replace a mouse. With this device, users can adjust sensitivity to meet their specific needs, and hand position or orientation is not limited, accommodating individuals with restricted hand movements.

Project link: https://www.hackster.io/yahya-khalid/motion-controller-for-people-with-limited-arm-function-4e15d3

 5. Cracked road detection for better travel

This project can help people who use wheelchairs to be aware of road potholes in advance to avoid accidental falls while travelling.

One of the challenges faced by wheelchair users is encountering cracked roads, where if the user is not concentrating, they could fall into a pothole and potentially injure themselves. Hendra Kusumah aims to create a solution that is easy to build and program, requires no soldering, and costs less than $50.

Project link:

https://www.hackster.io/hendra/cracked-road-detection-for-better-travel-e00340

6. Cheza Pona

This project is an innovative gaming platform that redefines inclusive skill development, specifically designed for people with disabilities such as cerebral palsy and muscular dystrophy. Cheza Pona provides dynamic and adaptive gaming experiences.

According to a 2017 study by the World Health Organization, only 1 in 10 people with disabilities in low-income countries have access to the assistive technology they need. In response to this challenge, Ryan Kiprotich and Mergery Wanjiru proposed a solution called Cheza Pona, which means "play better" in Swahili. They transformed the typically monotonous physical therapy into an enjoyable gaming experience. Using the low-cost M5StickC, they created a game where players can use the built-in inertial measurement unit sensor to move sideways and avoid blocks in the game to score points.

Project link: https://www.hackster.io/512307/cheza-pona-2d0c47

7. Move-It!

This project turns M5StickC int to an IMU-based gaming device - a small wearable device whose movement can provide input to games.

The project was mainly aimed at developing something small which can help people with Muscular Dystrophy play games without over-exerting and tiring out faster. I won the M5Stack Gift card and ordered the M5StickC and a mini dual button unit. The idea was to use IMU input from the M5StickC as serial data and process it as keyboard input.

Project link: https://www.hackster.io/nvraghavendra2000/move-it-2371ed

 

2023-12-26

Modular IoT system construction offers high flexibility and scalability as the developers can quickly build prototype systems using existing modules to save time in design and development. It assists developers in swiftly developing and validating their concepts and works directly from idea to product, allowing developers to create various types of devices and solutions more quickly and economically.

M5Stack’s products have a stackable design, providing standardized interfaces for easy construction of the system, when combined with the intuitive visual programming interface of UIFlow, it significantly reduces the technical barriers of system design and development. Even developers with limited hardware and software knowledge can quickly build powerful IoT devices.

Setting up the UIFlow Environment

Taking the MStack Basic as an example, the first step is to refer to the UIFlow firmware burning tutorial and download M5Burner to burn the UIFlow firmware to the controller.

Building an IoT System

If we need to detect air quality. We can stack the PM2.5 Air Quality Module  to the MStack Basic.

Then, in UIFlow, click on "PM2.5" and select "Load Examples" to open the sample code.

Click "Run," and we will see the air quality displayed on the screen.

When we want to drive a stepper motor to actuate certain mechanisms when the PM2.5 concentration is high. We can stack the GRBL  Module.

 

Next, find the code blocks corresponding to the GRBL module in UIFlow.

Set the motor drive mode at the beginning of the code, here we set it to distance mode.

In the main loop of the program, add a condition based on the PM2.5 concentration, using the value stored in SP for simplicity. When the concentration exceeds 55 (μg/m³), the stepper motor starts rotating. When it falls below 55, the stepper motor stops rotating.

Click "Run," and the system will operate as we set.

Conclusion

In summary, the stackable modular design provides a flexible, efficient, and scalable approach to IoT system development. When combined with the visual and user-friendly programming environment of UIFlow, it makes system construction easier, reduces development costs and risks, and facilitates rapid prototyping and feature expansion.

2023-12-14

With the continuous development of the Internet of Things (IoT) technology, an increasing number of devices require remote monitoring and control. In this context, RS485 communication, as a reliable communication protocol, is widely used for data transmission and communication connectivity between IoT devices.

RS485 communication, as a serial communication protocol, offers several prominent advantages:

1. Long-distance transmission: RS485 communication supports transmission over a maximum distance of 1200 meters, suitable for communication needs among IoT devices distributed over larger areas.
2. Strong anti-interference capability: RS485 communication uses differential signal transmission, exhibiting excellent anti-interference capability, ensuring stable and reliable data transmission in industrial environments.
3. Multi-point communication: RS485 supports multi-point communication, enabling the connection of multiple devices to form a network, meeting the inter-device connectivity requirements in IoT.
4. High-speed transmission: RS485 supports data transmission speeds of up to 10Mbps, meeting the data transfer speed requirements of IoT devices.

Applications of RS485 in IoT:

1. Industrial Automation:

In the field of industrial automation, RS485 communication is widely used for data transmission and control connectivity among various devices such as sensors, actuators, and PLCs. Through RS485 communication, these devices can achieve remote monitoring and control, enhancing production efficiency and work safety.

2. Smart Buildings:

In smart building systems, RS485 communication is used to connect various smart devices, such as lighting control systems, HVAC systems, and security systems, enabling data exchange and centralized management among devices. The stability and reliability of RS485 communication enable smart building systems to achieve efficient energy management and intelligent control.

3. Agricultural IoT:

In agricultural IoT applications, RS485 communication can be used to connect soil moisture sensors, weather stations, irrigation systems, and other devices, enabling remote monitoring of farmland environments and precision irrigation to improve crop yield and quality.

Future development of RS485 communication:

In conclusion, RS485 communication, as an important communication means in IoT, provides a reliable solution for data transmission and communication connectivity between different devices through its features such as long-distance transmission, strong anti-interference capability, and multi-point communication. As IoT continues to evolve, we have reason to believe that RS485 communication will continue to play an important role, building a solid bridge for interconnection among IoT devices.

Next, we will use the M5Stack device as an example to demonstrate the application of RS485 communication in IoT. Here we use RS485 HAT, RS485 HAT consists of a 485 automatic transceiver circuit and a DC-DC buck circuit which can drop an input 12V to 5V.

Setting up the Arduino Environment

First, please refer to the Arduino IDE setup tutorial to complete the basic software installation. And then install the `M5Unified and FastLED libraries` in the library manager, or manually clone and install them from the following GitHub links into the C:\Users\PC\Documents\Arduino\libraries  directory:

*M5Unified: (https://github.com/m5stack/M5Unified)

*FastLED: (https://github.com/FastLED/FastLED)

Setting up the Hardware Environment

Devices needed:

1.  ATOM Matrix x1
2. M5StickC Plus x1
3. RS485 HAT x1
4. Tail485 x1
5.120 Ohm plug-in resistor x1
6. RS485 cable x1
7. 12V power supply x1

Operational steps:

1.Connect the RS485 HAT to the M5stickc Plus.

2. Connect the ATOM Matrix to the Tail485.

 3. Connect a 120-ohm matching resistor is needed at the AB end of RS485.

4. Use a 12V power supply.

5. Connect using the RS485 cable.

RS485 Transmitter

Using the following code, we will utilize the M5stickc Plus + RS485 HAT to create an RS485 transmitter. Pressing button A will send control commands via RS485 to control the color of the receiving end's RGB light.

#include "M5Unified.h"

String command[3] = {"RED\n", "GREEN\n", "BLUE\n"};

uint8_t command_index = 0;

 

void setup() {

  M5.begin();

  M5.Display.setEpdMode(epd_mode_t::epd_fastest);

  M5.Display.setFont(&fonts::Font4);

  M5.Display.setTextColor(WHITE);

  if (M5.Display.width() < M5.Display.height())

  { /// Landscape mode.

    M5.Display.setRotation(M5.Display.getRotation() ^ 1);

  }

  M5.Display.startWrite();

  M5.Display.setTextSize(1);

  M5.Display.drawCenterString("M5Stack RS485", M5.Display.width()/2, M5.Display.height()/8);

  M5.Display.drawCenterString("Demo", M5.Display.width()/2, M5.Display.height()/8+20);

  M5.Display.setTextSize(1);

  M5.Display.drawCenterString("btnA send command", M5.Display.width()/2, M5.Display.height()/8+60);

  M5.Display.endWrite();

  Serial2.begin(115200, SERIAL_8N1, 26, 0);

  while (1)

  {

    M5.update();

    M5.Display.startWrite();

    if (M5.BtnA.wasClicked()) {

      command_index++;

      if (command_index > 2)

        command_index = 0;

      Serial2.printf("%s", command[command_index].c_str());

      switch (command_index)

      {

      case 0:

        M5.Display.clear(RED);

        break;

      case 1:

        M5.Display.clear(GREEN);

        break;

      case 2:

        M5.Display.clear(BLUE);

        break;

 

      default:

        break;

      }

 

      M5.Display.setTextSize(1);

      M5.Display.drawCenterString("M5Stack RS485", M5.Display.width()/2, M5.Display.height()/8);

      M5.Display.drawCenterString("Demo", M5.Display.width()/2, M5.Display.height()/8+20);

      M5.Display.setTextSize(2);

      M5.Display.drawCenterString(command[command_index], M5.Display.width()/2, M5.Display.height()/8+60);

      M5.Display.endWrite();

      break;      

    }

  }

}

 

void loop() {

  M5.update();

  M5.Display.startWrite();

  if (M5.BtnA.wasClicked()) {

    command_index++;

    if (command_index > 2)

      command_index = 0;

    Serial2.printf("%s", command[command_index].c_str());

    switch (command_index)

    {

    case 0:

      M5.Display.clear(RED);

      break;

    case 1:

      M5.Display.clear(GREEN);

      break;

    case 2:

      M5.Display.clear(BLUE);

      break;

 

    default:

      break;

    }

  }

 

  M5.Display.setTextSize(1);

  M5.Display.drawCenterString("M5Stack RS485", M5.Display.width()/2, M5.Display.height()/8);

  M5.Display.drawCenterString("Demo", M5.Display.width()/2, M5.Display.height()/8+20);

  M5.Display.setTextSize(2);

  M5.Display.drawCenterString(command[command_index], M5.Display.width()/2, M5.Display.height()/8+60);

  M5.Display.endWrite();  

}

RS485 Receiver

With the code below, we utilize the ATOM Matrix+Tail485 to create an RS485 receiver. The receiver waits for commands sent by the transmitter and changes the color of the RGB LED.

#include "Arduino.h"

#include <FastLED.h>

 

#define NUM_LEDS 25

 

#define DATA_PIN 27

 

CRGB leds[NUM_LEDS];

 

char terminateChar =  '\n';      

const int bufferLength = 100;    

char serialBuffer[bufferLength];

String rx_str;  

 

void setup() {

    FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);

 

    Serial2.begin(115200, SERIAL_8N1, 32, 26);

}

 

void loop() {

    if (Serial2.available()) {

        Serial2.readBytesUntil(terminateChar, serialBuffer, bufferLength);

        rx_str = serialBuffer;

        if (rx_str.indexOf("GREEN") != -1) {

            for (int i = 0; i < 25; i++)

                leds[i] = 0x001000;

            FastLED.show();

        }

        else if (rx_str.indexOf("RED") != -1) {

            for (int i = 0; i < 25; i++)

                leds[i] = 0x100000;

            FastLED.show();

        }

        else if (rx_str.indexOf("BLUE") != -1) {

            for (int i = 0; i < 25; i++)

                leds[i] = 0x000010;

            FastLED.show();

        }

    }

}

2023-11-24

ESP32 CAM is an ESP32 development board with a built-in camera. It is powerful, compact, and suitable for Internet of Things (IoT) projects. It can meet the market's demands for device connectivity, data transmission, and security. The ESP32 CAM offers the following advantages:

Powerful processing capabilities and rich features: ESP32 CAM integrates a high-performance ESP32 chip, providing powerful processing capabilities and various functional modules such as Wi-Fi, Bluetooth, and a camera. This enables easy device connectivity and data processing, meeting the requirements of IoT projects.
Stable wireless connection: ESP32 CAM has a built-in robust Wi-Fi module, offering a stable and reliable wireless connection. This facilitates reliable communication between devices and supports remote monitoring and control functionality.
Flexible device integration: ESP32 CAM has ample GPIO pins and communication interfaces, allowing for flexible integration with other sensors, actuators, and external devices. This simplifies the expansion and customization process of IoT projects.
Security assurance: ESP32 CAM supports secure data transmission and communication protocols such as SSL/TLS. Additionally, being open-source and having an active developer community ensures timely fixes and updates for security vulnerabilities, providing reliable security assurance.

Due to the advantages of the ESP32 CAM, it has a wide range of applications in IoT projects. It can be used in areas such as smart homes, industrial automation, smart agriculture, and smart cities. For example, leveraging the high-performance camera and image processing capabilities of the ESP32 CAM, intelligent video surveillance and facial recognition systems can be implemented.

In the following, we'll use the M5Stack TimerCam as an example and provide a guide to help you set up your own video surveillance project.

We will provide tutorials for four different uses: Web camera, scheduled wake-up capture, push and pull RTSP streaming. However, before getting started, it is necessary to set up the Arduino working environment.

To set up the Arduino environment, we can complete the basic software installation by following the first step in the Arduino IDE environment setup tutorial. And then install the "M5Stack board management" and the "TimerCam-Arduino library" in the Library Manager, or manually clone it from the GitHub link and install it into the "C:\Users\PC\Documents\Arduino\libraries" directory.

1. Set up your webcam

1). Using the code below, we will explain how to initialize the camera, capture a frame of image data, and enable the Webserver Demo for image preview.

// Include the necessary header files

#include "battery.h"

#include "esp_camera.h"

#include <WiFi.h>

#include "soc/soc.h"

#include "soc/rtc_cntl_reg.h"

 

#include "camera_pins.h"

 

//Configure the Wi-Fi information for the camera to connect to

const char *ssid     = "******";

 

const char *password = "******";

 

void startCameraServer( );

 

void setup( ) {

 

    Serial.begin(115200);
    WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);  // disable   detector
    bat_init();
 
    // After starting the TimerCAM, set the power pin to a high level to maintain power supply.
    bat_hold_output();
 
    Serial.setDebugOutput(true);
    Serial.println();
    pinMode(2, OUTPUT);
    digitalWrite(2, HIGH);

 

// Configuration of the camera includes settings for pins, image size, and compression format.
//Setting a large image size or high image quality may result in insufficient memory allocation, leading to initialization failure.
    camera_config_t config;
    config.ledc_channel = LEDC_CHANNEL_0;
    config.ledc_timer   = LEDC_TIMER_0;
    config.pin_d0       = Y2_GPIO_NUM;
    config.pin_d1       = Y3_GPIO_NUM;
    config.pin_d2       = Y4_GPIO_NUM;
    config.pin_d3       = Y5_GPIO_NUM;
    config.pin_d4       = Y6_GPIO_NUM;
    config.pin_d5       = Y7_GPIO_NUM;
    config.pin_d6       = Y8_GPIO_NUM;
    config.pin_d7       = Y9_GPIO_NUM;
    config.pin_xclk     = XCLK_GPIO_NUM;
    config.pin_pclk     = PCLK_GPIO_NUM;
    config.pin_vsync    = VSYNC_GPIO_NUM;
    config.pin_href     = HREF_GPIO_NUM;
    config.pin_sscb_sda = SIOD_GPIO_NUM;
    config.pin_sscb_scl = SIOC_GPIO_NUM;
    config.pin_pwdn     = PWDN_GPIO_NUM;
    config.pin_reset    = RESET_GPIO_NUM;
    config.xclk_freq_hz = 20000000;
    config.pixel_format = PIXFORMAT_JPEG;
    config.frame_size   = FRAMESIZE_UXGA;
    config.jpeg_quality = 10;
    config.fb_count     = 2;
 
// Initialize the camera
    esp_err_t err = esp_camera_init(&config);
    if (err != ESP_OK) {
        Serial.printf("Camera init failed with error 0x%x", err);
        return;
    }
 
    sensor_t *s = esp_camera_sensor_get();
 
//  Initially flip the sensor vertically and adjust brightness and saturatio
 
    s->set_vflip(s, 1);        // flip it back
    s->set_brightness(s, 1);   // up the blightness just a bit
    s->set_saturation(s, -2);  // lower the saturation
 
    // Set Frame Size
    s->set_framesize(s, FRAMESIZE_QVGA);
 
    Serial.printf("Connect to %s, %s\r\n", ssid, password);
 
 
    // Connect WiFi
    WiFi.begin(ssid, password);
 
    while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
    }
    Serial.println("");
    Serial.println("WiFi connected");
 
    // If you don't have access to a Wi-Fi network to connect to, you can switch to using the following code to enable the camera to create its own Access Point (AP)
    // WiFi.softAP(ssid, password);
    // IPAddress IP = WiFi.softAPIP();
    // Serial.print("AP IP address: ");
    // Serial.println(IP);
 
    // enable the Web server
    startCameraServer();
 

}

 

void loop() {

// After startup, you can view the IP address assigned to the camera by serial communication. Here's the code that will continuously print the IP address for easy viewing

 

    Serial.print("Camera Ready! Use 'http://");

    Serial.print(WiFi.localIP());

    Serial.println("' to connect");

 

    delay(1000);

    digitalWrite(2, HIGH);

    delay(1000);

    digitalWrite(2, LOW);

}

2). Modify the code with the WiFi information section, and compile and burn the program to the device. Then, you can use the serial monitor to view the IP address assigned to the camera.

WiFi connected

Camera Ready! Use 'http://192.168.31.11' to connect

For devices on the same network, you can access 192.168.31.11 through a web browser to access the control page, where  can obtain real-time images and adjust image properties.

(Note: You need replace the IP address with the actual IP address printed on the serial monitor).

 webcam

2. Scheduled wake-up capture

To achieve scheduled wake-up and capture using the RTC (Real-Time Clock) functionality for extended battery life, you can refer the code below. It captures an image during the period between camera startup and entering sleep mode. You can then transmit the image data to another location using a method such as HTTP POST for scheduled capture.

#include "battery.h"

#include "esp_camera.h"

#include <WiFi.h>

#include "soc/soc.h"

#include "soc/rtc_cntl_reg.h"

#include "led.h"

#include "camera_pins.h"

#include "bmm8563.h"

 

void setup() {

    Serial.begin(115200);

    WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);  // disable   detector

 

    bat_init();

    led_init(CAMERA_LED_GPIO);

    bmm8563_init();

 

    // Configuration of the camera includes settings for pins, image size, and compression format.

// Setting a large image size or high image quality may result in insufficient memory allocation, leading to initialization failure.

    camera_config_t config;

    config.ledc_channel = LEDC_CHANNEL_0;

    config.ledc_timer   = LEDC_TIMER_0;

    config.pin_d0       = Y2_GPIO_NUM;

    config.pin_d1       = Y3_GPIO_NUM;

    config.pin_d2       = Y4_GPIO_NUM;

    config.pin_d3       = Y5_GPIO_NUM;

    config.pin_d4       = Y6_GPIO_NUM;

    config.pin_d5       = Y7_GPIO_NUM;

    config.pin_d6       = Y8_GPIO_NUM;

    config.pin_d7       = Y9_GPIO_NUM;

    config.pin_xclk     = XCLK_GPIO_NUM;

    config.pin_pclk     = PCLK_GPIO_NUM;

    config.pin_vsync    = VSYNC_GPIO_NUM;

    config.pin_href     = HREF_GPIO_NUM;

    config.pin_sscb_sda = SIOD_GPIO_NUM;

    config.pin_sscb_scl = SIOC_GPIO_NUM;

    config.pin_pwdn     = PWDN_GPIO_NUM;

    config.pin_reset    = RESET_GPIO_NUM;

    config.xclk_freq_hz = 20000000;

    config.pixel_format = PIXFORMAT_JPEG;

    config.frame_size   = FRAMESIZE_UXGA;

    config.jpeg_quality = 10;

    config.fb_count     = 2;

 

// Initialize the camera

    esp_err_t err = esp_camera_init(&config);

    if (err != ESP_OK) {

        Serial.printf("Camera init failed with error 0x%x", err);

        return;

    }

 

    sensor_t *s = esp_camera_sensor_get();

 

//  Initially flip the sensor vertically and adjust brightness and saturatio

s->set_vflip(s, 1);        // flip it back

    s->set_brightness(s, 1);   // up the blightness just a bit

    s->set_saturation(s, -2);  // lower the saturation

 

    // Set Frame Size

    s->set_framesize(s, FRAMESIZE_QVGA);

 

    camera_fb_t *fb = NULL;

    esp_err_t res   = ESP_OK;

 

    // Get a frame of image data

    fb = esp_camera_fb_get();

 

    if (!fb) {

        Serial.println("Camera capture failed");

    }

    Serial.println("Camera capture OK");

    // Acquired image data

    uint8_t *data_buffer = fb->buf;

    size_t data_len      = fb->len;

 

    //...................

 

    // You can perform data processing in this section and send it to the server using the HTTP method.

 

    //...................

 

    // Set a 5-second wake-up interval.

    bmm8563_setTimerIRQ(5);

    delay(1000);

}

 

void loop( ) {

    // Power off.

    // The device enters sleep mode and wakes up after 5 seconds to start executing the program from the beginning. (This only applies when powered by a battery.)

    bat_disable_output();

}

3. Push and pull RTSP streaming

RTSP, short for Real-Time Streaming Protocol, is a network transmission protocol used to control the real-time transmission of data in multimedia applications. It is commonly used in conjunction with streaming media servers and clients to achieve real-time streaming and playback of audio and video content. Here is a brief description of the applications of RTSP and the meanings related to push and pull:

RTSP Applications:

Streaming Media Transmission: RTSP is widely used in streaming media applications such as online video streaming, video-on-demand, and video conferencing. It enables clients to work collaboratively with streaming media servers by negotiating session parameters, controlling playback status, and data transmission methods, thus achieving real-time media data transmission and playback.
Surveillance Systems: RTSP is commonly used in surveillance cameras and camera systems, allowing users to remotely monitor video streams over the network. This is particularly useful for home security, enterprise security, and public safety.
Video Conferencing: RTSP is used in video conferencing applications, allowing multiple participants to share audio and video data in real-time, enabling remote collaboration.
Audio Streaming: RTSP not only supports video streaming but also facilitates the transmission of audio streams. This is important for applications such as audio broadcasting and audio conferences.

Push and Pull

Push: Push refers to the process of sending multimedia data (typically audio and video) from a source to the network, allowing other devices or users to access and play it in real-time. Typically, the media source generates data and then pushes it to a streaming media server using a streaming media transfer protocol (such as RTSP, RTMP, HLS, etc.). The process from the source to the server is called "push".
Pull: Pull refers to the process of retrieving multimedia data from a streaming media server and decoding and playing it at the receiving end. Users or client devices request specific media content from the streaming media server using the same streaming media transfer protocol. This process is called "pull".

In summary, RTSP is an essential protocol for real-time streaming transmission widely used in the multimedia domain, enabling users to transmit and play audio and video data in real-time over the internet. Push involves sending media data to the network, while pull involves retrieving and playing media data from the network. Together, they form the core of streaming media services.

Using the Camera as an RTSP Server

By running the examples -> rtsp_stream code, you can configure the device as an RTSP server. Devices on the same network can access the real-time image by using a media player (such as VLC Player) and accessing rtsp://192.168.xxx.xxx:8554/mjpeg/1 (Note: Please replace the IP address with the actual IP address obtained from the serial monitor).

« ..WiFi connected

RTSP URL: rtsp://192.168.2.175:8554/mjpeg/1

LinkedListElement (0x3ffdb9ac)->(0x3ffdb9ac)->(0x3ffdb9ac)

Creating TSP streamer

Created streamer width=640, height=480

Relevant Links

 rtsp_stream relies on the Micro-RTSP library, which can be installed by following the dependency prompts when installing the TimerCam-arduino library. Alternatively, you can manually clone and install it using the GitHub link provided. VLC Player is a powerful media player that we will use for pulling/streaming tests in the subsequent testing phase.

- Micro-RTSP

- VLC player

VLC Player Pull Streaming

Configuration of Streaming Relay Server

Distributing HTTP Streaming Sources

In the previous demo, we used the camera as an RTSP server, but there are limitations in terms of performance, especially when multiple clients want to pull the stream, it can be challenging. In some cases, you may want to distribute media resources to external servers or live streaming platforms, or achieve stronger multi-device access capabilities. In the following, we will use an open-source RTSP server project combined with the ffmpeg tool to implement streaming (forwarding TimerCAM data to the server) and pulling (clients pulling video resources from the server).

Here we need to burn the camera with the first web_cam demo program mentioned at the beginning of the article, and we can directly access the image stream through http://IP:81/stream.

Visit EasyDarwin - Github releases, download the release version to your local machine, and extract it. Run it as a service and start the server. (Note: Please use the sudo command to run it, otherwise, you may not have permission to open the port.)

cd EasyDarwin

sudo ./start.sh

#sudo ./stop.sh 

Then please use ffmpeg to configure forwarding, and use the IP and port used in the previous demo for TimerCAM's running port and IP. The latter is the IP of the RTSP server (EasyDarwin) (default port 554, followed by a customizable ID number).

Note: Before executing this command, make sure to start the camera and ensure that the image can be previewed correctly on the webpage.

ffmpeg -re -i http://192.168.2.175:81/stream -rtsp_transport tcp -vcodec h264 -f rtsp rtsp://192.168.2.89:554/666

After completing the previous configuration, open a browser and enter http://IP:10008 to access the EasyDarwin control page. The default username and password are admin/admin. (Replace IP with the IP address of the Linux host).

By refreshing the page, we can see a new streaming address added to the control page. We can use general media player software such as VLC to fill in the corresponding streaming address to pull the video and locally cache the recording. Additionally, you can use multiple clients simultaneously for streaming playback.

 

Distributing Pull Sources

If the camera is being used as an RTSP server, you can also directly configure the pull forwarding in the EasyDarwin backend. For more details, please refer to the EasyDarwin GitHub repository.

 

2023-10-26

The biggest contributor to indoor air pollution is not formaldehyde or PM2.5 but the often-overlooked carbon dioxide. Once carbon dioxide reaches a certain level, it can pose a serious health risk, and no air purifier can effectively filter it. It is crucial to understand the health hazards, normal ranges, and solutions regarding indoor carbon dioxide concentrations.

What are the typical indoor and outdoor carbon dioxide concentrations? Within the normal range, carbon dioxide is harmless to the human body. In the natural environment, the concentration of carbon dioxide is approximately 0.04% (400 PPM), which may reach around 500 PPM in urban areas. In unoccupied indoor environments, the carbon dioxide concentration usually ranges from 500 to 700 PPM.

At what PPM level does carbon dioxide become harmful to health? The human body is highly sensitive to increases in carbon dioxide, with every 0.5% increase noticeably affecting the body. When the concentration reaches 1% (1000 PPM), individuals may experience stuffiness, lack of concentration, and palpitations. At 1500-2000 PPM, symptoms such as breathlessness, headaches, and dizziness may occur. Concentrations exceeding 5000 PPM can lead to cognitive impairment and confusion.

In real-life scenarios, carbon dioxide concentrations often exceed safe levels. For instance, when two individuals sleep overnight in a sealed bedroom, carbon dioxide concentrations can easily reach 2000 PPM. When the carbon dioxide concentration in an office space reaches 2000 PPM, employees may experience fatigue, lack of concentration, and mental exhaustion. Beyond 2000 PPM, individuals may even feel disinclined to continue working, and their cognitive abilities can significantly decline.

Maintaining good ventilation, regularly opening windows for fresh air and using air purifiers are effective methods of reducing indoor carbon dioxide levels. Among these methods, the carbon dioxide sensor is an important tool.

Today, we are introducing two CO2 measuring sensors for detecting carbon dioxide concentrations: CO2L Unit and TVOC/eCO2 Unit.

CO2L Unit is a digital CO2 concentration detection unit with a low-power mode designed for single-shot measurements. It features the Sensirion SCD41 sensor and a voltage regulator circuit, and communicates via I2C. This unit is suitable for measuring environmental conditions, with a typical accuracy of ±(40 ppm + 5% of the reading) for CO2 measurements. The measurement range for CO2 is 400 ppm to 5000 ppm, and it can also measure ambient temperature and humidity simultaneously.

TVOC/eCO2 mini Unit is a digital multi-pixel gas sensor unit that integrates the SGP30 sensor internally. It is primarily designed for measuring the concentrations of various volatile organic compounds (VOCs) and H2 in the air. Through programming, it allows for the measurement of TVOC (Total Volatile Organic Compounds) and eCO2 (Equivalent Carbon Dioxide) concentrations. The typical measurement accuracy within the measurement range is 15%. The SGP30 sensor communicates using the I2C protocol and has an on-chip humidity compensation feature that can be enabled with an external humidity sensor. The SGP30 also has a built-in calibration function, allowing users to calibrate it based on known measurement sources. Once internally calibrated, the SGP30 provides stable long-term output. Additionally, it's important to note that eCO2 is derived from H2 concentration, so the TVOC/eCO2 mini Unit cannot fully replace a CO2 sensor.

CO2 Monitoring Solution:

Here, we will introduce three methods to monitor the CO2 levels in the environment using the CO2L Unit and TVOC/eCO2 Unit and display the data on M5Stack Basic.

Method one: Use EasyLoader to get started.

This is the simplest and fastest way, let’s get it started!

Steps:

1. Open the documentation for the CO2L Unit  and  TVOC/eCO2 Unit .

2. Download the Easyloader program for each unit, which is a quick verification program.

3. Click to install when the download is complete. 

4. Select the port (here we choose COM34, but it's worth noting that different computers may display different COM ports, so please select the appropriate port), then click "burn" to start the program burning process.

 

It’s downloading and burning now.  Once completed, the screen will display "Successfully".

Then, the sensor will begin collecting carbon dioxide data from the air and display it on the Basic. The display effect will be as shown in the following image.

Method two: using source code in Arduino IDE

Next, I’ll lead the way to burn the firmware using the source code. We will use Arduino IDE as the programming environment.

Program CO2L Unit in Arduino IDE

1. The first step is to install the M5Stack development board in the Arduino IDE, which has been covered in our previous article.

2. Open the official documentation for the CO2L Unit , where we provide information about CO2L Unit and its relative code.

3. At the bottom of the documentation page, there are links to download the Arduino sample code. Since we are using the Core series Basic host today, please click on the first link.

4. Open the link and go to the entire project file.

5. Please click on the "Code" here to download the compressed file.

6. Please extract the compressed file into the "libraries" folder within the Arduino installation directory.

7. Open Arduino IDE, and click File>Examples>M5Unit-ENV>Unit_CO2_M5Core

8. Select the board

Select M5Stack-Core-ESP32 and the corresponding port (in this case, it is COM34, but the COM port may differ on different computers). Click OK.

9. Click the right arrow icon to upload the code.

When the upload is complete, we can see that the M5Stack Basic host screen is already displaying the CO2 concentration, as shown in the picture.

ProgramTVOC/eCO2 Unit in Arduino IDE

Next, we will continue to use the TVOC/eCO2 Unit to display the CO2 concentration.

1. Similarly, the first step is to install the M5Stack development board in the Arduino IDE, which has been covered in our previous article .

2. Open the documentation for the TVOC/eCO2 Unit. You can find information about the product and related code. 

3. At the bottom of the documentation, there is a link to download the code.

4. Open the link and go to the entire project file.

5. Please click on the "Code" here to download the compressed file.

6. Please extract the downloaded installation package into the "libraries" folder within the Arduino installation directory.

7. Open Arduino IDE, and click File>Examples>M5Stack>Unit>TVOC-SGP30

8. Select the board

Select M5Stack-Core-ESP32 and the corresponding port (in this case, it is COM34, but the COM port may differ on different computers). Click OK.

9. Click the right arrow icon to upload the code.

When the upload is complete, we can see that the M5Stack Basic host screen is already displaying the CO2 concentration, as shown in the picture.

Method three: using EasyLoader to get started

Finally, we introduce M5Stack’s graphical programming software UIFlow. It is convenient for those who are not familiar with coding.

1.To begin with, you need to install the firmware burning tool "Burner".

Note that different operating systems require different versions of Burner to be downloaded.

M5Burner_Windows: https://m5burner.m5stack.com/app/M5Burner-v3-beta-win-x64.zip

M5Burner_MacOS: https://m5burner.m5stack.com/app/M5Burner-v3-beta-mac-x64.zip

M5Burner_Linux: https://m5burner.m5stack.com/app/M5Burner-v3-beta-linux-x64.zip

Note:

For macOS users, after installing Burner, please move the application to the "Applications" folder as shown in the following image.

For Linux users, navigate to the extracted file directory and run "./M5Burner" in the terminal to launch the application.

2. Firmware Burning

Double-click to open the Burner firmware burning tool. In the left-side menu, select the corresponding device category and choose the firmware that matches your device, and click the“Download”button.

Connect the device to your computer using a Type-C data cable. Burner will automatically select the corresponding COM port. You can use the default configuration for the baud rate in M5Burner. Click "Burn" to start the burning process.

During the firmware burning stage, you need to enter the WiFi information in the WiFi configuration box. The WiFi information will be burned and saved to your M5Stack device along with the firmware.

Then, click "Start" to begin the burning process. Note: If a timeout occurs during the burning process, you can try lowering the baud rate to 115200.

When the burning log displays "Burn Successfully," it indicates that the firmware has been successfully burned.

If this is the first time burning or if the firmware program is running abnormally, you can click on "Erase" in the top right corner to erase the flash memory. In subsequent firmware updates, there is no need to erase again. However, please note that erasing the flash memory will delete the saved Wi-Fi information and refresh the API key.

3. Obtaining API Key

Please connect your M5Stack device to the computer using a Type-C data cable and select the corresponding COM port.

1). Click on "Configuration" to view the API Key information, which will appear in the configuration box. (Please copy and save the API Key as it will be used as credentials for UIFlow communication going forward).

2). Set the "Start Mode" to "Internet Mode." After completing this configuration, the device will automatically restart and enter online programming mode.

3). For further explanation of other configuration options in the configuration box, please refer to the configuration instructions below.

4. M5Burner Configuration Instructions

If you need to modify the configuration file, please connect your M5 device to the computer using a Type-C data cable and select the corresponding COM port. Then, you can click on "Configuration" to make the modifications.

APIKEY: The communication credentials for M5Stack device when using UIFlow web programming.

Start Mode: Configurable startup mode after booting.

Quick Start: Option to enable quick start to skip the startup interface.

Server: Selection of the server.

WiFi: Configuration of WiFi SSID and password.

COMX: Option to enable COMX.LTE network (this feature requires stacking the COMX.LTE module, for detailed instructions, please refer to the "Network Over COM.LTE Tutorial").

APN: Configuration of APN access point for COMX.LTE module. 

5. After completing the above steps, you can now start using UIFlow for programming.

Enter the UIFlow website URL in your browser: https://flow.m5stack.com/

Here, we will choose UIFlow 1.0 for now, as the list of supported devices for UIFlow 2.0 is still being expanded.

① In Step 3, we have got an API Key, and here we enter it in the bottom-left corner of the screen.

Then the screen will display “Connected”.

② At the "Add Units" section, add the "CO2L Unit" and select "OK."

Click “Load Examples”

④ Click on "Run" or "Download" (running is for testing the code and you can see the results on the host, but the code will not be saved on the device if power is disconnected. Downloading, on the other hand, will save the code on the device, and it will be retained even if power is disconnected. Choose based on your needs. If you choose to modify the code and upload it again, you will need to re-burn the firmware, which is discussed in Step 2).

The device will now start working as shown in the following image.

For the TVOC/eCO2 mini Unit, just follow the same steps as mentioned above, with the difference being the sensor selection during the unit addition. After completing the addition, select the example code, click "Run," and the device will start functioning normally.

Today's tutorial is complete here.

For an introduction to UIFlow statements, you can refer to https://docs.m5stack.com/en/quick_start/m5core/uiflow.

In the future, we will have a dedicated section specifically for explaining UIFlow statements. Stay tuned for that!

2023-09-28

Source: Svet Kompjutera (World of Computers)

Author: Dejan Petrovic

Link: M5Stack Core2 - Slaganje cigala i u mreži - SVET KOMPJUTERA (sk.rs)

Translate: M5Stack

 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:

https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/arduino/package_m5stack_index.json,

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.

2023-09-21

Source: Svet Kompjutera (World of Computers)

Author: Dejan Petrovic

Link: https://www.sk.rs/arhiva/clanak/32212/m5stack-atom-s3-atom-je-zapravo-mali

Translate: M5Stack

Last December, we covered some new products from M5Stack, one of which is the Atom S3. We got our hands on this compact device from M5Stack, and now let's write a few sentences about its introduction. In our article about M5Stack Core2, we mentioned that M5Stack's concept is to combine different microcontrollers, screens, sensors, and actuators through stacking to create a variety of completely different devices. Atom S3 also follows this principle.

esp32 device

This is an incredibly small device, measuring 24×24×13 mm and weighing only about 6.8 g. Without requiring any additional components, it can be used as a stand-alone unit (node) or as part of a larger system to perform various tasks. In fact, Atom S3 provides almost all the necessary functions to act as a control device. The core of this tiny Atom S3 is the ESP32-S3FN8 microcontroller from Espressif. We have previously written about the ESP32-S3, which features a dual-core Xtensa 32-bit LX7 processor with a clock frequency of 240 MHz, 384 kilobytes of ROM, 512 kilobytes of SRAM, and 16 kilobytes of RTC SRAM. Atom S3 sacrifices additional flash memory storage due to its size. With a 3D metal antenna, the Atom S3 can connect to a 2.4 GHz local area network, supporting the 802.11b/g/n standard with data transfer rates of up to 150 Mbps, and supports Station, SoftAP and Station+SoftAP modes.. The Bluetooth version of ESP32S3 chip is 5.0 and it also supports Bluetooth Mesh, making it convenient to communicate with other devices in the network. The data transfer rate of Bluetooth is also noteworthy, reaching up to 24 Mbps per second.

Despite its small size, Atom S3 offers quite a few peripheral devices. The first thing that catches the eye is a compact 0.85-inch LCD screen with a resolution of 128×128 pixels, which is connected to the ESP32-S3 via the SPI interface. The model of this screen is N085-1212TBWIG06-C08. We don't have much data about it, but we can confirm that the display quality is excellent. In fact, ATOM S3 consists of two PCB boards, forming a sandwich structure, with the smaller PCB located below the screen, carrying the MPU6886, which is a high-performance six-axis MEMS motion tracking device and a 6DOF (Six Degrees of Freedom) device. The MPU6886 combines a three-axis accelerometer and gyroscope with high precision and sensitivity. It is connected to the ESP32-S3 via I2C. Previously, we obtained a small add-on board called M5GOBottom2 with an MPU6886 together with the M5Stack Core2 kit. Inside ATOM S3, there is also a green LED (WS2812 RGB LED) and an IR LED (infrared emitter/transmitter).

Atom S3 can be connected to a computer using a USB-C connector, and it's worth noting that the ESP32-S3 has a direct USB port (CDC function) for programming through that port. AtomS3 is usually powered via USB-C (but can also be powered through the header connector), and the voltage regulation is handled by SY8089, which is a step-down regulator that allows an input voltage range of 3.3V to 5V and provides a maximum current output of 500mA.

In the Atom series of products, the bottom-exposed pins can be defined for functions such as I2C, SPI, UART, GPIO, and ADC. There is an expansion header connector called ATOM-MATE, which allows users to connect to other sensors, actuators, or external devices to expand the usage range by accessing the pins on the bottom of Atom. Additionally, Atom S3 has a programmable button and a programmable RGB LED that can be used for user interaction and status indication.

esp32s3 UIFlow

Atom S3 supports Arduino IDE, MicroPython, and UIFlow, which allows developers to write applications using familiar development environments and languages and leverage rich libraries and resources. M5Stack provides extensive documentation, sample code, and tutorials to help users get started and develop their own projects.

2023-09-14

Source: Svet Kompjutera (World of Computers)

Author: Dejan Petrovic

Link: https://www.sk.rs/arhiva/clanak/32306/m5stack-cores3-trece-jezgro-od-sunca

Translate: M5Stack

CoreS3 is the third-generation flagship product of the Core series controller launched by M5Stack. Compared to the previous Core2, CoreS3 brings more innovation and functionality. Through the continuous release of new products, M5Stack has proven that its products are not only suitable for electronic enthusiasts' projects but also widely applicable to industrial and commercial projects, providing an excellent foundation for training future engineers. CoreS3 is a strong testament to this. So what are the new features in CoreS3 compared to Core2, which was released two years ago?

CoreS3

If we compare them side by side, we will find that the dimensions of Core2 and CoreS3 are basically the same. In fact, if we ignore the color, their casings are identical. Of course, the difference lies in the hardware configuration, although there is some overlap in certain details.  Similar to the chip used in the Atom S3, which we have already mentioned several times, the M5Stack CoreS3 uses the ESP32 S3, a microcontroller from Espressif Systems.

Let's briefly review the basic features of the ESP32 S3. ESP32 S3 is a dual-core microcontroller that utilizes the Xtensa® dual-core 32-bit LX7 processor and supports 2.4GHz WiFi and Bluetooth functionalities. It offers a maximum of 16MB of optional Flash and a maximum of 8MB of optional PSRAM, sufficient to meet the requirements of any task. Users can transfer programs to the CoreS3 via the USB-C interface, which also supports OTG and CDC functionality. The USB-C interface can be used for both power and battery charging.

CoreS3 still features a 2-inch capacitive IPS screen with a resolution of 320x240 pixels. The glass screen is scratch-resistant and is equipped with an ILI9342C driver. The touch function is carried by the FT6336U, which is the same as Core2. While there isn't much difference in the screen between CoreS3 and Core2, there are significant differences in the functionality underneath the screen. Core2 only had three touch-sensitive areas underneath the screen, whereas CoreS3 is equipped with two microphones, light and proximity sensors, and a camera. In terms of audio, both devices are I2S devices with 1W power speakers, but CoreS3 has an ES7210 as a 24-bit audio ADC and an AW88298 audio amplifier. For the light and proximity sensor, CoreS3 has chosen Liteon's LTR553ALSJ proximity sensor, which can measure a range from 0.01 lux to 64K lux with a 16-bit resolution. The proximity sensor consists of a standard LED (emitter and receiver), and users can determine the distance using an 11-bit resolution. Lastly, CoreS3 also features a GC0308 camera with a 300,000-pixel sensor. The camera sensor has a 10-bit ADC resolution and supports VGA video at a maximum of 30 frames per second.

The CoreS3's metal casing hides even more interesting sensors. For accelerometer and gyroscope sensing, it features the Bosch BMI270. The BMI270 offers a 16-bit resolution for six-axis sensing. If you thought there should be a compass sensor next to such a sensor, M5Stack has already taken the lead. On the CoreS3, it also houses the Bosch BMM150, a three-axis magnetometer sensor with a resolution of 0.3 μT. But that's not all. Next is the BM8563 RTC, capable of displaying seconds, minutes, hours, days, months, and years. It supports both 24-hour and 12-hour formats, as well as leap years. For each mentioned integrated circuit, available interrupt pins are utilized. Specifically, for the RTC, the CoreS3 can be programmed to set an alarm, making use of this functionality.

On the side of the device, CoreS3 retains the microSD card slot, reset button, and power button. Next to the USB-C interface is the I2C PORT.A. CoreS3’s bottom provides access to a 2x15 pin header and a JST battery connector. It is worth mentioning that the AXP2101 is used as the battery management chip, which is a high-performance power management chip that utilizes advanced integrated circuit technology to provide comprehensive power management functions. On the bottom of CoreS3's metal casing, there are very small but clearly visible markings that show the internal connections of the ESP32 S3 with the entire hardware. Due to the similar pin layout and compatibility with the JST connector, the Core3's Din Base is compatible with Core2, allowing for full hardware support from Core2.

DIN Base is the default base of Core S3. This base is designed for mounting Core S3 on a DIN rail or a flat surface and comes with necessary plastic clips. The base provides additional expansion capabilities internally. The focus of the DIN Base is power management, allowing Core S3 to be powered by a voltage of 9 to 24 volts through a DC connector using the SY8303 voltage regulator. The 500mAh lithium-ion battery is located beneath the prototype PCB board and is managed together with the TP4057 integrated circuit. The power supplied to Core S3 from the base can be turned off using a small switch. The PCB board itself is a prototype board with plated through holes (PTH) that allow for the addition of hardware according to the user's needs. The side of the base casing has holes for adding additional openings for connecting probes, connectors, and so on. There are also two additional connectors, PORT.B and PORT.C, with pin mappings that are compatible with all Core series devices. Yes, the DIN Base can also be used with previous Core series hosts (all M5Stack components are mutually compatible). We also noticed three holes that allow the base to be used with the LEGO system, which has great potential among children.

The Core series controllers have multiple bases to choose from. Some of these modules are terminal bases, which are dedicated to forming complete devices with the Core, while other bases are universal, allowing them to be used with any controller from the Core series. We would like to specifically introduce the following:

AC Power Base: It allows the device to be directly connected to an AC power source.

2Relay 13.2 Module: It utilizes an STM32F030 microcontroller to provide two relays that can be controlled by the controller.

BaseX (EV3 Motor):  It can connect RJ11 LEGO motors and two servo motors, making it ideal for robotics projects, and can also be equipped with an additional microphone.

LAN Base: Based on the W5500, it allows the host to be connected to a local network via an Ethernet cable, enabling it to be used as a PLC device. This base also comes with RS485 and RS232 adapter boards.

These are several available types of bases, each with different functionalities and features to meet various application needs.

What about the software aspect?

The Core S3 comes with pre-installed firmware that allows for the use of all hardware features through eight built-in applications. These applications include scanning for available local networks, listing the contents of a microSD card, checking the sensitivity of the touch screen, and scanning I2C lines to test all sensors and functionalities on the device. The most notable application is the camera app, which combines the camera function with light and distance sensors. Considering the capabilities of the camera and screen, the camera display on the screen is quite impressive, and we are satisfied with its performance. Two bar graphs on the right side of the screen display the light intensity and proximity, such as the proximity of a finger.

 

M5Stack has prepared some new features to support the Core S3, and one of them is EasyLoader. It is a small tool used for quickly erasing or writing firmware to the Core S3. Assuming the user program has already been written in an editor, it only requires selecting the port and baud rate values.

M5Stack controllers support large software packages for the Arduino IDE (which takes a long time to download from the internet), and M5Stack also provides support for these controllers. Regarding the added support, we have mentioned it in a previous article about the Core 2. For this ESP32S3 device, the provided support includes some examples. However, in the custom library section, there is a large group of examples prefixed with "M5," most of which are grouped according to the available bases for each Core. Each group provides several examples, resulting in a total count close to three digits, so listing all of them wouldn't make sense. Additional examples not included in the support package can be downloaded from the official GitHub page. These examples are up-to-date and are expected to appear in future updates of the Arduino IDE support. Overall, there are so many examples available for each feature of the Core that there are hardly any scenarios left uncovered.

UIFlow 2, which supports all the latest devices from M5Stack, including the Core S3, has been introduced in previous articles about M5Stack devices. This "blocky" editor consists of three parts, with the ability to hide some parts for clarity when needed. The use of blocks is increasingly popular and may be the best choice for inexperienced users, especially children, as it guides them into the world of electronics and programming. When the curtain is lifted, Python code is revealed beneath the blocks. The third part of the editor is the Python editor itself, allowing complete device programming through Python without the need for block programming. The Python structure used here is largely similar to programming languages used for Arduino platform code written in C/C++. The M5Burner mentioned earlier can also be used here, but it does not support UIFlow, which means that programming through the M5Stack system without a wired connection to a computer is not possible. The tool provides some examples, including the factory examples that come with the device.

Considering the features offered by the Core S3, its price is reasonable. Additionally, by adding modules, it can provide even more functionalities to meet different needs and expectations. Imagine the power of hardware with a screen and direct data input capabilities, along with additional built-in sensors and countless sensors that can be added through ports. It is evident that the possibilities for combinations are limitless, and the Core S3 can serve as a control unit for a larger system or as the central unit of its own system. It can be used in conjunction with the LEGO system, which is an additional advantage. If you want to introduce children to electronics and programming through games and building with LEGO blocks, we believe this could be the right choice. We wholeheartedly recommend it.

2023-09-08

The ESP32 microcontroller is widely used in IoT projects and offers a flexible and powerful platform for development. Sometimes, people may need to erase the flash memory of their esp32 devices, such as removing existing firmware or preparing the device for new code.

When we are developing our project, we may store some data in the flash, such as when we use the NVS functionality to store information in the flash, but when we need to download new firmware to test this device as a new one, this previous information is not overwritten. So we need to erase the flash completely and then download the new firmware.

In this article, we will lead to erase ESP32 flash memory and provide step-by-step instructions. Here, we introduce a tool called esptool.   

To erase the flash memory of an ESP32 device, there are currently three common methods available:

Esptool.py, a command line tool (suitable for MacOS and Linux systems).

Esptool-js, a web-based tool (suitable for MacOS, Linux and Windows systems).

Flash Download Tools, a GUI-based tool based on Esptool (suitable for Windows system).

Next, we will provide detailed instructions for these three tools. In this article, we will use the M5Stack Core2 as an example. The M5Stack Core2 is a popular ESP32-based controller that features a 2.0-inch integrated capacitive touch screen and a wide range of built-in functions.

Esptool.py

Introduction:

Esptool.py is a Python-based, open-source, platform-independent utility for communicating with the ROM boot loader in Espressif SoCs. 

It can do a number of things, for example:

  •    Read, write, erase, and verify binary data stored in flash.
  •    Read chip features and other related data such as MAC address or flash chip ID.
  •    Read and write the one-time-programmable efuses.
  •    Prepare binary executable images ready for flashing.
  •    Analyze, assemble, and merge binary images.

How to use Esptool.py to erase the Flash chip in M5Core2

1). Install esptool.

Open the Terminal application and type the following installation command at the command line.

pip install esptool                                                                                                   

 After the installation, we can test it with the following command. If it returns the correct version, it indicates a successful installation.

esptool version                                                                                                         

 

2). Get the PORT number of M5Core2.

Use the following command to find out the USB serial port number of the M5Core2. In this step, please ensure that M5Core2 is the only device connected to your computer.

ls /dev/cu.usb*                                                                                                        

 

*The serial port number in the image above is for the MacOS system. If your computer is running a different operating system, you will need to replace the serial port number with the appropriate one.

3). Execute the erase command to erase the Flash chip in M5Core2.

esptool.py --chip auto -p /dev/cu.usbserial-56D40013521 erase_flash             

The Chip Auto automatically detects the chip type, making it easy to use. When you see the message "Chip erase completed successfully" in the terminal, it indicates a successful erase. The time required for erasing may vary depending on the actual capacity of the flash chip, so please be patient and wait a while. And now we have successfully erased the flash chip in M5Core2.

Esptool-js 

Introduction:

Esptool-js is a Javascript implementation of esptool, a serial flasher utility for Espressif chips. esptool-js is based on Web Serial API and works in Google Chrome and Microsoft Edge version 89 or later browsers.

Unlike the Python-based esptool, esptool-js doesn't implement generation of binary images out of ELF files.

In the following steps, we'll erase the ESP32 flash chip using a web-based demo provided by Espressif Systems..

 

How to use Esptool-js to erase the Flash chip of M5Core2

1). Open the following web link:

ESP Tool (espressif.github.io)

 

2). Connect M5Core2 with USB cable

Select a lower baud rate and then click the Connect button.

Select the serial port number of M5Core2 in the pop-up window.

3). Erase

Once connected, the next page will show the correct model and version of the M5Core2's ESP32 chip.

ESP32 erase flash

Click the Erase Flash button to start erasing the Flash chip!

When "Chip erase completed successfully ..." is displayed, it means that the M5Core2 flash chip has been successfully erased. As mentioned earlier, the erasing process may take some time due to the different actual capacities of the flash chip. Please be patient and wait a while. In addition, this website is not limited to the erase function, but also allows you to burn firmware. You can explore this functionality separately, as it is beyond the scope of this discussion.

Now, we have successfully used Esptool-js to erase the Flash chip of M5Core2.

Next, we will present the final method.

Flash Download Tools

Introduction:

Flash Download Tools is a GUI tool designed for the Windows platform. This tool can be used to program not only ESP32 series chips but also chips such as ESP8266 and ESP8285. It also provides batch programming for mass production. In this article, we will only discuss how to erase the flash chip.

To get started, you will need to download the tool from the following link:Tools | Espressif Systems

ESP32 Flash download tool

How to use Flash Download Tools to erase the Flash chip of M5Core2

1). We need to extract the downloaded files.

Once the extraction is complete, we will see the list of files shown in the image below.

This tool does not need to be installed. You can simply double-click it to run it. The documentation can be found in the red box.

2). View the serial port number in Device Manager

Connect M5Core2 to your computer using a USB cable, and then open Device Manager.

The serial port number here is COM28, the numbers may vary for different devices. Please check the actual serial port number on your computer. If you have multiple devices connected, please disconnect the others and ensure that only one M5Core2 device is connected to the computer.

 3). Open the tool and begin to erase!

Here we select "ESP32" for ChipType. If you are using a device with a different chip model, select the specific chip model accordingly. For WorkMode and LoadMode you can leave the default options. The tool interface will look like the image below.

At the bottom right, select the serial port number we checked in step two from the COM drop-down menu. If you have more than one device connected, make sure you do not select the wrong one to avoid accidentally erasing another device's flash or causing an error. Once you have made your selection, click the ERASE button to start the erasing process. Wait a while and when you see "FINISH" it means that the flash chip has been successfully erased.

Congratulations! You have successfully used Flash Download Tools to erase the Flash chip in M5Core2.

Summary:

In this tutorial, using M5Core2 as an example, we have presented three methods for erasing the ESP32 flash chip. Each method can be used and you can choose the one that suits you best.

2023-09-01

We often come across many excellent IoT projects that utilize ESP32 and Arduino. These two platforms clearly hold significant importance. So, what are they, and how can we utilize them together?

Introducing ESP32

ESP32 is a powerful microcontroller module developed by Espressif Systems, which comes with integrated Wi-Fi and Bluetooth connectivity for a wide range of applications, and highly integrating with in-built antenna switches, RF balun, power amplifier, low-noise receive amplifier, filters, and power management modules. It can interface with other systems to provide Wi-Fi and Bluetooth functionality through its SPI / SDIO or I2C / UART interfaces. ESP32 is widely used in mobile devices, wearable electronics and IoT applications.

M5Stack is a renowned company that specializes in providing hardware and software for rapid prototyping and IoT applications. M5Stack products are widely recognized for their integration, simplicity, and versatility, allowing users to stack or connect different modules/units together to build customized and scalable solutions. These modules cover a wide range of functionalities, including displays, sensors, communication interfaces, input devices, and more. By combining these modules, users can quickly create prototypes or even deploy complete IoT systems with minimal effort.

M5Stack Basic

One of the standout features is many M5Stack controllers built around the ESP32, leveraging its powerful processing capabilities, wireless connectivity, and extensive ecosystem. This compatibility grants users access to a vast library of code, examples, and community support, making development with M5Stack devices efficient and user-friendly.

Introducing Arduino

Arduino is an open-source electronics platform based on easy-to-use hardware and software. In the past years, countless of projects, ranging from simple household items to intricate scientific instruments, have used Arduino as their brain. Over time, Arduino has accumulated a vast user base worldwide including students, hobbyists, artists, programmers, and professionals, who  have gathered around this open-source platform to contribute an incredible amount of accessible knowledge that can be of great help to novices and experts alike. 

How to start

By leveraging the capabilities of both platforms, developers can create innovative IoT projects that benefit from the wireless connectivity of the ESP32 and the ease of development offered by Arduino. This combination opens up possibilities for remote monitoring, home automation systems, sensor networks, and much more.

In this tutorial, we will provide detailed steps and practical tips to help you correctly program  ESP32 (take M5Stack Basic for example) with Arduino IDE. Let's start!

1. Download the Arduino IDE

First, go to the Arduino website (https://www.arduino.cc/en/Main/Software) to download Arduino IDE that corresponds to your operating system.

 Download Arduino IDE

2. Preparing Arduino IDE

① Open the Arduino IDE and go to File -> Preferences -> Settings.

 Arduino IDE Perference

② Copy the following board manager URL and paste it into the Additional Board Manager URLs:

https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json

 Arduino URL-esp32

In this turial, we use M5Stack’s development boards,so in this step, just copy the following M5Stack board manager URL and paste it into the Additional Board Manager URLs:https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/arduino/package_m5stack_index.json 

Arduino Url-M5Stack

3.Select Tools -> Board -> Board Manager

ESP32 board in Arduino IDE

4. Installing ESP32 Board in Arduino IDE

In this tutorial, M5Stack's Basic Core is an example for leading. Thus, in this step, please enter "M5Stack" in the search field and click Install.

Installing M5Stack in Arduino IDE

And if you use other ESP32 controllers, please enter "ESP32" in the search field and click Install.

Installing esp32 in Arduino IDE

5. Selecting the Board

In this step, please select Tools -> Board -> M5Stack Arduino -> M5Stack-Core-ESP32. And currently, various M5Stack controller options are available for selection.

Selecting board in Arduino IDE

6. Programming ESP32 with Arduino IDE

Programming ESP32 with Arduino

Now, you can program the device using Arduino IDE and conveniently use it alongside hardware like Arduino Uno to unlock additional functionalities.  In this step, an example demo of Basic Core is uploaded, and you can see, the code is synchronized with the device. Now, you can start your own programming projects.

M5Stack Basic Core

 

 

2023-08-22