HC-06 configuration using a sketch for an Arduino Nano

Hi,

Challenge: I'd like to us the HC-06 Bluetooth AT commands to customize the board name.

Background: I'm using an Arduino Nano, an HC-06, and a sensor. I can pair my small project to an Android tablet and then use Blue Term to receive data from the sensor.

Issue: I've tried half a dozen sketches found online, none of them worked. With these I've been using the serial monitor to send command w/o CR or LF. I've tried a Windows serial terminal, no luck. The red pairing light on the HC-06 module flashes constantly leading me to believe that the module never enters into a mode where AT commands are accepted.

All suggestion (or sketches) are welcome.

Thank you, Ed

Can you explain a little more?

What is the board name that you refer to? What you see in e.g. Windows Device MAnager? If so, that is hard-coded in the USB-to-serial converter and, to my knowledge, can't be changed on a Nano.

If it's an identification to a PC application, you can simply send a 'personalised' text; the text can be stored in EEPROM.

Since this is an Arduino forum, I assume you want to configure the HC-06 with Arduino. Pairing with the tablet proves nothing more than that you have done that, and the power is on. The latter is something the LED tells you anyway. It does not even prove that the wiring to bluetooth is correct, and it might be a good idea to check that first - Rx>Tx and Tx>Rx. The next thing is to ensure that the code you are using is specifically for the HC-06, which is in AT mode by default on power-up, and should respond to AT+NAMExxxxx at 9600. It ceases to be in AT mode as soon as the tablet connects.

You will find more on the Martyn Currey website.

Hi Nick,

Thanks for some food for thought. Yes, I’m trying to use the Arduino serial communication window on my Windows 10 computer to send commands through my Arduino nano to the HC-06 module. You asked about a module ID. I don’t see one. Attached are pictures on the front and back of the HC-06. Also attached is my a picture of my breadboard project. The reason I believe it is working is that my project=related sketch sends data to the serial communications on my windows device and sends the same data wirelessly to an Android tablet. As such, I can see both simultaneously. Basically rx => tx and tx => rx are working as expected in my project sketch. I’ve also attached my project sketch and the sketch that I tried to use to send AT commands to the HC-06. When sending commands, the device is not paired. I’ve tried a various options… no CR no line feed, CR, etc. I have yet to hear back from the HC-06 module.

In the interest of full disclosure, I have not been able to get the voltage divider to work. So, my project, at this point, is working without the voltage divider in place.

I appreciate your prior thoughts… it lead me to additional testing. Anything further will also be appreciated.

Ed

HC-06 back.JPG

HC-06 front.JPG

Breadboard project.JPG

Project code sketch.txt (819 Bytes)

Bluetooth serial comm sketch.txt (1.08 KB)

Your config programme is clearly for HC-06, but it does not compile - presumably because of that extraneous voltage stuff at the end. The device is indeed an HC-06 by virtue of having only four pins.

I have not been able to get the voltage divider to work

Not being able to get the voltage divider to work is extremely difficult and rather suggests your real problem is somewhere else - like a dodgy breadboard or simply slack-arsed soldering - and quite possibly intermittent. Using a voltage divider is indeed good practice, but its absence is most unlikely to be fatal. My HC-06 initially ran for years without one.

Thanks again Nick. I didn't notice the voltage code at the end of the sketch. I'll rerun and let you know if it makes a difference.