0% found this document useful (0 votes)
2 views20 pages

Chapter Three

Chapter Three details the design and implementation of an ESP32-controlled audio recording system, outlining its architecture and component functions, including power supply, audio capture, data storage, and wireless communication. The system is designed for reliability and efficiency, featuring a modular structure that simplifies troubleshooting and future upgrades. Key components include the ESP32 microcontroller, microphone module, microSD card for storage, and a power management system that ensures continuous operation even during power interruptions.

Uploaded by

managermuhkid
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views20 pages

Chapter Three

Chapter Three details the design and implementation of an ESP32-controlled audio recording system, outlining its architecture and component functions, including power supply, audio capture, data storage, and wireless communication. The system is designed for reliability and efficiency, featuring a modular structure that simplifies troubleshooting and future upgrades. Key components include the ESP32 microcontroller, microphone module, microSD card for storage, and a power management system that ensures continuous operation even during power interruptions.

Uploaded by

managermuhkid
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

CHAPTER THREE

SYSTEM DESIGN AND IMPLEMENTATION

3.1 INTRODUCTION
This chapter explains how the ESP32-controlled audio recording system was designed and how it works
as a complete unit. The purpose of this chapter is to help describe the structure of the system, the
function of each component, and the method used to achieve reliable audio recording, storage, and
wireless data transmission.

The chapter begins by describing the overall system architecture, showing how the different parts of the
system are connected and how they interact with one another. These parts include the power supply
and battery backup unit, the ESP32 microcontroller, the microphone module used to capture sound, the
microSD card used for storing recorded audio, and the wireless communication interface that allows
remote access and control. Each component is discussed in a clear and straightforward manner to
ensure easy understanding.

In addition, this chapter explains the operational process of the system from the moment power is
applied. It describes how the ESP32 initializes the system, receives audio signals from the microphone,
converts these signals into digital form, and stores the recorded data on the SD card. The process of
transmitting stored data wirelessly and receiving remote control commands is also explained.

Special attention is given to important design considerations such as power efficiency, data reliability,
and system stability. These considerations ensure that the device can operate for long periods,
especially in battery-powered conditions, without data loss or system failure.

Overall, this chapter provides a detailed yet simple explanation of the design approach and
methodology used in developing the system. It serves as a foundation for the implementation and
testing procedures presented in the next chapter
Figure 3.1: The block diagram of the Voice-Recorder

3.2 SYSTEM OVERVIEW


The system developed in this project is an ESP32-controlled audio recording and data storage device
designed to capture sound, store recorded information locally, and allow wireless access and remote
control. The system brings together several hardware and software components that work as a single
unit to provide reliable audio recording while maintaining low power consumption and ease of use.

At the heart of the system is the ESP32 microcontroller, which serves as the main control and processing
unit. The ESP32 was selected because it combines processing power, memory, and wireless
communication capability in one compact device. This makes it suitable for applications that require
both data processing and wireless connectivity. All other components in the system are connected to
the ESP32 and depend on it for coordination and control.

The system includes a microphone module that is responsible for capturing sound from the
environment. When sound waves reach the microphone, they are converted into small electrical signals.
These signals represent the audio information but are still in analog form. Since the ESP32 operates
digitally, it uses its internal Analog-to-Digital Converter (ADC) to convert these analog signals into digital
data that can be processed and stored (Rusimamto, 2021).
Once the audio signals are converted into digital form, the ESP32 processes the data and organizes it
into a suitable format for storage. The processed audio data is then saved on a microSD card. The SD
card provides non-volatile storage, which means the data remains stored even when the system is
switched off or the battery runs out. This makes the system reliable for long-term recording and ensures
that important audio data is not lost (Wang, 2026).

In addition to storing data locally, the system supports wireless communication through the ESP32’s
built-in Wi-Fi module (Noronha, 2017). This feature allows recorded audio files to be transferred
wirelessly to another device or remote storage location when a network connection is available
(Thekkathil, 2025). It also allows users to send control commands to the system remotely, such as
starting or stopping the recording process (ElGibreen, 2022). This reduces the need for physical access to
the device and increases operational convenience (Wu, 2021).

Power management is an important part of the system design (Wang, 2026). The system is powered by
a regulated power supply and includes a rechargeable battery for backup operation (Alqahtani, 2025).
The power supply unit ensures that all components receive stable voltage, which is necessary for proper
operation and data integrity (Shakhatreh, 2019). The battery backup allows the system to continue
operating during power interruptions, making it suitable for portable and unattended use (P., 2023).

The overall design of the system follows a modular approach, where each functional unit performs a
specific role (Zhe, 2025). These units include the power supply module, microcontroller unit, audio input
module, storage module, and wireless communication module (Attia, 2016). This modular structure
simplifies system design, improves reliability, and makes troubleshooting easier (Chandnani, 2025). It
also allows future improvements or upgrades to be made without redesigning the entire system (Wild,
2021).

From a user perspective, the system operates in a simple and automated manner (R, 2021). Once
powered on, the ESP32 initializes all connected components and prepares the system for operation
(Islam, 2023). Audio recording begins based on predefined conditions or remote commands (Benayed,
2026). Recorded data is stored safely on the SD card and can later be accessed either directly or
wirelessly (Bedretchuk, 2023).

In summary, the ESP32-based audio recording system provides a balanced combination of performance,
reliability, and simplicity (Kostadimas, 2025). By integrating audio capture, local storage, wireless
communication, and efficient power management into a single system, the design meets the
requirements of modern embedded applications (Kampeerawar, 2018). This system overview provides a
clear understanding of how the device functions as a whole and prepares the reader for the detailed
design discussions presented in the following sections (Harrold, 2020).

3.3 CIRCUIT DESCRIPTION


The circuit for the "Design and Construction of an ESP32-Based Voice Recorder " is systematically
divided into two major sections: the Power Supply Section and the Processing Unit Section (Guo, 2016).
Each section plays a unique role in ensuring the smooth operation, stability, and functionality of the
voice recorder system (Sadaf, 2023).

3.3.1 Power supply

The power supply circuit is designed to provide a stable 3.3 V output required by the ESP32, SD card
module, and microphone module (GM, 2026). It also includes a battery charging and backup mechanism
to allow the system to operate independently of mains power (Saraswathi, 2024).

[Link] AC-DC 5V Adapter (U1)

The circuit bgins with an AC–DC adapter that converts the 220 V alternating current (AC) from the mains
supply into a regulated 5 V direct current (DC). This conversion is necessary because the electronic
components used in the system operate at low DC voltage levels and cannot be connected directly to
the mains supply (Akter, 2025). The adapter therefore serves as the primary power entry point of the
system and provides electrical energy to both the battery charging circuit and the voltage regulation
stage (R, 2024).

The adapter output voltage of 5 V is selected because it is compatible with the TP4056 lithium battery
charging module and also provides sufficient voltage headroom for proper regulation (Lang, 2025). The
ground terminal of the adapter is connected to the system ground and serves as a common reference
point for all components in the circuit (Agrawal, 2024).

The current rating of the adapter is chosen such that it can supply both the system operating current
and the battery charging current simultaneously (Abbasi, 2025). This requirement is expressed as:

Iadapter ≥ Isystem+Icharging
This condition ensures that the adapter can support normal system operation while charging the battery
without experiencing voltage drop or instability (Zhou, 2021).

Figure 3.2: Circuit Diagram of the Arduino-Based Voice Recorder Power Supply Unit

[Link] TP4056 Charging and Protection Module (U2)

The TP4056 module is used to charge the lithium-ion battery and control power flow between the
external supply and the system (Anshori, 2025). It is designed for single-cell lithium batteries and is
suitable for portable embedded systems such as the ESP32-based audio recorder developed in this
project.

The module accepts a 5 V DC input from the AC–DC adapter and regulates the charging process to
protect the battery from over-current, over-voltage, and overheating (Rangarajan, 2023). In the circuit,
the TP4056 input is connected to the adapter output, while its output is connected to both the battery
and the system power path. This configuration allows the battery to charge when mains power is
available and automatically supply power to the system when the adapter is disconnected.

Charging is performed using a constant-current, constant-voltage (CC–CV) method (Muslimin, 2023).


Initially, the battery is charged with a fixed current. As the battery voltage approaches 4.2 V, the module
switches to constant-voltage mode and gradually reduces the charging current. Charging stops
automatically when the current falls below a preset threshold, indicating full charge.

The charging current is set using a resistor connected to the program pin of the TP4056 (Anshori, 2025).
The charging current is defined by:

ICHG = 1200 / RPROG (mA)

𝐼𝐶𝐻𝐴𝑅𝐺𝐸 = 1200 1.2𝑘Ω =1000𝑚𝐴


According to the datasheet of this module, a 1.2kΩ 𝑅𝑃𝑅𝑂𝐺 will give a charging current
𝐼𝐶𝐻𝐴𝑅𝐺𝐸 between 950𝑚𝐴 and 1050𝑚𝐴 (Jang, 2025).

The TP4056 includes internal thermal regulation, which reduces the charging current if excessive
temperature is detected (Chopde, 2025). This prevents overheating and improves battery safety,
especially in compact systems.

When external power is removed, the TP4056 stops charging and the battery immediately powers the
system without interrupting operation. This ensures continuous power delivery to the ESP32 and
prevents data loss during audio recording.

In this project, the TP4056 provides controlled battery charging, automatic power switching, and safe
energy management, making it a critical component of the system power architecture (Paul, 2025).

[Link] LM2576T-3.3V Switching Regulator (U3)

The LM2576T-3.3 converts the battery or 5 V supply into a stable 3.3 V output required by all digital
components (Parashar, 2019). As a buck switching regulator, it reduces voltage by rapidly switching an
internal transistor and transferring energy through an external inductor. This method delivers high
efficiency, which minimizes heat and extends battery runtime.

In the circuit, the regulator receives power from the TP4056 output, allowing it to operate whether the
system is running from mains power or the battery (Inafuco, 2025). Its fixed 3.3 V output protects the
ESP32, SD card, and microphone module from overvoltage. The regulator must support the peak load
current of the system, and its output power is determined by: (Wei, n.d.)

POUT = VOUT × ILOAD

External components dictate performance: the inductor stores and releases energy during switching, the
diode provides a current path when the switch is off, and capacitors suppress ripple to maintain a clean
DC output (Tian, 2025). Together, these elements allow the LM2576 to deliver a stable voltage under
varying loads such as Wi-Fi transmission and SD card writes (, 2024).

In this project, the LM2576T-3.3 provides efficient, reliable, and continuous regulation, ensuring all
subsystems receive the correct operating voltage from either power source.
[Link] Inductor L1 (Buck Converter Energy Storage Component)

The inductor L1 is a critical part of the LM2576 buck regulator circuit (Wu, 2025). It stores energy when
the regulator’s internal switch turns on and releases that energy to the load when the switch turns off.
This controlled transfer of energy smooths the current flow and allows the regulator to maintain a
constant 3.3 V output from a higher input voltage (Lahade, 2026).

The inductance value is selected to ensure continuous current flow under all operating conditions,
preventing excessive ripple that could disrupt the ESP32 or sensitive audio circuitry (Rathnayake, 2021).
The inductor’s current rating must exceed the maximum load current to avoid saturation, which would
lead to voltage instability and power loss (Tuan, n.d.).

In this project, L1 enables the LM2576 to efficiently convert battery or adapter voltage into a stable
supply, minimizing power dissipation and supporting steady operation during high-demand events such
as wireless transmissions and SD card writes (Soni, 2025).

[Link] Capacitor C1 (100μF) – Input Filter Capacitor

C1 is positioned at the input of the LM2576 to stabilize the supply voltage and maintain smooth
operation of the converter (Omran, 2023). It absorbs sudden changes in load current and prevents
voltage dips that could interrupt regulation (Su, 2026). By supplying short bursts of current when the
system demand increases, C1 reduces stress on the TP4056 output and keeps the regulator input
voltage steady (Kersting, 2009).

Its capacitance value is chosen to limit voltage ripple and maintain stable input conditions across the full
range of battery and adapter operation (Silva, 2025). The capacitor’s voltage rating ensures safe
operation above the maximum battery voltage (Auer, 2020).

In this system, C1 supports continuous power delivery to the regulator, enabling reliable 3.3 V output
during rapid load transitions such as SD card writes and Wi-Fi bursts (, 2024).

. A 100μF capacitor was selected to provide sufficient energy during transient events (Su, 2026). Using
the formula:

C = I × Δt / ΔV = (0.5A × 1ms) / 0.1V = 50μF (Baturin, n.d.)


A 100μF capacitor provides a healthy margin and ensures clean voltage delivery (Spreafico, 2024). It is
polarized, so the positive terminal connects to VOUT and the negative to GND (Agnew, n.d.).

[Link] Capacitor C2 (330μF) – Output Filter Capacitor


The output capacitor, labeled C2 in the circuit, is connected at the output of the LM2576 voltage
regulator and plays a critical role in stabilizing the regulated 3.3 V supply (Tian, 2017). Its primary
function is to filter out voltage ripple and suppress high-frequency noise generated during the switching
operation of the regulator.

During normal operation, sudden changes in load current occur when the ESP32 transmits data,
accesses the SD card, or processes audio signals (Zhe, 2025). These rapid current variations can cause
momentary voltage drops or fluctuations. The output capacitor supplies or absorbs current instantly
during these transitions, ensuring that the output voltage remains stable and within safe operating
limits.

The value of C2 is selected based on the regulator’s requirements and the expected load current (Liang,
n.d.). A sufficiently large capacitance ensures reduced output ripple and improved transient response,
which is essential for sensitive digital components such as the ESP32 and the SD card module. The
voltage rating of the capacitor is chosen to be higher than the regulated output voltage to ensure safe
and reliable operation.

In this system, the output capacitor works together with the inductor and diode to form a stable buck
conversion stage (Thongmark, 2023). This combination ensures smooth DC output, minimizes electrical
noise, and enhances the overall reliability of the power supply. Proper filtering at this stage is especially
important to prevent voltage fluctuations that could affect audio quality or cause system instability.

[Link] Diode – D1 (FR107) (Freewheel Path for Buck Converter)

The FR107 diode provides a continuous current path in the LM2576 buck converter whenever the
regulator switch turns off (Tan, n.d.). When the internal transistor opens, the inductor releases stored
energy, and the diode conducts instantly to prevent voltage spikes and maintain current flow to the
load. This protects the regulator and stabilizes the 3.3 V output.
The FR107 is chosen for its fast recovery characteristics and ability to handle the current demanded by
the ESP32 system during peak activity (Vobecky, n.d.). Its forward current and reverse voltage ratings
exceed the expected operating levels, ensuring reliable switching performance and durability.

In this design, the FR107 enables smooth energy transfer within the regulator circuit, prevents switching
noise from propagating to the load, and ensures clean, dependable power delivery under both battery
and mains operation (Mitra, 2017).

3.3.2 Processing unit

The processing unit is the core of the system, handling audio acquisition, processing, storage, and
communication (Cameron, 2023). It integrates the microphone module, storage interface, and wireless
connectivity to enable the spy-bug recording function (P., 2023).

The MAX9814 captures ambient sound and outputs a conditioned analog signal (Kadis, 2012). This signal
is fed into the ESP32-S3, where the internal ADC converts it into digital samples. Once recording starts,
the microcontroller continuously samples the signal to maintain accurate audio capture.

The digital audio is briefly buffered and then stored on the microSD card in WAV format, ensuring
compatibility with standard audio software (Soto, 2025).

Using its built-in Wi-Fi capability, the ESP32-S3 can also upload recorded files to cloud storage, enabling
remote access and backup without removing the SD card (, 2024)
Figure 3.3: Circuit Diagram of the ESP32-Based Voice Recorder Processing Unit

[Link] ESP32 connections

The ESP32-S3 microcontroller serves as the central control unit of the system and interfaces with the
microphone amplifier, SD card storage module, and indicator circuitry through its GPIO and
communication interfaces (Ibrahim, 2010). Each peripheral module is connected to specific pins of the
ESP32-S3 to enable signal acquisition, data transfer, and system control.

The analog output of the MAX9814 microphone amplifier MICOUT (Pin6) is connected to Pin 35, which
functions as an analog input pin of the ESP32-S3 (Pfanzagl-Cardone, 2023). This pin is connected to the
internal Analog-to-Digital Converter (ADC) of the microcontroller. The ADC samples the analog audio
signal produced by the microphone amplifier and converts it into digital data that can be processed and
stored by the system.

Communication between the ESP32-S3 and the microSD card module is implemented using the Serial
Peripheral Interface (SPI) (Dawoud, 2022). The SPI communication lines are connected as follows: Pin 29
is used as the Serial Clock (CLK) pin5 of the microSD card module ,Pin 30, 25 and 26 are connected to the
Pin 7, 9 and 10 of the microSD card module . These connections allow the ESP32-S3 to control data
transfer and write recorded audio files to the SD card.
The system status LED is controlled through Pin 14, which is configured as a digital output pin (Dafonte,
2024). This pin drives the base of the BC547 transistor through a resistor. When the ESP32 sets the pin
high, the transistor switches on and allows current to flow through the LED, indicating system activity.

The ESP32-S3 operates from a regulated 3.3 V supply, which is connected to the VDD pin of the
microcontroller (Cameron, 2023). Proper grounding is maintained by connecting all ground points in the
circuit to the GND pins of the ESP32-S3 to ensure stable operation and minimize electrical noise.

Through these connections, the ESP32-S3 coordinates audio acquisition from the microphone module,
storage of digitized audio data on the microSD card in WAV format, and wireless transmission of
recorded files to cloud storage using its integrated Wi-Fi capability (Boettiger, 2026).

[Link] Microphone module connection (U1)

The MAX9814 module is essentially a microphone with an integrated amplifier and gain control circuit
(Pfanzagl-Cardone, 2023). It listens to sounds in the surrounding environment, converts those sounds
into weak analog signals, and amplifies them before passing the output to theESP32 (Μοσχογιάννης,
2025). The microphone onboard is an electret condenser type, well known for its sensitivity and
compact size, making it ideal for use in a covert spy bug voice recorder like this one (Yudaningtyas,
2020). The output signal from the sensor is analog in nature, which means it represents sound intensity
as a continuously varying voltage (Warden, 2022).

Pin 5 of the microphone module (U1) is the designated VCC is connected to the 3.3𝑉 rail (Pfanzagl-
Cardone, 2023). This supplies the necessary voltage to operate the internal circuitry of the microphone
module. Choosing 3.3𝑉 instead of 5𝑉 ensures compatibility with low-voltage modules like the ESP32
and also protects the input circuitry.

Pin 6 of the microphone module (U1) is the designated MICOUT which is the output pin of the module,
delivers the amplified analog signal corresponding to ambient sound (Self, 2023). This pin is connected
directly to Pin 35 of the ESP32. The Arduino reads this voltage level using its internal Analog-to-Digital
Converter (ADC), digitizing it for storage or processing (Katsidimas, 2023).

Pin 7 of the microphone module (U1) is the designated GND so it was connected to the system's ground
line (Pfanzagl-Cardone, 2023). It completes the electrical circuit and serves as a common reference point
for all components. Without this connection, the signal readings would be unstable or invalid. The
incoming signal is sampled by the ESP32 ADC at regular intervals, and these values are saved to a file on
the SD card (Merabtane, 2023). The result is a digital audio representation of the recorded sound, stored
in a format that can be retrieved and analyzed later (Deanitael, 2010).

Pin 8 of the microphone module (U1) is the designated MICIN which is the intput pin of the module, AC
signal from the microphone is passed into this pin to the module (Liang, 2025).

[Link] Status Indicator (LED with BC547 transistor)

The ESP32 Pin 14 was used to control a BC547 NPN transistor, which acts as a switch. When Pin 14 goes
HIGH, it supplies a small current to the base of the transistor through a resistor. This turns the transistor
ON, allowing current to flow from the 3.3𝑉 line, through the LED (LED1), and then through the
transistor to GND. As a result, the LED lights up, indicating that the system is actively recording. This
setup allows the ESP32 to control the LED without directly powering it, reducing the load on the
microcontroller pin and protecting it from overcurrent.

VESP− I𝐵𝑅2− 𝑉𝐵𝐸 = 0

where 𝐼B is the base current of the transistor, 𝑅2 is the base resistance of the transistor and 𝑉𝐵𝐸 is
the base emitter voltage drop of the transistor (Atta, 2021)..

The minimum base current (IB) required by BC547 is 4.3𝑚𝐴. Using

∴ VESP− I𝐵𝑅2− 𝑉𝐵𝐸 = 0

5 − 0.0043𝑅2 − 0.7 = 0;

4.3 = 0.0043 𝑅2

𝑅2=1𝑘Ω resistor was used.

Vcc −If𝑅1− 𝑉f− 𝑉ce(sat) = 0

where Vcc is the source voltage, Vf is the forward voltage, 𝑉ce(sat) is the small voltage drop across the
transistor (the BC547) when it is fully ‘’ON’’ (saturated). If is the forward current across the led, 𝑅1 is
the resistance.

Vcc −If𝑅1− 𝑉f− 𝑉ce(sat) = 0

3.3−0.0012 𝑅1−2−0.1 = 0
1.2= 0.0012R1

R1 =1𝑘Ω

[Link] SD Card Module (U3)

The microSD card module is used to store recorded audio data in WAV format (Cîrlugea, 2025). It
provides non-volatile memory, allowing recorded files to be retained even after power is removed. The
ESP32 communicates with the microSD card using the Serial Peripheral Interface (SPI) protocol, which
enables high-speed data transfer and reliable storage (Camarillo-Escobedo, 2022).

The SD card module has communication lines that are connected between the ESP32 and the SD card
socket to enable data exchange. The clock line (Pin 5) synchronizes communication, the DAT 0 line (pin
7) transfers data from the ESP32 to the SD card and vice versa, likewise Pin 9 and Pin 10. The chip select
line allows the ESP32 to activate the SD card during communication.

The SD card receives its operating voltage through the VDD (Pin 4), which is connected to the system
supply of 5V (Cîrlugea, 2025). The ground pins of the SD card and VSS (Pin 6) are connected to the
common system ground to ensure proper electrical reference.

A decoupling capacitor 100nF (C1) is placed across the power supply terminals to stabilize voltage and
reduce noise during write operations (Mondal, 2024). The value of 100nF is selected because it is the
standard decoupling capacitor value recommended for digital ICs.

Resistor R3 (1kΩ) is connected between the 5V supply rail and the VDD pin of the DM3D-SF microSD
card module, functioning as a pull-up resistor on the card's power supply line (Cîrlugea, 2025). It ensures
the VDD pin is held at a defined voltage level during power-on, preventing the SD card interface from
floating to an indeterminate state before the main supply rail stabilises. The 1kΩ value is selected to
provide sufficient sourcing current to hold the line high, while limiting the standing current draw from
the 5V rail to 5mA, a conservative value that does not contribute meaningfully to system power
consumption

During operation, the ESP32 creates a WAV file on the SD card and continuously writes digitized audio
data received from the microphone (Pfanzagl-Cardone, 2023). The use of SPI communication allows the
microcontroller to store data efficiently while maintaining system stability (Segura-García, 2024). This
storage mechanism ensures that recorded audio files are saved locally and can later be accessed or
transmitted wirelessly to cloud storage (Ren, 2022).

The microSD card interface therefore provides reliable audio storage, supports WAV file formatting, and
enables retrieval of recorded data for playback or remote transmission (Hassan, n.d.).

3.4 SOFTWARE DESIGN

The software component of the system manages audio acquisition, processing, storage, and wireless
transmission (Pousibet-Garrido, 2025). The program is developed using Arduino C/C++ in the Arduino
IDE and uploaded to the ESP32-S3 microcontroller (Li, 2024). Although other development frameworks
exist, the Arduino IDE was selected due to its simplicity, library support, and rapid prototyping capability
(Miranda, n.d.).

3.4.1 Arduino IDE

The Arduino IDE (Integrated Development Environment) is an open-source software, which is used to
write and upload code to the Arduino board (Pakdel, 2025). It is an official Arduino software, making
code complication too easy that even a common person with no prior technical knowledge can get their
feet wet with the learning process. It is easily available for operating systems like MAC, windows, LINUX,
and runs on the Java platform that comes with inbuilt functions and commands that plays a vital role for
debugging, editing and compiling the code in the environment.

3.4.2 Firebase

Firebase is a cloud-based platform developed by Google that provides backend services for building and
managing modern web and mobile applications (Cameron, 2023). It offers developers a wide range of
tools and infrastructure without needing to manage servers manually. Some of Firebase's key services
include: real-time Database and Cloud Fire-store for storing and syncing data across devices in real time
and cloud Functions for running server-side logic in response to events or HTTPS requests. Firebase is
widely used in IoT and embedded projects where modules like ESP8266 or ESP32 can be connected to
the cloud. For instance, in a voice recorder project, Firebase could be integrated to upload recorded file
logs, receive remote control commands, or monitor device status online.
3.4.3 Flowchart for the Software Design of the Spy-bug

Figure 3.4 shows the flowchart for the control of the recording operation of the spy-bug.

Figure 3.4: Flowchart of the System

The flowchart in Figure 3.4 is a visual representation of the code’s logic (Kolok, 2025). Once the system is
connected to the power supply, the Wi-Fi module initializes the system, then the microphone module
begins recording (, 2024). It captures the sound (analog signal) (Warden, 2022). This command is passed
to the ESP32 which takes the audio data from the microphone module (MAX9814) and digitizes it via its
Analog-to-Digital Converter (ADC), after which the audio data is passed to the SD Card. The WAV file is
saved and closed until the next recording cycle (Soto, 2025). The SD Card can be removed successfully.

3.4.4 Code Structure

The software controls how the system records audio, saves it, and sends it wirelessly (Pousibet-Garrido,
2025). The program is written in Arduino C/C++ and uploaded to the ESP32 microcontroller using the
Arduino IDE. The ESP32 acts as the brain of the system, managing the microphone input, SD card
storage, and Wi-Fi communication (, 2024).
When the system starts, the ESP32 sets up all the connected components (Warden, 2022). The
microphone pin is configured to receive analog audio signals, the SD card pins are prepared for data
storage, and the Wi-Fi module is initialized for wireless communication. Each pin is assigned a specific
role so the ESP32 knows which component it is communicating with.

The SD card communicates with the ESP32 using SPI (Serial Peripheral Interface) (Cîrlugea, 2025). This
requires main connections: clock (SCK), data lines, and chip select (CS). These pins are defined in the
program and initialized during startup. Once configured, the ESP32 can create files and store recorded
audio on the SD card.

The following libraries are included to support system operation: (Hazott, 2025)

WiFi.h for wireless connection

SPI.h for SPI communication

SD.h for SD card storage

FS.h for file system handling

During operation, the ESP32 reads the audio signal from the MAX9814 microphone through its analog
input (Mitsuyama, 2023). The signal is converted into digital data and temporarily stored in memory
(Mahbub, 2024). After enough data is collected, it is saved to the SD card in WAV format (Indrayani,
2020). This format allows the recorded audio to be played on standard media players.

After recording, the ESP32 connects to a Wi-Fi network and uploads the saved audio file to cloud storage
(, 2024). This allows the recorded data to be accessed remotely without removing the SD card. The
software also controls the LED indicator to show when the system is recording or idle.

This software structure enables simple and reliable audio recording, secure local storage, and wireless
access to recordings while keeping the system easy to understand and operate (Segura-García, 2024).

References

Abbasi, M. S. W., Kazmi, S., Billah, M., Altamimi, A., Khan, Z., & Malik, A. (2025). Power
quality optimization framework for three phase microgrids with grid tied solar PV and battery
storage under nonlinear loads. Scientific Reports. [Link]
Agrawal, S., Rage, R., Sahoo, M., & Kuncham, S. K. (2024). A single‐phase seven‐level buck–
boost common ground transformerless inverter for grid‐connected photovoltaic system.
International Journal of Circuit Theory and Applications. [Link]

Akter, K., Motakabeer, S., Alam, A. Z., Yusoff, S., Pachauri, R., Malik, H., & VK, J. (2025). A
novel MPPT approach for photovoltaic system using pelican optimization and high-gain DC-DC
converter. Scientific Reports. [Link]

Alqahtani, M., Alhajri, S., Menesy, A. S., Mohammed, A. M., Sultan, H. M., & Malik, K.
(2025). Comprehensive techno-environmental evaluation of an isolated PV/wind/biomass hybrid
microgrid employing various battery technologies: A comparative analysis. PLOS ONE.
[Link]

Anshori, I., Syafalni, I., Reivan, C., Ramadhan, I., Jonathan, T., Sari, R., & Sanjaya, A. (2025).
GANESTAT — a comprehensive design and modular analysis of portable, low-cost, and high-
accuracy potentiostat. PLOS ONE. [Link]

Attia, H. (2016). Multi-functional microcontroller based monitoring, alarming and protection


system. Semantic Scholar.
[Link]

Bedretchuk, J. P., García, S. A., Igarashi, T., Canal, R., Spengler, A. W., & Gracioli, G. (2023).
Low-cost data acquisition system for automotive electronic control units. Sensors, 23(4), 2319.
[Link]

Benayed, W., & Mahjoub, M. S. (2026). Voice-controlled autonomous navigation for smart
wheelchairs using ROS-based SLAM. Scientific Reports.
[Link]

Cameron, D. (2023). Practical smart device design and construction. Apress.

Chandnani, K., Tripathy, S., Parbhakar, A. K., Takiar, K., Singhal, U., Sasikumar, P., &
Maheswari, S. (2025). A novel smart baby cradle system utilizing IoT sensors and machine
learning for optimized parental care. Scientific Reports. [Link]
02691-8

Chopde, A., & Bhadauria, T. (2025). A new IoT smart plug framework using ESP32 for adaptive
charging and thermal protection. International Journal of Scientific Engineering and Research.
[Link]

ElGibreen, H., Ali, G. A., AlMegren, R., AlEid, R., & Alotaibi, S. (2022). Telepresence robot
system for people with speech or mobility disabilities. Sensors, 22(22).
[Link]
Guo, C., & Sun, J. (2016). Design of power supply for portable acoustic shock acquisition
system. 2016 International Conference on Audio, Language and Image Processing (ICALIP).
[Link]

Harrold, C. (2020). Smart system building lab. In Practical smart device design and
construction. Apress. [Link]

Inafuco, A., Machoski, P., Campos, D., Pichorim, S., & Marques, J. J. A. (2025). MOT: A low-
latency, multichannel wireless surface electromyography acquisition system based on the
AD8232 front-end. Sensors. [Link]

Islam, M. N., Raiyan, K. R., Mitra, S., Mannan, M., Tasnim, T., Putul, A. O., & Mandol, A. B.
(2023). PredictIS: An IoT and machine learning-based system to predict risk level of
cardiovascular diseases. BMC Health Services Research. [Link]
09104-4

Jang, Y., Song, S., Lim, S. J., & Kang, F. (2025). Relationship between charging time and
converter reliability according to the current magnitude of the CC section in the CCCV charging
method. 2025 IEEE International Conference on Artificial Intelligence in Engineering and
Technology (IICAIET). [Link]

Kampeerawar, W., Koseki, T., & Zhou, F. (2018). Efficient urban railway design integrating
train scheduling, onboard energy storage, and traction power management. 2018 International
Power Electronics Conference (IPEC-Niigata 2018 - ECCE Asia).
[Link]

Kostadimas, D., Kasapakis, V., & Kotis, K. (2025). A systematic review on the combination of
VR, IoT and AI technologies, and their integration in applications. Future Internet, 17(4), 163.
[Link]

Lang, W., & Xu, F. (2025). A study on the constant-current/constant-voltage output


characteristics of a lithium battery wireless charging system based on the LCC-S compensation
topology. 2025 2nd International Conference on Energy Technology and Electrical Power
(ETEP). [Link]

Muslimin, S., Maulidda, R., Nawawi, M., Rahman, A., & Kurnia, P. M. (2023). The method of
constant current–constant voltage (CC–CV) for SECA electric car battery charging with fuzzy
logic controller. Atlantis Highlights in Engineering: Proceedings of the 6th FIRST 2022
International Conference (FIRST-ESCSI 2022). [Link]

Noronha, S., Prasad, P., Puttaswamy, P., Shetty, S., & Bhat, S. (2017). Wi-Mob: Power
transmission system for charging smart phones using RF module through Wi-Fi. IJARCCE.
[Link]

Ochoa, H. J., Peña, R., Mezquita, Y. L., Gonzalez, E., & Cama-Pinto, S. (2023). Comparative
analysis of power consumption between MQTT and HTTP protocols in an IoT platform designed
and implemented for remote real-time monitoring of long-term cold chain transport operations.
Sensors, 23(13). [Link]

P., R. (2023). INTERPOL review of digital evidence for 2019–2022. Forensic Science
International: Synergy. [Link]

Parashar, S., Kokkonda, R., & Bhattacharya, S. (2019). Design of modular auxiliary gate driver
power supply for medium voltage converter system. 2019 IEEE Energy Conversion Congress
and Exposition (ECCE). [Link]

Paul, D., Alam, M. S., Babu, R. M., & Hossain, M. M. (2025). Smart solar battery charging
station with dynamic adaptive switching control. 2025 IEEE Electrical Power and Energy
Conference (EPEC). [Link]

R, R. C., T, K., E, K., S, A., & S, S. P. (2024). Optimizing solar energy harvesting: Unveiling the
efficiency boost with maximum power point tracking in battery charging system. 2024
International Conference on Electrical Electronics and Computing Technologies (ICEECT).
[Link]

Rangarajan, S. S., Raman, R., Singh, A., Shiva, C. K., Kumar, R., Sadhu, P. K., & Senjyu, T.
(2023). DC microgrids: A propitious smart grid paradigm for smart cities. Smart Cities, 6(4).
[Link]

Rusimamto, P. W., Endryansyah, E., Anifah, L., Harimurti, R., & Anistyasari, Y. (2021).
Implementation of Arduino Pro Mini and ESP32 CAM for temperature monitoring on automatic
thermogun IoT-based. Indonesian Journal of Electrical Engineering and Computer Science,
23(3), 1366–1375. [Link]

Shakhatreh, H., Sawalmeh, A., Al‐Fuqaha, A., Dou, Z., Almaita, E., Khalil, I., & Guizani, M.
(2019). Unmanned aerial vehicles (UAVs): A survey on civil applications and key research
challenges. IEEE Access. [Link]

Tian, R., Wang, N., Xie, X., Lou, H., Dai, Y., Wang, X., & Wu, X. (2025). Sub-module
capacitor voltage ripple suppression strategy of FB-MMC for continuous co-phase traction
power supply system. 2025 10th Asia Conference on Power and Electrical Engineering
(ACPEE). [Link]

Wang, R., Lu, T., Wang, F., Lu, Y., & Huang, J. (2026). StepsConnect: A real-time step-sensing
ambient display system to support connectedness for family members living apart. Sensors.
[Link]

Wang, Y., & Chen, H. (2026). RF energy harvesting-aided IoT network: System design and
prototype implementation. Micromachines. [Link]
Wei, J., & Lee, F. (2004). An output impedance-based design of voltage regulator output
capacitors for high slew-rate load current transients. Nineteenth Annual IEEE Applied Power
Electronics Conference and Exposition (APEC '04). [Link]

Wild, T. A., Wikelski, M., Tyndel, S. A., Alarcón‐Nieto, G., Klump, B. C., Aplin, L. M., &
Williams, H. J. (2021). Internet on animals: Wi‐Fi‐enabled devices provide a solution for big
data transmission in biologging. Methods in Ecology and Evolution.
[Link]

Wu, Q., Zhang, S., Zheng, B., You, C., & Zhang, R. (2021). Intelligent reflecting surface-aided
wireless communications: A tutorial. IEEE Transactions on Communications.
[Link]

Zhe, C. (2025). Design and implementation of a toxic gas detection system based on ESP32.
Hochschule Mittweida. [Link]

Zhou, J., Guidi, G., & Suul, J. A. (2021). High efficiency operation of inductive battery charging
system by the coordinated voltage-frequency control during large variations in coupling
conditions. 2021 IEEE 12th Energy Conversion Congress & Exposition – Asia (ECCE-Asia).
[Link]

You might also like