Receiving Multiple Bluetooth 'Advertising Only' Sensors

I am using the nRF Connect design environment (in VSC) and I would like to have a central Bluetooth module that receives multiple transmit only (pure advertising) sensors that each transmit their own temperature (each would have its own unique ID embedded in the advertising) .  I would like to have this central module also be able to connect to a mobile phone to download all of the detections it receives from all of the sensor advertisements it receives.

I found a sample/example of what I would like to for the previoius development tools titled: "Experimental: BLE Relay Example". However I don't see anything similar for the nRF Connect development tools.  Does some sample code exist for such a system?  At first I thought that the Bluetooth Mesh samples might be useful but they consist of sensors that have two way communication sensors which I do not have.

Any recommendations would be greatly appreciated!

Thanks!

Parents
  • Hi,

    A device can act both as a central and peripheral, and scan and advertise at the same time. So any combination is possible (with the limitation that there is only one radio so if you for instance use a high scan duty cycle, there will be less time for other activities).

    For what you describe, it seems to me that it makes sense to make a device that acts as a periphearl, doing connectable advertising that the phone can connect to. And for retreiving data from the sensors, it will do scanning. So it might make sense to start with a peripheral example (like Bluetooth: Peripheral UART that you mention), and add the scanning part to that.

    For the scanning part, you can refer to any central example, but you need to choose wether you want to use the nordic scanning module or not (this helps with filtering). The central samples under nrf typically us this module, and the Zephyr central samples do not.

    To see an example that acts both as a peripheral (and thus also does both advertising and scanning), you can look at Bluetooth: Central and Peripheral HRS. This establishes connections both in peripheral and central roles, which is not relevant for you as you don't want to connect with the censors, so if you start of with this sample that is something to keep in mind. But in any case you can take a look at prj.conf to see a sensible starting configuration for a multi role device.

Reply
  • Hi,

    A device can act both as a central and peripheral, and scan and advertise at the same time. So any combination is possible (with the limitation that there is only one radio so if you for instance use a high scan duty cycle, there will be less time for other activities).

    For what you describe, it seems to me that it makes sense to make a device that acts as a periphearl, doing connectable advertising that the phone can connect to. And for retreiving data from the sensors, it will do scanning. So it might make sense to start with a peripheral example (like Bluetooth: Peripheral UART that you mention), and add the scanning part to that.

    For the scanning part, you can refer to any central example, but you need to choose wether you want to use the nordic scanning module or not (this helps with filtering). The central samples under nrf typically us this module, and the Zephyr central samples do not.

    To see an example that acts both as a peripheral (and thus also does both advertising and scanning), you can look at Bluetooth: Central and Peripheral HRS. This establishes connections both in peripheral and central roles, which is not relevant for you as you don't want to connect with the censors, so if you start of with this sample that is something to keep in mind. But in any case you can take a look at prj.conf to see a sensible starting configuration for a multi role device.

Children
  • HI Einar,

    Thanks for your comments.  I had been looking at it from the 'central_uart' code and had it connecting properly to my other board and then it began scanning (and recognizing) my sensors.  After thinking about it more, though, I liked your idea of starting with the 'peripheral uart' because then I can use my iPhone to make the connection like it is supposed to be for data transfer (next step).

    The trouble is, when I copy the scanning code from the 'central_uart' to the 'peripheral_uart' I get a whole bunch of errors/warnings that I don't understand (and, I admit, I am very new to this stuff).  I must be misunderstanding something rather basic but I can't figure out why they worked in 'central_uart' but not 'peripheral_uart'.  Could it be that it can't be looking to make a connection because it already has one?  I don't get it.

    I've copied the problems the compiler is seeing and a bit of the source code that seemed like it should have just worked like it did in 'central_uart'.

    Sheldon

  • Please ignore this most recent post of mine (complaining about not being able to get the code to compile). I was able to track down the problems myself.  Could this most recent post of mine be removed?  It serves no useful purpose.  And is a distracting from the main thread.

  • Hi,

    Good to hear you resolved the issue.

    It should be possible for you to delete your own posts. Alternatively, you can edit it and remove what you have written there.

Related