Joachim SagayarajBrian Hobbs
Published

PS4 Temperature Monitor

A simple project that utilizes 2 Photons and a temperature sensor to set off an alarm when a device gets too hot.

BeginnerShowcase (no instructions)3 hours6,169
PS4 Temperature Monitor

Things used in this project

Hardware components

Photon
Particle Photon
×1
Breadboard (generic)
Breadboard (generic)
×1
Resistor 10k ohm
Resistor 10k ohm
×2
Temperature Sensor
Temperature Sensor
×1
LED (generic)
LED (generic)
×2

Software apps and online services

Particle Pi
Particle Pi

Story

Read more

Schematics

Photon Wiring Diagram

This is a PDF of the wiring for the two Photons.

Temperature Data Graph

This is a graph of the temperature data from the photons and IFTTT.

IFTTT Activity Feed

This is a screenshot of the IFTTT activity feed.

Code

Alarm Code

C/C++
This is the code used for the alarm.
// Declare variables and assign photon pins
int on=D7;
int on1=D6;

void setup() {
  // Initialize the outputs
  pinMode(on,OUTPUT);
  digitalWrite(on,LOW);
  pinMode(on1,OUTPUT);
  digitalWrite(on1,LOW);
  // Subscibe to the event sent by the other photon
Particle.subscribe("testevent", testevent1,"36001c000c47343438323536");
}
// Code that tells the photon what to do in the event the event is published
void testevent1(const char *event, const char *data)
{
  // Makes the photon blink thrice
delay(1000);
digitalWrite(on,HIGH);
digitalWrite(on1,HIGH);
delay(1000);
digitalWrite(on,LOW);
digitalWrite(on1,LOW);
delay(1000);
digitalWrite(on,HIGH);
digitalWrite(on1,HIGH);
delay(2500);
digitalWrite(on,LOW);
digitalWrite(on1,LOW);
delay(2500);
digitalWrite(on,HIGH);
digitalWrite(on1,HIGH);
delay(5000);
digitalWrite(on,LOW);
digitalWrite(on1,LOW);
delay(5000);

}

Temperature Sensor

C/C++
This is the code used for the temperature sensor.
// This #include statement was automatically added by the Spark IDE.
#include "OneWire.h"

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

// -----------------
// Read temperature
// -----------------

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(D0 );

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature dallas(&oneWire);

// Create a variable that will store the temperature value
double temperature = 0.0;
double temperatureF = 0.0;
int k = 0;

void setup()
{
  // Register a Particle variable here
  Particle.variable("temperature", &temperature, DOUBLE);
  Particle.variable("temperatureF", &temperatureF, DOUBLE);

  // setup the library
  dallas.begin();
}

void loop()
{
  // Request temperature conversion

  dallas.requestTemperatures();

  // get the temperature in Celcius
  float tempC = dallas.getTempCByIndex(0);
  // convert to double
  temperature = (double)tempC;

  // convert to Fahrenheit
  float tempF = DallasTemperature::toFahrenheit( tempC );
  // convert to double
  temperatureF = (double)tempF;
// delays the loop by five seconds
  delay(5000);
// variable dedclared so it can be linked to IFTTT
Particle.variable("Temperature", temperatureF);
// Publishes an event when the temperature exceeds 90
// The tempearture had to be less than 110 degrees to prevent outliers
if (temperatureF > 90 && temperatureF< 110)
{
  Particle.publish("testevent", "testevent1", PUBLIC);
}
}

Credits

Joachim Sagayaraj

Joachim Sagayaraj

1 project • 0 followers
Mechanical Engineering student at UNC Charlotte
Brian Hobbs

Brian Hobbs

1 project • 0 followers

Comments