ESP32 devkitC Wont connect to bluetooth Amp

Newbie here but Ive spent 10 hours working on this and I need help.

My goal is to play mp3 files from a dfplayer to the bluetooth amp when a IR sensor its tripped.

I bought the "EC Buying ESP32-DevKitC Development Board ,ESP32 Development Board Equipped with WROOM-32D Module Integrated WiFi Bluetooth Module Microprocessor Interface SPI I2C I2S Suitable for Arduino"

The amp- " DAMGOO Bluetooth Amplifier Board, 100W+100W Peak Output Power, 2.0 Channel DC:8-24V, Password Free Connect, BT 5.0 AMP Board for DIY Wireless Speakers Board"

I can get my phone and PC to find both bluetooth signals but i cant get the ESP32 to connect to the amp(Wuzhi Audio). Do I need to use the UUID for the amp instead of its name? Do i need to change it to bluetoothLE instead of classic? Is my code not reaching out to bluetooth like it should? I tried using "ESP32 dev module and ESP32 WROOM DA module and no luck.
my code -

#include <DFRobotDFPlayerMini.h>
#include <IRremote.h>
#include "BluetoothSerial.h"

BluetoothSerial SerialBT;
DFRobotDFPlayerMini mp3;
IRrecv irrecv(18); // IR Optocoupler Module connected to GPIO 18

bool connectedToAmplifier = false;

// Replace "Wuzhi Audio" with the actual device name of your amplifier
const char* amplifierName = "Wuzhi_Audio";

unsigned long startTime = 0;  // Variable to record the start time of connection attempts
const unsigned long connectionTimeout = 15000; // 15 seconds

void setup() {
  Serial.begin(115200);

  // Initialize Bluetooth Serial
  SerialBT.begin("ESP32_A2DP"); // Bluetooth device name

  // Initialize DFPlayer Mini (TX on pin 17, RX on pin 16)
  mp3.begin(Serial2);

  // Initialize IR Optocoupler Module
  irrecv.enableIRIn();

  // Connect to Bluetooth amplifier
  connectBluetoothAmplifier();
}

void loop() {
  // Your logic here
  if (connectedToAmplifier) {
    if (irrecv.decode()) {
      // IR signal received, trigger action (e.g., play "short crank mp3" from DFPlayer Mini)
      playMp3FromDFPlayer();
      irrecv.resume();  // Receive the next value
    }
  }
}

I have never tried BT audio but this lib look promising. SerialBT is for BT Serial Port Profile which I do not think applies to BT audio.

Yeah, I included that library to the code and no luck. I asked Perplexity if it was possible before I started the project but i guess the AI was misinformed. I ended buying an amp that's not bluetooth. Sure would be nice to solve this for future projects though.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.