in the past two weeks i posted twice about problems with fingerprint scanner , both problems was solved thanks to help i get here
so now i have a problem with HC05 bluetooth module
i can't get any response from it
1 - i eired id lile this
B grnd to Arduino Grnd
B VCC to arduino 5 v
B Tx to arduino Tx
B Rx to arduino Rx
and uploaded a blank sketch
i put the blue tooth once in data mode by just connecting it (it flashed rapidly)
and once in AT command mode by pressing the button while connecting it (it flashed one second on , one second off)
i tried to get any response to the AT commands i failed in both cases
so i changed the wiring
B Tx to arduino 2
B Rx to arduino 3
and used this code
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
void setup() {
Serial.begin(9600);
pinMode(9,OUTPUT); digitalWrite(9,HIGH);
Serial.println("Enter AT commands:");
mySerial.begin(38400);
}
void loop()
{
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
//Serial.write(Serial.read());
}
also i failed to get any response
i swaped the pins of the softwareserial (3,2) instead of (2,3)
i also failed
thankful for your help
Maybe not important but You can code it digitalWrite(9,HIGH); pinMode(9,OUTPUT); and awoid short spikes at initiation.
Then, I add my comments to Your code:
if (mySerial.available())
Serial.write(mySerial.read()); //One character is pulled out of the receiver buffer.
if (Serial.available())
mySerial.write(Serial.read()); //Second character is pulled out of the receiver buffer.
Railroader:
if (mySerial.available())
Serial.write(mySerial.read()); //One character is pulled out of the receiver buffer.
if (Serial.available())
mySerial.write(Serial.read()); //Second character is pulled out of the receiver buffer.
Pin 9 was intended to light a led in the original sketch and i just forgot to remove it
Yes i pressed the button and held it while the hc05 turns on and the led indicates at command mode by blinking one second on and one second off
Th at commands are the standard at commands i got from internet
Are you sure your wires connect to the Arduino pins 2 and 3? Maybe post some (clear and decent resolution) pictures of your setup showing all of your connections?
I made sure of the connection by using the same board for operating a fingerprint sensor after loadin the suitable sketch on arduino
Note the board is prepared so as to make it easy to test this or that by just plugging it in four pin connection
Vcc,ground,tx,rx
fidamon:
I made sure of the connection by using the same board for operating a fingerprint sensor after loadin the suitable sketch on arduino
Note the board is prepared so as to make it easy to test this or that by just plugging it in four pin connection
Vcc,ground,tx,rx
What? Are you saying you just plugged the HC-05 directly into some of the female header pins on your Arduino?
EDIT i didn't use a voltage divider
does that mean i damaged my BT and buying another one is the solution ?
Having a voltage divider on the bluetooth Rx to prevent it from seeing the 5v Arduino TX signals is a good idea, but I have never heard on this forum of an HC05 being harmed by an undivided connection.
Have you tried to work through the martyn currey tutorial referred by @GroundFungus?
You are trying to hardware the HC-05 to the UART pins of the Arduino. These pins are NOT to be used for device communication (i.e. with an HC-05) because these pins mirror what is happening on the USB port. Also, Arduino TX0 and RX0 pins are actually pins 0 and 1, not 2 and 3. Lastly, you have the TX and RX wires swapped.
Power_Broker i can't see how you concluded "You are trying to hardware the HC-05 to the UART pins of the Arduino. "
the image shows there are two ways to plug the BT module and the other image shows i plugged it in the one connected to arduino D2 , D3
the other set of Pins which is connected to UART pins of the Arduino. is not used in this trial
it was used when i tried a blank sketch
Power_Broker thank you for trying to help me ,don't get angry
i mentioned that i tested the board with fingerprint sensor and it worked fine , so the board has no faults
i doubt that not using voltage divider with the BT Rx fried it
thanks again
fidamon:
Power_Broker thank you for trying to help me ,don't get angry
Sorry, I wasn't actually angry, just a little tilted and sometimes I overuse emojis. My apologies
Idk man, you might just have a bad bluetooth module? Might try using one of these to connect the HC-05 to your computer (without an Arduino) and test the AT commands with PuTTY:
Thanks i am looking for one
Or serial ttl converter but it is hard to find here in upper egypt where i live
Thank you for your help
Till we meet again in the next problem