BLE slave.ino not connecting, not pairing

Hi All

I need help with debugging my BLE test sketch. I’m not getting any connection with my Bluetooth clients, one of my three alternate apps on my Android Samsung.

I know ZERO about BLE. I detect the sketch is working. But I get nothing passing in/out of my sketch.

I’m running a Seeed BLE Shield on an Arduino Uno. The BLE Shield seems to broadcast itself as HMSoft + mac-address.

The key QUESTIONs are: How can I use the code in the Arduino to add further [debugging] information? And, how can I use the debugging ideas to eventually guide me to exchange chat information?

The sketch follows:

#include <SoftwareSerial.h>   //Software Serial Port
#define RxD 2
#define TxD 3

#define DEBUG_ENABLED  1

SoftwareSerial BLE(RxD,TxD);

void setup()
{
    Serial.begin(9600);
    pinMode(RxD, INPUT);
    pinMode(TxD, OUTPUT);
    setupBleConnection();
}

void loop()
{
    char recvChar;
    while(1){
        if(BLE.available()){//check if there's any data sent from the remote BLE shield
            recvChar = BLE.read();
            Serial.print(recvChar);
        }
        if(Serial.available()){//check if there's any data sent from the local serial terminal, 
            // you can add the other applications here
            recvChar  = Serial.read();
            BLE.print(recvChar);
        }
    }
}

void setupBleConnection()
{
    BLE.begin(9600); //Set BLE BaudRate to default baud rate 9600
    BLE.print("AT+CLEAR"); //clear all previous setting
    BLE.print("AT+ROLE0"); //set the bluetooth name as a slaver
    BLE.print("AT+SAVE1");  //don't save the connect information
}

I have run both master and slave versions. The differences in in the
BLE.print(“AT+ROLE0”); //set the bluetooth name as a slaver
BLE.print(“AT+ROLE1”); //set the bluetooth name as a master

On my Android Samsung I get no connections:

App #1: Serial Bluetooth Terminal:

  • I can see the HMSoft with a mac-address
  • The HMSoft is listed as an LE emitter
  • When I send a numeral 1, the reply is “Serial device not connected”

App #2: Bluetooth Terminal:

  • HMSoft is listed
  • when selected, it shows "Connecting . . . "
    • after 3 or 4 seconds is followed by: “Unable to connect device”

App #3: nRF UART V2.0

  • HMSoft is shown in master-mode with a tag of “Rssi = -44”
  • HMSoft is shown in slave-mode with a tag of “Rssi = -62”
  • When selected I get:
    • “[time-stamp] Connected to HMSoft”
  • followed after 1 second by:
    • “[time-stamp] Disconnected to HMSoft”
  • and a further message:
    • “Device doesn’t support UART. Disconnecting”

All apps are showing the device is visible. They all show that pairing is attempted. Only App #3 gives me any informative responses, that: a) App#3 actually connected; b) the connection talked to the device and established that it does not use UART; and that c) the pairing was discontinued.

Again the QUESTIONs are: How can I use the code in the Arduino to add further [debugging] information? And, how can I use the debugging ideas to eventually guide me to exchange chat information?

I look forward to your replies
Thanks
EGB

The source link and setup is shown in http://wiki.seeedstudio.com/Seeed_BLE_Shield/
EGB

On my Android Samsung I get no connections:

It appears that the SeeedStudio module uses an HM11. It is similar to the HM10 from JNHuaMao, based on the CC2540 TI chip.

Like you, I have been able to get the Android Samsung to see and pair with the device. The Serial Bluetooth Terminal app will show the device, but the connections are very intermittent and constantly disconnecting.

BLE with Android and the HM10 (I have a clone, so maybe a genuine module is better) has been very frustrating for me and have not gotten it to work. I have had success with the Adafruit Feather BLE which uses the nRF51822 chipset from Nordic.

Why do you need to use BLE? Bluetooth Classic is pretty foolproof with Android.

cattledog:
Why do you need to use BLE?

That's the real question..... BT4 seems to be more trouble than it is worth, and one of the main reasons why is that it is often called to replace BT2, but is not really suitable for that purpose. I have never gotten an HM-10 to work and I considered myself lucky when I realised that I don't actually need it.......

cattledog:
Why do you need to use BLE? Bluetooth Classic is pretty foolproof with Android.

and: @Nick_Pyner ... more trouble than it is worth

This is a very relevant question and comment.

I'm trying to learn as much as I can about BT using what I have around me. I have a Seeed Studio BLE Shield, sitting on an arduino Uno. My ultimate objective is to link with a heart monitor (Faros 360) and log its output data running at 1KHz. It outputs data using BT Classic, I believe, but do not know. For now, I'm waiting on two things: Firstly, details on the Bluetooth protocol the heart monitor uses. Second my ESP32 items (supposedly for BT classic) are on order, awaiting delivery. So yea, BLE is not where I want to go, ultimately.

cattledog:
BLE with Android and the HM10 (I have a clone, so maybe a genuine module is better) has been very frustrating for me and have not gotten it to work. I have had success with the Adafruit Feather BLE which uses the nRF51822 chipset from Nordic.

The items I have bought are pairs of ESP32's, So hopefully, I can try @cattledog's idea of pairing with a clone. In the mean time, I must continue with the BLE (head-banging stuff!).

Meanwhile I'm checking this out: http://homepages.ihug.com.au/~npyner/Arduino/GUIDE_2BT.pdf and http://homepages.ihug.com.au/~npyner/Arduino/BT_2_WAY.ino ...

Thanks
EGB

The Pharos 360 claims a 100m range for its bluetooth, which implies it is a BLE device. It might be useful to check if it is backwards compatible with plain vanilla bluetooth devices. Unless they make a dedicated receiver, it probably is.

Unless you have closely researched them and are quite sure they are what you need, I suspect cancelling the order for the ESP32 would be a really good idea.

I specifically avoid BLE, so, if you really want to bang your head against the wall with BLE, don't bother reading anything other than the very last page of my bluetooth notes.

Nick_Pyner:
The Pharos 360 claims a 100m range for its bluetooth, which implies it is a BLE device. It might be useful to check if it is backwards compatible with plain vanilla bluetooth devices. Unless they make a dedicated redeiver, it probably is.

Unless you have closely researched them and are quite sure they are what you need, I suspect cancelling the order for the ESP32 would be a really good idea.

I specifically avoid BLE, so, if you really want to bang your head against the wall with BLE, don't bother reading anything other than the very last page of my bluetooth notes.

Thank you @Nick_Pyner for the pointers.

I'm waiting to contact the suppliers of the Faros360, in Finland. I believe they are on holiday. So I still know nothing about what the Bluetooth specs are. The specs are not available on their web-sites.

One of my Android Serial/BT apps is showing that the Faros360 communicates with both BTClassic and BLE.

Their application needs to transmit about 40Bytes per sample at a sampling rate of 1000Hz. That is 40KBytes/second. That's a lot, and continuous, which suggests that the data transmission occurs with BTClassic.

In the meantime, I'm just trying to prepare my systems ...

Thanks for being there

Regards
EGB

EGB:
That's a lot, and continuous, which suggests that the data transmission occurs with BTClassic.

No it doesn't but it might be helpful if it does both BLE and BT2.

I'm surprised that the BLE adapter can recognize AT commands without any line endings, but that is the way the SeeedStudio example shows it.