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

Using ADC/SAADC to read data in BLE app

I am currently development an app based on the example from the experimental folder using a NRF DK52 as a relay between a central and multiple peripherals.

The app should now react on the press of a button from an external device. The device is built like that - for whatever reason the unpressed button is at voltage 2.7V whereas when pressed falls down to 1.2V. The way the device works is out of my control. Because of the high lower value I was told I cannot use a digital input as the maximum 0 value would be recognized at 0.8V.

Therefore I now think about using ADC/SAADC to read the voltage continously and act when the read values are in the range that indicate the button was pressed. 

I was looking at the peripheral/saadc example and it worked quite well so far. But then I read that it is not recommended to perform SAADC measurements while BLE RF is happening at the same time. Also SAADC measurements seem to be delayed or in general slower when BLE is active?

What is your recommendation to perform that task? Should I use plain ADC or SAADC? I believe in order to recognize the button press accurately my sampling interval should not be much slower than every 100ms? Whats the best practice here? 

Parents
  • Hi Karl,

    got the LIMIT stuff working last night in a quick rush. Seems this might be what I actually need. I modified the nRF provided SAADC example. Still not sure how to do the final version but I think I have everything on my hand. Still need to evaluate if there are any issues with my BLE app as like priority stuff etc. Also used VDD/4 as the reference instead of internal 0.6V and used the GAIN of 4 as described in the SDKs documentation. Connecting the input pin to VDD now gives me 1023 as expected and I can play with my limit values in order to find the proper thresholds, before connecting it to my actual circuit where I want to measure stuff.

    I overlooked that big chapter on the SAADC as I just saw the library and HAL stuff but didn't see the actual technical description how it is all working at all. 

    The first example I did was with a circuit of 2x1.5 AA batteries where I measures and sampled the values. I think it was there where I got 831 as the maximum reading. Seems this is then consistent.

    Thanks again!

  • Hello,

    Sorry for my very late reply - I was out of office due to the recent national holiday season here in Norway.

    daubsi said:
    got the LIMIT stuff working last night in a quick rush. Seems this might be what I actually need.

    Great, I am happy to hear that!

    daubsi said:
    I modified the nRF provided SAADC example. Still not sure how to do the final version but I think I have everything on my hand.

    As suggested by snoopy you might want to take a look at using the COMP peripheral for your limits, if it is applicable to your application needs, as this should reduce your power consumption and reaction time somewhat.
    As mentioned, there is no COMP example, but now that you are familiar with the SAADC peripheral it should be a lot easier to familiarize with the COMP API Reference.

    daubsi said:
    Also used VDD/4 as the reference instead of internal 0.6V and used the GAIN of 4 as described in the SDKs documentation.

    This is fine since you are not measuring the battery. It is recommended to use the internal 0.6V reference when measuring the battery, since the level of the battery will skew the reference of the SAADC if you use the VDD/4 reference.

    daubsi said:
    I overlooked that big chapter on the SAADC as I just saw the library and HAL stuff but didn't see the actual technical description how it is all working at all. 
    daubsi said:
    Thanks again!

    No worries at all - It is a lot to take in when you first start working with the nRF series and the SDK.
    Please do not hesitate to ask if you should encounter any other issues or questions!

    Good luck with your development!

    Best regards,
    Karl

Reply
  • Hello,

    Sorry for my very late reply - I was out of office due to the recent national holiday season here in Norway.

    daubsi said:
    got the LIMIT stuff working last night in a quick rush. Seems this might be what I actually need.

    Great, I am happy to hear that!

    daubsi said:
    I modified the nRF provided SAADC example. Still not sure how to do the final version but I think I have everything on my hand.

    As suggested by snoopy you might want to take a look at using the COMP peripheral for your limits, if it is applicable to your application needs, as this should reduce your power consumption and reaction time somewhat.
    As mentioned, there is no COMP example, but now that you are familiar with the SAADC peripheral it should be a lot easier to familiarize with the COMP API Reference.

    daubsi said:
    Also used VDD/4 as the reference instead of internal 0.6V and used the GAIN of 4 as described in the SDKs documentation.

    This is fine since you are not measuring the battery. It is recommended to use the internal 0.6V reference when measuring the battery, since the level of the battery will skew the reference of the SAADC if you use the VDD/4 reference.

    daubsi said:
    I overlooked that big chapter on the SAADC as I just saw the library and HAL stuff but didn't see the actual technical description how it is all working at all. 
    daubsi said:
    Thanks again!

    No worries at all - It is a lot to take in when you first start working with the nRF series and the SDK.
    Please do not hesitate to ask if you should encounter any other issues or questions!

    Good luck with your development!

    Best regards,
    Karl

Children
Related