Facing a problem with HC-05 in data transfering

Hello everyone, so I started a project on wireless IMU calibration. I'm facing a problem with HC-05. I uploaded the program to arudino (I use nano 3.0) and after opening the teraterm software, when the port is the USB port, I find no problem, the values are being shown perfectly. But, when I open the receiving port of bluetooth in teraterm, there are no values shown. The display is just blank. At that time, HC-05 is just double blinking with red LED light. Can anyone suggest me where did I go wrong?? (Please let me know if it has to do the EN (KEY) pin on HC-05, I didn't do much with that.) and also, I removed the Rx and Tx pins of HC-05 while programming arduino.

manatom:
Hello everyone, so I started a project on wireless IMU calibration. I'm facing a problem with HC-05. I uploaded the program to arudino (I use nano 3.0) and after opening the teraterm software, when the port is the USB port, I find no problem, the values are being shown perfectly.

This suggests the code is kosher.

At that time, HC-05 is just double blinking with red LED light.

This suggets that it is transmitting OK. I assume the HC-05 is on a ZS-040 board.

EN (KEY) pin on HC-05, I didn't do much with that..

At this stage, doing nothing with it is a pretty good idea.

Assuming Terraterm is a PC programme, I think it's likely that all your problems are at the PC end. For starters, you can be pretty sure the terminal will not be using the same port as it does when using cable. Device Manager should tell you. It is usually around COM 40. Most terminals have a display that confirms data transmission but you conspicuously fail to mention anything about that. If there is no display, ditch it and get RealTerm, which has a display.

Leave the USB cable disconnected.

You might find the following background notes useful

http://homepages.ihug.com.au/~npyner/Arduino/GUIDE_2BT.pdf
http://homepages.ihug.com.au/~npyner/Arduino/BT_2_WAY.ino

How is the HC-05 wired up?
It sounds like you are using the same pins as the serial I/O on the Arduino.

@manatom, do not cross-post. Other thread removed.

The COM PORTS as suggested by device managers are 7 and 8. I have opened COM 7 port in teraterm. As you suggested in the pdf, I have reduced the baud rate from 115200 to 9600. Still, facing the same problem. I have tried it in Realterm also, there is no display. (Status - CTS and DSR are glowing in green, I don't know what exactly does it convey.) I'm using an IMU sensor, and the following are my connections.

Board - Arduino nano 3.0
module - HC-05
sensor - MPU6050 GY-521

Wiring:

Nano HC-05 MPU6050
3V3 _ VCC
D2 _ INT
A4 _ SDA
A5 _ SCL
GND _ GND
5V +5V
GND GND
D9 TX
D10 RX

I'm not using a breadboard. I have done this wiring using normal jumper wires. I'm using the normal laptop USB as my power supply.

Please tell me, if you need to know any other details. But, I need to solve this asap. And, I'm sorry about the second post, I was just hoping, people with knowledge in different areas will be addressing the problem.

Couple of points.

  1. The HC-05 is a 3V3 device, that means it requires 3V3 power supply and 3V3 signals although I see a lot of crap on the net saying just connect it up to 5V.

  2. Are you sending data out of pin D9 with software serial?

  3. You could do with posting your code.

Sir, I have tested software serial program in the USB port and it works perfectly. But as I change it to the Bluetooth incoming port, the screen again goes blank. Yes, I connected the D9 pin of arduino to the KEY pin of HC-05 during the AT commands test.

I'm using the same code for IMU given by Jeff rowberg in his library. It works perfectly with the USB. The only problem is not able to transfer the data from HC-05 to Computer.

It works perfectly with the USB.

Yes that is probable because the code is talking to the USB serial port with Serial.write or Serial.print calls.

To talk to the HC-05 you must replace those calls with calls to the software serial module.

Could You kindly give me an example or an tutorial link.

Can you not use Google yourself?

OK, it’s time for two things:

  1. Come forth with your code.
    I assumed you were trying to use the proper hardware serial. Your previous post rather suggested that. In that event you need to use the proper hardware serial pins D0,D1. If you do that now, you might find it will work.

If you have real need to use pins 9,10, and I bet you haven’t, you do need to use code that includes the software serial library but there is no “must” about replacing those calls with calls to software serial. As I said, there does not appear to be anything wrong with the code you have. If that is the code you want, and it works on the serial monitor, it will work with bluetooth as it stands. Just use the proper pins D0,D1, and you already know about disconnecting the USB cable.

  1. Describe the bluetooth module.
    Your previous suggests you are using a bluetooth module on a backboard with a flashing LED, and six pins, one of which is labelled EN, and the board is possibly labelled ZS-040, and also clearly marked to use a 3.6 - 6v power supply. In that event you can safely ignore item 1) in reply #5 above. That is the real crap round here, and leaning 3.3v against a board like that is not a good idea.

The link posted before should have all the tutorial you need on this, maybe all you will ever need.

I rather suspect you never had the device on 115200 in the first place but, so long as you use hardware serial D0,D1, you can run at that rate and it might be wise to make some tests there by changing the programme if you still don’t get a result, just in case you have.

This is the code I got from Online I2Cdev. I agree, I don't know how to make it bluetooth or software friendly. If you could kindly advice me the necessary changes, it would be very helpful.

The link to the code:

https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/Examples/MPU6050_DMP6/MPU6050_DMP6.ino

And, the HC-05 module which I bought is:

The arduino which I'm using presently is arduino nano 3.0

Waiting for your reply, I remain.
Thank you.

As you can see, the device is a ZS-040, designed to run on 3.6>6v as is normal. It is a good idea to use a voltage divider on Arduino’s Tx line, as described in my notes, but you will be amazed about how many people don’t.

The code has nothing to do with bluetooth per se, but that is not a problem. The only thing that counts is that you see what you expect to see on the serial monitor now and there is no need to change it. Just use the hardware serial pins.

Further, and contrary to my previous, there is probably nothing wrong with your procedure at the PC end. The double flash does not suggest Arduino is transmitting OK, it is merely confirming that Android and Bluetooth are properly connected. This is the trap mentioned in item 2. Section .7 of my notes, and you are the first I have known to actually fall into it - and thereby have made a significant contribution to those notes, which will be amended accordingly.

Sir, thank you for your interest and advice. Still, i’m facing a problem in transmitting data from arduino to bluetooth. Do I need to follow any specific steps to get it right ?

P.S: Your notes has given me an insightful knowledge on handling HC-05, and just waiting for the amended version.

manatom:
Do I need to follow any specific steps to get it right ?

I guess you do. Essentially, it is to connect bluetooth to the proper Tx/Rx pins as described. They are labelled TX1, RX0 on the Nano board. It seems to me that your problem has always been a simple case of wrong connection.

P.S: Your notes has given me an insightful knowledge on handling HC-05, and just waiting for the amended version.

The amended version simply comments on the ZS-040 LED resulting from your problem and deleting my misunderstanding that the LED might be signalling data transmission. All you need is in the notes you already have.

Nick_Pyner:
I rather suspect you never had the device on 115200 in the first place but, so long as you use hardware serial D0,D1, you can run at that rate and it might be wise to make some tests there by changing the programme if you still don't get a result, just in case you have.

Has the baud setting of the module been determined?

As suggested by Nick_Pyner you either need to set the HC-05 to 115200 or change line 173 of the program you're using from:

   Serial.begin(115200);

to:

   Serial.begin(9600);

The module you're using should be fine when powered from 5V (it's likely not to work if you power it from 3.3V) but it doesn't look like the PCB has any level shifting.

Running the I2Cdevlib at 9600 will really slow it down. If your module really is set for 9600, you should probably change it to 115200.

I can definitely change the baud rate. But, before doing that, I would like to apologize for not mentioning it before that, I'm presently using Windows 10. Does it has an effect on bluetooth settings (the teraterm and realterm apps which I have been using are not updated for Windows 10). I would like to know your opinion on this. I just found that these apps are only for Windows 7 and 8.

manatom:
I just found that these apps are only for Windows 7 and 8.

No they aren't. At most, they were just written when W7, W8 were current and declared kosher for them - i.e. just words. They run fine on XP and you can be pretty sure that the reason why they are not "updated" for W10 is that is no need. If there was a problem, I believe everybody would know about it.

DuaneDegn:
but it doesn't look like the PCB has any level shifting.

I don't think these little boards ever do. That fact might be indicative of the real need, but most have a label saying signal level 3.3v. This suggests no more than that the transmission line from Arduino @5v could do with a voltage divider. There is no need to do anything about the transmission from bluetooth. Arduino can read a 3.3v signal OK.

I have never heard of a Bluetooth being fried by 5v from Arduino's Tx. There have been instances where feeding the VCC with just 3.3v was likely the cause of a problem.

I have changed the baud rate to 115200,0,0. (Not working)
Tried it in a teraterm in windows 7 laptop (Not working) - (I just didn't want to leave any stone unturned).

Coming to wiring:

I have tried the (Rx, Tx, Key) pins of HC-05 with these combinations of arduino pins for AT Commands test.
(D10, D11, D9 - Working with USB)
(D10, D11, 3V3 - Working with USB)
(RxD, Tx1, D9 - Not working with USB and Bluetooth)
(Tx1, RxD, D9 - Not working with USB and Bluetooth)
(RxD, Tx1, 3V3 - Not working with USB and Bluetooth).

At last, nothing worked for me! Please tell your opinion!!!!