author
5Instructables12,222Views26Comments

Tell us about yourself!

Complete Your Profile

Achievements

10K+ Views Earned a bronze medal
  • Door and Temperature Status Logger Project

    Yes, just eliminate the temperature and humidity sensor from the hardware and eliminate the code that supports it.

    View Instructable »
  • Door and Temperature Status Logger Project

    Yes, just eliminate the temperature/humidity sensor from the components and within the code.

    View Instructable »
  • SpecialRobotBuilders followed WickedMakers2 months ago
      • How NOT to Make a River Table (For Your Chair!)
  • Door and Temperature Status Logger Project

    I sent you a private message. You should see it under your Instructables profile.

    Here is my latest code. It has a few extras with the SMS Message and Email:/** * This Arduino Project will monitor a reed switch attached to any door/window to determine if the door/window is opened or closed. * It will also capture the temperature and humidity from a DHT11 sensor. * It logs the status of the door and the DHT11 sensor in Google Doc and after dark it sends SMS messages when the door/window is left open. * It also makes use of the TimeZone database to set the internal system clock to accurately measure time. * * Major components of this project were derived by observing various examples on the internet espically from Instructables.com */#include <ESP8266WiFi.h>#include <ESP8266HTTPClient.h>#include <ArduinoJson.h>#include <TimeLib.h>#include &quo...

    see more »

    Here is my latest code. It has a few extras with the SMS Message and Email:/** * This Arduino Project will monitor a reed switch attached to any door/window to determine if the door/window is opened or closed. * It will also capture the temperature and humidity from a DHT11 sensor. * It logs the status of the door and the DHT11 sensor in Google Doc and after dark it sends SMS messages when the door/window is left open. * It also makes use of the TimeZone database to set the internal system clock to accurately measure time. * * Major components of this project were derived by observing various examples on the internet espically from Instructables.com */#include <ESP8266WiFi.h>#include <ESP8266HTTPClient.h>#include <ArduinoJson.h>#include <TimeLib.h>#include "DHT.h"#include "DataToMaker.h"#define DOORPIN 14 // what digital pin the door switch is on. #define DHTPIN 2 // what digital pin we're connected to#define DHTTYPE DHT11 // DHT 11DHT dht(DHTPIN, DHTTYPE); //Configure the DHT objectfloat h; //humidityfloat f; //temp in fahrenheitfloat t; //temp in celsiusfloat hif; //heat index in fahrenheitfloat hic; //heat index in celsiusconst char* ssid = "" ; // Your WiFi Access Pointconst char* password = "" ; // Your WiFi Password// IFTTT Maker Webhooks const char* myIftttKey = ""; // your maker key hereDataToMaker eventLog(myIftttKey, "statusLogger"); // configure the status logger.DataToMaker eventSms(myIftttKey, "statusLoggerSms"); // configure the SMS messenger.DataToMaker eventEmail(myIftttKey, "statusLoggerEmail"); // Configure the Email messenger.// statusesString doorStatus = "Closed"; // door statusString previousDoorStatus = "Opened"; // previous door statusvolatile bool statusChanged = false; // status change flag// Set interval by hr * 60 minutes * 60 seconds * 1000 millisecondsconst long interval = 5 * 60 * 60 * 1000; // .25 * 60 * 60 * 1000; // 5 * 60 * 60 * 1000;const long eveningInterval = 0.5 * 60 * 60 * 1000; // 0.25 * 60 * 60 * 1000;unsigned long previousMillis = 0 - (2 * interval);int hourCheckStart = 21; //2100 in millitary time is 9:00 int hourCheckEnd = 07; //0600 in millitary time is 9:00 int sleepTime = 1000;int previousDay = -1;/** * Method used to configure the application. */void setup() {Serial.begin(115200);attachInterrupt(digitalPinToInterrupt(DOORPIN), eventTriggered, CHANGE);pinMode(DOORPIN, INPUT); //Door Sensor dht.begin();Serial.print("\nConnecting to ");Serial.println(ssid);WiFi.mode(WIFI_STA);WiFi.begin(ssid, password);Serial.print("\nConnecting..");while (WiFi.status() != WL_CONNECTED) {delay(1000);Serial.print(".");}Serial.println("\nIP address: ");IPAddress ip = WiFi.localIP();Serial.println(ip);Serial.print("\n");}/** * Method that is triggered each time a door sensor state changes. */void eventTriggered() {statusChanged = true;Serial.println("Event was triggered!");// May not need to check the status here because the main loop forces the check too. // checkStatus();}/** * Method used to determine the status of a door. */void checkStatus() {previousDoorStatus = doorStatus;Serial.println("Checking the door!");if (digitalRead(DOORPIN) == HIGH) { // Check to see if door is openSerial.println("Door is closed!");doorStatus = "Closed";} else {Serial.println("Door is open!");doorStatus = "Opened";}}/** * Method used to capture the temp from the DHT11 sensor */bool checkTemperature() {// Reading temperature or humidity takes about 250 milliseconds!// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)h = dht.readHumidity();// Read temperature as Celsius (the default)t = dht.readTemperature();// Read temperature as Fahrenheit (isFahrenheit = true)f = dht.readTemperature(true);// Check if any reads failed and exit early (to try again).if (isnan(h) || isnan(t) || isnan(f)) {Serial.println("Failed to read from DHT sensor!"); //Serial.print("."); //Failed to read from DHT sensor!return false;}// Compute heat index in Fahrenheit (the default)hif = dht.computeHeatIndex(f, h);// Compute heat index in Celsius (isFahreheit = false)hic = dht.computeHeatIndex(t, h, false);return true;}/** * Method used to send the status to both SMS and Email. */void sendStatusToSmsAndEmail(){ sendStatusToSms(); sendStatusToEmail();}/** * Method used to send the status of the door via SMS. */void sendStatusToSms() {delay(100);eventSms.setValue(1, "Door is " + doorStatus);if (eventSms.connect()) {Serial.println("Connected To Maker Sms.");eventSms.post();Serial.println("Posted status to Maker Sms!");eventSms.post();} else {Serial.println("Failed To Connect To Maker Sms!");}}/** * Method used to send the status of the door via Email. */void sendStatusToEmail(){ delay(100); eventEmail.setValue(1, "Door is " + doorStatus); if (eventEmail.connect()) { Serial.println("Connected To Maker Email."); eventEmail.post(); Serial.println("Posted status to Maker Email!"); eventEmail.post(); } else { Serial.println("Failed To Connect To Maker Email!"); }}/** * Method used to send the status of the door and temperature to Google Docs. */void sendStatusToLog(String oper) {delay(100);// Read the temperature and humidity while (!checkTemperature()) {delay(10);}Serial.print("\n");Serial.print("Temperature: ");Serial.print(f);Serial.print(" *F (");Serial.print(t);Serial.print(" *C)");Serial.print("\t");Serial.print("Heat index: ");Serial.print(hif);Serial.print(" *F (");Serial.print(hic);Serial.print(" *C)%");Serial.print("\t");Serial.print("Humidity: ");Serial.println(h);eventLog.setValue(1,String(f) + "*F (" + String(t) + "*C) / " + String(hif) + "*F ("+ String(hic) + "*C)");eventLog.setValue(2, String(h)); String statusString = doorStatus + " " + oper; Serial.println(statusString);eventLog.setValue(3, statusString);if (eventLog.connect()) {Serial.println("Connected To Maker Log");eventLog.post();Serial.println("Posted status to Maker Log!");} else {Serial.println("Failed To Connect To Maker Log!");}// sendStatusToEmail();}/** * Main loop */void loop() {delay(sleepTime); // Give the CPU a break. unsigned long currentMillis = millis();//If this is a new day then syncronize the internal clock with UTC.if (previousDay != day()) {syncToUtcWithLocalTimezone();previousDay = day();}//If we surpassed the elapsed time then force a check of the door and temp.if (currentMillis - previousMillis >= interval) {previousMillis = currentMillis;Serial.print("\nChecking statuses because of elapsed time of "); if(interval/1000/60 <= 60){ Serial.print(interval/1000/60); //due to 1000 milliseconds in a second and 60 seconds in a minute. Serial.println(" minutes!"); }else{ Serial.print(interval/1000/60/60); //due to 1000 milliseconds in a second, 60 seconds in a minute, and 60 minutes in an hour. Serial.println(" hours!"); }checkStatus();sendStatusToLog("TimeLapsed"); //Since we surpassed the elapsed time we will send the status to the log regardless. Serial.print("\nGoing to sleep for "); if(interval/1000/60 <= 60){ Serial.print(interval/1000/60); //due to 1000 milliseconds in a second and 60 seconds in a minute. Serial.println(" minutes!"); }else{ Serial.print(interval/1000/60/60); //due to 1000 milliseconds in a second, 60 seconds in a minute, and 60 minutes in an hour. Serial.println(" hours!"); }} else if ((hour() >= hourCheckStart || hour() <= hourCheckEnd) && currentMillis - previousMillis >= eveningInterval && doorStatus == "Opened") {//We want to check here if we are past 9:00 PM and the door is stil opened. previousMillis = currentMillis;Serial.print("\nChecking statuses because it's between ");Serial.print(hourCheckStart); Serial.print("00 hours & "); Serial.print(hourCheckEnd);Serial.print("00 hours and the door was open the last time we checked!\n");checkStatus();sendStatusToSmsAndEmail(); //Since it is after hours send a warning of the status via SMS. Serial.print("\nGoing to sleep for "); if(interval/1000/60 <= 60){ Serial.print(interval/1000/60); //due to 1000 milliseconds in a second and 60 seconds in a minute. Serial.println(" minutes!"); }else{ Serial.print(interval/1000/60/60); //due to 1000 milliseconds in a second, 60 seconds in a minute, and 60 minutes in an hour. Serial.println(" hours!"); }} else if (statusChanged) {Serial.println("\nChecking statuses because of state change!");checkStatus();sendStatusToLog("statusChanged"); //Since the state changed we will send the status to the log regardless.statusChanged = false;if ((hour() >= hourCheckStart || hour() <= hourCheckEnd) && previousDoorStatus != doorStatus) { // Need to check hour here too because of possible status change.//Since it is after hours send a warning of the status via SMS.sendStatusToSmsAndEmail();} Serial.print("\nGoing to sleep for "); if(interval/1000/60 <= 60){ Serial.print(interval/1000/60); //due to 1000 milliseconds in a second and 60 seconds in a minute. Serial.println(" minutes!"); }else{ Serial.print(interval/1000/60/60); //due to 1000 milliseconds in a second, 60 seconds in a minute, and 60 minutes in an hour. Serial.println(" hours!"); }}}/** * Method used to set the system time to the UTC time adjusted for the Eastern USA Timezone. */void syncToUtcWithLocalTimezone() {StaticJsonDocument < 700 > doc; // Object used to parse the json response from the Time Server.if (WiFi.status() == WL_CONNECTED) { //Check WiFi connection statusHTTPClient http; //Declare an object of class HTTPClientString baseUrl = "http://api.timezonedb.com/v2.1/get-time-zone?key=3LQ5H5VQINP6&format=json&by=zone&zone=America/New_York";Serial.print("Calling ");Serial.println(baseUrl);http.begin(baseUrl); //Specify request destinationint httpCode = http.GET(); //Send the requestSerial.print("HTTP Response Code: ");Serial.println(httpCode);if (httpCode > 0) { //Check the returning code String jsonResponse = http.getString(); //Get the request response payloadSerial.print("Length: ");Serial.println(jsonResponse.length());Serial.println(jsonResponse); //Print the response payload// Deserialize the JSON documentDeserializationError error = deserializeJson(doc, jsonResponse);// Test if parsing succeeds.if (error) {Serial.print(F("deserializeJson() failed: "));Serial.println(error.c_str());} else {// Get the root object in the documentJsonObject root = doc.as<JsonObject>();Serial.print("TimeStamp:\t");const char* formattedTimeStamp = root["formatted"];Serial.println(formattedTimeStamp);int unixTime = root["timestamp"];Serial.print("Setting system time to: ");Serial.println(unixTime);setTime(unixTime);Serial.printf("\n\nLocal Time:\t %02d:%02d:%02d\t%02d-%02d-%4d", hour(), minute(), second(), month(), day(), year());Serial.print("\n");}}http.end(); //Close connection }}

    View Instructable »
  • Door and Temperature Status Logger Project

    Unfortunately due to some family matters I was not able to look at it yet. Hopefully tonight or tomorrow night. Sorry

    I was able to find some time this evening to turn on the system. I didn't have any issues with it logging the reed switch. I also have an EPS32 that I might try the code on tomorrow if I have enough time but as far as the ESP8266, everything is still working as layout in the Instructable. I did modify the code once to send SMS messages when the door is open after a certain timeframe (9:00 PM EDT). Would you like to see that code too?

    View Instructable »
  • Door and Temperature Status Logger Project

    I'm not sure by just looking at it. I'll have to test it out myself. Unfortunately I do not have the hardware with me at this time. I will do my best to get access to the hardware this week. However, if you don't hear back from me by weeks end then please drop me a little reminder.

    View Instructable »
  • Door and Temperature Status Logger Project

    Do you have the 10k ohm resistor connected to the reed switch? If not, that is probably your problem. Also, I bought several inexpensive reed switches and found that at least 1 of those was faulty. So, if you are confident that the reed switch is properly connected to the 3.3 volts, ground and the 10k ohm resistor then you may just have a faulty reed switch. As for off-line recording of the events, I actually have not tried off-line storage, so I can't provide you with any guidance on that subject.Good luck!

    View Instructable »
  • Animated Spooky Pumpkin Eyes

    Great job. Why did you need to put a capacitor on that circuit?

    View Instructable »
  • Animated Spooky Pumpkin Eyes

    Hi PierreV16, For the 6 servos that I used in my creation I was able to run all of them off of the 5V from the Uno but if you are going with 12 servos then I would think you would need to power them separately. Good luck and please let me know how it turns out.

    View Instructable »
  • Q5 a Star Wars Themed Astromech Driod

    Yes we do. Do you have them too?

    View Instructable »
  • Animated Spooky Pumpkin Eyes

    Thanks

    Cool

    Oh yes, the comment is incorrect. Originally we had planned on having 8 eyes but later settled on only 6. Therefore the comment should be changed to say "Move all 6 servos". The reason we eliminated 2 servos is because the interior of the pumpkin we used got really tight with only 6. If you have a larger pumpkin you can have 8 servos but you will need to change the servo array to hold 8 servos and the for loops would also need changed from 6 to 8.Thanks and good luck.

    View Instructable »
  • Q5 a Star Wars Themed Astromech Driod

    Yep, the kids love it and so does dad!

    View Instructable »
  • Animated Spooky Pumpkin Eyes

    Thanks

    Yes, that would work well. In this case, however, they move fast to surprise the kids. ;-)

    View Instructable »
  • SpecialRobotBuilders's instructable Animated Spooky Pumpkin Eyes's weekly stats: 1 year ago
    • Animated Spooky Pumpkin Eyes
      1,969 views
      10 favorites
      1 comments
      • Door and Temperature Status Logger Project
      • Yet Another Instructable on Using the DIYMall RFID-RC522 and Nokia LCD5110 With an Arduino
      • Q5 a Star Wars Themed Astromech Driod
  • SpecialRobotBuilders followed makjosher1 year ago
      • The Ski Sled
      • Simple Sheet Metal Brake: No Welding
      • Rocket Boat
  • Moving a Servo to Sound Signals

    I can't seem to get this to work. Anyone have any tips?

    View Instructable »
  • How to Use OV7670 Camera Module With Arduino?

    Does this camera have the ability to stream video or just take pictures?

    View Instructable »
  • DIY Bluetooth Phone Controlled BB-8 Droid with Arduino UNO

    I love your design. I was wondering how you took apart the hamster ball?

    View Instructable »
  • SpecialRobotBuilders followed airsoft, kids, computers, arduino and 13 others channel 3 years ago
  • Q5 a Star Wars Themed Astromech Driod

    Thanks! We do have both the dark side and droid develper. Bought them new in the 90s, I think. Dragged them out of storage to let the kids play with them.

    View Instructable »