Close

Sensor Tile Update-Power measurements and data logging

A project log for STM32L4 Sensor Tile

Small, connected device for smelling and hearing in any environment.

kris-winerKris Winer 07/04/2017 at 20:550 Comments

07/04/2017

I ran my first really successful test of the logging features of the Sensor Tile in the last few days and collected some interesting power efficiency information.

Firstly, I just ran the Sensor Tile with no attempt to manage the power usage. I was collecting data from the CCS811 air quality sensor (one of two big power users on the board) at 10 second intervals, with the BMD-350 nRF52 module (the other big power user on the board) operating with its defaults and sending data via BLE also every 10 seconds. In all of these experiments, I was simultaneously logging data to the 1 Mbyte SPI flash, although it took me a while to get this right. The result of the first experiment was a total run time of 31.5 hours on a 150 mAH LiPo battery; just under 4.8 mA average power usage. Not really great. Furthermore, I made several errors in setting up the SPI flash logging and ended up in these first few experiments with all zeros or a completely erased flash. But I finally figured this out too.

I was able to configure the TX power of the BMD-350 to its lowest power level (-30 dB from the -4 dB default) and maxed out the advertising interval to 2.5 s (from the 1.285 s default). These are the lowest power setting of the BMD-350 module when advertising BLE data to a central (my iPhone).

There is a way to enable hot swapping of the AT mode where these parameters can be set without resetting the BMD-350 module. This is useful for keeping the power minimized except when data has been packaged for transmission, when the TX power would be set to maximum (or at least a higher value than -30 dB), the data sent, the serial buffer cleared (TX complete) and then the power could again be minimized until the next data package was ready for transmission. This is the righter way to do things, but the firmware currently on my BMD-350 (Protocol 2) doesn't support this feature. Fortunately, it is straightforward to upgrade the firmware via OTA, I just haven't gotten around to doing so yet. So in these experiments, I simply kept the TX power (which affects the reception range) and advertising interval (how long one has to wait when pairing with the iPhone) at their low power limits. Even so I had no trouble reading the BLE data whenever I wanted within 10 feet of the Sensor Tile, which is good enough for these experiments.

The next thing I tried was some basic power management. I decreased the duty cycle of the CCS811 air quality sensor to once every 60 seconds, put the BMA280 in low-power mode (not really a big player in power consumption anyway) with a 50 ms sleep interval (effectively a sample rate of 20 Hz) and with the BMD-350 in its lowest power mode I asked for BLE data at 1 Hz and again attempted to capture all of the data on the SPI flash. In the end, I got all zeroes again on the flash but managed to get streaming BLE at least for 90 hours on a 150 mAH LiPo battery for an average power usage of just under 1.8 mA. This is a significant improvement in power usage!

The CCS811 is really quite a power hog, supposedly requiring 7 mW (~2.1 mA @ 3.3 V) at the 10 second per sample setting and 1.2 mW (360 uA @ 3.3 V) of power at the 60 second per sample setting per the data sheet. I wanted to figure out how much the CCS811 is really costing me. So I put the CCS811 in idle mode (where it presumably takes ~10 uA) and essentially just repeated the last experiment. To my pleasant surprise the Sensor Tile lasted at least 120 hours (having died sometime between midnight and 9 AM) for an average power usage without the CCS811 of < 1.25 mA. So running the CCS811 once per 60 seconds is actually costing >550 uA, a bit more that the data sheet (which in fairness is spec'd at 1.8 V and I am at 3.3V).
Even better, I got almost exactly 96 hours of sensor data recorded every ten seconds on the SPI flash for later analysis. I discovered yet one more error in that I had set the maximum number of pages to 0x0EFF instead of the 0X0FFF it should have been for the 4096, 256-byte pages of the 8 Mbit SPI NOR flash on the board. So I lost the last 256 pages of logging data or about 5 hours worth. Also, for some reason, the RTC month was not initialized properly so the date I recorded is January/February and not June/July! Oh well...

What this result means is that the 150 mAH battery is well matched to the SPI flash capacity and power usage of the Sensor Tile. For logging purposes there is no sense in having the device last longer than the available logging capacity. Of course I can always adjust the data logging interval to some other value than 0.1 Hz and I can use a bigger battery, etc. But the 150 mAH battery is convenient, being almost exactly the same areal size as the Sensor tile, so the pair make a nice compact package.

So I am finally in range of the ultimate goal, having a practical, compact environmental data logger that can last for four or five days and that I can periodically query with my smartphone.

Here is some of the data I was able to collect:

I haven't spent a lot of time analyzing this particular data since the environment of sitting on my window sill next to my work station isn't very interesting. But it is easy to see the diurnal variations of temperature and humidity (what is that blip at ~10 AM every day?!), pressure variations are muted on this scale but the pressure-derived altitude estimation (my house is at 1050 feet elevation) shows a lot of interesting structure. Interesting also is the battery voltage monitored via a resistor divider on an STM32L432 ADC pin which shows the battery voltage steadily decreasing but in a non-linear fashion from 4.2 to ~3.7. Anyway, I expect the data from a well-chosen spot outside the house will prove to be more interesting.

I need to upgrade the BMD-350 firmware to enable a wider range of the BLE, especially if I am going to start truly remote sensing experiments. Plus I redesigned the Sensor Tile again to add a VEML6040 RGBW ambient light sensor and a MAX17048 LiPo battery fuel gauge. Ambient light sensing provides a lot of interesting data, especially outside, and doesn't cost too much more power. And I want just a little more information about the battery behavior than I am getting from the voltage-divider measurement of battery voltage.

These improvements will take some time to get working, in the mean time I think I will repeat this experiment with the Sensor Tile placed in the garden or on the back deck....

Discussions