This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Message synchronization with no connection

Hello,

We are working on a network of low energy sensors that work without connection. The sensors have a configurable service, so from time to time it makes itself available for new configuration of the service that it is running. Based only on advertisements and observers.

We are using the scan_request and scan_response to either increase the amount of data to be transferred and to ACK the instructions from the network to the sensors.

It works like this:

  1. Every 30 seconds the low energy sensor broadcasts an ADV, with the "scan_response" active. Making itself available for configuration or service request.
  2. If the network node (raspberry or smartphone) wants to reconfigure the sensor application, it sends a scan_request.
  3. If the sensor receives the scan_request, it sends the scan_response and right after it turns on the scanner for a short time (3ms or 5ms), so it can receive the configuration bytes.
  4. The network node sends the configuration message through ADV right after receiving the scan_response from the sensor. In this case the scan_response is seen like an ACK and the flag in time to synchronize the communication.

My questions are:

  1. Is 3ms or 5ms enough time to receive the advertisement from the network node?
  2. How should I configure this short scanner on the sensor regarding the frequency channels?
  3. Does it seems like its going to work?

Thanks a lot!

  • Hi,

    The scan request/response mechanism is not really designed for message synchronization in mind. Also note that all active scanners will generally request the scan response packet. So both sensor and network node need to know each other’s BLE address, to filter out other scanners. And you will need to add the network-node BLE address in the sensor whitelist, so that only the network-node will trigger the sensor to send a scan_response.

    1) No. The SoftDevice will send the application the BLE events asynchronous, and also note that the real advertising interval is adv_interval + advDelay, where advDelay is a pseudo-random value with a range of 0 ms to 10 ms generated by the Link Layer for each advertising event. So you should just enable the scanner with a given scan interval and window, and wait for the network node to send the configuration ADV packet, and the sensor to receive it. If you have not received it within a couple of seconds, you could turn the scanner off and restart the procedure.

    2) The SoftDevice handles this for you. The 3 advertising channels(37,38,39) will be used.

    3) It could work, but it will depend on your implementation on how robust it will be. I think it would be a lot more robust to connect to the sensor devices. The network node could keep a list of all senors, and when it wants to configure them, it could iteratively connect to the sensors and configure them. If you have alot of sensor devices, it could also be worth checking out Bluetooth Mesh for this type of sensor network.

Related