nano ble33

Using Arduino BLE lib I would like to receive data from another Bluetooth device which has a mac id.

How to pair and connect to the this device ?

so whenever power is given to Nano 33 ble it will automatically gets connected to the hard-coded mac id device

this is similar to that, one do to connect HC05 to any blue tooth device using configuration mode of hc05

To help you better it would be useful to get some additional information.

pramod:
Using Arduino BLE lib I would like to receive data from another Bluetooth device which has a mac id.

Why do you want to do that?
What is the Bluetooth device? (Any just in case you cannot connect to Bluetooth Classic devices.)

Connecting to a MAC address is usually not a good idea. The goal should be to connect the application with the data and not worry about the low level.

pramod:
How to pair and connect to the this device ?

Pairing is an optional feature in the BLE standard and currently not supported by the ArduinoBLE library. In BLE you usually just connect.

pramod:
so whenever power is given to Nano 33 ble it will automatically gets connected to the hard-coded mac id device

You can just scan for a unique service. No need for the MAC address.

Many thanks for the reply,

Blue tooth device is neurosky headset mindwave mobile 2

if I scan the above device , I do get a UUID and mac address.

this device do not have user interface.

It is used in such a way that when I power up , nano 33 ble and the head set should get connected without any user interface.every thing should be hard-coded.

I am doing this with arduino nano and HC05. But HC-05 comes with lot of variants . so supply is a problem

SO if I use the scan example in BLE lib it will give me the UUID, then how to connect to that device .
I also want to show LED indication when connected.

It will probably help you if you brush up online and try to understand the Bluetooth specs a bit better as there is a fundamental difference between HC05 and Nano 33 BLE. They are not interchangeable.

HC05 uses Bluetooth 2.0 EDR and Nano 33 BLE uses Bluetooth 5.

I had a quick look at the MindWave users guide. The MindWave supports Bluetooth Classic and BLE.

With the Arduino Nano 33 BLE you can only use BLE. It does not support Bluetooth Classic.

The MindWave manual describes pairing which could indicate you must pair first to be able to use the device. To find out whether this is the case I recommend you use an app like BLE Scanner on an iPhone and scan for the MindWave. Make sure you do not pair the two together before. The app will show you whether the device is connectable and you can explore the GATT. For each GATT characteristic you should see whether it has Read/Write access.

If that works, have a look at the PeripheralExplorer example from the ArduinioBLE library.

If you cannot connect to the MindWave without pairing you will need to look at alternative solutions.

Ok fine many thanks every one.

This what I get on monitor by using PeripheralExplorer.

/*************************************************************
BLE Central - Peripheral Explorer
Found c4:64:e3:e7:9f:52 'MindWave Mobile'
Connecting ...
Connected
Discovering attributes ...
Attributes discovered

Device name: MindWave Mobile
Appearance: 0x0

Service 1801
Service 1800
Characteristic 2a00, properties 0x2, value 0x4D696E6457617665204D6F62696C65
Characteristic 2a01, properties 0x2, value 0x8000
Service 180a
Characteristic 2a29, properties 0x2, value 0x4E6575726F536B792C20496E632E
Characteristic 2a24, properties 0x2, value 0x76312E35
Characteristic 2a25, properties 0x2, value 0x433436344533453739463532
Characteristic 2a27, properties 0x2, value 0x312E302E30
Characteristic 2a26, properties 0x2, value 0x312E302E3233
Characteristic 2a28, properties 0x2, value 0x4E2F41
Characteristic 2a23, properties 0x2, value 0x0000000000000000
Characteristic 2a2a, properties 0x2
Characteristic 2a50, properties 0x2, value 0x015E00ADDEEFBE
Service 039afff0-2c94-11e3-9e06-0002a5d5c51b
Characteristic 039afff8-2c94-11e3-9e06-0002a5d5c51b, properties 0x12, value 0x34240000FC2300007E
Characteristic 039affa0-2c94-11e3-9e06-0002a5d5c51b, properties 0x8
Characteristic 039afff4-2c94-11e3-9e06-0002a5d5c51b, properties 0x10
Characteristic 039affd3-2c94-11e3-9e06-0002a5d5c51b, properties 0xA, value 0x000000000000000002

Disconnecting ...
Disconnected
**************************************************************/

As you see it gets connected with name.

My configuration of the product demands the connection to be paired to perticular nano 33 BLE.
This is because I have many sets of Mindwave Mobile sets and particular headset should get connected to a fix nano 33 BLE

How should I go about it

Well pairing is a defined process in the BLE standard, and it is optional and not supported in the ArduinoBLE library. I doubt this will come anytime soon.

What you can do is your own version of it based on connecting.

As you can see from your printout you can read the MAC address of the MindWave. Use the example you have used for the printout and write your software in a way that you are looking for all the Mindwave you can find around you but only connect to a device with the right MAC address.

You will need to do some experimentation to confirm that the MAC address of the MindWave does not change. As you can imagine having a fixed MAC address would allow people to track a device. That is why most mobile phone now randomly change the BLE MAC address. If your MindWave does something like that it will get difficult. But you do not need to worry about that yet. See what MAC address you can read after power cycling the units a few times.

How you are "pairing" the devices depends a bit on your Arduino hardware. You can ether hard code the MAC address in the sketch or have a procedure to "pair" a MindWave with your Arduino.

Hi,
Many thanks,

So before connecting I should put the condition for checking particular MAC and then connect.

up-till now I have not experienced change in MAC of mind-wave.

I will also check whether mind-wave requires handshake before sending the data.(which I think it should not require)

If it starts sending data after power-on with mac then I may not need pairing.

Ok then let me try .

will keep posting the results.