|Figure 1. Current usage after optimizations implemented last time. Small spikes are humidity and temperature measurements and the large spike is measurement together with radio communication|
I'm using the sensors in "hold master" mode, in which the sensor IC keeps SCL of the I2C bus low during the measurement. This is the fastest mode to get measurements out of the sensor as no polling or waiting is required. However, when an I2C line is pulled low, current flows through the pull-up resistor. In my case this resistor is 10 kilo-ohms, which produces a current of 300 uA. This current is equivalent to the amount used by the whole sensor IC itself. Furthermore, although the microcontroller (ATMEGA328P) is in idle sleep mode while the sensor IC measures, the idle mode current consumption is still greater than that of the sensor.
My plan is to switch the measurement mode to "no hold master" so that the sensor IC releases the I2C bus and to put the processor into power-save sleep mode in which only the 32.768 kHz low-power crystal oscillator runs. I don't want to mess with the timer prescale settings so that I still have accurate timestamps on the measurements. The prescaler is set to its maximum, which is divide by 1024. This gives a minimum sleep time of 31.25 ms. The measurement time is significantly shorter than this, but this shouldn't increase the power consumption as the sensor IC will go into sleep mode after it completes a measurement. Figure 2 shows the result of this.
Figure 2. Current usage using "no hold master" mode in measurements and putting CPU in power save mode during measurements.
|Figure 3. Current usage using "no hold master" mode in measurements and putting the CPU in low clock frequency idle mode during the measurements.|
|Figure 4. Current usage before this optimization.|
|Figure 5. Current usage after this optimization.|