SPA06-003 Temperature+Pressure Sensor
The spa06 sensor platform allows you to use your Goertek SPA06-003
(datasheet, Adafruit or Seeed) temperature and pressure sensors with ESPHome. An I²C or SPI bus is
required to be set up in your configuration for this sensor to work.
Example Configuration
Section titled “Example Configuration”Over I²C
Section titled “Over I²C”# Example configuration entry for I2C connectionsensor: - platform: spa06_i2c temperature: name: "Indoor Temperature" pressure: name: "Indoor Pressure"Over SPI
Section titled “Over SPI”# Example configuration entry for SPI connectionsensor: - platform: spa06_spi cs_pin: 12 temperature: name: "Indoor Temperature" pressure: name: "Indoor Pressure"Configuration variables
Section titled “Configuration variables”-
temperature (Optional): The information for the temperature sensor.
-
oversampling (Optional): The oversampling rate for the temperature sensor. See Oversampling Options.
-
sample_rate (Optional): The internal sample rate for the temperature sensor See Sample Rate.
-
All other options from Sensor.
-
-
pressure (Optional): The information for the pressure sensor.
-
oversampling (Optional): The oversampling rate for the pressure sensor. See Oversampling Options.
-
sample_rate (Optional): The internal sample rate for the pressure sensor See Sample Rate.
-
All other options from Sensor.
-
-
update_interval (Optional, Time): The interval to check the sensor. Defaults to
60s. -
address (Optional, int, I²C only): Manually specify the I²C address of the sensor. Defaults to
0x77. Another address can be0x76. -
cs_pin (Required, SPI only): Specify the chip select pin to use for this sensor.
-
i2c_bus (Optional, str) (I²C only): Manually specify the I²C bus to use, if your device has multiple I²C buses.
-
spi_bus (Optional, str) (SPI only): Manually specify the SPI bus to use, if your device has multiple SPI buses
Oversampling Options
Section titled “Oversampling Options”By default, the SPA06 sensor oversamples pressure measurements by 16 and does not oversample temperature measurements. Higher oversampling rates can increase precision at the expense of slower update times and potentially higher current consumption. Possible oversampling values include:
NONE(sensor is sampled once, default for temperature)2x4x8x16x(default for pressure)32x64x128x
The datasheet (page 19) provides a table showing the tradeoff for oversampling:
Oversampling Settings
Section titled “Oversampling Settings”| Oversampling setting | Measurement Time (ms) | Pressure Precision (PaRMS) |
|---|---|---|
NONE | 3.6 | 2 |
2x | 5.2 | 1 |
4x | 8.4 | 0.7 |
8x | 14.8 | 0.6 |
16x | 27.6 | 0.5 |
32x | 53.2 | 0.4 |
64x | 104.4 | 0.3 |
128x | 206.8 | 0.2 |
Sample Rate Options
Section titled “Sample Rate Options”The SPA06 can sample measurements as frequently as 200 samples per second and as infrequently
as 1 sample per second. Note that if update_rate is a higher rate than the sensor sample
rate, the sensor will report data from the previous reading.
The full list of sample options are as follows:
1: 1 Hz (default)2: 2 Hz4: 4 Hz8: 8 Hz16: 16 Hz32: 32 Hz64: 64 Hz128: 128 Hz25p16: 25 samples per 16 seconds (~1.56 Hz)25p8: 25 samples per 8 seconds (~3.13 Hz)25p4: 25 samples per 4 seconds (6.25 Hz)25p2: 25 samples per 2 seconds (12.5 Hz)25: 25 Hz50: 50 Hz100: 100 Hz200: 200 Hz
WARNING
The SPA06 sensor has a limit on the number of samples it can take per second, based on the oversampling and sample rate configuration for temperature and pressure sensors (datasheet page 26). Configured rates must meet the following equation:
1 > T_t * R_t + T_p * R_p
Where T_t is the equivalent measurement time for the configured temperature oversampling
rate, R_t is the temperature update rate in hertz, T_p is the equivalent measurement
time for the configured pressure oversampling rate, and R_p is the pressure update rate
in hertz. If pressure is not configured, T_p*R_p is equal to 0.