49-713 Designing for the Internet of Things
· 26 members
A hands-on introductory course exploring the Internet of Things and connected product experiences.
Found in Ambient Affect · UNLISTED (SHOWN IN POOLS)
Overview:
StressZONE is an ambient IoT product to help monitor incoming emails in turns to hopefully reduce stress. The StressZONE delivers a spinning light source indicating when you are receiving emails and how many emails you have. If the spinning light is spinning at a rapid pace you have several emails (over 5). It spins rapidly to mirror the emotion of your head spinning out of control under stress. When the spinning light is moving at an amble pace, the amount of emails you have is very little. By being able to see the spinning light in your peripheral vision, you can know when it is time to check your email without constantly wondering how many emails you have, and if you should do the daunting task of opening up your inbox. Once your emails are read, you simply press the button to reset the StressZONE. By inducing stress through rapid light motion, we hope to forward your thinking about checking emails and being up to date so you don't have moments of being overwhelmed.
Process:
Bill of Materials:
/*This program will alert the user that there is an increase in incoming emails
through lights and speed of a neopixel, it can be reset by pushing a button*/
#include "neopixel.h"
#include <math.h>
// IMPORTANT: Set pixel COUNT, PIN and TYPE
#define PIXEL_PIN D0
#define PIXEL_COUNT 24
#define PIXEL_TYPE WS2812B
int status = 0;
int pixel_position = 0;
int btnState = LOW;// initialize the button
int btn = D1;//Led btn
//No new emails, breathe
// IMPORTANT: Set pixel COUNT, PIN and TYPE
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);
void setup() {
Serial.begin( 9600 );
strip.begin();
strip.show(); // Initialize all pixels to 'off'
pinMode(btn, INPUT_PULLUP);
Particle.subscribe( "diot_breathe", emailcheck );
}
void loop() {
TurnOn();
if(status < 1){
breathe();
}
else if(1<=status<2){
colorchase();
}
else {fastcolorchase();
}
delay( 50 );
Serial.println (status);
}
void emailcheck(const char *event, const char *data){
status = status+1;
}
void TurnOn()
{
// find out if the button is pushed
// or not by reading from it.
int currentButtonState = digitalRead(btn);
if( currentButtonState == LOW && btnState != currentButtonState ){
status = 0;
}
btnState = currentButtonState;
}
/* Calc the sin wave for the breathing white led */
float breathe() {
float val = (exp(sin(millis()/2000.0*M_PI)) - 0.36787944)*108.0;
Serial.println( val );
uint16_t i;
uint32_t c = strip.Color(val, val, val);
for(i=0; i< strip.numPixels(); i++) {
strip.setPixelColor(i, c );
}
strip.show();
}
int colorchase() {
for(int i=0; i< strip.numPixels(); i++) {
uint32_t c;
if( pixel_position == i ){
c = strip.Color(50, 255, 10);
}else{
c = strip.Color(0, 0, 0);
}
strip.setPixelColor(i, c );
}
strip.show();
pixel_position++;
if( pixel_position >= strip.numPixels() )
{
pixel_position = 0;
}
}
int fastcolorchase() {
for(int i=0; i< strip.numPixels(); i++) {
uint32_t c;
if( pixel_position == i ){
c = strip.Color(255, 0, 0);
}else{
c = strip.Color(0, 0, 0);
}
strip.setPixelColor(i, c );
}
strip.show();
pixel_position++;
if( pixel_position >= strip.numPixels() )
{
pixel_position = 0;
}
}
//0 - 5 emails, increases by one dot for each email up to 5
//5+ emails, increase speed/change color
//Check emails, press button to reset*/
Click to Expand
Outcome
In the end we ended up being very successful in making our StressZONE prototype come to life. After having two neo pixels fail on us, we were able to figure out it was our code but actually the neo pixels! Figuring out how to coordinate the breathing with the colorhcase was probably the most stressful part of the whole coding process. We were able to hook up the emailing portion quite easily, and had success early on with the colorchase connecting to the emails as well. What stumped us was when we tried to incorporate colors and speed of the colorchase. We enjoyed working on it together as a team, and even during stressful moments we found reasons to laugh. We hope in the end StressZONE will help people be more proactive about checking emails so that anxiety doesn't set in from an overwhelming amount of emails we can all receive sometimes.
This project is only listed in this pool. Be considerate and think twice before sharing.
A hands-on introductory course exploring the Internet of Things and connected product experiences.
~
February 6th, 2017