Skip to content

Latest commit

 

History

History
55 lines (35 loc) · 1.11 KB

README.md

File metadata and controls

55 lines (35 loc) · 1.11 KB

CO2 monitor

Record CO2 ppm value from MH-Z19b via UART.

  • retrieve ppm value and publish it to MQTT topic
  • subscribe MQTT topic and append min/max/median/avg to google spreadsheet

Setup

Google Spreadsheet API credentials

Follow the instruction to enable Spreadsheet API.

Create service account and download its credentials in JSON.

Spreadsheet

  • Create spreadsheet and
  • share it with the service account.
  • Create sheet1

build

To build it for Raspberry Pi

GOOS=linux GOARCH=arm GOARM=7 go build

MQTT server

Run mosquitto

sudo apt install mosquitto
sudo systemctl start mosquitto

Run

CO2 monitor

./co2-monitor sniff

spreadsheet recorder

./co2-monitor recordSpreadsheet -record-interval 300 -spreadsheet-id your-spreadsheet-id

where your-spreadsheet-id is in the URL of Google spreadsheet. https://docs.google.com/spreadsheets/d/{your-spread-sheet-id}/....