Tronixlabs Support Forum
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
danno

Junior Member
Registered:
Posts: 7
Reply with quote  #1 
Hi there,

I'm very much a n00b when it comes to this stuff. I'm trying to reconfigure an HC-06 module I bought from here for a simplebot project as per these instructions. Unfortunately, I don't think I am able to send AT commands to the module because Serial Monitor (Arduino IDE) only ever prints the messages Starting Config and Done.

I've tried different baud rates (9600, 38400) for the connection to the module from the arduino as some googling gives conflicting default baud rates for the module (most seem to refer to 9600 although some default to 38400). No success.

I've tried adding an additional line of code after the call to mySerial.begin (with a 5000 delay between) to print a message if the BT module serial connection is unavailable. Sure enough, the message prints indicating it is not available:

if (!mySerial.available()) Serial.println("BT module not available");

I'm wondering whether the module is in AT command mode. The red LED blinks rapidly when it starts up (i've never paired anything to the module either). I've read conflicting info on teh interwebs, some saying that the HC-06 is always able to accept commands, and others indicating that I need to pull up the EN/Pin34/KEY pin before powering the module on (which I can't do easily because there is no header soldered in this version of the module).

Any help would be greatly appreciated.
danno

Junior Member
Registered:
Posts: 7
Reply with quote  #2 
I've whittled down the code in the above link to this:

 

#define BLUETOOTH_SPEED 9600
#define RESPONSE_DELAY 1000

#include <SoftwareSerial.h>

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

void setup() {
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.println("Starting config");
mySerial.begin(BLUETOOTH_SPEED);
waitForResponse();
mySerial.print("AT");
waitForResponse();
Serial.println("Done");
}

void loop() {
}

void waitForResponse() {
delay(RESPONSE_DELAY);
while (mySerial.available()) {
Serial.write(mySerial.read());
}
Serial.write("\n");
}

 




And the only response I see is:

Starting Config

Done
stryker

Junior Member
Registered:
Posts: 15
Reply with quote  #3 
Hi Danno

I don't see anything immediately obvious - have you tried swapping the RX/TX wires to be sure you've got those around the right way?

If it's a HC06 it should default to AT mode - if you've somehow got a HC05 you'll have to jiggle the EN pin to get it in the mood.

The high speed flashing light is expected if it's not yet paired.

Other things to try - it's possible the module isn't set to 9600 BAUD, so try your code with a few different speeds.  And I usually would test the module using a serial terminal program (if you have an FTDI-USB adapter to wire it to your PC) like Tera Term.  

If you want to be sure the module is functional, pairing with a phone so the flashing LED slows will set your mind at ease. 

Bottom line is there's not too much to have wrong, so you're probably far closer to getting this running than you're feeling you are right now [smile]

Cheers ! Geoff
danno

Junior Member
Registered:
Posts: 7
Reply with quote  #4 
Thanks for the reply Geoff.

I've tried all baud speeds between 1200 and 115200. No luck. I've then tried swapping TX/RX wires at your suggestion, and retried each of those individual baud rates with the wires swapped. Still no joy.

I'm pretty certain it is an HC-06 because it shows that is it's bluetooth name. I've paired with it from my tablet successfully, however, the led flash rate did not change after pairing.

I don't have an FTDI-USB adapter. Is this the one you mean?

https://tronixlabs.com.au/usb-serial/usb-ftdi-ttl-232-cable-ttl-232r-3-3v-australia/


stryker

Junior Member
Registered:
Posts: 15
Reply with quote  #5 
That would do the job, but also any of the breakout boards like this one https://tronixlabs.com.au/usb-serial/ftdi-breakout-board-5v-3-3v-australia/ will do the same, only you need to select 5V or 3V3 on that one.

They are a very handy thing to have, and eventually you'll probably end up with a bunch of different ones as I have over time...somehow.
danno

Junior Member
Registered:
Posts: 7
Reply with quote  #6 
That's great. I'll pick one of those up. Thanks for your help Geoff. It is much appreciated. I'll let you know how I go :-)
danno

Junior Member
Registered:
Posts: 7
Reply with quote  #7 
My FTDI breakout board arrived today. I've given it a shot hooked up directly to the module (see attached photos for wiring, but important point is i've crossed over the TX/RX wires).

I open serial monitor in Arduino IDE, set it to no line endings and 9600 as the following links instruct, and I try and send the AT command by typing it in and pressing the SEND button. Once I do that, I do not get a response, but rather, the command box at the top where I typed in AT is blanked out, and the response large textbox remains completely blank.

I've tried all sorts of things, from not swapping the TX/RX wires, to switching the jumper on the FTDI board to 3.3V to swapping the wires out entirely to trying it from the arduino IDE on a windows PC (I'm on Ubuntu). I've even tried a separate bluetooth module (I have 2 of them).

In all cases, I am unable to get the module to respond to the AT command.

From all the reading I've done, the HC-06 is different from the HC-05 in that it is supposed to automatically go into command mode (as opposed to the HC-05 where you have to pull up the KEY/EN pin). I'm sure my modules are HC-06's because that is what the bluetooth name displays as when I search for the module from another device to pair with it (and I do not have anything else paired with it btw).

Even though the HC-06 is supposed to automatically go into command mode, I can't help feeling that this is not in fact happening.

I'm at a loss. Any ideas?

Cheers,
Dan.

Attached Images
jpeg 20180201_204822 (1).jpg (63.67 KB, 1 views)
jpeg 20180201_205514.jpg (149.60 KB, 1 views)

danno

Junior Member
Registered:
Posts: 7
Reply with quote  #8 
Sorry, links I was talking about in previous post that I've been referencing are:

http://www.psychicorigami.com/2014/03/22/re-configuring-the-hc-06-cheap-bluetooth-serial-module/
http://embeddedprogrammer.blogspot.com.au/2012/06/ubuntu-hacking-hc-06-bluetooth-module.html
http://www.farrellf.com/projects/hardware/2013-12-01_Working_with_the_HC-06_Bluetooth_Serial_Module/
http://www.instructables.com/id/AT-command-mode-of-HC-05-Bluetooth-module/
stryker

Junior Member
Registered:
Posts: 15
Reply with quote  #9 
I've always hooked these modules up via a voltage divider but I'm not sure if it's necessary.

Something like is explained here http://www.martyncurrey.com/arduino-to-arduino-by-bluetooth/#more-2922
danno

Junior Member
Registered:
Posts: 7
Reply with quote  #10 

Hi Geoff,

I tried a voltage divider at your suggestion, and still didn't work. I also tried another module that I had previously purchased from another store, again no luck.

I ordered another module from a different store, hooked it up to the voltage divider when it arrived and presto. Worked straight up!

Interestingly, the previous 2 modules, including the one I bought here, did not have JY-MCU listed on the back (which a lot of the content out there talks about being there). The one I bought elsewhere did and worked straight up.

Ultimately, I haven't been able to diagnose the problem with the first two of those modules I was using. I suspect they were not in command mode even though both supposedly being HC-06 modules (which as I understand it, the firmware automatically puts the into command mode until it is paired with another device). 

So there you go, I've found a way forward. Not ideal, I would have liked to have understood why I couldn't get those first 2 modules to work, and after I've made some progress on my sumobot, I may come back and have a fiddle and see if I can find a way to get them into AT command mode.

Anyways, thanks for taking the time to help me out Geoff. It is appreciated.

Cheers,
Dan.

Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.