Deploy an Enviro+ environment sensor (with PMS5003 particle sensor) using Balena and export the data for Prometheus.
To try this on your Raspberry Pi using Docker:
Install Docker.
curl -sSL https://get.docker.com | sh
sudo usermod -aG docker pi
- Reboot your Pi
Clone this repo, and initialise the submodule.
git clone https://github.com/sighmon/balena-enviro-plus
cd balena-enviro-plus
git submodule update --init
Build and run the Docker image in the background.
docker build -t sighmon/enviroplus_exporter:v1 .
docker run -d --privileged -p 8000:8000 sighmon/enviroplus_exporter:v1
- Open your favourite browser and visit: raspberrypi.local:8000
- See the running container with
docker ps
- Check the logs with
docker logs <containaer_name>
If you'd like to also post your data to InfluxDB, enable this by adding your InfluxDB-Cloud environment variables to the Dockerfile
:
ENV INFLUXDB_URL="https://your_server_location.gcp.cloud2.influxdata.com"
ENV INFLUXDB_TOKEN="your_token"
ENV INFLUXDB_ORG_ID="your_organisation_id"
ENV INFLUXDB_BUCKET="your_bucket_name"
ENV INFLUXDB_SENSOR_LOCATION="Adelaide"
ENV INFLUXDB_TIME_BETWEEN_POSTS="5"
# To see all debug messages
ENV DEBUG="true"
If you'd like to also post your data to Luftdaten, set the time between posts in the Dockerfile
:
ENV LUFTDATEN_TIME_BETWEEN_POSTS="30"
# To see all debug messages
ENV DEBUG="true"
If you're using Enviro+ on a RPi3, 4 or Zero W you'll need to set "pi3-miniuart-bt"
in your Balena Dashboard / Device/Fleet Settings / "Define DT overlays" section for it to read from the serial interface for the PMS5003 particulate monitor.
You'll also need to disable the Serial port on the Balena Host by masking the serial getty service.
# SSH to Balena Host
mount -o remount,rw /
systemctl mask [email protected]
reboot
Once you're happy that it works on your Pi, use the Balena CLI to push it to a Balena app.
balena push <your_app_name>
If you'd prefer to build your own base image, follow these instructions:
cd base_image
docker build -t <your_name>/balena-enviro-plus:v1 .
- Create a repository on Docker Hub
docker push <your_name>/balena-enviro-plus:v1
Thanks to Zane Williamson for his work.