This project was designed to inform when the room you are in currently has reached a temperature that is uncomfortable. There are many ways to set up a notification, I notified myself with a phone call.
Hardware SetupHere are a few angles of the wiring setup for this project. I used a Particle Argon and a temperature and humidity sensor on a standard breadboard.
Before setting up any notifications about the temperature of the room, I had to code the device to be able to read the temperature of the room.
This is the code for the initial setup. I imported the Adafruit_DHT.h API for this project.
#include <Adafruit_DHT.h>
#define DHTPIN D6
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
This was my setup function.
void setup() {
pinMode(D7, OUTPUT);
Serial.begin(9600);
dht.begin();
}
In my loop function, I find the humidity and the temperature in both Fahrenheit and Celsius. While I only use Fahrenheit for this project, it can be modified to be triggered by the humidity in a room or by a certain degree in Celsius measurement.
In addition, I have around a 10 second delay between temperature readings.
void loop() {
delay(10000);
float f = dht.getTempFarenheit();
Now to check that the sensor was correctly reading the temperature of the room, I printed the temperature (in degrees Fahrenheit) to the serial monitor.
Serial.print(dht.getTempFarenheit());
Serial.println(" degrees F");
Now my project was reading the temperature of the room, and I could check what the temperature was anytime the Argon was plugged in and running.
IFTTT NotificationTo receive a notification from IFTTT, I first had my Argon publish an event whenever the temperature (in Fahrenheit) was greater than a certain index. In addition, I added a safety measure in the form of an if-statement, so if the sensor received an incorrect reading (a temperature that was a clear outlier) it would not be counted.
if (isnan(f) || dht.getTempFarenheit() > 85.00) {
Serial.println("Failed to read from DHT sensor!");
return;
}
else if (dht.getTempFarenheit() > 74.00){
Particle.publish("tooHot", "openDoor");
}
Once this was done, I setup the IFTTT applet. In my IFTTT applet, I had it so that if the event was published from my Particle Argon, I would then receive a phone call, telling me to open my door.
Here is a recording of the phone call received.
While it can take a while for an IFTTT notification to be triggered, it is an effective way to get notified.
Comments