RAK3172 + RUI3 + ADC Speed?

RAK3172 and RUI3 are used to configure the program with Arduino.

ADC 3CH is being used and the average of about 100,000 data is being used, but it takes a very long time. (About 5 minutes or more)
The analogRead() function is being read 100,000 times using a for loop.

When I used other products, it didn’t take this long. Is there any solution?

Thanks for reading.

Welcome to RAK forum @JMSHIN ,

At 100,000 adc read in 5 minutes, that’s 333 per seconds (333 Hz). The RUI3 is optimized for LoRaWAN application so sampling beyond that speed might not be an ideal use case for RAK3172. Btw, what signal are you sampling and what is the frequency of interest?

I am trying to measure the switchboard current using a ct sensor. The higher the number of sampling, the more accurate the situation, so a lot of sampling is required.

100,000 sampling data must be averaged to become similar to the reference value. But the problem is that it takes a long time.

Thanks for the reply.

I understand now the situation. If you are measuring AC line frequency, that can be either 50hz or 60hz. If it is rectified, you will double so it will be 100hz or 120hz respectively. To solve for aliasing, you should have at least x10 of the frequency of interest (in theory should be only x2 based on nyquist theorem but in real word, it doesn’t work), so you must have at least 1 to 1.2 Khz sampling freq. Might not be the best case for RAK3172’s ADC. This assumes you are measuring AC line.

Alternatives you can have:

  1. Just do a peak detect on those 333 ADC readings per second then do interpolation of current reading based on reference?
  2. Use an external ADC chip that can communicate to RAK3172 via I2C. This should be faster and more accurate but will require external chip.