officeAir - A temperature and Humidity Meter and Google Sheet Logger with Raspberry Pi and I2C sensors
This project lets you log temperature and humidity data via Raspberry Pi and a sensor easily and automated way into you google sheet, collecting the raw data and automatically drawing a nice chart as data coming in. (The name and use case comes from life: initially we set this up to monitor DecentLabs office climate in a hot summer period, when air conditioning had some weakness.)
Code by: Róbert Szalóki, Hardware configuration and manual by: Zoltan Dóczi (RFsparkling), Licensed by DecentLabs
First lets see the Google sheet and its script side to prepare that before Raspberry pi configurations.
Here are two charts for temperature and humidity for several days:
And this is how the raw data looks like:
Let's see how to configure RPi and google sheet scripts and web app deploy to enable this "data flow gateway".
or you can download the script code file too from the repo here
3. copy that link (the most important thinkg) which needs to be paste in the future steps into the Rapsberry Pi code (see below in step 8). This key makes a "link" between the RPi and the Google web app server, thus the data will be uploded into the right place: your google sheet.
After the google sheet configuration now see what configuration we need to do under the hood of Raspberry Pi:
sudo raspi-config
sudo apt update
sudo apt upgrade
sudo apt install i2c-tools
sudo i2cdump -y 1 64
#should look like somthing like this:
sudo mkdir /usr/local/bin/log
cd /usr/local/bin/log
sudo nano log
#/bins/sh
DATA=`sht21.py`
curl -L "https://script.google.com/macros/s/**copy your Google script deployed web app key here**/exec?$DATA"
sudo chmod +x log
cd /usr/local/bin/
sudo wget https://raw.githubusercontent.com/DecentLabs/officeAir/master/sht21.py
sudo chmod +x sht21.py
sudo nano /etc/crontab
* * * * * root /usr/local/bin/log/log #log air quality
Finally reboot the RPi, once it comes back it should report temperature and humidity values every minute to the google sheet
sudo reboot