"Missing U" - Photo Frame

Made by Chun Wang, vedhaviyas Gopalakrishnan and SijiaWang

Found in DioT 2019: Social Objects - Part 2

A smart photo frame which can connect family members far away from each other through emotion sharing by different LED displays.

0

Introduction

Group Member: Vedha, Sijia W., Chun W.


"Missing U" is a smart photo frame that is designed for families or couples who live far away from each other. When one side interacts with the photo (that is in the photo frame), the other side will receive a LED display. Different interaction methods represent different emotions and will activate different displays. When the other side responds back by touching the photo as well, for example, both sides will play the same LED pattern.

As international students studying far away from home, we three were trying to come up with something that can help connect our families and us. Unlike western culture, many Asian cultures are shy about emotional expressions. People don't say it out when they miss each other, and they rarely say "I love you". Therefore, we want to use this opportunity to design an ambient object that can help shy people express their love and miss to people they care about.

0

Process

1. We started with a few rounds of mass idea generation. We knew we want to make something that connects people in the long-distance situation, but we had a hard time figuring out what it should be. 

2. Then, we brainstormed from another angle, thinking about what sensor/what effect we want to accomplish in our design. From there, we picked LED and touch/tap sensor. 

3. Then we crafted the user journey, mapping out what steps users will encounter and what kind of interactions they will use. Later, we generated some quick storyboard.

4. Based on the storyboard, we started building the circuit and writing the code. 


0

Code

0
// ---------- Activate Side -----------

// This value will store the last time we published an event
long lastPublishedAt = 0;
// this is the time delay before we should publish a new event
// from this device
int publishAfter = 10000;
int touch = D2;

void setup()
{

  pinMode( touch , INPUT);


}

void loop()
{
   
    // publish my event
    // you'll want some more complex stuff here
    if (digitalRead( touch ) == HIGH )
    {
    publishMyEvent();
        // delay for a bit
    delay(100);
    }
}


void publishMyEvent()
{
  // Remember that a device can publish at rate of about 1 event/sec,
  // with bursts of up to 4 allowed in 1 second.
  // Back to back burst of 4 messages will take 4 seconds to recover.
  // So we want to limit the amount of publish events that happen.

  // check that it's been 10 secondds since our last publish
  if( lastPublishedAt + publishAfter < millis() )
  {
      // Remember our subscribe is matching  "db2018/paired/"
      // We'll append the device id to get more specific
      // about where the event came from

      // System.deviceID() provides an easy way to extract the device
      // ID of your device. It returns a String object of the device ID,
      // which is used to identify your device.

      String eventName = "diot/2019/paired/sijiavedhachun" + System.deviceID();

      // now we have something like "diot/2019/paired/0123456789abcdef"
      // and that corresponds to this devices info

      // then we share it out
      Particle.publish( eventName, "true" );

      // And this will get shared out to all devices using this code

      // we just pubished so capture this.
      lastPublishedAt = millis();
  }

}
Click to Expand
0
// ------------ Receive Side -------------

// This #include statement was automatically added by the Particle IDE.
#include <neopixel.h>



#define PIXEL_PIN D4
#define PIXEL_COUNT 3
#define PIXEL_TYPE WS2812
 
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

int buttonPin = D1;

int redValue = 0; 
int greenValue = 0;
int blueValue = 0;
int val;
// This value will store the last time we published an event
long lastPublishedAt = 0;
// this is the time delay before we should publish a new event
// from this device
int publishAfter = 10000;



void setup()
{
  strip.begin();
  strip.show();
  strip.clear();
  pinMode (buttonPin, INPUT_PULLUP);
  // We'll want to subscribe to an event thats fairly unique

  // From the Particle Docs
  // A subscription works like a prefix filter.
  // If you subscribe to "foo", you will receive any event
  // whose name begins with "foo", including "foo", "fool",
  // "foobar", and "food/indian/sweet-curry-beans".

  // Basically this will match any event that starts with 'db2018/paired/'
  // This is a feature we'll useto figure out if our event comes from
  // this device or another (see publishMyEvent below)

  Particle.subscribe(  "diot/2019/paired/sijiavedhachun" , handleSharedEvent );
  

}

void loop()
{
  
    // publish my event
    // you'll want some more complex stuff here
    val = digitalRead( buttonPin );
    

  // if the button is pushed
  if( val == LOW )
  {
      // The doorbell is pushed
    // for( int i = 0; i < strip.numPixels(); i++ ){
    //     strip.setPixelColor(i, e); // set a color 
    // }
    // strip.show();
      publishMyEvent();

      // Wait for 2.5 seconds before letting
      // another event happen
      delay( 2500 );
  }
    
    

    // delay for a bit
    delay(100);
}


void publishMyEvent()
{
  // Remember that a device can publish at rate of about 1 event/sec,
  // with bursts of up to 4 allowed in 1 second.
  // Back to back burst of 4 messages will take 4 seconds to recover.
  // So we want to limit the amount of publish events that happen.

  // check that it's been 10 secondds since our last publish
  if( lastPublishedAt + publishAfter < millis() )
  {
      // Remember our subscribe is matching  "db2018/paired/"
      // We'll append the device id to get more specific
      // about where the event came from

      // System.deviceID() provides an easy way to extract the device
      // ID of your device. It returns a String object of the device ID,
      // which is used to identify your device.

      String eventName = "diot/2019/paired/sijiavedhachun" + System.deviceID();

      // now we have something like "diot/2019/paired/0123456789abcdef"
      // and that corresponds to this devices info

      // then we share it out
      Particle.publish( eventName, "data goes here" );

      // And this will get shared out to all devices using this code

      // we just pubished so capture this.
      lastPublishedAt = millis();
  }

}

// Our event handlde requires two bits of information
// This gives us:
// A character array that consists of the event name
// A character array that contains the data published in the event we're responding to.
void handleSharedEvent(const char *event, const char *data)
{
   int brightness = 0;
   unsigned long lastFade = 0;
   
    // Now we're getting ALL events published using "db2018/paired/"
    // This includes events from this device.
    // So we need to ignore any events that we sent.
   uint16_t i;
   uint32_t w = strip.Color(255, 255, 255);
   uint32_t off = strip.Color(0, 0, 0);

   uint32_t q = strip.Color(0, 0, 255);
   uint32_t e = strip.Color(255, 0, 255);
   uint32_t r = strip.Color(255, 0, 0);
    // Let's check the event name
    String eventName = String( event ); // convert to a string object
    // This gives us access to a bunch of built in methods
    // Like indexOf()
    // Locates a character or String within another String.
    // By default, searches from the beginning of the String,
    // but can also start from a given index,
    // allowing for the locating of all instances of the character or String.
    // It Returns: The index of val within the String, or -1 if not found.

    // We can use this to check if our event name contains the
    // id of this device

    String deviceID = System.deviceID();

    // device id = 0123456789abcdef
    // event = "diot/2019/paired/0123456789abcdef"

    if( eventName.indexOf( deviceID ) != -1 ){
      // if we get anything other than -1
      // the event came from this device.
      // so stop doing stuff
      return;
    }
    
    else{
        
       
		unsigned long now = millis();
		
    //  while ((now - lastFade) <= 2000){
    //      now = millis();
            
		  //for( int i = 0; i < strip.numPixels(); i++ ){
    //       strip.setPixelColor(i, w); // set a color 
    //       }
    //       strip.setBrightness(255); 
    //       strip.show();
          
           
    //  }
// 		{
         for (brightness = 0; brightness <= 255; brightness = brightness + 5){
		  		     
		     
		  for( int i = 0; i < strip.numPixels(); i++ ){
          strip.setPixelColor(i, w); // set a color 
           }
        
          strip.setBrightness(brightness);   
          strip.show();
          delay(100);
        

		 }
     
         delay (500);
    
		 for (brightness = 255; brightness >= 0; brightness = brightness - 5){
		  		     
		     8
		  for( int i = 0; i < strip.numPixels(); i++ ){
          strip.setPixelColor(i, w); // set a color 
           }
        
          strip.setBrightness(brightness);   
          strip.show();
          delay(100);
        

		 }
		
			// if we haven't yet reached
			// off or zero... then fade
			
// 		}
    }

    // otherwise do your stuff to respond to
    // the paired device here

    //motorOn = true;

}
Click to Expand
0

Next Step

We have a rough prototype so far, and there is a lot to improve. We created the 1st interaction demo when one side touches the capacitive sensor that is behind one photo, the LED behind another photo will light up. Later, we will work on different interaction methods and their matching LED displays. 

x
Share this Project

Courses

49713 Designing for the Internet of Things

· 18 members

A hands-on introductory course exploring the Internet of Things and connected product experiences.


Focused on
About

A smart photo frame which can connect family members far away from each other through emotion sharing by different LED displays.

Created

February 12th, 2019