Evan Rust
Published © GPL3+

Log Data to Google Sheet Particle Photon

Use IFTTT to automatically log data to a Google spreadsheet using a Particle Photon. This will show how I logged temperature data.

BeginnerFull instructions provided2 hours4,478
Log Data to Google Sheet Particle Photon

Things used in this project

Hardware components

Photon
Particle Photon
×1
Generic Wire
×1
DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
×1
Resistor 10k ohm
Resistor 10k ohm
×1

Software apps and online services

Particle Build Web IDE
Particle Build Web IDE
IFTTT

Story

Read more

Schematics

Schematic

Code

Code

C/C++
#include <Adafruit_DHT.h>

#define DHTPIN 2
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);

unsigned long last_time=0;
int how_often = 10000; //Take reading every 10 seconds
bool Celcius_or_Farenheit = true; //false for C, true for F

void setup() {
dht.begin();
}

void loop() {
if(millis()-last_time>how_often){
    String data = take_reading(Celcius_or_Farenheit);
    Particle.publish("Temp_Published", data);
    last_time = millis();
}
}

String take_reading(bool CorF){ //false for C, true for F
float t;
if(CorF){
    t = dht.getTempFarenheit();
}
else{
    float t = dht.getTempCelcius();
}
    return String(t);
}

Credits

Evan Rust

Evan Rust

122 projects • 1080 followers
IoT, web, and embedded systems enthusiast. Contact me for product reviews or custom project requests.

Comments