Tronixlabs Support Forum
Register Latest Topics
 
 
 


Reply
  Author   Comment  
tskvivekmani

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

I have been interfacing HC-05 with Arduino and sending characters from my simple Android app.

I can successfully able to communicate with HC-05, but the problem is I'm getting garbage characters in Arduino. I have tried many times and different methods like using Serial.write() and Serial.print(). But all I'm getting is full of garbage characters.[confused]

I have also used some already available android apps like "ArduDroid" , "Bluetooth Terminal" etc..., but the response I'm getting in Arduino is same.[confused]

Please tell me what are all the things I need to do make this communication effective.
  • Do I have to add start and stop bits? If so, what characters and all can I use?
  • Do I need to change any configuration of HC-05 using AT commands?
Note:
   The equivalent value of all that garbage character is in range of 240 - 250.[rolleyes]

Thanks in advance for any help... :-)
stryker

Junior Member
Registered:
Posts: 12
Reply with quote  #2 
Hi,

Can you share your code?

Thanks
Geoff
tskvivekmani

Junior Member
Registered:
Posts: 7
Reply with quote  #3 
Yea I have shared my code below:

Code:

#include <SoftwareSerial.h>
SoftwareSerial BT(2,3);
void setup()
{
  BT.begin(9600);
  pinMode(13,OUTPUT);
  Serial.begin(9600);
}
void loop() 
{
  char c;
  if(BT.available() > 0)
  {
    //I have tried c as byte also, but same garbage value.
    c = BT.read();
    //Also tried Serial.write(). Its just displaying ASCII value of that garbage characcter...
    Serial.println(c);
  }
 }
stryker

Junior Member
Registered:
Posts: 12
Reply with quote  #4 
Hi

Had you changed the serial bitrate on the HC05 using AT commands or is it still as the default from-the-box settings?  Reason being the ones I've had are default 38,400 which means in setup() I'd try
Quote:
BT.begin(38400);

Cheers!
Geoff
tskvivekmani

Junior Member
Registered:
Posts: 7
Reply with quote  #5 
Yea I have changed it using AT command to 9600. I double checked it as well...
stryker

Junior Member
Registered:
Posts: 12
Reply with quote  #6 
Any chance you can share a photo of your wiring too? 
tskvivekmani

Junior Member
Registered:
Posts: 7
Reply with quote  #7 
Sorry I dint have one to share... But, I can describe it.

Digital Pin 2 -> Tx pin of HC-05
Digital Pin 3 -> Rx pin of HC-05
Arduino 5V -> 5V HC-05
Arduino GND -> GND HC-05

In the module itself, they have converted Rx pin of HC-05 to 3.3V logic.:-)
stryker

Junior Member
Registered:
Posts: 12
Reply with quote  #8 
That appears good, so can you give a transcript of some of the characters you're sending and what you're seeing?
tskvivekmani

Junior Member
Registered:
Posts: 7
Reply with quote  #9 
I tried to send the following data.

start and stop bit -> #
In between -> I tried possibly all characters

From Android, we can send data as a byte[] trough bluetooth.
I tried an app named Ardudroid from Android play store. I tried connecting two Android phones, it worked well. It communicates. But using same app, i tried connecting HC-05. Connected successfully. But, same garbage character problem.

Then I tried to do my own app and same problem appeared in my app also.

My major doubt is, do I need to convert the data type while receiving in HC-05? If so, how can I do that?

Or what could be the possible problem?

Please help me out ASAP.
stryker

Junior Member
Registered:
Posts: 12
Reply with quote  #10 
Can you copy and paste a session from your serial monitor on the Arduino that you are seeing?
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.