I just obtain my Arduino Nano BLE and try to test connection and services via nRF connect using example sketches.
Tested with different devices - Arduino is invisible in range more than 2 meters
It’s incredibly short range. Is it ok? Can I connect external antenna to arduino or maybe change settings in sketch?
onepixel0:
... nRF ... It’s incredibly short range. Is it ok?
AFAIK the 'n' in nRF stands for "near". I interpret this as a behaviour my cash card shows: It's not recognized until I place it directly on the thing with the display and keyboard (where I enter my PIN).
So, I wouldn't say that 2 m is "incredibly short range".
Gregor
The "n" in "nRF" stands for Nordic, the company that makes the chips.
FYI, for the cash card you're thinking of NFC (near field communication). That's a different technology than BLE. BLE is generally considered a technology for PAN (personal area network), but it is possible to get some pretty good range (~100 m) with Bluetooth under ideal circumstances. I'm not sure how close to that theoretical maximum you can get with the Nano 33 BLE boards though.
pert:
... NFC (near field communication) ..
Ooops ... yes ... I mixed that.
Thanks!
Gregor
Application is not the problem, I also tried "BLE Scanner", and both apps show me the list of all bluetooth devices in pretty good range. But Arduino show poor signal in range more than 1m and completely missing in range more than 2m.
Can it be iOS problem? Unfortunately I have no other devices with BLE for testing
Hey, I was actually going to make a post on this.
My Nano BLE has crazy short range too. It can be detected up to 2m away but I can only reliably communicate with it whilst it is 1m away.
This is with a laptop and 2 different android phones.
The range is unfortunately exceptionaly short. I have approximately 2-3 meters of range and even if the devices are in clear range of each other with no obstruction they cannot communicate, (phone to ble sense).
Something clearly must be wrong 2 meters is way way way too low.
Any advice would be great!
I have done a range test and could still receive data at a range of 40 meters / 130 ft. Here are the conditions of my experiment.
- Arduino Nano 33 BLE (1.5m above ground, outside, houses and vegetation around but free line of sight)
- iPhone 7 (BLE Scanner app)
- 3 characteristics (1 float and 1 long read notify and 1 bool write)
- The float is an accelerometer value and the long a counter
- the two values are updated every 20ms
I could clearly see the values updating dynamically in the app, but there are values dropped which is to be expected. I cannot measure the drop rate with the phone app, only see that the counter sometimes does not update with the same speed / amount of intermediate values (depending the orientation of the phone while walking). I could also write the bool value which resets the counter.
40m is fine I think, but really, I can’t get even 5 in a room without any obstacles. According to nina b306 datasheet it’s range could be up to 1400m.
Sad, but I just get external BLE module if we’ll not figure it out
Klaus_K:
I have done a range test and could still receive data at a range of 40 meters / 130 ft.
Could you provide the sketch you used and then I can compare mine? Having the same code should make a better comparison instead of us all doing different things.
nuhash:
Could you provide the sketch you used and then I can compare mine?
Sure. Here you go. You will need to reset the board once the connection was lost completely. I haven’t found a way to recover the BLE stack from that.
/*
This example creates a BLE peripheral with a service that contains a
couple of characteristics to test BLE connection.
The yellow LED shows the BLE module is initialized.
The green LED shows RSSI of zero. The more it blinks the worse the connection.
The circuit:
- Arduino Nano 33 BLE Sense board.
You can use a generic BLE central app, like LightBlue (iOS and Android) or
nRF Connect (Android), to interact with the services and characteristics
created in this sketch.
This example code is in the public domain.
*/
#include <ArduinoBLE.h>
#include <Arduino_LSM9DS1.h>
//----------------------------------------------------------------------------------------------------------------------
// BLE UUIDs
//----------------------------------------------------------------------------------------------------------------------
#define BLE_UUID_TEST_SERVICE "9A48ECBA-2E92-082F-C079-9E75AAE428B1"
#define BLE_UUID_ACCELERATION "2713"
#define BLE_UUID_COUNTER "1A3AC130-31EE-758A-BC50-54A61958EF81"
#define BLE_UUID_RESET_COUNTER "FE4E19FF-B132-0099-5E94-3FFB2CF07940"
//----------------------------------------------------------------------------------------------------------------------
// BLE
//----------------------------------------------------------------------------------------------------------------------
BLEService testService( BLE_UUID_TEST_SERVICE );
BLEFloatCharacteristic accelerationCharacteristic( BLE_UUID_ACCELERATION, BLERead | BLENotify );
BLEUnsignedLongCharacteristic counterCharacteristic( BLE_UUID_COUNTER, BLERead | BLENotify );
BLEBoolCharacteristic resetCounterCharacteristic( BLE_UUID_RESET_COUNTER, BLEWriteWithoutResponse );
const int BLE_LED_PIN = LED_BUILTIN;
const int RSSI_LED_PIN = LED_PWR;
void setup()
{
Serial.begin( 9600 );
// while ( !Serial );
pinMode( BLE_LED_PIN, OUTPUT );
pinMode( RSSI_LED_PIN, OUTPUT );
if ( !IMU.begin() )
{
Serial.println( "Failed to initialize IMU!" );
while ( 1 );
}
Serial.print( "Accelerometer sample rate = " );
Serial.print( IMU.accelerationSampleRate() );
Serial.println( " Hz" );
if( setupBleMode() )
{
digitalWrite( BLE_LED_PIN, HIGH );
}
} // setup
void loop()
{
static unsigned long counter = 0;
static long previousMillis = 0;
// listen for BLE peripherals to connect:
BLEDevice central = BLE.central();
if ( central )
{
Serial.print( "Connected to central: " );
Serial.println( central.address() );
while ( central.connected() )
{
if( resetCounterCharacteristic.written() )
{
counter = 0;
}
long interval = 20;
unsigned long currentMillis = millis();
if( currentMillis - previousMillis > interval )
{
previousMillis = currentMillis;
Serial.print( "Central RSSI: " );
Serial.println( central.rssi() );
if( central.rssi() != 0 )
{
digitalWrite( RSSI_LED_PIN, LOW );
float accelerationX, accelerationY, accelerationZ;
if ( IMU.accelerationAvailable() )
{
IMU.readAcceleration( accelerationX, accelerationY, accelerationZ );
accelerationCharacteristic.writeValue( accelerationX );
}
counter++;
counterCharacteristic.writeValue( counter );
}
else
{
digitalWrite( RSSI_LED_PIN, HIGH );
}
} // intervall
} // while connected
Serial.print( F( "Disconnected from central: " ) );
Serial.println( central.address() );
} // if central
} // loop
bool setupBleMode()
{
if ( !BLE.begin() )
{
return false;
}
// set advertised local name and service UUID:
BLE.setDeviceName( "Arduino Nano 33 BLE" );
BLE.setLocalName( "Arduino Nano 33 BLE" );
BLE.setAdvertisedService( testService );
// BLE add characteristics
testService.addCharacteristic( accelerationCharacteristic );
testService.addCharacteristic( counterCharacteristic );
testService.addCharacteristic( resetCounterCharacteristic );
// add service
BLE.addService( testService );
// set the initial value for the characeristic:
accelerationCharacteristic.writeValue( 0.0 );
counterCharacteristic.writeValue( 0 );
// start advertising
BLE.advertise();
return true;
}
Also, the way you are powering the board can make the difference. Is that USB?
Hi,
I have the same problem. I tried several examples with BLE and Raspberry Pi and maximum range is about 5 meters. Are there any signal strength settings? Power is from USB.
Klaus_K:
Sure. Here you go. You will need to reset the board once the connection was lost completely. I haven’t found a way to recover the BLE stack from that.
Thanks for that. I tried it and it can only communicate from at most 4m away. I replicated your test conditions as you had described (to a fair degree).
I opened a support ticket with ublox to ask them if they could advise on the issue (https://portal.u-blox.com/s/question/0D72p000008qj6k/is-it-normal-for-a-ninab306-module-to-have-an-extremely-short-range)
The support rep asked me to check the SMD components on the antenna and as it turns out, 2 of them are missing. They were never there, which explains why my experience has been so poor.
As I bought my device on amazon I have asked there for a refund or a replacement device.
Yeah, that's it!
I have one missing component too. Have no idea what it should be, I shorted it and it became better.. not perfect, but better
Thanks a lot @nuhash
Hi, I have the same issue with signal level, can you post a picture with missing components?
Thks.
Its the components on the green antenna area.
Klaus_K:
/*
//----------------------------------------------------------------------------------------------------------------------
// BLE UUIDs
//----------------------------------------------------------------------------------------------------------------------
#define BLE_UUID_TEST_SERVICE "9A48ECBA-2E92-082F-C079-9E75AAE428B1"
#define BLE_UUID_ACCELERATION "2713"
#define BLE_UUID_COUNTER "1A3AC130-31EE-758A-BC50-54A61958EF81"
#define BLE_UUID_RESET_COUNTER "FE4E19FF-B132-0099-5E94-3FFB2CF07940"
Hi Klaus
I am fairly new to the Arduino platform. I am using Arduino nano 33 BLE sense for my project. Could you please help me that how you know what UUID represents what? I want to access all 9 axis IMU values using UUID. I can not use the library since I am working on Matlab. Therefore I need to work with reading values using UUID.
Thanks in advance. I would be really grateful if you could help.
I have also attached the Arduino BLE object characteristics that I can access from my Matlab code.
rakhiag:
Could you please help me that how you know what UUID represents what?
As the developer of your Arduino Nano 33 BLE project, you must decide what data your Arduino is providing via the Bluetooth GATT (that is the structure defined in the specification to hold the data).
Each service or characteristic uses a UUID.
The Bluetooth org has specified a list of 16-bit UUID for things that the member of the org wanted to produce e.g. heart rate sensors for sport watches, temperature sensor for air condition and heating system ... and so on. If your device can use these UUIDs your device could automatically be compatible with other things that know these UUIDs.
Because the Bluetooth org has members that will develop stuff that will be unique and they have customers like us that will create even more unique stuff they have specified that you can create your own UUIDs but they have to be random 128 bit numbers. This way it is unlikely two devices specify the same UUID for different things.
So, the UUID for acceleration I looked up on the Bluetooth org site and the other UUID I created with a random number macro for the example. I could have created a random UUID for the acceleration as well, because my demo does not need to be compatible with some application. I just wanted to test both UUID formats.
I created the #define names so my source code is not littered with numbers and I can change them easier. You can also place them in a header file and compile them into two different Bluetooth nodes e.g. server and client.