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

auto connect with ble proximity nrf51422

Hai guys,

I am using nrf51dk, S130, and Keil to develop a simple project. My aim is to send the sensor data from the nrf51422 to the mobile app.

when no mobile is available and no data change happens on sensor the nrf device should sleep. When ever a data change ocucrs the nrf51 device should wake up from the sleep mode and send the data to the already paired device, if it is available. As per my understanding the wake up can be done using the gpio interrupt from the sensor while a data change happens. Once if the nrf device is wake up from the sleep/power cycling it should search for the already paired device and start sending data over ble to the paired device.Is it possible? If it is possible please let me know how can I achieve this?

Thanks and regards,

  • The normal configuration when connecting a mobile phone to the nRF51 is that the mobile is the central and the nRF51 is a peripheral. There are a couple of reasons for this, the most important are that most mobile phones don’t support being a peripheral and that a central will generally use more power than a peripheral (and mobile have larger battery than the nRF51 device).

    The peripheral cannot search for other devices, it can advertise and hope that the central discovers it. So when you say that the device should wake up and then send data to the paired device (mobile), it will have to advertise for some time and send the data if the mobile connects, or just send the data in the advertisement packet may be easier. If it gets no response it will have to assume that the other device is not available.

    When you say sleep I assume you mean SYSTEM OFF sleep mode, where the device consumes the least amount of power and can only be woken up on gpio (logic or analog). In this mode the device cannot be in a BLE connection.

    Depending on how long you are sleeping and how you decide to send the data (connect first or just send it in advertisement packet), it may be better to be in a connection and choose connection parameters (connection interval and slave latency) to the maximum. See here for description on connection parameters.

  • Hello Ole Bauck,

    Thank you for the nice reply. Sorry for being little late to reply.

    Is it possible to send data over the advertising packet? What is the advantage in sending data over the advertisement packet over beacon? Thanks and regards,

  • It is possible to send data over adverisement packet in the manufacturer specific data. The advantage of advertising is that you don't have to be in a connection. When you are in a connection you have to communicate regularly to keep the link up. You can set the connection parameter to communicate as infrequently as possibly, depending on what is in the other end/the central (Android and IOS have limitations for allowed connection parameters). Whether or not advertising is advantageous depends on how often you should send data, how many advertising packets on average the device have to send before the central picks it up (the central does not scan all the time necessarily), the connection parameters you are using if in a connection and other things. The best way is to test it and see what is best.

Related