Pixel Activity Tracker Prototype

Made by Ruipeng Liu, Zhuoran Gao and Vaibhav Gupta

Found in DioT 2019: Social Objects - Part 2

The goal of the project is to provide a very simple and intuitive way to remind people to work out, and motivate them to work out with friends.

0

Introduction

Our project is to provide a very simple and intuitive way to remind people to work out, and motivate them to work out with friends. We are proposing 8x8 LED pixels to display a smiley face with a bar indicating the activity level of the person throughout the day. The bar fills as the person becomes more active, and therefore encourages the person to work out more. There is also a second bar indicating the ‘friend’s’ activity level, reading through WiFi. When 2 people wearing the device meet, there can be a interaction animations between the watches, and the device encourages the owners to do running or other exercises together.


0

Process

For our first working prototype, since the pixel matrix is not yet available, we are utilizing 2 pixel bands and 1 accelerometer. The acelerometer determines the wearer's activity level. Based on the activity level of the wearer, the 1st led band will display a number of lights to inidicate how active the wearer is. The 2nd led band will display the friend's activity level using wifi to gain data.

0

Code


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

#define x_axis A0
#define y_axis A1
#define z_axis A2
#define PIXEL_PIN D4
#define PIXEL_COUNT 11
#define PIXEL_TYPE WS2812

int x_val;
int y_val;
int z_val;
int steps = 0;
int up = 0;
int down = 0;
long lastPublishedAt = 0;
int publishAfter = 10000;
int ledPos = 0;

Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

void setup() {
    
    Particle.subscribe(  "diot2019/steps_count" , handleSharedEvent );
    strip.begin();
    strip.show();
    
    pinMode(x_axis, INPUT);
    pinMode(y_axis, INPUT);
    pinMode(z_axis, INPUT);
    
    Particle.variable("X",&x_val,INT);
    Particle.variable("Y",&y_val,INT);
    Particle.variable("Z",&z_val,INT);
    Particle.variable("Steps",&steps,INT);
    Particle.variable("LED",&ledPos,INT);
}

void loop() {
    
    //up=0;
    //down = 0;
    
    x_val = analogRead(x_axis);
    y_val = analogRead(y_axis);
    z_val = analogRead(z_axis);
    
    if (x_val<1820) {
        up = 1;
        delay(200);
    }
    
    if (x_val>2020) {
        down=1;
        delay(200);
    }
    
    if (up==1&&down==1) {
        steps++;
        up=0;
        down=0;
    }
    
    publishMyEvent();
}


void publishMyEvent() {
    if( lastPublishedAt + publishAfter < millis() ) {
        String eventName = "diot2019/steps_count" + System.deviceID();
        Particle.publish(eventName, String(steps));
        lastPublishedAt = millis();
    }

}

void handleSharedEvent(const char *event, const char *data) {
    String eventName = String(event);
    String dataValue = String(data);
    String deviceID = System.deviceID();
    
    if (eventName.indexOf( deviceID ) != -1) {
        return;
    } else {
        ledPos = (dataValue.toInt()/10)%11;
        lightUp();
    }
    
}

void lightUp() {
    
    uint16_t i;
    uint32_t c = strip.Color(255, 0, 0);
    uint32_t c2 = strip.Color(0, 0, 0);

    for(i=0; i< strip.numPixels(); i++) {
        if (i==ledPos) {
            strip.setPixelColor(i, c);
        } else {
            strip.setPixelColor(i, c2);
        }
		strip.show();
		delay( 100 );
	}
}
Click to Expand
0

Final Results

As indicated from the video, the LED band will close the loop as you become more active (tracked in steps you have walked). The 2nd band displays the activity level of your close friend, which is done via wifi through your friend's band. 

0

Next step

Utilizing the pixel matrix upon arrival, The interactions can be more intuitive and fun. First, the person’s activity level can be displayed as a smiley face. When the person reaches a certain level of activeness, the smiley face displays an animation of  encouraging. When 2 friends wearing the same device meet, the display shows a rainbow color of smiley faces, and encourages a race together. The goal is to be intimate among friends, and also encourages a healthy living. 

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.


About

The goal of the project is to provide a very simple and intuitive way to remind people to work out, and motivate them to work out with friends.

Created

February 10th, 2019