Moritz Strube
Published © MIT

Measuring Temperature and Humidity with Particle Photon

Measure temperature and humidity with Particle Photon and Adafruit Si7021 using the Adafruit Si7021 library for I2C based communication.

EasyFull instructions provided1 hour1,432
Measuring Temperature and Humidity with Particle Photon

Things used in this project

Hardware components

Photon
Particle Photon
With power supply.
×1
Adafruit Si7021
×1
Solderless Breadboard Half Size
Solderless Breadboard Half Size
With some jumper wires.
×1

Software apps and online services

ThingSpeak API
ThingSpeak API
To store the measurement data.
IFTTT Particle Service
Optional, to send alerts to a user via Telegram messenger.
IFTTT Telegram Service
Optional, to send alerts to a user via Telegram messenger.
Telegram
Optional, to send alerts to a user via Telegram messenger.

Story

Read more

Schematics

Project schematics

Schematics of the a breadboard with the Photon and the sensor.
Schematics mswxxe00ob

Code

Code

C/C++
Code to get access to the Si7021 sensor data using the Adafruit Si7021 library.
// Connect Vin to 3-5VDC
// Connect GND to ground
// Connect SCL to I2C clock pin (D1 on Photon/Electron)
// Connect SDA to I2C data pin  (D0 on Photon/Electron)


#include "Adafruit_Si7021.h"   // Use for Build IDE
// #include "Adafruit_Si7021.h"               // Use for local build

Adafruit_Si7021 sensor = Adafruit_Si7021();
double h;
double t;

void setup() {
    sensor.begin();
    
    // Variable for IFTTT
    Particle.variable("t", &t, DOUBLE);
    Particle.variable("h", &h, DOUBLE);
}

void loop() {
    
    h = sensor.readHumidity();
    t = sensor.readTemperature();
    
    // Publish data
    String temperature = String(t);
    String humidity = String(h);
    
    temperature = temperature.format("%1.2f", t);

    Particle.publish("temperature", temperature, PRIVATE);
    
    delay(30000);
     
    Particle.publish("humidity", humidity, PRIVATE);
 
    delay(30000);
}

Credits

Moritz Strube

Moritz Strube

4 projects • 6 followers
I’m an experienced technology manager with deep interest in technology, innovation and science.
Contact

Comments

Add projectSign up / Login