How can I test this serial BlueTooth module?

I got a bluetooth module for my HobbyKing MultiWii 328 quadcopter board but it simply doesn't work despite my trying everything I can imagine. My phone will connect to the module but I get no data, not even a raw stream.

I tried connecting it to my UNO to see if it was faulty and I am not sure about the results. I can only send data from the phone if I don't set up Serial in the arduino sketch, and just use the window to listen. If I set up Serial so that I can send to the phone, it works, but then I can't send from the phone anymore, even using the serial read example. Then in both situation, reversing RX and TX doesn't seem to change anything. If I try to use serial read and write in the same sketch they seem to interfere with each other. I have everything set to 115200.

Using just the phone, with the BT module powered, but RX and TX not connected, it acts like it's looped back, even though I haven't looped RX and TX.

So rather than guessing, how can I determine for sure if this thing is faulty?

stoopkid:
So rather than guessing, how can I determine for sure if this thing is faulty?

The first thing to do is to assume it isn't. The device looks like a HC-0x, and they are pretty straightforward and very popular. The notes below should help establish the procedures for connection.

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

Is it supposed to be sending that text in Setup() to my phone? Because it doesn't. It does receive text from the phone. The only way I get text on the phone from the arduino code is if I don't use the pullup resistor and just connect it directly. But then it goes nuts, like some kind of loop feedback and keeps printing those Setup() messages over and over.

stoopkid:
Is it supposed to be sending that text in Setup() to my phone?

Phone is a loose term. It sends the text to a terminal programme running on your Android device. It has just occurred to me that you could be trying to use an iPhone. If that is the case, forget it. The solution is to get an Android, and perhaps I should make that more clear in the published notes..

Because it doesn't. It does receive text from the phone. The only way I get text on the phone from the arduino code is if I don't use the pullup resistor and just connect it directly. But then it goes nuts, like some kind of loop feedback and keeps printing those Setup() messages over and over.

This may all be explained by the above. Don't even think about pullup resistors. The procedure is mature enough to the point where there is no point in being the first person in the universe to do that, so there is no point in asking how you did it. If you are using an Android device or a proper Windows computer, your problem should be just a minor misunderstanding.

The resistors were in the PDF you linked, that's why I tried. It pulls down to ground actually, so I should have said pulldown resistors. Whatever the case, I tried with and without them. Without the the resistors it acts like there's feedback and it sends the text over and over.

I am using "Bluetooth Terminal" on a Galaxy S4, CM10.2. I am certain that I am connected to the module because I do get some communication, but it is erratic as I have explained.

OK, they are level shifting resistors, which is not quite the same thing. They should not cause any problem. Note that they are only on Arduino's Tx line, and this is ostensibly to protect the JY-MCU. Techbitar's, and sundry others' claims of the need for them sounds reasonable and it would be irresponsible of me not to point this out, but I have never used them myself.

But I now think it is clear that you DO have a power problem. As you point out, the main lines of text are in the setup and therefore you should only see it once. If you see that constantly, Arduino must be constantly resetting, and a bodgie power supply is the only explanation that I can think of. If you are getting power from the USB cable, now is probably a good time to get a 9v wall wart.

On reflection, this could be the only problem. If you can see anything at all, your procedures must be correct, same goes for the wiring, except for the resistors, which are just making a bad situation worse. The JY-MCU is not famous for its low power consumption.

Ok, just to be perfectly sure I am powering the BT module by itself with a 7805, a 10uF cap on the input and output and a 12v 2A wall adapter. The grounds of the BT/7805 and the arduino are connected. The 7805 is not getting more than warmish. (I also tried just plugging the wall adapter into the arduino DC jack and powering the BT from the 5v arduino line). I get the same issue: With resistors I can send text from the android terminal to the arduino but nothing from the arduino. Without the resistors it spits out the Setup() text over and over. I added this to the Setup()

    randomSeed(analogRead(0));
    Serial.println(random(1000));

Every time I restart it gives me a different number as expected. But this repeated text is the same number over and over. So I don't think the arduino is restarting, I think it is some kind of feedback.

I heard you say:
OK then, you first, say something.....
Go on, type something id hit Send,
or just hit the Enter key
800

I heard you say:
OK then, you first, say something.....
Go on, type something id hit Send,
or just hit the Enter key
800

I heard you say:
OK then, you first, say something.....
Go on, type something id hit Send,
or just hit the Enter key
800

This also appears on the android terminal.

What else is troubling is that if I reverse the RX and TX lines I get the EXACT same results. With and without resistors. Powering the BT module on its own.

stoopkid:
if I reverse the RX and TX lines I get the EXACT same results. With and without resistors. Powering the BT module on its own.

I'm afraid you have said enough there to put this right out of my league. I cannot even speculate on that.

On the face of it, your 7805 power supply seems reasonable, but I am more interested in you running off the Uno's 5v pin, with the Uno properly fed, in the normal manner.

As I said, if you keep seeing "OK then, you first etc" it is surely because Arduino is resetting. No, I don't know where the 800 is coming from, but I submit that Android and Bluetooth are entirely innocent until proven guilty by a lot more than I have heard so far. There is a faint irony here in that Bluetooth is so innocent that it is able to maintain the pairing by virtue of its power supply being kosher. Either that, or the reset is so quick that neither Android nor Bluetooth get to know about it.

Either way, I think Android and Bluetooth are fine. I could be wrong but I reckon you have done everything right as far as they are concerned, and they are just doing their job as they see it.

And putting those serial prints in the setup is now starting to look like a really good idea.

Nick_Pyner:
On the face of it, your 7805 power supply seems reasonable, but I am more interested in you running off the Uno's 5v pin, with the Uno properly fed, in the normal manner.

I did that first, and only went to the 7805 when I got the same results.

It seems to me that there would be a problem with the serial stuff on the BT module. I am finding that even if I disconnect bluetooth from the phone and the bluetooth module starts blinking as it normally does when it is not connected, it keeps doing the loop thing. Or even if I start it without connecting the BT to the phone. Something must be wrong with the serial board, I don't see any other way around it.

edit:
Aha! I found it! Using the HC-06 Bluetooth Module | MCU on Eclipse

This site shows the RX and TX of the BT module. Looking at those pins on mine, they are bridged with solder.

edit:

SUCCESS!!!

I soaked up the bride and now it works with the UNO! Now I can try again on the flight controller.

edit: and it works on the copter finally. Man am I relieved. Thanks for your help.

stoopkid:
SUCCESS!!!

I soaked up the bride and now it works with the UNO! Now I can try again on the flight controller.

WOW!!

I'm really pleased to hear this - just some dumb thing that will only happen once.

I recall reading about that solder problem but I had forgotten about it.

That is further input to my notes, so thank you!