# Bar30 sampling rate and OSR?

Hi,
I am trying to estimate the current draw of the Bar30 when it is acquiring data.

The current draw is given in the datasheet as a function of OSR and for 1 sample/sec.

Does this mean that the sensor can only gather 1 sample/sec? If not, do I need to multiply the given current by the amount of samples per second, in order to calculate the current draw for a higher sampling rate?

Also, my understanding of the OSR is that it is higher than the sampling rate. If an OSR of, for example, 256 is used, should the supply current given on the datasheet for the condition of 1 sample/sec be multiplied by 256 or does it only count as 1 sample?

Finally, how can I determine the maximum sampling rate of the Bar30?

Thanks,
Laura.

Hi @laura, welcome to the forum

I expect that’s primarily so that the numbers are comparable. Oversampling adds extra resolution to a single output measurement, but at the cost of both time and energy. Fixing the number of output measurements and the time period makes it easier to compare just the energy difference (seemingly with an averaged current in this case).

Note that the peak supply current (same table) is 1.25mA, which occurs while actually sampling, and the standby current (the rest of the time) is typically 0.01uA. With an oversampling rate (OSR) of 8192, the “supply current” over 1 second is given as ~20.09uA. Taking the typical 8192 OSR conversion time from the next table, and noting that for 1 sample per second t_{idle} = 1\text{s} - t_c,

\begin{align} I_{DD} &= (I_{peak} \cdot t_c + I_{idle} \cdot t_{idle}) / (t_c + t_{idle})\\ &\approx (1250\mu\text{A}\cdot 16.44\text{ms} + 0.01\mu \text{A} \cdot (1000 - 16.44)\text{ms}) / 1000\text{ms} \\ &\approx 20.56\mu \text{A} \\ &\approx 20.09\mu \text{A}\quad \checkmark \end{align}

No, the sensor can take measurements whenever it’s not communicating. Lower resolution measurements take less time, but sending more measurements requires more communication.

If you’re interested in more precise timing information you can either try getting samples as fast as you can and measuring the output rate, or use the i2c clock speed (commonly 100kHz) to calculate how much time will be spent communicating throughout each conversion sequence (page 9), and assume the rest of the time is spent taking samples. That doesn’t account for calculation time in the main computer, but it may be possible to do that while the next measurement is being taken by the sensor (especially for the larger OSRs).