Monitor your home temperature over the web

  • Electronic
  • Photon
  • Dallas ds18b20
  • Iot

I am currently living in reunion island (between Madagascar and Mauritius) with my wife and a little rabbit! As the climate is tropical (very warm and humid) I wanted to be able to know my home’s temperature from my office using one of my Photon and a Dallas ds18b20 temperature sensor.


First of all you need :

  • A Photon
  • A bread board
  • A 4.7kOhm resistor (in my example I use two 10kOhm in parallel, so ~5kOhm)
  • A Dallas ds18b20 temperature sensor
  • Some jumper wires


fritzing schematics


// This #include statement was automatically added by the Particle IDE.
#include "application.h"
#include "OneWire/OneWire.h"
#include "spark-dallas-temperature/spark-dallas-temperature.h"

// ---------------------
// Init the tempC variable
// ---------------------
double tempC = 0;

// ---------------------
// ---------------------
// Set the oneWire bus to pin 4
#define ONE_WIRE_BUS 4
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);
// Pass the oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);

void setup() {
  // VARS
  // ---------------------
  // Init the tempC variable with the Particle method
  Particle.variable("tempC", &tempC, DOUBLE);

  // INIT Serial for terminal checking
  // ---------------------

  // INIT Sensors
  // ---------------------
  // Start up the library
  Serial.println("Dallas Temperature IC Control Library");

void loop() {
  // ---------------------
  // ---------------------
  // call sensors.requestTemperatures() to issue a global temperature
  // request to all devices on the bus
  Serial.println(" Requesting temperatures...");

  // Send the command to get temperatures

  Serial.println("Temperature for Device 1 is: ");
  tempC = sensors.getTempCByIndex(0);

  // Why "byIndex"?
  // You can have more than one IC on the same bus.
  // 0 refers to the first IC on the wire

  // ---------------------
  // DELAY
  // ---------------------

Reading the temperatures

You can now have access to your home’s temperature with the Particle cloud api :


I admit this setup is not doing much on its own, but I hope it will help some of you to getting started with your Photon and to have fun doing this.