I'm using the Nano as a central device connecting to a peripheral (HC-19). My connection range seems to be very weak (4-6ft). It connects fine, but I can only get about 4-6 feet away before a disconnection happens. I've used my phone to connect to the HC-19 and I can get distances much greater than the nano. It seems like there have been a few topics.
It seems this sketch shows the nano acting as the peripheral, connecting to a central and they seem to get good range. I couldnt quite apply this post to my issue. The only thing I could see is the data rate affected the range. I am not sending any data, just trying to keep a connection.
This post talks about the antenna having an issue, mine looks fine.
This post seems promising. They are actually calling mbed functions directly.
Specifically this:
const ble::phy_set_t CodedPHY(ble::phy_t::LE_CODED); // Creating a Coded Phy set
But I can't even add the required library file "ble/BLE.h"
#error "BLE requires at least one role 'BROADCASTER' or 'OBSERVER' to be enabled"
And I'm not quite sure where to go from here. It seems these other topics involve sending or receiving data, I'm not trying to do that I just want to keep a connection. Is there a way I can just change the transmitter power?
This is very true. Considering this, if I connect my phone to the HC-19 using the NRFconnect app I cannot even get it to disconnect within my house. If I use the Nano, it disconnects when I walk roughly 3-4 feet away. So I may be able to get better ranges in different environments, but using the same environment with 2 different central devices, the ranges vary drastically.
Is there any significance to sending data to an from devices to maintain a connection? It just seems i am missing something. I also am not trying to say the Nano should have the same performance as my phone, I think that just is ruling out the HC-19 as being a problem.
In case this is helpful, here is the sketch. Maybe I don't have this setup correctly
#include <ArduinoBLE.h>
#define deviceName ""
void setup() {
Serial.begin(115200);
pinMode(LED_BUILTIN, OUTPUT);
pinMode(LED_PWR, OUTPUT);
}
int state = 0; // Setup
BLEDevice peripheral;
void loop() {
switch(state){
case 0 : // Setup
if (!BLE.begin()) {
Serial.println("starting BLE failed!");
while (1);
}
BLE.scanForName(deviceName);
state = 1;
break;
case 1 : // Searching
peripheral = BLE.available();
if (peripheral) { // Upon finding the device
BLE.stopScan(); // Stop scanning
state = 2;
}
break;
case 2 : // Connect
if (peripheral.connect()){ // When device is connected
digitalWrite(LED_BUILTIN,HIGH);
state = 3;
}
break;
case 3 :
if (!peripheral.connected()){ // When device is not connected
digitalWrite(LED_BUILTIN,LOW);
BLE.scanForName(deviceName);
state = 1;
}
break;
}
}
If you get only 3-4 feet your Nano 33 BLE hardware is not working correctly.
I have a Nano 33 BLE with a broken antenna and still get 3-5 feet with my iPhone. With my second Nano 33 BLE I get a much better distance.
It really can just be the luck of the draw with short range devices.
Cannot see anything inherently wrong with the code.
If it really is range you are looking for then a different wireless would maybe better.
Or just for fun you could try some old amateur radio tricks of putting a small tinfoil reflector shaped like a parabolic dish behind the device and aiming at the receiving device.
Just ensure it cannot touch any electrical connections.
I think that antenna design was an unfortunate choice for Arduino. u-blox probably has happy customers using that module inside products but for open evaluation boards it proved to be a bad choice.
When I saw the first post about components missing on some boards, I thought this could not happen to my boards because I handle them with care. Still one day I was surprised about the distance I was getting with my board and found one of these tiny things missing.
The Nano 33 IoT looks like a tank next to the Nano 33 BLE.
Well, I got the Nano IOT and I ran into the same issue. It's unfortunate we are limited to working with our hands tied behind our backs while the hardware is able to do so much more than we are allowed to change. No options to change the physical layer from LE-1M to LE-CODED for long-range communication. I understand they want to make sure there are no compatibility issues since most devices don't support LE-CODED.
Maybe I'm using these devices in a manner they are not intended to be used but I'm simply trying to make a connection to a device well within the capabilities of the hardware. I guess I don't quite get how other people use these devices. Are they purely using these outdoors with no Bluetooth interference around?
Wish i saw this before, looks like it actually allows you to configure features.
Can you be more specific? I have not seen any range issues with the Nano 33 IoT and do not remember posts from other users reporting range issues with the Nano 33 IoT.
Everything is open source, and you can change what you want. You will have to read up on the radio regulations in your country and pay Bluetooth SiG if you want to make this a product.
Arduino did not advertise any of these features and you did not pay for that.
Most features of Arduino standard software support are well below the limit of the devices. Analog values are sampled manually, no DMA support, timing is controlled by software. Compared to that the BLE and WiFi support makes good use of the hardware and provides easy access to complex functionality.
I have a Nano 33 IoT collecting data and sending them over WiFi using MQTT, trough walls, 24/7 for many months.
In case anyone stumbles upon this in the future, I got an Adafruit itsy bitsy nrf5280 and I no longer have range issues. I'm sure the nano is great for what it's designed to do but I couldn't get either the BLE or IOT versions to have any kind of useable connection range. The itsy is a little bit less user-friendly but the library allows you to customize it much more than the Arduino BLE library. I was able to get a minimum of 4 times the connection range. Maybe I was doing something wrong, the code I was using was posted above. The only thing that I changed was the microcontroller and my range was significantly improved for what I was trying to do. Also polling the RSSI when not connected to the device is much much quicker on the Itsy vs. the Nano.
I am also using Arduino Nano 33 BLE and I have the same issue with the range. All the components on the Arduino looks okay but it can connect to my devices from 1-2 meters only. Since I can't change the microcontroller or use other device for this project, can anyone tell me how to improve the range on Arduino Nano 33 BLE?
Thank you @Klaus_K , when I tried to read the signal strength with iPhone and android phone that was also showing a bit weaker signal. Still it was able to connect from a distance of 6-8 meters. With Arduino Nano 33 BLE I could only connect from as far as 2-3 meters.