49713 Designing for the Internet of Things
· 25 members
A hands-on introductory course exploring the Internet of Things and connected product experiences.
Found in DIoT 2018 3: Connected Intimacy and DIoT 2018 2: Ambient Affect
Encouraging rituals beyond borders
The goal of this project is to strengthen couples rituals beyond boundaries. We focused on a particular ritual of holding hands while walking through cherry blossom fields. Our motivation for making this project is to support our classmates that are in long distance relationships and don't have the opportunity to continue to practice meaningful rituals that they have with their partners.
Each partner can place his or her object in her room . Our intimacy objects consists of a teddy bear and glass dome that contains cherry blossom petals. When a partner thinks of the other person, he or she squeezes the hand of their teddy bear which sends a signal to their partner's glass dome. A simulated current of air will make the petal move inside the glass dome. The simulated movement of the petals will bring back the couples memory of walking and holding hands through cherry blossom's fields. If the partner is next to the object, he or she will be able to see it and reply to the signal, indicating that as a couple they are not only thinking of each other but also keeping a tradition that the couple has alive.
Our team was really interested in exploring how we could incorporate movement and touch to our intimacy object. We brainstormed different rituals that we thought couples or families cared about and were difficult to replicate because of long distances. We really enjoyed the story that one of our team members shared around cherry blossom festivals.
Once we aligned on a scenario, we explored how we could create movement inside the glass dome and how we could incorporate touch as the trigger for our intimacy object. We tested different servos and fans to determine the best option for our object. Once the code, the input (squeeze sensor) and output (blower) were incorporated, we developed the base to host the glass dome.
Challenges:
As we developed our prototype, we encountered the following challenges:
For one intimacy object
Inside Components:
Outer Shell:
// Define a pin we'll place an LED on
int ledPin = D2;
// Pin locations on the Particle
int buttonPin = D0;
int flexPin = A0;
int fanPin = D1;
int flexReading = 0;
int flexValue = 0;
long lastPublishedAt = 0; //not sure what this is for?
// from this device
int publishAfter = 10000;
unsigned long duration;
unsigned long timeLength = 10000; // run blower for 10 seconds.
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(buttonPin , INPUT_PULLUP);
pinMode(flexPin, INPUT_PULLUP);
pinMode(fanPin, OUTPUT);
Particle.variable("flex", &flexReading, INT);
Particle.variable("brightness", &flexValue, INT);
Particle.subscribe( "diot/2018/connected/bearinmind" , handleSharedEvent );
}
void loop()
{
// find out if the button is pushed
// or not by reading from it.
int buttonState = digitalRead( buttonPin );
flexReading = analogRead(flexPin);
flexValue = map(flexReading, 3246, 3680, 0, 255);
if( abs(flexValue) >= 175 )
{
int loopTime = millis();
publishMyEvent();
while(millis() <= loopTime + timeLength){
digitalWrite( ledPin, HIGH);
digitalWrite( fanPin, HIGH);
}
}else{
digitalWrite( ledPin, LOW);
digitalWrite( fanPin, LOW);
}
}
void publishMyEvent()
{
// check that it's been 10 secondds since our last publish
if( lastPublishedAt + publishAfter < millis() )
{
String eventName = "diot/2018/connected/bearinmind" + System.deviceID();
// then we share it out
Particle.publish( eventName, "Thinking of you..." );
lastPublishedAt = millis();
}
}
void handleSharedEvent(const char *event, const char *data)
{
// Now we're getting ALL events published using "diot/2018/connected/bearinmind"
// This includes events from this device.
// So we need to ignore any events that we sent.
// 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();
if( eventName.indexOf( deviceID ) != -1 )
{
// if we get anything other than -1
// the event came from this device.
// so stop doing stuff
return;
}
// otherwise do your stuff to respond to
// the paired device here
int loopTime = millis();
duration = loopTime - millis();
while(millis() <= loopTime + timeLength){
digitalWrite( ledPin, HIGH);
digitalWrite( fanPin, HIGH);
}
}
Click to Expand
As a team we enjoyed experimenting with the blower and the flex sensor. It provided is with a new challenge to learn to work with new inputs and outputs. We also learned to leverage different functions within our code (e.g., while) as well as work with transistors and diodes. Placing an LED within our board was also a successful way to understand if our code was working. We also used a motor at the beginning to test the output of our object. Finally as a team we leveraged our strengths which enabled us to work effectively and produce a prototype that we were proud of.
1. template for pairing devices: https://diot2018.slack.com/files/U8J0Q602U/F968KM3A9/template_code_for_paired_devices.txt
2. tutorial for flex sensor: https://learn.adafruit.com/force-sensitive-resistor-fsr
3. Circuit tutorial for transistor: https://www.arduino.cc/en/Tutorial/TransistorMotorControl
A hands-on introductory course exploring the Internet of Things and connected product experiences.
A hands-on introductory course exploring the Internet of Things and connected product experiences.
Encouraging rituals beyond borders
February 10th, 2018