Environmental sensor

From HeepyWiki
Jump to navigation Jump to search

Design

This is a small, lower power environment sensor based on Bosch's BME280 sensor, STM32L062 MCU, and Nordic NRF24L01+ short-range 2.4GHz radio. Multiple sensor boards transmit periodic readings to a local relay unit which packages received metrics and forwards them via TCP/IP to a data collection system via Wifi. The radio-to-internet relay is based on the ESP32 platform and uses both a NRF24L01+ radio and the ESP32's onboard Wifi.

Telemetry includes:

  • Battery voltage
  • Temperature
  • Relative Humidity
  • Barometric Pressure
  • packet sequence number
  • Number of retransmits needed for previous transmission to be acknowledged

There is a configuration utility that can be flashed before installing the operating code which allows configuration of:

  • battery measurement voltage divider coefficient
  • unique unit identifier string
  • telemetry transmission interval
  • radio target address and channel number
  • radio retry limit and interval
  • radio link mode (nrf24 bandwidth)

Sensor units receive a confirmation packet in response to data packets as part of the nrf24 protocol, and this confirmation packet can be preloaded on the receiver end to contain custom data. The telemetry units check for their unit ID in this response packet and will respond to a small subset of configuration commands in it; for instance this allows changing the reporting interval without needing physical access to the unit.

The goal of the sensor board design was reliability and long-term unattended operation. In standard configuration metrics are sent around every 30 seconds, and when sleeping between readings it draws single-digit microamps. Energy consumption is dominated by the radio's current draw while transmitting, so to some degree it depends on the local RF environment and how often retransmits are necessary, but this can be offset by limiting the maximum retry count or using a different nrf24 bandwidth mode.

Energy Consumption

Measured energy consumption in actual use suggests long battery lifetimes such that there is essentially no need to provide for external charging, eg via solar or other scavenging. Sleep current has a temperature component as well as a varying with battery voltage and can range from 4.5 to 6.5 uA under normal conditions.

Best case - packet received and acknowledged on first try.

Best case - no retransmits
Readings 66 mS at 1.1mA 72.6 uA*sec
Transmit 1 mS at 20mA 20 uA*sec
LED flash 10ms @ 1.5mA 15 uA*sec
Sleep 29923mS @ 6.5 uA 195 uA*sec
Total 302.6 uA*sec

Total 302.6 uA*s/cycle * 2880 cycles/day = 0.242 mAH/day

On a 2600 mAH AA-size primary lithium thionyl chloride cell, this suggests a runtime approaching 30 years, though of course in reality lifespan will be limited by the physical degradation of the battery and other components.

Worst case - maximum retransmits
Read & transmit 259 mS @ avg 2.6mA 673 uA*sec
Sleep 29741 mS at 6.5 uA 190 uA*sec
Total 863 uA*sec

Total: 863 uA*sec/cycle * 2880 cycles/day = 0.690 mAH/day, or about 10 years on a 2600 mAH AA-size primary lithium thionyl chloride cell.

Schematic and Layout

Board.png Schematic.png