Can't Connect to BlueTooth

Hi I have a JY-MCU blue tooth module connected to my UNO and can't seem to connect to it with BlueTerm or any other terminal emulator for that matter. It paired properly with the code 1234 and I can see it in the list of devices on my S6 phone but can't connect to it. The LED blinks red and as far as I know should go steady red when connected. Any ideas what I'm missing?

zappullae: It paired properly with the code 1234 and I can see it in the list of devices on my S6 phone but can't connect to it. The LED blinks red and as far as I know should go steady red when connected.

This is correct, and implies your problems are between Arduino and Bluetooth. It may be just procedural but check your wiring too. 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

I assume an S6 is not an iPhone.

Thanks Nick. You are right it is a BT to Android problem. So far the only app I found that will connect is "Bluetooth Serial Controller" http://apk-dl.com/bluetooth-serial-controller-16

So I have it working connected to Android as per this sketch:

http://www.instructables.com/id/How-to-install-and-use-the-JY-MCU-Bluetooth-module/?ALLSTEPS

I would also like to talk to the BT device to configure it. I found this manual and tried using the Serial Monitor to talk to the BT module but it doesn't seem to respond.

www.ram-e-shop.com/ds/general/Bluetooth_TRx_Module_New.pdf

First up, I said it implies a problem Arduino<>Bluetooth, but I now realise you are not getting a solid LED at all, and that indeed means Android<>Bluetooth (to start with)

JY-MCU is not a bluetooth device, it is the type of backboard a bluetooth device fits onto. The fact that the Instructable talks about “the JY-MCU Bluetooth module” is rather indicative of the level of junk they publish. This backboard can take two bluetooth modules, an HC-05 and HC-06 which, while they look and work the same out of the box, have totally different methods of configuration.

This is all explained in the notes I referred you to.

If you are not getting a solid LED, you are not getting a connection. If you are not getting a solid LED with Bluetooth Serial Controller, you are not getting a connection, you just think you are, and I would suggest you read the notes. If you are getting a solid LED with that, you are getting a connection, the app is immaterial, you should get a connection with any other app, and your real problems are all at the Android end.

The configuration manual you allude to is for HC-05. It will not work if your module has four pins.

I agree Nick. It is an Android to Bluetooth connection problem. The Bluetooth Serial Controller app will connect and give me a solid red LED. After that I can send text and turn off the Arduino internal LED with the code below.

I will be reading the links you sent and appreciate your help.

char val; // variable to receive data from the serial port
int ledpin = 13; // Onboard LED

void setup()
{

  pinMode(ledpin, OUTPUT);  // Onboard LED as OUTPUT
  Serial.begin(9600);       // start serial communication at 9600bps
}

void loop()
{

  if(Serial.available())       // if data is available to read
    val = Serial.read();         // read it and store it in 'val'

  if(val == 'H')               // if 'H' was received
     digitalWrite(ledpin, HIGH);  // turn ON the LED
  else 
    digitalWrite(ledpin, LOW);   // otherwise turn it OFF

  delay(100);                    // wait 100ms for next reading
}

zappullae: I agree Nick. It is an Android to Bluetooth connection problem. The Bluetooth Serial Controller app will connect and give me a solid red LED. After that I can send text and turn off the Arduino internal LED

OK, in that event I think we can put all the problems down to pilot error, and all at the Android end. Any other app should work just like the first one, but only one at a time, so make sure the first is disconnected, LED flashing 2Hz, before you start the second app.

Most, if not all, apps can disconnect comms from within. If yours doesn't, you will need more drastic means, like app manager, or an app shutdown app.

Not pilot error Ken. Blue Term and other apps just don't connect to the paired device HC-08. I read your notes and had everything in place properly but the Android apps wouldn't connect. As a matter of fact, they never even allowed me to choose the device to connect to. I'm assuming they assumed the connection was made via the Bluetooth Wireless settings in Android where you tap a device and it connects. That didn't happen with the BT shield yet connections to other devices like a laptop did connect at a tap. Bluetooth Serial Controller on the other hand worked perfectly first time. I'm going to give the apps in your notes a look and see if they will connect.

I hope your HC-08 was a typo. While I can only comment on HC-05 HC-06, I still believe your problems are at the Android end anyway.

I’m assuming they assumed the connection was made via the Bluetooth Wireless settings in Android where you tap a device and it connects.

You need to understand the difference between “pair” and “connect”. Pairing is done in the settings, once, and connecting is done in the app, often.

The LED should go solid when pairing, but it should start flashing again when you exit the Settings menu. It might pay to also check the paired devices list in the settings. If the app does not offer you a list of paired devices, the obvious conclusion is that you have failed to pair and so there is nothing to offer.

It might be a good idea to beg, borrow, or steal somebody else’s phone but, if one app works, all the others should…

Nick, I understand the difference between pairing and connecting. Pairing worked perfectly every time I tried it. Connecting only works with the Bluetooth Serial Controller app so far. I tired multiple Android devices, a tablet and phone. I will give an iOS phone a shot also when I have a chance but I don't have high hopes it will be different. That's a good idea. Thanks again for your input.

So the BT device is HB-01 not 08. Bluetooth Terminal by QWERTY connects fine but I see any data coming back from the HB-01. Blue Graph works fine as does Bluetooth Serial Controller.

zappullae: I will give an iOS phone a shot also when I have a chance but I don't have high hopes it will be different.

You're damn right, it won't be. IOS does not work with HC-0x. Get a real phone, get an Android!

If the Bluetooth Serial Controller really works OK, it suggests there is nothing wrong with Arduino or Bluetooth. I might point out though, that I had some grief when I started with Bluetooth. My cheapo tablet would not look at my HC-06. I checked it with my neighbour's equally cheapo Huawei phone, and it worked perfectly, so I blamed the tablet and bought the same phone. I later found that the tablet worked fine with a keyboard I actually bought for the phone. I never got to the bottom of this because the tablet died soon after, but I don't think it was pilot error. I have never had a problem since, but subsequent blueteeth have all been HC-05.

What's the problem with HC-0x and iOS? Is there a more compatible BT shield you would suggest I try?

zappullae: So the BT device is HB-01 not 08.

If that is true, which I doubt, and Google seems skeptical, it could be the cause of your problems. Since you have succeeded in pairing, the real identity of the device will be in the pairs list. I can barely speculate on what the problems are but, if you still have any and it really is an HB-01, investing $3-70 on a real HC-0x might be a sensible solution.

Qwerty's terminal is one that I use. There may be a settings problem, like CR, and it is getting the data but not showing it. It seems that you now have 2 1/2 out of three apps working, which tends to confirm that the problems are procedural, and at the Android end.

IOS is BT-4 only. See my notes. I still don't have experience with BT-4 - or the need, I'm afraid.

It's 02:30, and I'm going to bed.

So I tried to pair an iPhone 4, 5 and 6 without luck. I need a real BT device that can connect tyo both Android and iPhones. Any suggestions?

I think the most obvious choice is the TinySine HM-10, but I don't know if it is the best choice. I have a couple but I have never used them. I couldn't even get them to pair with my BT-2 phone, but the phone could see them.

While I believe they have stopped moving the BT4 goalposts, I rather suspect that the technology is not quite mature and thus not worth pursuing. The grief with BLE encountered on this forum tends to reflect that.

You might confirm you are using what you say you are using. I don't believe it but I could be wrong and, if I am, there is a fair possibility that you are already using a BT4 device that I have never heard of. All I really know is that you have a JY-MCU backboard and have an HC-05 manual that you can't use. I have never heard of a BLE on a JY-MCU, but it can't be impossible and may be a good idea.

The SunFounder-Bluetooth-Master-Module-Arduino seems to work with iPhone according to the comments. $10 on amazon.

It appears to be identical to the TinySine HM-10 at about twice the price.

I succeed to connect to HC-08 Bluetooth at window 10 from my own C#-written application. The idea is that this device doesn't support pairing but it support new GATT API interface that enables to connect to its so called characteristics that possessed a known GUID. The Java-code example for Android is available at the manufacturer web-cite http://www.hc01.com. It write the equivalent code in C# using Universal Windows Platform. Here is a fragment of the code:

string HEART_RATE_MEASUREMENT = "0000ffe1-0000-1000-8000-00805f9b34fb"; GattDeviceServicesResult result = await bluetoothLeDevice.GetGattServicesAsync(); if (result.Status == GattCommunicationStatus.Success) { var services = result.Services; // Loops through available GATT Services. foreach (GattDeviceService gattService in services) { Guid uuid = gattService.Uuid; GattCharacteristicsResult result20 = await gattService.GetCharacteristicsAsync();

foreach (GattCharacteristic gattCharacteristic in result20.Characteristics) { GattCharacteristicProperties properties = gattCharacteristic.CharacteristicProperties; Guid uuidCharacteristic = gattCharacteristic.Uuid; if (uuidCharacteristic.CompareTo(new Guid(HEART_RATE_MEASUREMENT)) == 0) {

GattCommunicationStatus status = await gattCharacteristic.WriteClientCharacteristicConfigurationDescriptorAsync( GattClientCharacteristicConfigurationDescriptorValue.Notify); if (status == GattCommunicationStatus.Success) { // Server has been informed of clients interest.

gattCharacteristic.ValueChanged += Characteristic_ValueChanged; selectedCharacteristic = gattCharacteristic; //rootPage.NotifyUser("Connected ", NotifyType.StatusMessage);

}

} } } } If somebody needs a working example I may publish it as well.