RE> Temperature Logger Using Arduino Into Google Spread Sheet
Logs temperature into google sheet in arduino.
Project description
A new way of logging temperature
By this time, you'd probably want a temperature sensor in the house - one less than $25. If you have one, you are probably wanting a better one. Here is an easy solution around this problem.
Creating And Deploying The Script
Create a new spreadsheet as shown below:
Once you have got that down go to Tools > Script Editor.
Create a new spreadsheet as shown below:
![](https://projects.arduinocontent.cc/1807f743-499d-48cd-9ab6-cc4cd49fab67.png)
Name the sheet below TempSheet
Once you have got that down go to Tools > Script Editor. Then copy and paste the code given here . Edit the script ID in the code. The script ID is found in the place where "vbn" is in the given URL:
https://docs.google.com/spreadsheets/d/vbn/edit#gid=0
Now go to Publish > Deploy as web app. The "Project version" will be "New" . Select "your email id" in the "Execute the app as" field. Choose "Anyone, even anonymous" in the "Who has access to the app" field. And then click on "Deploy" . Note that When republishing please select the latest version and then Deploy again. Type "New Script Created" in the "Project Version" field.
You will have to give Google permission to deploy it as a web app. Just click on "Review Permissions". Then choose your Email ID here using which you have created spreadsheet.
Click on "Advanced".
And then click on " Go to ' your_script_name ' (unsafe) " . Here in my case, it is "TempLog_Script" .
Click on "Allow" and this will give permission to deploy it as a web app.
Now you can see the new screen with a given link and named "Current web app URL ”. This URL contains Google Script ID. Just copy the URL and save it somewhere.
Testing The DHT22
Use the given circuit diagram and code:
Diagram:
![](https://projects.arduinocontent.cc/83542956-e5d7-405c-9131-6c6871cb7ce4.png)
Code:
#include "DHT.h"
#define dht_apin A0
DHT dht;
#define DHTTYPE DHT22 //Change this to any type of DHT Sensor you're Using!
DHT(dht_apin, DHTTYPE);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600); //Starts serial
delay(5000); //Waits before reading from sensor
Serial.println("DHT22 Temp. And Humi. Test"); //Prints the intro
}
void loop() {
// put your main code here, to run repeatedly:
dht.read11(dht_apin); //Reads from the sensor
Serial.println("Humi. ---------- "); //Prints humidity
Serial.print(DHT.humidity); //Prints humidity
Serial.print("% "); //Marks the humidity as %
Serial.print("Temp. ------------ "); //Prints temperature
Serial.print(DHT.temperature); //Prints temperature
Serial.print("℃") //Marks the temperature unit
delay(2000); //Waits 2 seconds before doing the loop again fastest is once evrey 2 seconds
} //end loop
It should be printing the temperature and humidity. If it is not, try running this code at rate 9600 that will print "Hello!" evrey second to see if you are getting any serial communication at all:
#define one_second 1000
#define the_word_hello "Hello!"
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
delay(5000);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.print(the_word_hello);
delay(one_second);
}