Good evening.
I am currently having a problem in my HC-05 as it doesn't respond to my commands, I think the problem is it isn't on the AT command mode so if anyone knows how to set my BT module to the AT command mode I'd be very thankful.
Just to be clear, I am working on a project which is about creating a smart mp3 playet. I am very sure of the hardware connections and I'm using a HC-05 BT module, arduino UNO bored,DFPlayer pro. I think that the code isn't the problem but I'm gonna post it anyway .The problem in details is that everything seems to be working well but on its own, supposed that when I say (Film) the bluetooth module respond to it and makes tha DFplayer pro plays track 3. My speaker which is a 0.5W mono speaker just keeps producing the word music and repeating it when electricity is connected to it, I think that means it is on the "music mode" or something and plz correct if sth is wrong
#include <SoftwareSerial.h>
#include <DFRobotDFPlayerMini.h>
// SoftwareSerial for DFPlayer & HC-05
SoftwareSerial DFSerial(10, 11); // RX, TX (DFPlayer)
SoftwareSerial BTSerial(2, 3); // RX, TX (HC-05)
DFRobotDFPlayerMini DFPlayer;
// Track assignments
const int TRACK_EGYPT = 1; // "Egypt" → 0001.mp3
const int TRACK_SCIENCE = 2; // "Science" → 0002.mp3
const int TRACK_FILM = 3; // "Film" → 0003.mp3
const int TRACK_QUARAN = 4; // "Quaran" → 0004.mp3
void setup() {
Serial.begin(9600);
BTSerial.begin(9600); // HC-05 default baud rate
DFSerial.begin(9600); // DFPlayer default baud rate
// Initialize DFPlayer
if (!DFPlayer.begin(DFSerial)) {
Serial.println("DFPlayer Pro not connected!");
while (true);
}
DFPlayer.volume(20); // Set volume (0-30)
Serial.println("Ready! Say 'Egypt', 'Science', 'Film', or 'Quaran'...");
}
void loop() {
if (BTSerial.available()) {
String command = BTSerial.readStringUntil('\n'); // Read Bluetooth data
command.trim(); // Remove whitespace
// Debug: Print received command
Serial.print("Received: ");
Serial.println(command);
// Check for keywords and play corresponding track
if (command.equalsIgnoreCase("Egypt")) {
DFPlayer.play(TRACK_EGYPT);
Serial.println("Playing: Egypt (Track 1)");
}
else if (command.equalsIgnoreCase("Science")) {
DFPlayer.play(TRACK_SCIENCE);
Serial.println("Playing: Science (Track 2)");
}
else if (command.equalsIgnoreCase("Film")) {
DFPlayer.play(TRACK_FILM);
Serial.println("Playing: Film (Track 3)");
}
else if (command.equalsIgnoreCase("Quaran")) {
DFPlayer.play(TRACK_QUARAN);
Serial.println("Playing: Quaran (Track 4)");
}
}
}
It was when I connected the VCC pin to the 5V arduino pin but when I connected both EN and VCC pins to the 3.3V arduino pin it stopped pairing(I am quite sure this was wrong but I got this information from an AI source when I just was about to give up)
AI is not a source. It is mostly wrong as it is a statistics compiler, so when 100 bad ideas are posted, and only one good idea is posted, the statistical average is wrong, too.
Why do you want to enter AT mode, and what parameters do you want to change from defaults? Why? Nothing in your original post about the HC05 and the DF player indicate a need for AT commands to the HC05.
I wanna set the AT mode to control my BT well as my commands are sent to the BT module but not responded (Not working as the code's orders) So maybe the problem is that my BT module isn't at the AT command mode. For more details plz scroll down to see my project's idea so maybe that clarifies why I wannna set it to the AT mode
This is not correct. the default communication mode is what is used when sending and receiving with the HC05. The AT mode is used for changing the modules operating parameters.
You indeed have a problem communicating with the HC05 in communication mode. AT mode will not help you.
The voltage divider is a good idea, but many people can run an HC05 successfully without one. Why not use one and remove this issue from your mind.