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

How to poll data from sensor using an android app nrf52 nordic

I am developing on the nRF52 boards with a capacitive sensor. I followed the tutorial in this link and created a custom service with 3 read characteristics. I am able to use the nordic connect app to read the values in those 3 characteristics continuously. I am also able to modify the nrf uart app to read those values and print it out on the phone continuously when I connect to the nrf52.

However, what I want to do now is polling data from the nrf52 when I press a button on the android app. For example, my nrf52 will be in sleep mode, then when I connect it to the phone and pressed a button, then the nrf52 will wake up and send some data over to the phone for a few seconds then nrf52 goes back to sleep again.

I'm having trouble on how to set up my application so that it will only send data when I press a button. Any suggestion on how to implement this would be appreciated it.

Thank you

Parents
  • Could you be more precise in your middle paragraph? By "uC" you mean nRF52? If it sleeps how does it wake up? Then how exactly BLE connection happens? Once you have BLE connection then nRF52 cannot be OFF so you can "pull" by GATT methods whatever you need.

    I believe the problem you have is that you changed architecture to push/pull (GATT Write/Read) while basically all BLE GATT applications use push/async push by GATT Write/Notify methods. So if you now realize all advantages of that approach simply return from "Read" to "Notify" as it was in original Nordic BLE UART Service examples.

Reply
  • Could you be more precise in your middle paragraph? By "uC" you mean nRF52? If it sleeps how does it wake up? Then how exactly BLE connection happens? Once you have BLE connection then nRF52 cannot be OFF so you can "pull" by GATT methods whatever you need.

    I believe the problem you have is that you changed architecture to push/pull (GATT Write/Read) while basically all BLE GATT applications use push/async push by GATT Write/Notify methods. So if you now realize all advantages of that approach simply return from "Read" to "Notify" as it was in original Nordic BLE UART Service examples.

Children
No Data
Related