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

Selective sampling of ADC channels at run time

I am using a 52810 custom board and the SAADC module.

It is used for sampling one analog input through AIN2 and the battery voltage directly by setting the pin to VDD

As per the documentation, since more than one channel is configured/enabled, it goes into scan mode.

i need to measure the analog input at AIN2 for 15 seconds.

However, i do not need to measure the battery voltage in every scan. I only want to measure it once every 5 seconds to check for voltage drop.

Is this possible ?

Regards

Chary BS

Parents Reply Children
  • Hi Chary,

    No, the SAADC driver is completely independent from the SoftDevice. The V2 API is included in SDK 17.x.x.

    Einar

  • Ok, i will do as you said and try to use the V2 API. But before that i have two small queries -

    1. As you know the 52810 has only two RTCs. I am using the soft device so RTC0 is dedicated for that. And RTC1 is used for app_timer.  I saw an saadc low power example on the Devzone that uses RTC instead of timer for lower power consumption, however, it is written for the 52832 and uses RTC2, which  does not exist on the 52810. Is there a way by which i can implement that on the 52810 ? Because mine is a battery operated device and i find that the battery drains very fast...it must be due to this ?

    2. I need to implement a calendar clock functionality on the 52810 without using any external RTC chip. The accuracy need not be very high, up to seconds level. Even if it is accurate up to a minute it is sufficient... with periodic correction from a smart phone. Is it possible to  do this ?

    Regards

    Sreenivasa Chary

  • Hi Chary,

    1. I cannot say if the SAADC related code is responsible for your high current consumption without knowing more about your application. In general, if you do not need to sample with a very high frequency and very high accuracy (the former would prevent a low power solution anyway), then you can trigger SAADC sampling from SW regularly from an app timer. This makes the SAADC driver low power mode concept irrelevant.

    2. Yes you can do this by basing your calendar clock on the app timer. You may have some jitter, but the average accuracy would be equal to the accuracy of your 32.768 kHz clock source (so if you use a 20 ppm crystal, that is the accuracy you get).

    Einar

  • Hello Einar,

    I have implemented the saadc_init(0 and saadc_uninit() sequence to switch between AIN2 and VDD as and when required.

    It is working fine, thank you !

    Only one observation is that the VDD measurement seems to be off by about 0.3V. And also, it is taking three measurements to get a stable value - I am taking 10 samples in each measurement and averaging them. The averaged reading  starts with a little lower value and keeps rising towards the actual value, after three successive readings it gives a consistent value of Vdd - 0.3V. Any ideas as to how to improve the accuracy ? For a CR2032 battery @3.0V, a deviation of 0.3V makes a big difference when estimating the battery level.....

    My settings are :12bit, internal reference with 1/6 gain and channel input set to VDD.

    For the help regarding calendar implementation using app_timer i have raised a separate ticket.. as it is a different topic and i felt i should not mix the two issues.

    Regards

    Chary BS

  • Hi Chary,

    SChary said:
    Only one observation is that the VDD measurement seems to be off by about 0.3V.

    Using the internal reference you should definitely not see an offset of 0.3 V. Perhaps the issue is related to the nRF drawing more current while sampling, and that it affects the measurement results? Can you check with an oscilloscope probing on the VDD pins on the chip to see if that is the case? How stable is the plot you get on the oscilloscope in this case?

    SChary said:
    For the help regarding calendar implementation using app_timer i have raised a separate ticket.. as it is a different topic and i felt i should not mix the two issues.

    That makes a lot of sense, so thank you for that.

    Einar

Related