Hi, I'm having a problem with my HC-05 bought recently , I want to control and old RC car with my arduino and HC-05, but when the motors and the hc-05 is connected and try to control de car motors through a bluetooth app in my phone nothing happens!
So I tested my HC-05 to see if is receiving any signal of my phone, I made this connection from UNO to HC-05
5V uno - VIN HC-05
GND uno - GND HC-05
pin 10 uno - tx hc-05
pin 11 uno - rx hc-05
I uploaded this code to UNO to send messages via serial
#include <SoftwareSerial.h>
SoftwareSerial SUART(10, 11); // SRX = 2, STX = 3
#define ledpin 13 //built-in L of UNO
void setup()
{
pinMode(ledpin, OUTPUT);
digitalWrite(ledpin, LOW); //L is OFF
Serial.begin(9600);
SUART.begin(9600);
}
void loop()
{
if (SUART.available())
{
char x = SUART.read();
if (x == 'Y')
{
digitalWrite(ledpin, HIGH); //L is ON
}
if (x == 'N')
{
digitalWrite(ledpin, LOW); //L is OFF
}
}
if(Serial.available())
{
char c = Serial.read();
SUART.write(c);
}
}
The baud rate is 9600 and no line ending, i connect my hc-05 through the serial bluetooth app in my phone, Open the serial monitor in my PC, when I write any word in the SM in my PC I receive the message in the app in my phone, but when i send a message from my phone to serial monitor in my PC, I don't receive anything, I think cause of that I can't control my RC car, my HC-05 is not receiving any signal, I don't know why is happening that, could anybody help me, what I'm doing wrong?, Do you think my HC-05 is broken? Please let me know about it.
How do you know? It may be that you are not receiving 'Y' or 'N'. Put in a serial print to see if anything is coming in and if so, what.
#include <SoftwareSerial.h>
SoftwareSerial SUART(10, 11); // SRX = 2, STX = 3
#define ledpin 13 //built-in L of UNO
void setup()
{
pinMode(ledpin, OUTPUT);
digitalWrite(ledpin, LOW); //L is OFF
Serial.begin(9600);
SUART.begin(9600);
}
void loop()
{
if (SUART.available())
{
char x = SUART.read();
Serial.print("recieved "); // ********** is anything incoming?
Serial.print(x); // ******** what is it?
if (x == 'Y')
{
digitalWrite(ledpin, HIGH); //L is ON
}
if (x == 'N')
{
digitalWrite(ledpin, LOW); //L is OFF
}
}
if (Serial.available())
{
char c = Serial.read();
SUART.write(c);
}
}
Please post a schematic or wiring diagram. Written descriptions are always more ambiguous than a drawing. Hand drawn, photographed and posted is fine. Include all pin names/numbers, components, their part numbers and/or values and power supplies.
Are you sure that you have HC05? Please post photos front and back and show your wiring.
Is the HC05 paired with your phone?
Is the HC05 connected with the Bluetooth app?
What is the Bluetooth app?
This is the connections i have, The yellow wire is connect in the Vin hc-05 to 5v in arduino, the black wire is ground either both, the blue cable is connect the tx of the hc-05 to pin 10, and the white cable is connect the rx of the hc-05 to pin 11 in arduino.
I'm using the same app you say, my phone is paired with the hc-05, and also connects with the bluetooth app, but like i said, only i can receive messages from SM in my PC to my phone, but when I try to send messages from my phone to SM in my PC, nothing received
As I understand it, you are getting one way traffic only.
This suggests a poor connection in Arduino Tx, possibly something to do with the voltage divider. I imagine the device is fine and the code is kosher, even if it is confusing.
Isn't the Vin(high) 0.6 * Vcc on the mega328 processor? So 3.0V for Vcc = 5V. The resistor voltage divider on the HC05 RX has been used by many people with no issues.
No, certainly not. But it is simple and cheap and it does work.
Marginal, not guaranteed considering that a "3.3V" processor might be running on 3V, with correspondingly reduced high level outputs.
It is a bad idea to count on this working, although it often does. I don't see any point in encouraging beginners to be sloppy, particularly when there is such a cheap solution to the interface problem. Better: use a 3.3V Arduino with 3.3V devices!
I was, and still am, implying that your wiring is slack, but I'm afraid I got it the wrong way round. Using the divider is the standard way of doing this, and it is OK, but check Arduino Rx.