Don't Miss Downton!

Made by Ian Lee

My wife and her friends love Downton Abbey and while not physically together, they watch it at the same time each week. This app reminds the group to tune in and alerts the group to those who have not tuned in within 5 minutes of start time.

Created: January 29th, 2016



The goal of the project was to help my wife and her friends build shared experiences while physically apart (PA, NC). 


One thing my wife and her friends all love is the PBS show, Downton Abbey and they have tried to build a habit of watching it at the same time. They all tune in, turn on a conference call and laugh and share jokes about the show. 

I wanted to build an app that would remind the group to tune in and check to see who had tuned in upon show time and alert the group if someone was missing. This would work by building an IFTTT connection to send an SMS to the group 15 minutes before each episode and then using a photosensor, 5 minutes after showtime check to see if the TV was on. If it was not on, then the device would post a tweet and funny photo to twitter alerting the group that someone had not joined. 

Locally,  LEDs would signify to the local user if the program was running, if Downton Abbey was on, and if the TV was on. 



The process was a long and painful journey. What started out as an expected 5 hour project, quickly turned into a 20-25 hours test of patience but I am a better man having gone through it. Originally, I had intended to build a weather app using a thermometer as input and sending customized SMS messages via Twillio to my wife with clothing suggestions...if I got fancy, I played around with using Kimono to pull relevant images off pinterest. However, I later realized that this design did not meet the requirements for the project and began searching for an alternative. 

Having missed her social showing on Sunday, on Wednesday my wife and I caught up on the latest episode of Downton Abbey and I got the idea for this device. Having worked with photosensors during the workshop, I thought this would be an easy project to assemble. While I quickly was able to augment the workshop code to achieve the desired functionality locally (getting photosensor readings, blinking LEDs, and turning on LED when low photo readings) getting the code logic around the time syntax was far more challenging then I expected. After googling and attempting numerous efforts myself, Dr. Bryne was able to help find the errors in my code and get the logic working properly to drive actionable response on the Photon only during the time periods at and right before the show. The key it turns out was in the Time.weekday numbering which I can erroneously being using so my code thought it was the wrong day of the week...thus was not working. 

Altering clearing this hurdle, I was able to take time to implement the time logic for the photosensor and twitter integrations as well as clean up the code a bit through indentation and added comments. Please note that when posting the code into the window below, this seems to have causes more of a mess than benefit but I promise the code looks much cleaner in my ATOM terminal. 



Overall, the functionality of the app is as desired but not as elegant as I would have liked. Locally, information is communicated to the end user through App Status (Blinking Yellow LED), Downton Status (Blue LED), and TV Status (Red LED). Remotely users receive a text message reminder generated by the Phonton 15 minutes prior to a showing and for those not tuned it the Twitter calls work as directed and provide strong social pressure to join the group. 

Images & Code Below

- Image1: Reminder Text Sent from Photon to Phone via IFTTT

- Final Code

- Image 2: Log returns via Particle Cloud showing Publishing results used to trigger IFTTT

- Image 3: Twitter Post Sent from Photon to Twitter via IFTT when sensor responded to low photo activity from TV. 

// Creative Project 1: Ian Lee
// 1/29/16, CMU-Designing for IOT
// Project: Downton Abby Viewing Party Bot

// Goal: Create an IOT Device that signals when and if Downton Abby is on notifies my wife and her friends via SMS 15 minutes prior to watch.
// At start time, photosensor then signals and alerts if TV is not turned on. TV State is logged to Google Drive.

// Project Components
	// 1. Particle Photon
	// 2. 3 Single Color LEDs
	// 3. 1 Photosensor
	// 4. 4 Resisters

// variables
	// Signal Elements
		// LED Pins
			int ledPinRed = D0; // RED (TV IS OFF AND SHOULD BE ON)
			int ledPinBlue = D1; // BLUE (DOWNTON ABBY IS ON NOW)
			int ledPinYellow = D2; //YELLOW (PROGRAM RUNNING)
	// Photo Resistor
			int photoCellPin = A0;
	// Store the sensor reading
			int photoCellReading = 0;
	// threshold for being on
			int threshold = 350;
	// hold a state to say if TV is on or not
			bool isOn = false;
	// store how bright the LED should be
			int ledBrightness = 0;
			int ledBrightness2 =0;
	// store the time value since it was first covered
			long timeSinceFirstThreshold = 0 ;
	// Time Store For When to Send Reminder SMS Messages
			int dayOfInterest1 = 6;
			int hourOfInterest1 = 23;
			int minuteOfInterest1 = 0;
	// Time Store for When Downton Abbey is On
			int dayOfInterest2 = 6;
			int hourOfInterest2 = 23;
			int minuteOfInterest2 = 0;
	// Time Store for When to Check TV Status
			int dayOfInterest3 = 6;
			int hourOfInterest3 = 23;
			int minuteOfInterest3 = 0;

// setup
void setup()
			{  // define the LED as output
			 	pinMode( ledPinRed , OUTPUT );
			 	pinMode (ledPinBlue, OUTPUT);
				pinMode (ledPinYellow, OUTPUT);

			 	// connect the photo cell reading to the cloud
			 	Particle.variable( "light", &photoCellReading, INT ); -5 );

			 	Serial.begin( 9600 );

// loop
void loop()
		digitalWrite( ledPinYellow, HIGH);
		digitalWrite( ledPinYellow, LOW);
		delay (1000);
		// reading from the sensor
		photoCellReading = analogRead( photoCellPin );
		Particle.variable( "light", &photoCellReading, INT );

		if (Time.weekday() == dayOfInterest2 && Time.hour() == hourOfInterest2 && Time.minute() >= minuteOfInterest2 ){
		// see if TV is on
		 if( photoCellReading < threshold ){
				isOn = false;
				ledBrightness = 255;
				Particle.publish("Missing_Downton", "Yes"); //If covered, write to cloud to kick of IFTTT
				delay (10000);
			if( photoCellReading > threshold){ //If not covered, turn of LED indicator
				isOn = true;
				ledBrightness = 0;

		digitalWrite( ledPinRed , ledBrightness);

		Serial.print( "Sensor reading is: " );
		Serial.println( photoCellReading );
		delay( 50 );

	if (Time.weekday()==dayOfInterest1 && Time.hour() == hourOfInterest1 && Time.minute() >= minuteOfInterest1  ){
		Particle.publish("Downton_Alert", "Yes");
		delay (10000);

	if( (Time.weekday() == dayOfInterest2 && Time.hour() == hourOfInterest2 && Time.minute() >= minuteOfInterest2 )){
	digitalWrite( ledPinBlue, HIGH);
Click to Expand


By completing this project, I learn a lot more about how to use (and NOT use) the Particle platform. I think most directly, I learned how little I still understand about the Particle Syntax and being able to understand nested elements in code, but perhaps more importantly how strong my knowledge of circuitry and the local elements of the Photon have become. Behind this project were a great number of small projects that proved my abilities in individual elements, now I must continue to improve my understanding of particle cloud and the code syntax. I feel as if had I grasps these elements better, I could have greatly simplified my code by uniting numerous single elements into connected actions and had more time to focus on delivering more elegant notifications to the end-user.  
Don't Miss Downton IOT Demo
Ian Lee -
Share this Project


49-713 Designing for the Internet of Things

· 4 members

This course charts the emergence of the now "connected world" to explore the possibilities for future products and connected spaces.


My wife and her friends love Downton Abbey and while not physically together, they watch it at the same time each week. This app reminds the group to tune in and alerts the group to those who have not tuned in within 5 minutes of start time.