Book Image

M5Stack Electronic Blueprints

By : Don Wilcher
Book Image

M5Stack Electronic Blueprints

By: Don Wilcher

Overview of this book

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.
Table of Contents (14 chapters)
1
Part 1: M5Stack Electronics Hardware Architecture
5
Part 2: M5Stack Electronic Interfacing Circuit Projects
9
Part 3: M5Stack IoT Projects

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.