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
Our project aims to connect partners who are in a long distance relationship and feel the lack of their partner's presence.
Advanced technology enables people from all around the world to work and communicate remotely. However, it is never easy for people in romantic relationships to be apart. There are methods to communicate, express love by sending texts or know their wellbeing through social media, yet, people still suffer from a lack of presence which is essential for maintaining a relationship. Therefore, we wanted to solve for: how might we design an IoT device that will shorten the emotional distance between long-distance partners?
Our project aims to connect partners who are in a long distance relationship and feel the lack of their partner's presence. Users will have their own device which is paired with their partner's. By "booping" the device, it sends data to the device of your loved one to simulate a hugging motion. If seen, you can reciprocate your feelings and "hug" back. Our device simulates the act of hugging and enables partners to feel intimacy and presence in a physical form.
1. Designing and wiring the circuits
We developed two identical circuits for our paired devices. Each circuit has one FSR (Force Sensitive Resistor) and two Servos. Before we used the servos, we used one LED to check whether the FSR worked. For the concept to work, the FSR has to receive the data inputs and then servos output a rotating motion. Once the Photon gets an input from the FSR, the two servos of the paired device rotate their rotors. Thus, the servos represent the hugging arm, responding to the pressing action of the user.
2. Coding
As we followed the basic steps of connecting FSR, we encountered some problems. Servos of one device failed to respond to the data input from the other paired device. The possible reason behind this would be the poor internet condition which led to the Photon needing to reset sporadically and causing a very long delay. Moreover, we spent a long time to deal with our code to publish and subscribe Particle events for both devices.
3. Building the device
Next, we constructed a prototype of our figurine. We create patterns to test the size and used it to cut on parts to be sewn together. We sewed two identical patterns to build the body of our paired devices. We filled the body with cotton to express the soft touch of the body. Servo panels were built into the arms of the figurine.
// 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;
// Create values for the servomotors
int servoPinDig1 = D3;
int servoPinDig2 = D2;
Servo myServo;
Servo my2ndServo;
// Define values for force-sensitive resistor
int fsrPin = A0;
// Create a variable to hold the FSR reading
// Remember to add a 10K Ohm pull-down resistor too.
int fsrReading = 0;
// Create global variables for the event cases
String boop = ""; // formerly eventName
String a = "b"; // for passing the right event name based on data
void setup() {
myServo.attach( servoPinDig1 );
my2ndServo.attach(servoPinDig2 );
myServo.write(0);
my2ndServo.write(180);
Particle.subscribe( "diot/2018/paired/team4" , handleSharedEvent );
}
void loop() {
fsrReading = analogRead(fsrPin);
Particle.variable("fsrCurrent",fsrReading);
//delay(5000);
if(fsrReading > 2500){
// publish my event
a = "h";
//Particle.variable("fsrCurrent3",a); //test only
publishMyEvent(a); //high
// delay for a bit
delay(100);
}
else{
a = "l";
//Particle.variable("fsrCurrent3",a); //test only
publishMyEvent(a); //low
}
}
// These assume servos are mounted such that rotation direction is the same
// Thus to go in opposite directions, we start at 0 and 180 degrees
// and change them both by the same magnitude (135) to cross the arms
void individualServo1(){
myServo.write(135);
my2ndServo.write(45);
delay(200);
}
void individualServo2(){
myServo.write(0);
my2ndServo.write(180);
delay(200);
}
void publishMyEvent(String a)
{
// Particle.variable("fsrCurrent2",a); test only
if( lastPublishedAt + publishAfter < millis() )
{
boop = "diot/2018/paired/team4" + System.deviceID();
if (a=="h"){
Particle.publish(boop, "A sensor is above 2500" );
lastPublishedAt = millis();
}else{
Particle.publish(boop, "A sensor is below 2500" );
lastPublishedAt = millis();
}
}
}
void handleSharedEvent(const char *event, const char *data)
{
String boop2 = String( event ); // convert to a string object
String deviceID = System.deviceID();
if( boop2.indexOf( deviceID ) != -1 ){
// The event was published by MY photon
}else{
// The event was published by the OTHER photon
String whatDoesTheDataSay = String(data);
if(whatDoesTheDataSay == "A sensor is above 2500"){
individualServo1();
}else{
individualServo2();
}
}
}
Click to Expand
Our team worked really efficiently step by step through the circuitry and coding to make the connected devices work. We struggled the most with getting both devices to talk to each other. For further improvement, the delay between the devices would be reduced and the stability of the servos would be improved.
A hands-on introductory course exploring the Internet of Things and connected product experiences.
Our project aims to connect partners who are in a long distance relationship and feel the lack of their partner's presence.
February 12th, 2018