This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

PWM for simple connection

Hello, I am looking for the way I can use PWM to control duty cycle of connection. I am really novice and my understanding about programming and Bluetooth protocol is really at beginners' level.

What I am trying to do at first is to have a Bluetooth tracking device based on RSSI level change. I believe this is the most basic application in nRF51822. To minimize power consumption and maximize device running time, I would like to have Bluetooth advertise few milliseconds per one minute, so the duty cycle of the connection event will be less than 5%. I've looked at reference code given in "ble_sdk_alert_notification" and there I found advertising interval setting, but I got confused with what slow & fast advertising means.

Could someone explain what I should do with this slow, fast advertising interval? Also, what I should do if I want to have less than 5% duty cycle for every 1 minute? I would appreciate any help!

HaChung

Parents
  • Hi

    To adjust how frequently advertising packets are transmitted by the device you adjust the advertising interval. If you set your advertising interval to e.g. 100ms then the device will send out advertising packets 10 times per second. In the BLE examples in the nRF51 SDK, you adjust the advertsing interval by modifying the APP_ADV_INTERVAL constant.

    A good starting point to BLE development on the nRF51822 device is to look at the nAN-36 application note. The associated code example is available for SDK 5.2.0 here. To get up to speed with BLE, there are two good books available on the subject, this one and this one

Reply
  • Hi

    To adjust how frequently advertising packets are transmitted by the device you adjust the advertising interval. If you set your advertising interval to e.g. 100ms then the device will send out advertising packets 10 times per second. In the BLE examples in the nRF51 SDK, you adjust the advertsing interval by modifying the APP_ADV_INTERVAL constant.

    A good starting point to BLE development on the nRF51822 device is to look at the nAN-36 application note. The associated code example is available for SDK 5.2.0 here. To get up to speed with BLE, there are two good books available on the subject, this one and this one

Children
  • Additionally, if you want to look at these books right away, then they are both available on www.safaribooksonline.com, where they offer 30 day trial period.

  • Thank you so much Stefan! It might be a dump question, but let me double check with your answer. So, if I set advertising interval as 1000ms it will send out 1 time in a seconds and 10000ms for 1 time in 10 seconds?

    Also, is there a practical way to make nRF51822 device only wakes up when smartphone is advertising so that it can be in off mode all time except for actual connection to minimize power consumption?

    Thank you again for the answer. I will also look at those books!

    HaChung

  • Yes, you are correct, if you set advertising interval to 1000ms it will advertise once a second. The most general practice is that the nRF51 is the peripheral and performs the advertising. The phone is the central and will perform the scanning. IPhone has the ability to be the peripheral , but otherwise it is uncommon for phones/tablets to support the peripheral role. So, when the nRF51 wants to connect, it will advertise and if a phone is scanning at the same time, it will discover the advertising packet from the nRF51 and be able to connect. The peripheral can adjust the advertising interval, or periodically pause advertising, e.g. advertise for 1 minute, then sleep for 1 minute before advertising again.

Related