Hello everyone,
I’m working on a project involving two JDY-31 Bluetooth modules, and I am facing a problem where the modules won’t communicate with each other in Master-Slave mode. I’m trying to set up a wireless communication system between two Arduino devices using these Bluetooth modules, but after several days of troubleshooting, I have not been able to get them to communicate properly.
What I’ve done so far:
- Hardware Setup:
- I have two JDY-31 Bluetooth modules, and they are connected to two separate Arduino UNOs.
- I am using SoftwareSerial to communicate with the modules through the following pins:
- Master Module: RX -> Pin 2, TX -> Pin 3
- Slave Module: RX -> Pin 11, TX -> Pin 10
- Both modules are connected to VCC (5V) and EN (3.3V) for proper power and operation.
- Testing the Bluetooth Modules Individually:
- I successfully tested both Bluetooth modules individually by connecting them to the Arduino and using Serial Bluetooth Terminal on my phone. I was able to send and receive data between my phone and each Bluetooth module with no issues.
- The modules work fine when communicating with the phone, so I know they are not faulty.
- AT Command Mode:
- I have successfully entered AT Command Mode for both modules (as shown in the serial monitor: JDY-31 AT Command Mode and Type AT commands in the Serial Monitor).
- I was able to use commands like AT+VERSION and AT+NAME to retrieve and change the Bluetooth name successfully.
- Setting Up Master and Slave:
- I used the following code to set up the Master (COM4) and Slave (COM7) Bluetooth modules:
- Master Module Code: This code sends data to the Slave module using the SoftwareSerial interface, and prints incoming data to the Serial Monitor.
- Slave Module Code: This code receives data from the Master and prints it to the Serial Monitor.Both modules are set to 9600 baud rate, and I ensured that both modules are not in AT mode when running the communication test.
- Issue:
- Despite all the above steps, when I run the Master-Slave communication code, the Master module successfully sends data, but the Slave module does not receive anything.
- I checked the wiring, ensured the baud rates match, and ensured that both modules were properly reset before uploading the code.
- When trying to communicate via AT mode, I ran into issues where certain AT commands like AT+ROLE=1 or AT+ADDR? have no effect or result in no response, though I successfully used other commands like AT+VERSION and AT+NAME.
- The EN pin on both modules is connected to 3.3V.
- Troubleshooting Steps Taken:
- I’ve reset both modules using AT+DEFAULT.
- I’ve ensured that the EN pin is properly connected to 3.3V.
- I’ve tried swapping the TX and RX connections between the Master and Slave modules to ensure the communication lines are correct.
- I’ve checked all wiring and ensured there is no short or faulty connection.
- I’ve used the SoftwareSerial library for communication, and I’ve made sure both modules are using the correct baud rate (9600).
- I’ve confirmed the Master module is trying to send data, but the Slave module is not receiving any data.
- Software and IDE:
- I’m using Arduino IDE and the SoftwareSerial library to communicate with the Bluetooth modules.
- I’ve tried using different baud rates (9600, 115200) but it didn’t solve the issue.
- The Serial Monitor in Arduino IDE is set to NL & CR (Newline & Carriage Return).
What I Need Help With:
- Despite all of these steps, I cannot get the Master and Slave modules to communicate with each other in a simple Master-Slave data exchange.
- The issue seems to be with the Bluetooth modules not receiving data from the Master.
- I’ve also attempted resetting the modules to factory defaults, ensuring they’re in data mode (not AT mode), and confirmed that TX/RX pins are correctly wired.
Questions:
- Is there something specific about the JDY-31 Bluetooth modules or the JL C105857 processor that requires a special configuration or handling when setting up Master-Slave communication?
- Has anyone encountered similar issues with the JDY-31 modules and found a solution?
- Could there be any incompatibility with the AT+ROLE command or other AT commands when trying to switch between Master and Slave mode?
I would really appreciate any insights or suggestions. Thank you in advance!