Bluetooth HC-05 on Arduino + Debugging

I'm kinda stuck here. I have the HC-05 Bluetooth module - from ebay - and I'm testing it to make sure it works. I uploaded the following sketch to the chip:

////////////////////////////////////////////////////////////////////////////////// // REMIXED BY: TECHBITAR (HAZIM BITAR) // LICENSE: PUBLIC DOMAIN // DATE: MAY 2, 2012 // CONTACT: techbitar at gmail dot com char INBYTE; int LED = 13; // LED on pin 13 void setup() { Serial.begin(9600); pinMode(LED, OUTPUT); } void loop() { Serial.println("Press 1 to turn Arduino pin 13 LED ON or 0 to turn it OFF:"); while (!Serial.available()); // stay here so long as COM port is empty INBYTE = Serial.read(); // read next available byte if( INBYTE == '0' ) digitalWrite(LED, LOW); // if it a 0 (zero) tun LED off if( INBYTE == '1' ) digitalWrite(LED, HIGH); // if it a 1 (one) turn LED on delay(50); } 

I used three different bluetooth terminals on Android, as well as a TeraTerm terminal on WIN7, to check if the blutooth module works successfully. For some reason, all 4 get the line Press 1 to turn Arduino pin 13 LED ON or 0 to turn it OFF: but when I enter 1 in the terminals and send them to the module, the LED does not turn on.

Note: The LED is working. I claim that I have correctly connected all My serial RX and TX lines should work differently, I would not be able to download the sketch.

Is it possible that HC-05 is not working and cannot receive information? What can I do to check otherwise?

Thanks a lot!

+1
source share
2 answers

Thanks @SunGa for the idea of โ€‹โ€‹feedback. It worked, so I can confirm that the Bluetooth module is in good condition. After reading other forums to try to understand why pin 0 could not receive the serial signal sent by the Bluetooth module, I found that this was a common problem. It turns out that since RX and TX are firmly connected to the USB converter chip to TTL on the board, sometimes the state of pin 0 and Pin 1 is โ€œstuckโ€ and they cannot be used properly (which is unsuccessful! And a bad engineering imo).

I was able to successfully send and receive data using the SoftwareSerial library and reassigning Pins 10 and 11 to RX and TX.

However, if the AtMega chip was used as a stand-alone microcontroller (for example, DIYduino), then Pins 0 and 1 could be used to communicate with the Bluetooth module!

Hope this helps others who are facing the same problem.

+2
source

I am not completely familiar with Arduino. But you can offer you to configure reverse connections on the HC05 contacts and test only the connection between the Android terminal (or PC) and HC05. This will find out if HC05 is working or not.

0
source

Source: https://habr.com/ru/post/970112/


All Articles