Go Down

Topic: Bluetooth HC05, CZ-HC-05 Problem with AT Commands (Read 5940 times) previous topic - next topic

ChrisMe

Jan 08, 2015, 10:02 am Last Edit: Jan 08, 2015, 10:03 am by ChrisMe
Hello,

i've got an Arduino Nano and an bluetooth modul CZ-HC-05 which works with 5V on every pins, so that I dont need an voltage devider. The last configuration i've tried is from this page:
http://arduinofy.blogspot.com.tr/2013/10/tutorial-programming-hc-05-at-mode-with.html
In normal Slave mode the bluetooth modul works fine and sends Data as it should be.
But when I get into the AT Command mode trying the command "AT" I'll get this strange characters: "O§†…". I also took other baudrates, but only at 38400 i'll get an answer ("AT" -> "O§†…"). I also tried Tera Term and ReaTerm but got the same problems with other strange characters.
I also tried the baudrate 38400 for both, the arduino and bluetooth modul, but got the same problem.


My sketch is:

Code: [Select]
#include <SoftwareSerial.h>
SoftwareSerial mySerial(4, 5); // RX, TX

#define bt_power 11
#define bt_key_power 12

String command = ""; // Stores response of the HC-06 Bluetooth device


void setup() {

  // set the pins to OUTPUT
  pinMode(bt_power, OUTPUT); 
  pinMode(bt_key_power, OUTPUT);
  // set the pins to LOW
  digitalWrite(bt_power, LOW);
  digitalWrite(bt_key_power, LOW);
  // make sure the key has been LOW for a bit
  delay(100);
  // set the key pin to High
  digitalWrite(bt_key_power, HIGH);
  // small delay
  delay(100);
  // now power on the BT
  digitalWrite(bt_power, HIGH);
 
  // Open serial communications: 
  Serial.begin(9600);
  mySerial.begin(38400);
  delay(1000);
  Serial.println("Type AT commands!");
}

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

  // listen for user input and send it to the HC-05
  if (Serial.available())
    mySerial.write(Serial.read());
}



So I dont know if the module is damaged or there is an other problem i cannot see.

Greetings Chris

johnb10000

#1
Jan 13, 2015, 12:22 am Last Edit: Jan 13, 2015, 10:33 pm by johnb10000
Is the LED on the HC-05 blinking?  It should be blinking fast for normal mode and about once every two seconds in AT mode.

I tried this using a CZ-HC-05 module on an Arduino and Moteino but the output pin didn't have enough current to power the HC-05.  The Arduino has an output current 0f 40 mA while the Moteino and Flutter Wireless have outputs of 30 mA.  There are multiple manufactures of the HC-05 chips and the amount of input current varies.

This program works fine after connecting pin 11 to a relay to control the power to the HC-05.



biblicalbread

I have the cz-HC-05 module and I'm also having trouble with it. It goes into command mode and light blinks every 2 seconds. I don't get any response at all from the module. I have tried many different ways to get into command mode, all which seems to work, but no response no matter which way I try. Any suggestions as to why I can't get any response?

twelti

#3
Feb 03, 2015, 01:55 am Last Edit: Feb 03, 2015, 08:40 am by twelti
Ditto on that.  I have the CZ version.  I tried already two different tutorials, one using analog pins on the Arduino Uno and one using digital, windows 8.1.  I tried in Arduino IDE and using Atmel/Visualmicro.  I tried all combinations of baud and string termination, etc. etc.  Cannot get that dang "OK" for the life of me.

UPDATE:  tried this and it worked.  I think I may have had my serial port baud set wrong.  9600 worked.

/*
AT+ORGL (Restore the factory default state)
AT+UART=115200,0,0 (Set baud rate to 115200, one stop bit and no parity bit)
AT+NAME=TinyG
*/
#include <SoftwareSerial.h>
#define rxPin 10
#define txPin 11
SoftwareSerial mySerial(rxPin, txPin); // RX, TX
char myChar ;
void setup() {
  Serial.begin(9600);   
  Serial.println("AT");
  mySerial.begin(38400);
  mySerial.println("AT");
}
void loop() {
  while (mySerial.available()) {
    myChar = mySerial.read();
    Serial.print(myChar);
  }
 while (Serial.available()) {
    myChar = Serial.read();
    Serial.print(myChar); //echo
    mySerial.print(myChar);
  }
}

Nick_Pyner

I have never heard of anybody having success with that Ardionofy stuff. I recently configured an HC-05 on ZS-040 using this

http://www.martyncurrey.com/?p=1348

and it worked first time. The ZS-040 has a switch on board for configuring but, if yours doesn't, he provides an alternative method that may work for you.

wikee

I had the same issue.AltsoftSerial library is worked for me.

http://www.pjrc.com/teensy/td_libs_AltSoftSerial.html

nithinchigullapalli

how to connect HC-05 to lilypad USB as there are no ports Tx and Rx

Go Up