Go Down

Topic: How to use AT commands to reconfigure bluetooth device? (Read 111 times) previous topic - next topic

Huy-LT

How do you connect the arduino board to the bluetooth module (HC-06) and then use "AT commands" to reconfigure it's name, pin etc.

I tried this code, but there was an error about 'invalid operands of types 'const char [8]' and 'const char [17]' to binary 'operator+' :

Code: [Select]
#include <SPI.h>
#include <EEPROM.h>
#include <TouchScreen.h>
#include <SoftwareSerial.h>
#define BLUETOOTH_RX 10
#define BLUETOOTH_TX 11
 
SoftwareSerial BT(BLUETOOTH_RX, BLUETOOTH_TX);
 
void setup(void) {
    // int passed here should match your Bluetooth's set baud rate.
    // Default is almost always 9600
    BT.begin(9600);
    delay(500);
 
    BT.print("AT");
    delay(500);
 
    BT.print("AT+VERSION");
    delay(500);
 
    // renames your BT device name to My-Sweet-Project
    String nameCommand = "AT+NAME" + "My-Sweet-Project";
    BT.print(nameCommand);
    delay(500);
 
    if (BT.available() > 0)
        Serial.println(BT.readString());
}



I watched a youtube video that showed a 'stupid simple' method. Which worked. Thuogh, it does not work when i replace the command with the command to change the pin (AT+PSWD____) Here is the Video:

Huy-LT

I have the Duinotech BC417 bluetooth module.

Vcc - 3.3v
Gnd-Gnd
RX-10
TX-11

I've tried all sorts. How do you correctly connect the bluetooth module to the arduino and go into AT mode???

Nick_Pyner

How do you connect the arduino board to the bluetooth module (HC-06) a
I watched a youtube video that showed a 'stupid simple' method. Which worked. Thuogh, it does not work when i replace the command with the command to change the pin (AT+PSWD____)
It should work if you follow the procedure exactly. There is no difference in the way you send AT commands. Ensure the serial monitor is disconnected.

Huy-LT

Don't I need the serial monitor to retrieve stuff from the arduino and then command the arduino??

Nick_Pyner

#4
Sep 27, 2017, 01:47 am Last Edit: Sep 27, 2017, 05:13 pm by Nick_Pyner
No. The command is sent from the Arduino programme and the monitor merely receives confirmation that you don't actually need. There is nothing wrong with the method, it is just what it says it is - stupid simple, and is more or less what I use for HC-06.

I might not have been clear in reply#2. IF you have succeeded in sending one AT command to bluetooth, there is nothing wrong with your code or procedure, and you should be able to send another. A failure to send a second command rather suggests loose wiring. It does not suggest the wiring is wrong.
Note also that there is only one baud rate for configuration of HC-06. It is 9600, no exceptions.

If you see the above as a tacit suggestion to ignore reply#5, you are right. You might look here for somebody who knows what he is doing.           http://www.martyncurrey.com/arduino-and-hc-06-zs-040/

AshwiniGunjal

if your using HC-05 bluetooth module. then
make following connection:
HC-05       Arduino

Rx     ------    RX
Tx     ------     Tx
Vcc   -----      5V
GND -----     GND

do this all connections. Bluetooth have small push button.remove 5V supply from bluetooth. long press push button then apply 5V to bluetooth module. after that LED on bluetooth module blinking slowely.it indicate that bluetooth enter in AT mode.

upload blank code in arduino. open serial monitor. set baud rate 9600,115200,38400 those suit to your module.
Enter "AT" on Serial monitor. send if you get "OK" response .congratulation device enter in AT mode.


AT+RESET
AT+NAME?

search more command on internet




Go Up