How can I send packets of audio data using ESP Now between two ESP32 MCUs?

I connected a microphone and speaker to 2 ESP32s and was able to hear my voice reproduced by the speaker from the microphone using an ESP32. I was also able to send audio signals between them, but I was not able to comprehend the spoken words. I assume it is because I am sending the current value from the analogRead function and since the data rate of the ESP Now link is lower than the adc sampling rate, much information is lost in the transmission.

I tried creating an array of 1000 values and sending one array at a time using the code below but its not working for me. I will appreciate your help, I need to send higher quality audio between the 2 ESP32s.

#include <esp_now.h>
#include <WiFi.h>

// REPLACE WITH THE MAC Address of your receiver
uint8_t broadcastAddress[] = {0x7C, 0x9E, 0xBD, 0x47, 0x92, 0x4C}; //MAC Address

float A;
const int Max = 1000;

//Define Sent Message
typedef struct test_message {
  float A[Max];
} test_message;

test_message tx; //Sent Message
test_message rx; // Received Message

// Transmitting Callback
void OnDataSent(const uint8_t *mac_addr, esp_now_send_status_t status) {
  char macStr[18];
  // Copies the sender mac address to a string
  snprintf(macStr, sizeof(macStr), "%02x:%02x:%02x:%02x:%02x:%02x:", mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);

// Receiving Callback
void OnDataRecv(const uint8_t * mac, const uint8_t *incomingData, int len) {
  memcpy(&rx, incomingData, sizeof(rx));

void setup() {
  // Set device as a Wi-Fi Station
  // Init ESP-NOW
  if (esp_now_init() != ESP_OK) {
   // Serial.println("Error initializing ESP-NOW");
  // Once ESPNow is successfully Init, we will register for Send CB to
  // get the status of Trasnmitted packet
  // Register peer
  esp_now_peer_info_t peerInfo;
  memcpy(peerInfo.peer_addr, broadcastAddress, 6); = 0;
  peerInfo.encrypt = false;
  // Add peer        
  if (esp_now_add_peer(&peerInfo) != ESP_OK){
   // Serial.println("Failed to add peer");
  // Register for a callback function that will be called when data is received

void loop() {
  for (int i=0; i<Max; i++){
  tx.A[i] = analogRead(35);
  esp_err_t result = esp_now_send(0, (uint8_t *) &tx, sizeof(test_message));
  for (int i=0; i<Max; i++){
  dacWrite(25, rx.A[i]);

Thanks in Advance.

1 Like

The ESP-NOW protocol can send only 250 bytes per message.

If you want to transfer audio use a real audio-transmitter.

If it should be transmitted over a bigger distance more than 30 meters up to 1000 m use
two PMR walky talkies

best regards Stefan

issue is that ESP-NOW only allows 250 bytes as a payload, so sending 1000 of anything other than bits is just going to get truncated. And what's the point of copying the sending MAC address into a local variable in the transmit callback and then just returning?