Air quality.
You probably think about it more now that our clean air has turned into a permanent haze across the sky.
Yuck.
One thing you do have control over is the air quality inside your home. In this tutorial, I'll show you how to build an air quality sensor in a few short steps.
Get everything together that you'll need for this project.
This includes:
//this is a function that fires when the webapp receives a POST request
function doPost(e) {//Return if null if( e == undefined ) { Logger.log(“no data”); return HtmlService.createHtmlOutput(“need data”); }
//Parse the JSON data var event = JSON.parse(e.postData.contents); var data = JSON.parse(event.data);
//Get the last row without data var sheet = SpreadsheetApp.getActiveSheet(); var lastRow = Math.max(sheet.getLastRow(),1); sheet.insertRowAfter(lastRow);
//Get current timestamp var timestamp = new Date();
//Insert the data into the sheet sheet.getRange(lastRow + 1, 1).setValue(event.published_at); sheet.getRange(lastRow + 1, 2).setValue(data.temperature); sheet.getRange(lastRow + 1, 3).setValue(data.humidity); sheet.getRange(lastRow + 1, 4).setValue(data.pm10); sheet.getRange(lastRow + 1, 5).setValue(data.pm25); sheet.getRange(lastRow + 1, 6).setValue(data.tvoc); sheet.getRange(lastRow + 1, 7).setValue(data.c02);
SpreadsheetApp.flush(); return HtmlService.createHtmlOutput(“post request received”); }
Then,
If everything is working and you have some pretty graphs, congrats!! If you're ready to move on to the next step using an IoT service like Adafruit's check out my full guide here.