Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

This project utilizes the Elecrow CrowPanel ESP32 4.3″ HMI to create a “mini audio analyzer”: audio from a microphone is collected on a PC and transmitted in real-time to the development board, which displays waveforms and spectra using the onboard LVGL UI, allowing for flexible viewing options.Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

Project Overview

Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

This project is developed as part of the 2025 5th “Winter Break Practice Together” event organized by the Hard禾 Academy, covering FPGA, STM32, RP2040, and ESP32 directions. This task selects the CrowPanel ESP32 Display 4.3-inch HMI development board for waveform analysis development. The board is developed by Elecrow, and the project uses the board to accomplish the following tasks:

  • Collect audio signals from the PC using its built-in microphone and transmit them to the 4.3-inch display terminal.
  • The display terminal performs spectrum analysis on the received audio signals, displaying the following on the screen:
    • Waveform of the audio signal;
    • Spectrum of the audio signal;
    • Signal parameters – amplitude value, frequency range;
    • The interface allows selection to display only the waveform, only the spectrum, or both.

Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

Hardware Introduction

Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

The CrowPanel ESP32 Display 4.3-inch HMI development board features an Elecrow ESP32 4.3-inch LCD display with a resolution of 480*272. It uses the ESP32-S3-WROOM-1-N4R2 module as the main processor, equipped with a dual-core 32-bit LX7 processor, integrated WiFi and Bluetooth wireless capabilities, with a maximum frequency of 240MHz, providing powerful performance and multifunctional applications suitable for IoT devices.

Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

This kit includes a 4.3-inch LCD display and a driver board, with a resistive touch technology display and a resistive touch pen for more flexible screen usage. Additionally, the board has reserved slots for TF cards, various peripheral interfaces, USB interfaces, speaker interfaces, battery interfaces, etc., providing more expansion possibilities. It supports multiple development environments including Arduino IDE, Espressif IDF, PlatformIO, MicroPython, and is compatible with the LVGL graphics library, allowing developers to customize their UI and quickly create interesting projects.

Features

  • Integrated ESP32-S3-WROOM-1-N4R2 module, with built-in wireless communication 2.4 GHz Wi-Fi (802.11 b/g/n) and Bluetooth 5.0;
  • Supports development environments Arduino IDE, Espressif IDF, PlatformIO, MicroPython, and is compatible with the LVGL graphics library;
  • Built-in LVGL demo interface and Arduino examples for plug-and-play;
  • LCD 480*272 4.3-inch TFT-LCD with driver IC NV3047;
  • Rich peripheral interfaces and expansion capabilities to meet the needs of different fields.

Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

Requirement Analysis and System Framework

Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

First, audio data from the environment needs to be collected using the microphone on the PC. The collected audio data is analyzed to obtain waveform amplitude data, and frequency statistics are obtained using Fast Fourier Transform (FFT). The amplitude data and frequency data are sent via serial port, received by the ESP32S3, and stored in a data buffer after type conversion. The main loop of the display checks the data reception flag to load and display the received data. The system function logic flowchart is shown below:

Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini OscilloscopeDual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

Implementation of Functional Modules and Related Code

Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

1. Data Audio Collection on PC

The PC uses the Python library sounddevice to access the microphone audio device for data collection and buffering. The audio collection callback function is as follows:

Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

Processing the audio data mainly involves statistical analysis of the audio amplitude and using Fast Fourier Transform to obtain frequency statistics:

Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

2. Elecrow ESP32 Display Interface

This project uses LVGL 8.3.1 for interface display, defining three main screens:

Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

Each of the three screens is initialized, and the following is the initialization code for screen1:

Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

3. Displaying Charts and Data

Charts and data for different screens are defined and initialized, including the data series initialization for the third screen with two charts:

Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

4. Implementation of Button Interface Switching Function

The interface switching function is implemented by adding switches to buttons such as screen1, switch, screen2, switch_screen2 etc. The implementation of the interface switching function is as follows:

Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

5. Implementation of Data Display Update Function

Data updates are performed by checking the data reception flag in a loop, while also considering which main screen is currently active for targeted data updates and refreshing display components. The code implementation is as follows:

Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini OscilloscopeDual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

Experimental Demonstration

Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

1. Waveform Display

Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

2. Spectrum Display

Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

3. Waveform and Spectrum Display

Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini OscilloscopeDual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

Project Summary

Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

This project, based on the CrowPanel ESP32 development board provided by Hard禾 Academy and Elecrow, successfully implements a real-time audio signal collection, transmission, and visualization analysis system. The project has provided insights into embedded system development, digital signal processing, and GUI design, validating the feasibility of the ESP32 in real-time audio processing scenarios. Special thanks to Hard禾 Academy for providing the practical platform and to Elecrow for their support; the highly integrated CrowPanel development board provided the essential hardware foundation for rapid prototyping of the project.

Dual Display of Spectrum and Waveform: Transforming the ESP32 into a Mini Oscilloscope

Click to read the original text for more information

Leave a Comment