How to Build an Offline ESP32 Walkie Talkie – Step-by-Step Project Guide

0

 

ESP32 Walkie Talkie, ESP32 Audio Transmission, ESP-NOW Tutorial, I2S Mic ESP32, ESP32 DAC Output, Analog Mic Noise, DIY Wireless Audio, Offline ESP32 Communication, Embedded Audio Project, etdiscover


This project demonstrates how to build a fully functional wireless audio communication system using two ESP32 microcontrollers, without requiring WiFi or internet. The communication is entirely offline using ESP-NOW protocol, which allows peer-to-peer data transfer. The final setup enables real-time audio transmission, LED control, OLED status display, and signal strength monitoring.

Step 1: How to Find the MAC Address of an ESP32

ESP-NOW uses MAC addresses to identify and connect with peers. To enable communication between two ESP32 boards, you must first retrieve each board’s MAC address.

Upload the following code to your ESP32:

#include <WiFi.h>
void setup() { Serial.begin(115200); Serial.println(WiFi.macAddress()); } void loop() {}

Open the Serial Monitor and note the MAC address printed, e.g., C8:F0:9E:12:34:56. You will use the MAC of one ESP32 to register it as a peer on the other.


ESP32 mac


Step 2: How ESP32 Communicates Using MAC Address

After retrieving MAC addresses, you can establish communication using ESP-NOW. The process involves:

  • Setting WiFi mode to WIFI_STA

  • Initializing ESP-NOW

  • Adding the peer using its MAC address

  • Sending and receiving data using callbacks

At this point, you can start sending simple messages or control signals between TX and RX boards.

[Insert code snippet for ESP-NOW communication setup]

Step 3: Controlling an LED on RX from TX

To demonstrate command-based control, we send a message from TX to turn an LED on or off at the RX end. The RX ESP32 parses the received message and updates the LED state.

For example:




This is a simple yet effective way to understand bidirectional control logic using ESP-NOW.

Step 4: Displaying LED State and POT Value on OLED



To provide user feedback, add a 128x64 OLED display (I2C) to the RX side.

Features:

  • The RX device displays current LED state (ON/OFF)



  • The TX side reads a potentiometer value (analogRead) and sends it to RX

  • The RX displays this value in real-time

This setup is great for visual monitoring of remote sensor data.




Step 5: Audio Transmission Between Two ESP32 Boards

This is the core functionality — transmitting real-time audio from TX to RX.

TX Side:

  • Connect a microphone module

  • Initially, I used an analog microphone with op-amp LM393 module 

RX Side:

  • Use ESP32’s DAC output (GPIO25 or GPIO26)

  • Amplify the DAC signal using a 3W I2S amplifier (e.g., PAM8403)

  • Why I Used a 16-bit I2S 3W Audio Amplifier Instead of ESP32’s Internal DAC

    The ESP32 does include a built-in DAC (Digital to Analog Converter), available on GPIO25 and GPIO26. However, this internal DAC has several limitations that make it unsuitable for quality audio output in real-time applications.

    Limitations of ESP32’s Internal DAC:

    • The internal DAC is only 8-bit, which means it can only represent 256 levels of audio signal.



    • As a result, the output sound is harsh, noisy, and lacks clarity.

    • There is significant distortion at higher frequencies.

    • More importantly, the DAC output is very weak in voltage and current — not capable of driving a speaker directly.

    • It is more suitable for basic waveform generation or low-resolution control signals, not for audio playback.

    Why a 3W I2S Audio Amplifier Was Necessary:

    To overcome these issues, I decided to use an external 3W I2S audio amplifier, such as the MAX98357A or similar.

    Here’s why:



    1. Higher Audio Resolution:
      The I2S amplifier supports 16-bit or higher digital audio, which offers much better fidelity compared to the 8-bit DAC.

    2. Clearer, Richer Sound Output:
      I2S amplifiers decode digital audio directly with minimal loss, producing clean and professional-quality audio.

    3. Built-in Amplification:
      The amplifier can drive a standard 8-ohm speaker up to 3W output, which is impossible with ESP32’s DAC alone.

    4. Efficient Power Usage:
      These amplifiers are designed for embedded systems and consume minimal power while still providing loud output.

    5. Noise Isolation:
      Since the I2S interface transmits pure digital data, it is immune to analog noise, ensuring clean audio even in noisy environments.

Step 6: Analog Mic Issues and Transition to I2S Mic

Initially, I used an op-amp-based analog microphone. Although the signal was within ESP32's ADC range (under 3.3V), the audio was very noisy. I analyzed the waveform using an oscilloscope and found the signal had:

  • High levels of background noise

  • Poor signal stability



  • Susceptibility to electromagnetic interference



I tried using filters, changing gain settings, and shielding — but the audio quality remained poor and unintelligible.


Switching to I2S Mic

I replaced the analog mic with an I2S digital microphone (e.g., INMP441). The I2S mic sends clean digital signals to the ESP32’s I2S input peripheral, avoiding the noise issues of analog mics.

Advantages of I2S Mic:



  • Excellent signal-to-noise ratio

  • Immune to analog noise

  • Fully compatible with ESP32’s built-in I2S module

After this change, the audio became much clearer and the walkie talkie was finally usable for real communication.



Step 7: Range Testing

To evaluate performance in real-world conditions, I tested the device in an open field.

Results:

  • Up to 100 meters: clear and stable communication



  • Around 200 meters: unstable, noticeable lag and dropouts



  • Indoor testing: range reduced due to walls and interference

Therefore, for best results, use in open or semi-open environments with line-of-sight.

Final Thoughts

This project was an excellent learning experience in wireless communication, real-time audio, digital sensors, and ESP32 features like ESP-NOW, I2S, DAC, and OLED integration. With proper amplification and a good digital mic, the audio quality is surprisingly good for an offline, DIY system.


Post a Comment

0 Comments

please do not enter any spam link in comment box

Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !
To Top