An Apple HomeKit accessory for the Adafruit SCD-30 CO2 sensor.
- Adafruit SCD-30 CO2 sensor (Core Electronics)
- Raspberry Pi (3, 4, zero)
Adafruit have a great tutorial: Learn SCD-30
Raspberry Pi pin | SCD-30 sensor pin | Wire colour |
---|---|---|
1 3.3V |
VIN Voltage in |
Red |
3 GPIO 02 I2C SDA |
SDA I2C SDA |
Blue |
5 GPIO 03 I2C SCL |
SCL I2C SCL |
Yellow |
6 Ground |
GND Ground |
Black |
- Install Go >= 1.14 (useful Gist for Raspberry Pi)
- Build:
go build homekit-scd30.go
- Run:
go run homekit-scd30.go
- In iOS Home app, click Add Accessory -> "More options..." and you should see "SCD-30"
To export the co2
, temperature
, and humidity
for Prometheus use the optional flag -prometheusExporter
.
- Run:
go run homekit-scd30.go -prometheusExporter
You'll then see the data on port 8000
: http:https://localhost:8000/metrics
# HELP co2 CO2 measured (ppm)
# TYPE co2 gauge
co2 513.689697265625
# HELP temperature Temperature measured (°C)
# TYPE temperature gauge
temperature 16.708629608154297
# HELP humidity Relative humidity measured (%)
# TYPE humidity gauge
humidity 66.6168212890625
- Read the sensor
- Add HomeKit CO2, temperature, humidity accessory
- Add Prometheus exporter
- Add Pull Request for sending a forced calibration reference, and maybe altitude calibration