Arduino Giga R1 not scanning BLE addresses

Hi everyone,

I am hoping for some help with an Arduino Giga R1 that I am having trouble getting to work with ' BLE.scanForAddress()'. The Giga works fine with the in-built example 'Scan' within 'ArduinoBLE', but the script posted below fails to work with the Giga even though it does work with an Uno R4 Wifi. The scan process does appear to start properly (i.e. I get a "Bluetooth® Low Energy Central scan" message in the serial monitor), but nothing further comes up in the monitor, even when the tag is very close by.

Here is the code I am trying:

#include <ArduinoBLE.h>

void setup() {
  Serial.begin(9600);

  //Keep trying while serial connection isn't working
  while (!Serial);

  // begin initialization and keep trying
  if (!BLE.begin()) {
    Serial.println("starting Bluetooth® Low Energy module failed!");

    while (1);
  }

  Serial.println("Bluetooth® Low Energy Central scan");

  // start scanning for periherals (tags)
  BLE.scan();
}

void loop() {
  //Use this to enter the MAC addresses of the tag we are interested in 
  BLE.scanForAddress("54:6c:0e:57:8c:d1");
  // check if a tag has been discovered
  BLEDevice Tag_1 = BLE.available();

  if (Tag_1) {
    // discovered Tag 1
    Serial.println("Discovered Tag_1");
    Serial.println("-----------------------");

    // print address
    Serial.print("Address: ");
    Serial.println(Tag_1.address());
    Serial.print("Tag 1 RSSI: ");
    Serial.println(Tag_1.rssi());

   
      Serial.println();
    }
}

Thanks for any suggestions or guidance,

Rob

First, put the device on top of the sensor. If it still fails, closely compare the working sketch and the failing sketch to determine the differences.

Hi @koalarduino. Did you connect the antenna that comes with the GIGA R1 WiFi board?:

https://docs.arduino.cc/tutorials/giga-r1-wifi/cheat-sheet/#radio-module

The UNO R1 WiFi board's radio has an integrated onboard antenna, but the GIGA R1 WiFi uses an external antenna. The radio module will not have good functionality if that antenna has not been connected.

Hi @sonofcy , thanks for the suggestion. The main difference between the sketches (at least to my untrained eye) relates to: 'BLE.scanForAddress()'. However, it does work fine with an Uno R4 Wifi. Is it possible that BLE.scanForAddress() is somehow incompatible with a Giga?
Thanks again for the guidance,
Rob

Hi @ptillisch , thanks for posting. I have tried the antenna the Giga was shipped with, and also another omnidirectional 2.4GHz antenna I had (just in case the one it came with was damaged). It doesn't seem to be an antenna issue though, as the example scan sketch works fine and picks up the tag (and many other nearby BLE devices) immediately with either antenna attached. Appreciate your suggestions.
Cheers,
Rob

Check the ArduinoBLE library library.properties file for the statement architecture. If it is * then it should work for all, otherwise if it says something else, it needs to include the GIGA.

Ok shall check, thanks very much.
Rob

Hi @sonofcy

it's listed here: ArduinoBLE - Arduino Reference, and in the README on Github, although it's not specifically mentioned here, but the achitecture is mentioned here...so I am not sure, but I think the library should be compatible? The only firware related statements in the README appear to be about the Uno (nothing I can see specifically about the Giga). Searching the repository, I did find this, which does seem to be possibly related, although that poster was directed here to the forum and I can't find anything further...so I am not 100% sure, but it seems like it might be compatible...
Cheers,
Rob

I wonder if this is related? It seems to be, because the specific problem appeared to be with using BLE.scanforAddress(), although I am now trying to understand how the work-around works exactly given that the mac address is no longer used...