Impossible to connect to bluetooth on Nano 33 BLE

Hello ;

I recently brought an Arduino nano 33 BLE for a IoT project but i can't pair my phone and my microcontroller.

I don't have anything compiled on it , i just can't find my device in the bluetooth list of my phone.

Also , the only exemple in the IDE for my microcontroller is a PDM (?) program.

Anyone has a good exemple to help me with ?

nemergix:
.. but i can't pair my phone and my microcontroller.

Pairing is an optional security feature for BLE and currently not supported by the ArduinoBLE library. All you need to do is connect to a BLE device from within an app or another Arduino.

nemergix:
I don't have anything compiled on it , i just can't find my device in the bluetooth list of my phone.

Without a sketch you will not be able to connect to the Arduino Nano 33 BLE. The sketch needs to setup the Bluetooth stack with the services and characteristics you want for your application. Do not worry this is not too complicated, but a lot more flexible than the Serial-Bluetooth chips other Arduino projects use.

nemergix:
Also, the only exemple in the IDE for my microcontroller is a PDM (?) program.

When you install the device support and the ArduinoBLE library you will have a few examples. There are two subcategories. Peripheral (server) and Central (client). In BLE the peripheral provides the data (usually a sensor /Arduino) and the central (PC/MAC, smartphone, or another Arduino) read or write the data.
Start with the

File -> Examples -> ArduinoBLE -> Peripheral -> Battery Monitor

You need to compile and download to your Arduino. You also need to start the Serial Monitor once this is done. Most example sketches wait for the Serial Monitor to connect before they initialize everything.

Get yourself an App like BLE Scanner. Its free on iPhone. There are others as well. Open the app scan and connect. The have a look at the source code and compare the information to the app data.

nemergix:
Anyone has a good exemple to help me with ?

Have a look at the examples in the library. There are a few examples in this sub forum. If these examples do not show you what you need, you need to provide some more information about what you would like to achieve.

Check out this thread for the instructions like "How to connect your BLE board to your Phone"

Hey , thanks for the great answers but i have a new problem ;

I have used the "LED" program and modified it for my own use , but for whatever reason my arduino seems to go offline after some time and i always have trouble connecting to it using both my custom app and nrf connect. ( but it works sometimes , meaning that i can read data on my phone)

Is it a feature of the board or a problem in my code ?

#include <ArduinoBLE.h>

BLEService OzoneService("19B10000-E8F2-537E-4F6C-D104768A1214"); 
BLEByteCharacteristic switchCharacteristic("19B10001-E8F2-537E-4F6C-D104768A1214", BLERead | BLEWrite);
BLEIntCharacteristic PPMvalue ("19B10002-E8F2-537E-4F6C-D104768A1214", BLERead | BLEWrite);

const int swtichPin = LED_BUILTIN; // pin to use for the LED
const int pin = A6;

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

  // set switch pin to output mode
  pinMode(switchPin, OUTPUT);

  // begin initialization
  if (!BLE.begin()) {
    Serial.println("starting BLE failed!");

    while (1);
  }

  // set advertised local name and service UUID:
  BLE.setLocalName("Ozone");
  BLE.setAdvertisedService(OzoneService);

  // add the characteristic to the service
  OzoneService.addCharacteristic(switchCharacteristic);
  OzoneService.addCharacteristic(PPMvalue);

  // add service
  BLE.addService(OzoneService);

  // set the initial value for the characeristic:
  switchCharacteristic.writeValue(0);
  PPMvalue.writeValue(0);

  // start advertising
  BLE.advertise();

  Serial.println("BLE Ozone Peripheral");
}

void loop() {
  // listen for BLE peripherals to connect:
  BLEDevice central = BLE.central();

  // if a central is connected to peripheral:
  if (central) {
    Serial.print("Connected to central: ");
    // print the central's MAC address:
    Serial.println(central.address());

    // while the central is still connected to peripheral:
    while (central.connected()) {
      int sensorVal = analogRead(pin);
      PPMvalue.writeValue(sensorVal);
      Serial.println(sensorVal);
      // if the remote device wrote to the characteristic,
      // use the value to control the LED:
      if (switchCharacteristic.written()) {
        if (switchCharacteristic.value()) {   // any value other than 0
          Serial.println("LED on");
          digitalWrite(ledPin, HIGH);         // will turn the LED on
        } else {                              // a 0 value
          Serial.println(F("LED off"));
          digitalWrite(ledPin, LOW);          // will turn the LED off
        }
      }
    }

    // when the central disconnects, print it out:
    Serial.print(F("Disconnected from central: "));
    Serial.println(central.address());
  }
}

Code.ino (2.9 KB)

The board does not like when the connection is lost while you are connected. Closing apps on smartphones does not seem to be an issue but walking away does. The distance is usually not bad but some had issues with missing components on the PCB antenna area. Make sure there are 5 small SMD parts on the green area of the module.

You have to reset the board when that happens.

Again, thanks for the great answers.

I tried finding all the small problem that makes my Arduino card unreliable;

  1. When the power is brutally disconnected, and then reconnected, the program doesn't restart itself. It isn't stuck in a loop, because with debugs serial prints I don't have any debug messages coming on the console.
    The program just dies. The reset button doesn't seem to affect it either, meaning that after reconnecting it and pressing the debug button the program doesn't restart itself. (Doesn't matter if I disconnect the phone off the mircocontroller or not)

I need to upload the program on the board to have it rework. This is a big issue as my application demands that it automatically reboots when you reconnect it to power.

This also means that I can't try my device not connected to my computer (such as on a phone charger)

  1. It sometimes takes time to find the device even on different phones at the same time, (some time at least 30 to 40s)

  2. After disconnecting my phone to the microcontroller it sometimes won't be able to be re-found. It seems that you need to kill every app that you are using to detect BLE in order to show up one just one.

nemergix:

  1. When the power is brutally disconnected, and then reconnected, the program doesn't restart itself. It isn't stuck in a loop, because with debugs serial prints I don't have any debug messages coming on the console.
    The program just dies. The reset button doesn't seem to affect it either, meaning that after reconnecting it and pressing the debug button the program doesn't restart itself. (Doesn't matter if I disconnect the phone off the mircocontroller or not)

When you remove power you loose the connection between the Arduino and the IDE (Serial Monitor). You will need to close the Serial Monitor, select the COM port and open a new Serial Monitor. This is because the new Arduino's handle USB directly.

nemergix:
I need to upload the program on the board to have it rework.

I do not believe this is the case. I am certain you are missing a step (see 1).

nemergix:
This is a big issue as my application demands that it automatically reboots when you reconnect it to power.

This should work. Take your time to understand the behavior of the board. Its just a bit different than older Arduino's. It will all make sense after a while.

nemergix:
It seems that you need to kill every app that you are using to detect BLE in order to show up one just one.

Do you use Android or iOS? I use iOS and do not have too many issues. Maybe I am already conditioned to do the right thing and don't notice anymore. :confused:

Hey, i sotred out most of the reliablity problems , but now i have another question : i am able to power the arduino nano 33 BLE using the pins ? like the Vin ? Thanks

nemergix:
question : i am able to power the arduino nano 33 BLE using the pins ? like the Vin ?

Yes, look in the Arduino store under the Arduino Nano 33 BLE - FAQ. It explains all options.

Make sure you comment the while(!Serial) line in your code when you use external power. Otherwise this will stop your sketch from working because you do not open the Serial Monitor.