Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
M5Stack Electronic Blueprints
M5Stack Electronic Blueprints

M5Stack Electronic Blueprints: A practical approach for building interactive electronic controllers and IoT devices

Arrow left icon
Profile Icon Don Wilcher
Arrow right icon
Mex$424.99 Mex$607.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5 (4 Ratings)
eBook Feb 2023 288 pages 1st Edition
eBook
Mex$424.99 Mex$607.99
Paperback
Mex$758.99
Subscription
Free Trial
Arrow left icon
Profile Icon Don Wilcher
Arrow right icon
Mex$424.99 Mex$607.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5 (4 Ratings)
eBook Feb 2023 288 pages 1st Edition
eBook
Mex$424.99 Mex$607.99
Paperback
Mex$758.99
Subscription
Free Trial
eBook
Mex$424.99 Mex$607.99
Paperback
Mex$758.99
Subscription
Free Trial

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
Table of content icon View table of contents Preview book icon Preview Book

M5Stack Electronic Blueprints

Exploring the M5Stack Core

You are the proud owner of a small and powerful microcontroller development platform called the M5Stack Core. The M5Stack Core uses the Espressif ESP32 microcontroller to allow you to create a variety of programmable electronic gadgets and devices. You can build programmable gadgets such as touchscreen controllers, Wi-Fi-operated devices, wearables, robots, and portable electronic games using the M5Stack Core. In addition, with the M5Stack Core, you can add visually appealing graphics and sound to your electronic creations easily and effectively using the Arduino Integrated Development Environment and the UiFlow Blockly code programming environment.

By the end of this chapter, you will understand the ESP32 microcontroller and the internal supporting electronics hardware. You will understand the M5GO Core hardware architecture’s inner workings. Finally, you will know about applying the internal support electronics hardware to create an interactive electronic widget device.

In this chapter, we’re going to cover the following main topics:

  • Welcome to the M5Stack Core
  • Overview of the M5Stack Core hardware architecture
  • UI design basics
  • UiFlow overview
  • Communicating with the M5Stack Core

Technical requirements

To engage with the chapter’s learning content, you will need the M5GO IoT Starter Kit to explore the internal/external hardware electronics and software coding of your first basic application. The UiFlow code block software will be required to build and run the M5Stack Core application.

You will require the following:

  • M5Burner
  • The M5Stack Core
  • The M5GO IoT Starter kit
  • UiFlow Blockly code programming software

Here is the GitHub repository for supporting software resources: https://github.com/PacktPublishing/M5Stack-Electronic-Blueprints/tree/main/Chapter01.

Welcome to the M5Stack Core

In this section, you will learn the basic functions and features of the M5Stack Core. You will be able to perform the following tasks upon completing the lessons in this section:

  • Power and reset the M5Stack Core
  • Prepare the unit for programming
  • Identify the three programmable user-interface buttons
  • Identify the external ports for connecting electronic units
  • Identify the USB port
  • Identify the LED bars
  • Select your stored applications
  • Change the initial setup operation of the M5Stack Core

Upon completing this section, you will have a solid foundation of the external features and internal functions of the M55tack Core. Being able to complete these tasks will be important for programming and testing software applications that you create with your M5Stack Core. We will start the discussion with an overview of the M5Stack Core external features.

Powering and resetting the M5Stack Core

Turning on the M5Stack Core is quite easy to do. The M5Stack Core has a small red power button, as seen in Figure 1.1. The small red power button is located on the left side of the M5Stack Core. You turn on the M5Stack Core with a single press of the power button. You reset the M5Stack Core with a quick double press of the power button:

Figure 1.1 – The M5Stack Core power button location

Figure 1.1 – The M5Stack Core power button location

Once the M5Stack Core is powered on, a UiFlow splash screen is displayed on the liquid crystal display (LCD), as seen in the following screenshot:

Figure 1.2 – UiFlow splash screen displayed after powering on the M5Stack Core

Figure 1.2 – UiFlow splash screen displayed after powering on the M5Stack Core

Initially, the M5Stack Core is programmed with 11 demonstration activities. The 11 demonstration activities are shown in the following diagram:

Figure 1.3 – UiFlow M5Stack Core demonstration activities

Figure 1.3 – UiFlow M5Stack Core demonstration activities

Next, let us learn about each demonstration activity through an accompanying explanation. We will explore the internal features of the M5Stack Core through a series of hands-on demonstrator activities:

  • Demo 1 on/off: To turn off the M5Stack Core, a quick double press of the power button will accomplish this task, as seen here:
Figure 1.4 – The on/off operation of the M5Stack Core

Figure 1.4 – The on/off operation of the M5Stack Core

  • Demo 2 speaker: Press the center button on the M5Stack Core to hear a sound from the internal speaker:
Figure 1.5 – Speaker demonstrator

Figure 1.5 – Speaker demonstrator

  • Demo 3 microphone: Speak into the pinhole microphone located on the side of the M5Stack Core. While speaking into the microphone, observe the line and sound wave images. Let’s see how this looks in the following figure:
Figure 1.6 – Microphone demonstrator

Figure 1.6 – Microphone demonstrator

  • Demo 4 gyro: Tilt the M5Stack Core and observe the ball movement on the LCD screen. The movement is accomplished using a gyroscope and an accelerometer, as can be seen in Figure 1.7:
Figure 1.7 – Gyro demonstrator

Figure 1.7 – Gyro demonstrator

  • Demo 5 RGB LEDs: This demonstrator will glow and dim the sidebar RGB LEDs of the M5Stack Core. There is one LED bar on each side of the M5Stack Core:
Figure 1.8 – RGB bar demonstrator

Figure 1.8 – RGB bar demonstrator

  • Demo 6 ports explanation: The different electrical ports and their specific functions will be explored in this demonstration:
Figure 1.9 – Extension port demonstrator

Figure 1.9 – Extension port demonstrator

Congratulations, you have completed exploring the internal features of the M5Stack Core. We will now learn about four sensor units from the M5GO IoT Starter Kit, which are shown in the following photo:

Figure 1.10 – The M5GO IoT Starter Kit

Figure 1.10 – The M5GO IoT Starter Kit

  • Demo 7 environment sensor: The temperature and humidity levels are displayed on the LCD upon connecting the sensor to extension port A of the M5Stack Core:
Figure 1.11 – Environment sensor demonstrator

Figure 1.11 – Environment sensor demonstrator

  • Demo 8 passive infrared (PIR) sensor: Attach the PIR sensor to extension port B of the M5Stack Core. You can observe a color change in the circle when placing your hand in front of the sensor. The color change response of the circle also occurs when you move your hand away from the PIR sensor. The following diagram illustrates the motion sensor’s response to a hand moved away from the PIR sensor:
Figure 1.12 – PIR sensor demonstrator

Figure 1.12 – PIR sensor demonstrator

  • Demo 9 RGB unit: You explored the RGB LED bars in the fifth demonstrator activity. You will investigate the RGB LEDs packaged in this extension unit. This RGB LED unit will only light up when properly attached to extension port B. This diagram shows the wiring connector being attached to the RGB LED to connect to extension port B:
    Figure 1.13 – RGB unit demonstrator

Figure 1.13 – RGB unit demonstrator

  • Demo 10 infrared (IR) Remote unit: You can attach the IR Remote unit to extension port B using a wiring connector, as shown in Figure 1.14. Next, you take an ordinary IR handheld remote and point it toward the IR Remote unit. You can press any button on the IR handheld remote and observe the detection effect on the M5Stack Core LCD:
Figure 1.14 – IR Remote demonstrator

Figure 1.14 – IR Remote demonstrator

  • Demo 11 angle sensor: You can test the knob on the angle sensor as shown in Figure 1.15, and observe the RGB LED bars getting brighter or dimmer:
Figure 1.15 – Angle sensor demonstrator

Figure 1.15 – Angle sensor demonstrator

Congratulations, you have learned about the M5Stack Core demonstrators. You have learned how to operate external sensors that are packaged with the M5GO IoT Starter Kit.

Note

To reinstall the firmware with the Demo app, use the M5Burner software. Select version 1.7.5 of the UIFLOW Core firmware. The name of the app is M5GO.py.

You have also learned how internal devices such as the RGB bar, microphone, and gyro operate using the appropriate M5Stack Core demonstrators. These mini hands-on demonstration activities allowed a glimpse into the M5Stack Core’s hardware architecture.

In the next section, we will dive deeper into the M5Stack Core’s hardware architecture by reviewing the electronic circuit schematic diagrams and the technical specifications of the ESP32-based programmable controller.

Overview of the M5Stack Core hardware architecture

In the previous section, you learned about the basic internal and external electronic features of the M5Stack Core. You investigated these basic features by using the M5Stack Demo app and specific IoT Starter Kit sensor units. In this section, you will learn about the embedded electronic subcircuits used to operate the M5Stack Core. The M5Stack Core’s hardware architecture consists of the following four electronic subcircuits:

  • Power management
  • Audio amplifier
  • ESP32 subsystem
  • USB-UART and accessories

The M5Stack Core hardware architecture system block diagram is illustrated in Figure 1.16:

Figure 1.16 – M5Stack Core hardware architecture system block diagram

Figure 1.16 – M5Stack Core hardware architecture system block diagram

EA3036 DC-DC converter (power management)

The EA3036 direct current to direct current (DC-DC) converter is a power management integrated circuit (IC). The EA3036 IC can be powered by one lithium-ion (Li-Ion) battery. The input voltage range for the EA3036 is 2.7 V (volt) DC to 5.5 V DC. The IC can also be powered by a basic 5 V DC adapter or phone charger. The EA3036 integrates three synchronous buck converters into one convenient 20-pin quad flat no-lead (QFN) IC package. Let us learn more about the EA3036 DC-DC converter by reviewing the IC’s physical pin packaging, shown in Figure 1.17, and the internal electronic circuits:

Figure 1.17 – EA3036 IC QFN package

Figure 1.17 – EA3036 IC QFN package

The EA3036 DC-DC converter provides the 3.3 V (3V3) voltage source to operate the ESP32 microcontroller and support electronic circuit peripherals. Electronic circuit peripherals include the audio amplifier (N54148), A, B, C, and reset pushbutton switches, the LCD, the universal asynchronous receiver transmitter (CP2104) IC, and the USB-Micro (IP5306) circuit. The M5Stack Core Li-ion battery can power these subcircuits efficiently and effectively. The electronic circuit schematic and functional block diagrams for the EA3036 DC-DC converter are provided in the following diagram:

Figure 1.18 – The EA3036 DC-DC converter electronic circuit schematic and functional block diagrams

Figure 1.18 – The EA3036 DC-DC converter electronic circuit schematic and functional block diagrams

The EA3036 DC-DC converter can be used to source the appropriate voltage and current for the M5Stack Core’s N54148 power amplifier.

Power amplifier

As illustrated in Demo 2, the M5Stack Core has an audio power amplifier. The NS4148 is a 3-watt (W) class D audio power amplifier. The unique feature of the NS4148 is that the device can power down, which reduces power consumption. This feature allows the M5Stack Core to maximize its 3.3V Li-ion battery capacity. The NS4148 audio power amplifier can be packaged in an 8-pin micro-small outline package (MSOP) or a small outline package. To minimize the printed circuit board space of the M5Stack Core, the MSOP IC package is used. Figure 1.19 shows the MSOP of the NS4148 IC package:

Figure 1.19 – The NS4148 MSOP device

Figure 1.19 – The NS4148 MSOP device

The electronic circuit schematic for the NS4148 MSOP-based 3 W Class D audio power amplifier is shown in Figure 1.20. Although the NS4148 is a low electromagnetic interference (EMI) filter-less IC device, there is a pair of inductor (L) and capacitor (C) (LC) filters on the audio output pins. The LC filters consisting of ferrite beads (FB1), FB2, and capacitors C42 and C45 are to remove the amplified audio signal ripple noise or waveform distortion from being emitted to the M5Stack Core’s speaker.

In addition, the bypass capacitor is connected across the collector supply voltage or voltage common collector (VCC) and ground (GND) pins to reduce high-frequency noise generated by the external clock circuit. The external clock circuit synchronizes the ESP32 microcontroller’s internal timing operations, such as the program counter. A variety of sounds can be created using MicroPython, UiFLOW, or Arduino C/C++ coding languages. The NS4148 audio power amplifier will amplify these sounds generated by the ESP32 microcontroller, allowing the unique tones to be heard through the wired speaker. The NS4148 receives the ESP32 code-based tones from the GPIO25 pin.

Figure 1.20 – The NS4148 3 W class D audio power amplifier circuit schematic diagram

Figure 1.20 – The NS4148 3 W class D audio power amplifier circuit schematic diagram

ESP32 subsystem

The heart of the M5Stack Core is a 2.4 gigahertz (GHz) Wi-Fi and Bluetooth combination microcontroller. The ESP32 microcontroller is supported by 20 external components that enable features of the M5Stack to interact with the end user. The ESP32 provides appropriate control signals to the externally wired LCD and universal asynchronous receiver-transmitter (UART) devices. In addition, the A, B, C, and reset pushbutton switches are wired to the appropriate general-purpose input/output (GPIO) pins of the ESP32 microcontroller. The ESP32 microcontroller is packaged as a 48-pin QFN chip device. To ensure the proper timing of the ESP32’s core processor functions as the program counter or shifting data through memory register movements, an external crystal clock circuit of 40 megahertz (MHz) is used.

Figure 1.21 – ESP32 pinout and QFN48 package

Figure 1.21 – ESP32 pinout and QFN48 package

The ESP32 microcontroller subsystem circuit schematic diagram is shown next:

Figure 1.22 – ESP32 subsystem circuit schematic diagram

Figure 1.22 – ESP32 subsystem circuit schematic diagram

An external 40 MHz crystal clock circuit, as seen in Figure 1.23, is used to maintain the proper timing and data storage operations of the ESP32 microcontroller’s core central processing unit (CPU):

Figure 1.23 - A 40 MHz crystal clock circuit

Figure 1.23 - A 40 MHz crystal clock circuit

USB-UART and accessories

The method used to communicate internally and externally with the M5Stack Core uses a universal serial bus (USB) or UART circuits. The external port A allows units with inter-integrated circuit capabilities (I2C) to communicate with the ESP32 microcontroller. A serial clock (SCL) and a serial data address (SDA) scheme allow such units to share data with the microcontroller. In addition, sending application programs created using UiFLOW Blockly code, MicroPython, or C/C++ programming languages is accomplished with a data transmit/receive (TX/RX) UART scheme through a USB communication port. An IP5306 circuit is used to accomplish these communication tasks. The two USBs depicted in the circuit schematic diagram in Figure 1.24 represent the traditional data communication and extension A ports found on the M5Stack Core:

Figure 1.24 – The IP5306 USB-I2C communication circuit schematic diagram

Figure 1.24 – The IP5306 USB-I2C communication circuit schematic diagram

Besides the internal circuits, the M5Stack Core uses a communication bus packaged on its bottom base to communicate with the microphone and the RGB LED bars. The communication bus allows the ESP32 microcontroller to receive and send audio and controls signals accordingly to the internal microphone and RGB LED bars. The allocated ESP32 GPIO pins are wired to the communication bus, thus allowing access to the audio and control signals from the externally connected devices. As shown in Figure 1.25, the GPIO15 pin operates the RGB LED bar. The ESP32’s GPIO34 pin is wired to the microphone and amplifier circuit:

Figure 1.25 – The M5 communication bus and associated peripheral devices

Figure 1.25 – The M5 communication bus and associated peripheral devices

The following photo shows some of the ESP32 microcontroller supporting ICs, the microphone, the RGB LED bar, and the M5 bus:

Figure 1.26 – Location of the key electronic components and M5 communication bus

Figure 1.26 – Location of the key electronic components and M5 communication bus

You now understand the M5Stack Core’s hardware architecture and the supporting electronic circuits. This knowledge will be important in the proceeding chapters of this book. The importance of this knowledge is in the development of interactive controls and wearable devices. In developing M5Stack Core projects, you will be immersed in the creative process of building practical and engaging products.

In the next section, you will learn how to design user interfaces (UIs) that allow interaction and engagement with the M5Stack Core.

UI design basics

In developing M5Stack Core applications, the UI aids in the operation of the device. The M5Stack Core’s LCD easily lays out graphics that convey information from electronic sensors attached to the programmable controller. The M5Stack Core LCD can also provide the status as output devices like an electromechanical relay. In this section, you will learn about effective visual effect approaches for UIs. You will learn about UI design basics that make your applications appealing and easy to use. Before you start designing your UI, the dimensions of the M5Stack Core are needed.

The M5Stack Core’s LCD dimensions are 320 x 230 pixels. Therefore, you have a total of 73,600 pixels available to create a variety of unique UIs:

Figure 1.27 – M5Stack Core dimensions

Figure 1.27 – M5Stack Core dimensions

The pixels are electronic dots arranged using a Cartesian coordinate system. When placing the images or controls, their locations can be managed using the Cartesian coordinate system. You can move the image quite easily using the UiFlow programming tool. The UiFlow programming tool has a design layout area that allows a preview of the images and controls placed on the LCD. The following example illustrates the x and y coordinates of 58 and 45 for the location of the square on the LCD:

Figure 1.28 – Placement of an object on the UiFlow design layout area

Figure 1.28 – Placement of an object on the UiFlow design layout area

The x-data point is 58 and the y-data point is 45. You can place the objects by dragging them to the specified location or entering them manually as follows:

Figure 1.29 – Manual placement of a square on the UiFlow design layout area

Figure 1.29 – Manual placement of a square on the UiFlow design layout area

You can obtain the properties box by clicking on the square. Once the properties box is visible on the UiFlow design layout area, x and y location data points may be entered as shown in the following figure:

Figure 1.30 – Entering x and y data points into the properties box

Figure 1.30 – Entering x and y data points into the properties box

The square can be precisely located on the LCD by entering the value incrementally in the properties box. As you enter the value, the square will move accordingly based on the coordinate position. You can use this approach to lay out your UI design on the M5Stack Core’s LCD. To make your UI effective, there are some basic design elements you need to consider.

Input controls

Input controls such as buttons, text fields, checkboxes, radio buttons, drop-down lists, list boxes, toggles, and date fields, allow the user to interact with your M5Stack Core device easily. You should size the input controls to be visible and for ease of use. Overlayed objects should not be placed on the input controls. Such information will make the input controls difficult to use.

Design considerations

When you lay out a UI design for an M5Stack Core device application, three factors should be considered: development, visibility, and acceptance. Let’s look at them in detail:

  • Development factors: These help improve the visual communications of the UI design by providing tool kits, component libraries, and rapid prototyping support. The M5Stack Core’s main development factor is the availability of the UiFlow Blockly and Arduino code libraries. An example of a development factor is the Wi-Fi network UiFlow Blockly library shown in the following screenshot:
Figure 1.31 – Wi-Fi Blockly code library example of development factors

Figure 1.31 – Wi-Fi Blockly code library example of development factors

  • Visibility factors: These allow multiple representations that aid the user to interact and engage with a UI design based on styles of learning and comprehension. Engagement, as it relates to the visual appeal of a UI design, provides education or is a productive tool and aligns with the learning aspect of the multiple representations concept. Examples of multiple representations include graphs, symbols, shapes, pictures, and sounds. The M5Stack Core includes a variety of shapes that will allow you to provide multiple representations for user interaction and engagement.
  • Acceptance factors: These align with the documentation and training of the UI design-based product. For example, the M5Stack Core has been used in a variety of K-12 education classrooms based on the ease with which learners can create engaging and interactive devices. Figure 1.32 illustrates an acceptance factor using multiple representations for learner engagement and device interaction:
Figure 1.32 – M5Stack Core UI shapes for multiple representation

Figure 1.32 – M5Stack Core UI shapes for multiple representation

A final important note in designing and developing M5Stack Core UIs is simplicity. Simplicity is the design consideration consisting of using the important UI elements for communicating features and functions of your M5Stack Core device. The UI you design should be simple, eliminating unnecessary input control elements. The labeling of the multiple representations you use should be clear in language and messaging. The following screenshot illustrates clarity, thus eliminating unnecessary input control elements:

Figure 1.33 – (Left) complicated UI versus (right) simpler UI design

Figure 1.33 – (Left) complicated UI versus (right) simpler UI design

You now understand UI design basics that will aid in developing easy-to-use M5Stack Core applications. In the next section, we will present an overview of the UiFlow software.

UiFlow overview

In the previous section, you learned about some approaches to designing UIs to provide interaction for your M5Stack Core applications. The design basics provide suggested guidelines for developing uncluttered UI layouts. You can think of the design basics as the developmental theory to assist in creating UIs that have purposeful, engaging, and interactive functions for the M5Stack Core. In this section, you will learn about the UiFlow software basics. To start the learning journey, you will need to download UiFlow. You can use the following link to download the UiFlow software: https://shop.m5stack.com/pages/download.

Here’s what the page looks like:

Figure 1.34 – M5Stack Core software

Figure 1.34 – M5Stack Core software

Download and install the UIFlow-Desktop-IDE (integrated development environment) software, as shown in Figure 1.34. Once the programming package has been installed, click on the icon to open the software, which looks like this:

Figure 1.35 – UiFlow icon

Figure 1.35 – UiFlow icon

The UiFlow IDE will appear on your screen, as you can see in Figure 1.36. With the IDE open, various block categories, shapes, and an M5Stack Core preview will be visible. The UiFlow IDE will allow you to program the M5Stack Core using a variety of Blockly code blocks. You will construct your M5Stack Core application by stacking the Blockly code blocks and using shapes to create engaging product UI aesthetics and functions.

Figure 1.36 – UiFlow IDE

Figure 1.36 – UiFlow IDE

You will see that the UiFlow layout is very easy to understand and use. Figure 1.37 explains UiFlow’s IDE features. The M5Stack Core preview will allow you to design interactive devices to engage the end user with your product creation. To ensure your M5Stack Core device allows interaction and engagement with the intended product, you can consult the UI design basic material presented. A nice feature of the M5Stack Core preview is the ability to sketch out a UI design by using the shapes provided by the UiFlow software. You can proceed to design a UI that engages through simplicity and clarity.

Figure 1.37 – UiFlow IDE layout explanation

Figure 1.37 – UiFlow IDE layout explanation

With the UI design sketched out using the M5Stack Core preview, you can proceed to add function to the aesthetics by selecting appropriate Blockly code blocks. The UiFlow IDE provides several programming code blocks to provide interaction and engagement with your intended product. The software approach used to code is a top-down method. You can think about using Blockly code blocks in the same way as creating a functional flowchart. Instead of using pseudocode to capture the logic of the M5Stack Core’s function, the software algorithm development is created using Blockly code blocks. With the Blockly code blocks aligned with the UI design, you have now created an interactive device to engage your end user. There are several Blockly code categories to select within the coding development tool suite, as shown in the following screenshot:

Figure 1.38 – UiFlow code blocks menu

Figure 1.38 – UiFlow code blocks menu

You can develop a Blockly code program as a sequence of interlocking instructions. Each code block functional instruction feeds and interlocks with the next program block. Therefore, a mental model can be created whereby creating M5Stack Core product functions align with a sequence of a program diagram. You can use the following diagram to develop simple or complex functions for your M5Stack Core device. You can practice using this mental model diagram when creating your M5Stack Core device’s interactive function:

Figure 1.39 – UiFlow Blockly code program sequence diagram

Figure 1.39 – UiFlow Blockly code program sequence diagram

Besides Blockly code block categories or menus, images, shapes, and the M5Stack Core preview, the menu tab plays an important role in the UiFlow software. The three basic Blockly code blocks that align with the program sequence diagram are Setup, Loop, and Wait, as shown in the following screenshot:

Figure 1.40 – UiFlow Blockly code program sequence diagram

Figure 1.40 – UiFlow Blockly code program sequence diagram

You will use these three Blockly code blocks quite often to allow the M5Stack Core device application’s functions to be properly sequenced while maintaining engagement with the end user.

The role of the UiFlow menu tab is to provide you with a set of tools to run, test, and save your Blockly code. There is documentation on the code blocks and units for using them in your M5Stack Core device applications. Further, connecting to the M5Stack Core through USB can be achieved through the Setting menu. A description of the UiFlow Menu tab features is provided in Figure 1.41:

Figure 1.41 – UiFlow Blockly code program sequence diagram

Figure 1.41 – UiFlow Blockly code program sequence diagram

The final section of this chapter will allow you to communicate with the M5Stack Core by establishing a proper communication setup with an ESP32-based device. You will use the UiFlow IDE software to communicate with the M5Stack Core device.

Communicating with the M5Stack Core

You are now familiar with the M5Stack Core’s hardware architecture, UI design basics, and UiFlow IDE. In this section, you will learn how to set up the UiFlow IDE to communicate with the M5Stack Core. Being able to communicate with the M5Stack Core is important because the Blockly code applications you design and implement will now be tangible devices that people can use for controlling physical objects, such as LEDs, motors, and buzzers. You will be able to sense objects and environments using PIR and temperature sensors. Therefore, running software for these hardware components is dependent on communicating with the M5Stack Core device.

Requirements

To engage with this section’s learning content, you will need the M5GO IoT Starter Kit to explore the internal/external hardware electronics and software coding of your first basic application. In addition, the UiFlow code block software will be required to build and run the M5Stack Core application.

You will require the following:

  • The M5Stack Core controller
  • The M5GO IoT Starter Kit
  • UiFlow Blockly code software

Communication setup

The initial step to communicating with the M5Stack Core is to turn on the programmable device. Press the power ON button. Once the UiFlow splash screen is displayed, press the rightmost button on the M5Stack Core. The rightmost button is the M5Stack Core’s Setup function.

Figure 1.42 – Turning on the M5Stack Core

Figure 1.42 – Turning on the M5Stack Core

Then, perform the following steps:

  1. Scroll down to Switch mode.
  2. Scroll down to USB Mode. Use the middle button to select USB Mode.

These steps are shown in the following photo:

Figure 1.43 – Scroll to USB Mode

Figure 1.43 – Scroll to USB Mode

  1. Scroll down to reboot the M5Stack Core. Use the middle button to select the Reboot mode. After selecting Reboot, the USB API KEY splash screen will be displayed on the M5Stack Core unit’s LCD, as you can see in the following photo:
Figure 1.44 – Placing the M5Stack Core in USB mode (3 and 4)

Figure 1.44 – Placing the M5Stack Core in USB mode (3 and 4)

You will then insert a USB-C cable into the M5Stack Core unit. Insert the other end of the USB-C cable into the development desktop personal workstation or laptop computer. Open the UiFlow Blockly code software. The Setting screen will appear on your personal desktop workstation or laptop screen. Select the M5Stack Core icon and the proper communication (COM) port, all of which you can see in the following screenshot:

Figure 1.45 – Setting the communication port to select the M5Stack Core device

Figure 1.45 – Setting the communication port to select the M5Stack Core device

Once the M5Stack Core and communication port have been selected, click OK. The UiFlow IDE coding environment will be displayed on the screen as follows:

Figure 1.46 – UiFlow IDE

Figure 1.46 – UiFlow IDE

In the lower left-hand corner, you will see the Connected text displayed, as shown in the following screenshot:

Figure 1.47 – The M5Stack Core is connected to UiFlow Blockly code software

Figure 1.47 – The M5Stack Core is connected to UiFlow Blockly code software

You will notice the COM4 port is displayed with the Connected text, which confirms that the selection for the communication port was correct. Congratulations, your M5Stack Core is now communicating with the UiFlow IDE! In Chapter 2, you will learn how to attach and program small electronic modules such as angle and motion sensors, an RGB (red, green, and blue) LED, and an IR Remote unit to the M5Stack Core. The knowledge you have obtained in this chapter will be used to explore M5Stack Units in Chapter 2.

Summary

In this introductory chapter, you learned about the technical skills of understanding the M5Stack Core hardware architecture. Within the M5Stack Core’s hardware architecture, you learned about the integrated circuits that provide the functional structure of this programmable device. You also covered how to operate the M5Stack Core demonstrators. Further, you learned about effective UI layout design approaches to make your M5Stack Core projects user-friendly. To implement the UI layout design approaches, you covered the UiFlow Blockly code features and functions that come as standard with the coding tool’s IDE. Finally, you learned how to set up USB communications between the UiFlow Blockly code IDE and the M5Stack Core.

With this knowledge, you will be able to explore the M5Stack Core units in the next chapter. The M5Stack Core units are small electronic modules that work with the hardware architecture and Blockly code discussed in this chapter. You learned about the electronic circuits that aid in the hardware architecture of the M5Stack Core.

In the next chapter, you will use this electronic circuits knowledge, the design layout approaches, and the UiFlow IDE to program the units in Blockly code to create engaging and interactive devices.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Learn ESP32 microcontroller and M5Stack Core development platform with hands-on projects
  • Create aesthetically appealing visuals for technology engagement using the M5Stack Core device
  • Build interactive devices using Arduino and SNAP circuits with the M5Stack Core development platform

Description

As an embedded systems developer or an IoT developer, you can often face challenges in maintaining focus on prototyping a product concept while using a specific high-level programming language for implementation. To overcome these challenges, the M5Stack Core platform uses an ESP32 microcontroller and block code that allows you to focus on product creation and application instead of the high-level programming language. M5Stack Electronics Blueprints presents various design and prototyping approaches as well as UI layout and electronics interfacing techniques that will help you to become skilled in developing useful products effectively. This book takes you through a hands-on journey for a better understanding of the ESP32 microcontroller and the M5Stack Core's architecture. You’ll delve into M5Stack Core topics such as electronic units, light, sound, motion devices, interfacing circuits, SNAP circuit kits, Arduino applications, and building Bluetooth and Wi-Fi IoT devices. Further, you’ll explore various M5Stack core applications using a project-based learning method, including the fascinating 32-bit microcontroller device technology. By the end of this book, you’ll be able to design and build interactive, portable electronic controllers, IoT, and wearable devices using the M5Stack Core.

Who is this book for?

This book is for practicing embedded systems and IoT developers, electronics and automation technicians, STEM technical educators, students, and hobbyists looking to learn about the ESP32 microcontroller and M5Stack technologies. There is no prerequisite – apart from a desire to learn about ESP32-based electronics and interactive devices, then this book is for you.

What you will learn

  • Design user interfaces using no-code/low code programming languages
  • Prototype electronic controllers for audio alarms swiftly
  • Wire an M5Stack Core 2 to an Arduino Uno or equivalent to build a touch control relay controller
  • Prototype Bluetooth IoT controllers efficiently
  • Build and code Wi-Fi sniffers and scanner gadgets
  • Prototype wearable devices with ease
  • Create ESP32 applications using system block diagram design
  • Build a DC motor controller operated by a M5Stack Core unit

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Feb 17, 2023
Length: 288 pages
Edition : 1st
Language : English
ISBN-13 : 9781803238425
Category :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning

Product Details

Publication date : Feb 17, 2023
Length: 288 pages
Edition : 1st
Language : English
ISBN-13 : 9781803238425
Category :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Mex$85 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Mex$85 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total Mex$ 2,441.97
M5Stack Electronic Blueprints
Mex$758.99
Building Smart Home Automation Solutions with Home Assistant
Mex$656.99
Developing IoT Projects with ESP32
Mex$1025.99
Total Mex$ 2,441.97 Stars icon

Table of Contents

13 Chapters
Part 1: M5Stack Electronics Hardware Architecture Chevron down icon Chevron up icon
Chapter 1: Exploring the M5Stack Core Chevron down icon Chevron up icon
Chapter 2: Hands-On with M5Stack Units Chevron down icon Chevron up icon
Chapter 3: Lights, Sound, and Motion with M5Stack Chevron down icon Chevron up icon
Part 2: M5Stack Electronic Interfacing Circuit Projects Chevron down icon Chevron up icon
Chapter 4: It’s a SNAP! Snap Circuits and the M5Stack Core Chevron down icon Chevron up icon
Chapter 5: Solderless Breadboarding with the M5Stack Chevron down icon Chevron up icon
Chapter 6: M5Stack and Arduino Chevron down icon Chevron up icon
Part 3: M5Stack IoT Projects Chevron down icon Chevron up icon
Chapter 7: Working with M5Stack and Bluetooth Chevron down icon Chevron up icon
Chapter 8: Working with the M5Stack and Wi-Fi Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5
(4 Ratings)
5 star 75%
4 star 0%
3 star 25%
2 star 0%
1 star 0%
JSA Mar 18, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Whilst the writing style is sometimes a little stilted, this is nevertheless a solid and essential reference for the M5STACK. Some information on connecting to Azure etc. would be appreciated. I learned quite a lot from this book without having to navigate the sometimes Byzantine and poorly written M5STACK documentation.
Amazon Verified review Amazon
Lensey C King Jul 25, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great book. Great author!! If you want to get started with the M5, this definitely the way to go.
Amazon Verified review Amazon
Tracey N. Apr 29, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book is excellent if you want to really understand the inner workings of the M5Stack.
Amazon Verified review Amazon
Mr. Adam Bryant Mar 05, 2023
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
Don't get me wrong. Dr W wrote a good book on the M5products including how to interface then with the sandpit electronics product range but the book is let down by the print quality. This book was printed using a P.O.D. and it shows with the blurred low quality black and white images and print banding (black or white stray lines) on several pages.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.