Pixel Away Working Prototype

Made by Sijia Li, Ranveer Katyal and Menghan Zhang

Found in DioT 2019: Social Objects - Part 2

Our creative project is to help friends / couples connect with each other in a subtle and fun way. The device is a basic 10 by 10 square LED matrix and serves as a canvas for both sides to draw.

0

Introduction

Our creative project is to help friends/couples connect with each other in a subtle and fun way. There will be 100 LED pixels (10x10) attached in this installation. Each person can light up 1 pixel a day to make a drawing together. If one person stops responding for over a day, the lights on both sides will be turned off and the game will start over. If either side feels the drawing is completed, they can press the button to stop and restart the game, and at the same time, the drawing will be archived and sent to both sides as a memory. The little cubic stature can be a nice decoration on your desk, as well as a vessel to carry social interactive experiences. With Pixel Away, friends or couples who are far from each other can be just pixels away through shared experience on the same canvas.

0

Process

For our first working prototype, we want to create a set of two connected Neopixel devices. If one presses the button, the corresponding LED will light up on both devices.

Here is a rough sketch of the model.

0

Code

0
//Date - 02/10/2019  - Small prototype for the concept Pixel Away. Contributors: Ranveer Katyal, Menghan Zhang, and Sijia Li
//Idea: The follwoing code lets a user light up a specific Pixel on a strip of neo-pixel and transmit it to another device 

// This #include statement was automatically added by the Particle IDE.
#include <neopixel.h>
// IMPORTANT: Set pixel COUNT, PIN and TYPE
#define PIXEL_PIN D2
#define PIXEL_COUNT 30
#define PIXEL_TYPE WS2812

long lastPublishedAt = 0;

int publishAfter = 10000;

int pushSendButton = D6;
int pushButtonPin = D4;
int oldButtonState = HIGH;
uint16_t i = 0;
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

void setup() {
    Particle.subscribe(  "diot2019/PixelAway/" , handleSharedEvent );
    pinMode(pushButtonPin, INPUT_PULLUP);
    pinMode(pushSendButton, INPUT_PULLUP);
    strip.begin();
    strip.show(); // Initialize all pixels to 'off'
}

void loop() {
   
   int count = neoPixelCounter();
  String countString = String(count); //send the loction to other devices when the send push button is pressed. 
       if (digitalRead(pushSendButton) == 0){
    publishMyEvent(countString);
    }

    // delay for a bit
    delay(100);
   

}


void publishMyEvent(String Loc)
{
  if( lastPublishedAt + publishAfter < millis() )
  {

      String eventName = "diot2019/PixelAway/" + System.deviceID();
      Particle.publish(eventName, Loc);
      lastPublishedAt = millis();
  }

}
void handleSharedEvent(const char *event, const char *data)
{
    String eventName = String( event ); // convert to a string object
    String deviceID = System.deviceID();
    String Loc = String(data);
    int count = Loc.toInt(); //convert the string data  into Int

    if( eventName.indexOf( deviceID ) != -1 ){
      return;
    } else {
        pixelLit(count); // Lights up the Pixel sent byt the other device
        
    }

}

//The function neoPixelCounter lets the user select the specific pixel they want to light up by the press of push button
//The function returns the pixel locetion to be transmiited to other devices.
int neoPixelCounter(){
    int newButtonState = digitalRead(pushButtonPin);

    uint32_t c = strip.Color(255, 255, 255);
    if (newButtonState != oldButtonState){
            if (newButtonState == LOW ){
                i++; //increase the position counter with press of button 
                //since the neoPixel strip is 30 led long the if condition and the modulo operator lets the user select the pixel in an rotational manner
                if (i>30){
                    strip.setPixelColor(i-1,0,0,0);
                    i = i % 30;
                    newButtonState = HIGH;
                    strip.setPixelColor(i-1,0,0,0);
                    delay(50);
                    strip.setPixelColor(i, c );
            		strip.show();
            		delay( 100 );
                }
                else{
                    newButtonState = HIGH;
                    strip.setPixelColor(i-1,0,0,0); //turns off the previous pixels.
                    delay(50);
                    strip.setPixelColor(i, c );
            		strip.show();
            		delay( 100 );
                }
        }
        delay(100);
    }
    oldButtonState = newButtonState; //prevents the overflow of button press
    return i;
}

void pixelLit(int pixelLoc){
    
    strip.setPixelColor(pixelLoc, 255,0,0 ); //lights up the specific pixel receviced through other device in red color.
    strip.show();
    delay( 100 );
    
}
Ranveer Katyal, Menghan Zhang, and Sijia Li (2019) Click to Expand
0

Circuit

0

Final Result

During the implementation of the project, we decided to have two pushbuttons for each device. One is to select the position of the light and the other one is to confirm and publish the light position on both ends.

0
Pixel Away Working Prototype_2019 IoT
Si Lee - https://youtu.be/r7W-Pd0TQWM
0

Reference

Ishac Bertran 

Slow Game designed by Bertran is our inspiration for Pixel Play. Other than the romance of Slow Game, Pixel Away is a social game that involves two people to play. Users can be friends, lovers, families, etc..

http://www.ishback.com/slowgames/index.html


x
Share this Project

This project is only accessible by signed in users. Be considerate and think twice before sharing.


Courses

49713 Designing for the Internet of Things

· 18 members

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


About

Our creative project is to help friends / couples connect with each other in a subtle and fun way. The device is a basic 10 by 10 square LED matrix and serves as a canvas for both sides to draw.

Created

February 10th, 2019