AT Mode HC-05 via port 0&1 of Arduino Nano

Hey guys!
I am currently working on a project with Arduino nano and HC-05 bluetooth module. I have to change some settings in the AT Mode. It already worked with Software Serial, but i have to get in to AT Mode via Pin 1 and 0 of the nano. The module is with a customer and we want to provide an update, the pins are allready soldered so its not possible to use other pins.
Is ist possible to enter AT Mode and change some default settings via Pin 0 and 1 of the Nano? For information: i use a voltage divider, so i havev 3,3V for RX pin and between the 5V of the Arduino and VCC of HC-05 is a switch, so i can turn off the power of HC-05 for updates.

Hope you can help me :slight_smile:

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3); // RX, TX

void setup()
{
  myserial.begin(9600); //Initialize virtual serial port
  Serial.begin(9600); //Initialize Arduino default serial port
}

void loop()
{
  while(1){
  while (myserial.available()) {
    Serial.write(myserial.read());//if Serial received data, output it via mySerial.
  }
  while(Serial.available()) {
    myserial.write(Serial.read());//if myserial received data, output it via Serial.
  }
}
}

Something like this? Then you can write the AT-Commands in the serial monitor.

Yes something like this. But i need this to work with pins 0 and 1 of Arduino Nano. I did it exactly the way you did, my only trouble are the pins :frowning:

Did you change the RX and TX to 0 and 1 in the code (instead of (2,3))?

I have never tried using pins 0 and 1 because I read that it can conflict with the Serial.print command. However, I heard it should work though.

Have you tried just using Serial.println? e.g. Serial.println("AT-Commands");

Yes i did.
Unfortunately both does not work. I get both time no answer. I tried changing the name so i could see, if the name would change, even if i get no answer. But name did not change.

Try this:

String readString;

void setup() {
  Serial.begin(9600);
  Serial.println("serial test 0021"); // so I can keep track of what is loaded
}

void loop() {

  while (Serial.available()) {
    delay(2);  //delay to allow byte to arrive in input buffer
    char c = Serial.read();
    readString += c;
  }

  if (readString.length() >0) {
    Serial.println(readString);

    readString="";
  }
}

I found this here: https://forum.arduino.cc/index.php?topic=93084.0

You are basically writing directly in the serial monitor. Try the AT-Commands there.

THANKS! It worked awesome! I can now change the name of my bluetooth module via port 0 and 1 and provide the update without changing something on the soldering!

Thanks again!

I'm glad it works. You are welcome.