Bluetooth AT Command Not Working (Resolved)

I have a HC-06 and HC-08 bluetooth module, and it doesn't seem to respond to any AT commands I give it. I can connect to it no problem, but when I try to send data, even the AT command doesn't return anything. I've tried switching around the TX and RX pins in the code, but nothing works. I have the RX pin on the bluetooth module on a voltage divider that I checked with a voltmeter that works. I've also tried 38400 baud rate, yet still doesn't work. Module is from DSD Tech if that helps. Does anyone know why the AT command doesn't work?

#include <SoftwareSerial.h>

SoftwareSerial mySerial(11,10); // RX, TX PIN

String str;

void setup() {
  Serial.begin(9600);
  Serial.println("Enter AT Commands:");
  mySerial.begin(9600);
}

void loop() {
  if(mySerial.available()){
    Serial.write(mySerial.read());
  }
  if(Serial.available()){
    mySerial.write(Serial.read());
  }
}

I only have used the HC-05 and even with the HC-05 there are a few varieties.
As I recall, you need to set the module into AT mode.

Your post makes no sense. Which one is not working, or are both not working? HC-06 is in AT mode by default - no messing with buttons or wires. And "connect" is a loose term anyway. If you connect via Bluetooth, it means you are in communications mode - not AT mode. The AT command is AT, no enter or /r/n. I'm sure the HC-08 is BLE and thus also in AT mode by default, irrespective of what the breakout board might suggest. I assume the common commands are the same as HC-06.

Nick_Pyner:
Your post makes no sense. Which one is not working, or are both not working? HC-06 is in AT mode by default - no messing with buttons or wires. And "connect" is a loose term anyway. If you connect via Bluetooth, it means you are in communications mode - not AT mode. The AT command is AT, no enter or /r/n. I'm sure the HC-08 is BLE and thus also in AT mode by default, irrespective of what the breakout board might suggest. I assume the common commands are the same as HC-06.

Both aren't working, both the HC06 and HC08. I'm not sure when it is in AT mode, but even when it is not paired with my phone, any AT command still doesn't work. In the serial monitor, I have set it to no new line or carriage return, but despite any configurations, sending AT returns nothing into the serial monitor

As I said, both are in AT mode by default - apply power and you are in AT mode, and will stay that way until you either start communicating or power off. Both use 9600 for AT mode - no exceptions for HC-06, and probably not for HC-08. And there only one way to connect - Tx>Rx and Rx>Tx - no exceptions, ever.

This can't be that hard, and I am certainly not going to suggest that Bluetooth might be faulty, so try again with all the above in place at the same time.

Nick_Pyner:
As I said, both are in AT mode by default - apply power and you are in AT mode, and will stay that way until you either start communicating or power off. Both use 9600 for AT mode - no exceptions for HC-06, and probably not for HC-08. And there only one way to connect - Tx>Rx and Rx>Tx - no exceptions, ever.

This can't be that hard, and I am certainly not going to suggest that Bluetooth might be faulty, so try again with all the above in place at the same time.

So here's what I have:
RX on a 1k + 2k voltage divider connected to the 5v output of pin 11
TX connected to pin 10
GND to ground
VCC to 5v

Image here:

Code is as above, I type in AT into the serial monitor running at a 9600 baud rate with "No line ending", and no output. The serial monitor does output the "Enter AT Commands" in the setup(), but does not seem to print anything else

RX on a 1k + 2k voltage divider connected to the 5v output of pin 11
TX connected to pin 10

SoftwareSerial mySerial(11,10); // RX, TX PIN

Your connections are not Tx>Rx and Rx>Tx. The software serial constructor is from the point of view of the Arduino. The RX arduino pin 11 should be connected to the module Tx. The Tx Arduino pin10 should connect over the voltage divider to the module Rx.

cattledog:

SoftwareSerial mySerial(11,10); // RX, TX PIN

Your connections are not Tx>Rx and Rx>Tx. The software serial constructor is from the point of view of the Arduino. The RX arduino pin 11 should be connected to the module Tx. The Tx Arduino pin10 should connect over the voltage divider to the module Rx.

2nd Try: 2nd Try - Album on Imgur

Actually, I got some serial output now:

79 
75

So it's printing the ASCII values for OK, so I'm assuming its good from here?

You have certainly solved the wiring problem, and now know that transmitters transmit to receivers - not other transmitters. I'm not entirely sure that the configuration command formats are the same for HC-06 and BLE. Check the Martyn Currey website.

Hello guys...I use the at commands to change the baud rate on Bluetooth module..but it not working..
If I send AT on serial monitor again it reply AtT on screen...it not reply ok...guys please help me

Somewhere deep in your code, which I assume is a state secret, the answer to your problem may be clear but, since it is a secret, nobody will ever know. Then again, the answer may be in your wiring, also a secret.