Arduino “having11” Guy
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.

EasyFull instructions provided2 hours1,379
Log Data to Google Sheet Particle Photon

Things used in this project

Hardware components

Photon
Particle Photon
×1
Generic Wire
×1
DHT11
×1
Resistor 10k ohm
Resistor 10k ohm
×1

Software apps and online services

Particle Build IDE
IFTTT

Story

Read more

Schematics

Schematic

Schematic mdpijnu4cn

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

Arduino “having11” Guy

Arduino “having11” Guy

7 projects • 183 followers
IoT, Arduino, and Raspberry Pi. I can create design, code, and build projects for only $22/hr. Just message me with your project request.
Contact

Comments