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
  • Cool. So how exactly do you envision that "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"? nRF5x chips have only two power saving states/modes: first is SLEEP (POWER ON) which is basically used every time MCU doesn't need to do any processing. However during this state all HW peripherals can be active so e.g. RTC can run and wake MCU for all scheduled operations such as radio events. So in this state you can have BLE active - in pretty much any state including connected link. The second power saving mode is POWER OFF. In this only external event such as GPIO high/low change or NFC field sense can wake up MCU and it will treat it basically as reset (so you need to initiate all the things including BLE stack). Obviously this is not usable for your story.

Reply
  • Cool. So how exactly do you envision that "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"? nRF5x chips have only two power saving states/modes: first is SLEEP (POWER ON) which is basically used every time MCU doesn't need to do any processing. However during this state all HW peripherals can be active so e.g. RTC can run and wake MCU for all scheduled operations such as radio events. So in this state you can have BLE active - in pretty much any state including connected link. The second power saving mode is POWER OFF. In this only external event such as GPIO high/low change or NFC field sense can wake up MCU and it will treat it basically as reset (so you need to initiate all the things including BLE stack). Obviously this is not usable for your story.

Children
No Data
Related