What's on your mind?
Made by Jesse Park, Shannon Cui and Himanshu Rasam
Made by Jesse Park, Shannon Cui and Himanshu Rasam
send your emotion to your loved one without using your phone by simply rotating a dial.
Created: February 9th, 2016
Our project is designed for the loved ones, a couple or a friend, who would like to easily communicate how they feel to each other. Using a phone has become too complicated. We are inundated with notifications from countless apps we use and our important notifications can get easily buried if we are careless.
We wanted to create a different notification system that lived outside the cell phone. For example, I would rotate a dial to the mood I am in. This mood will be sent to my partner's device through an LED and he or she will know how I feel without looking at the cell phone. The communication is thus simpler and easier to manage than through regular text messaging.
We first had to find a way to send and receive signals through Particle. In order to test this functionality, we built the code and the hardware without the potentiometer to reduce the complexity. Because a sensor was not used, we used a cloud function to act like the potentiometer was sending signals and checked if the LED had changed on the different device.
Once the sending and receiving part of the code was completed, we moved on to integrating potentiometers. We first used a slider potentiometer, but we accidentally burnt it. To not repeat our mistake, we changed our sensor to a rotating potentiometer, which we found a lot easier to use. Getting the value was easy, but integrating with the pre-written code was more difficult. We had to revise our code slightly to have them work together.
After finalizing the code and the hardware, we built props to make our project more attractive.
This is our 3rd project, and it has gone very smoothly for us. We weren't stuck on any big coding problems. We believe this was achieved by coding little by little and trying not to do too much. This simplified our code and had us understand the code more fully. We would like to repeat our smooth progress we have achieved from this project in our next assignment.
int potPin = A1;
int ledPin1 = D0;
int ledPin2 = D1;
int ledPin3 = D2;
int potPosition;
int currentPosition = analogRead(A0);
int newPosition = analogRead(A0);
void setup() {
pinMode( ledPin1 , OUTPUT ); // sets pin as output
pinMode( ledPin2 , OUTPUT ); // sets pin as output
pinMode( ledPin3 , OUTPUT ); // sets pin as output
pinMode( potPin, INPUT ); //sets pin as input
digitalWrite(ledPin1,LOW);
digitalWrite(ledPin2,LOW);
digitalWrite(ledPin3,LOW);
Particle.subscribe( "jesse2016/paired/emoji-change" , handleEmojiChange );
//Particle.function( "lightEmoji" , lightEmojiFromCloud );
Serial.begin(9600);
}
void loop()
{ int newPosition = analogRead(A0);
Serial.print("NewPosition ");
Serial.println(newPosition);
delay( 1000 );
//announcePosition( newPosition );
if( newPosition != currentPosition )
{
// if they're not the same
// then announce it
announcePosition( newPosition );
// update the remote position variable
currentPosition = newPosition;
// wait 1 second before transmitting again
delay( 1000 );
}
}
void announcePosition( int newPosition )
{
// Combine the device ID and desired angle / servo position
// into a data string
String myID = System.deviceID();
String data = String(newPosition) + "," + myID;
// and share as a public event
Particle.publish( "jesse2016/paired/emoji-change", data );
}
// Cloud function to set the pot position
int lightEmojiFromCloud( String command )
{
int newPosition = command.toInt();
announcePosition( newPosition );
return 1;
}
// Event handler
// Triggered when a new event is recieved
// It will look like 106,ADF1347893274289374
// i.e. angle,device_id
void handleEmojiChange(const char *event, const char *data)
{
// Display what we got
Serial.println( "received=" );
Serial.println( data );
Serial.println( event );
// conver the data to a String type.
String dataStr = data;
// check for error stuff
// if there isn't data do nothing
if (!data) return;
// We only want to handle events
// From our paired device
// We're not interested in stuff that's come from
// this device ...
String myID = System.deviceID();
// if the device that sent is this device... ignore. return exits this function
if( dataStr.indexOf( myID ) > -1 ) return;
// If we get to here, it's an event we care about
Serial.println( "Not from another ... ");
// Extract the angle from the data string
// by chopping off the piece before the comma
int index = dataStr.indexOf(",");
String value = dataStr.substring( 0, index );
int newPosition = value.toInt();
// move the servo to the new position
lightEmoji( newPosition );
}
// Move the servo to where we want it to be...
void lightEmoji( int newPosition )
{
//happy
if (newPosition >= 0 && newPosition < 700 ){
digitalWrite(ledPin1,HIGH);
digitalWrite(ledPin2,LOW);
digitalWrite(ledPin3,LOW);
}
//sleepy
if (newPosition >= 700 && newPosition < 2000 ){
digitalWrite(ledPin1,LOW);
digitalWrite(ledPin2,HIGH);
digitalWrite(ledPin3,LOW);
}
//love
if (newPosition >= 2000 && newPosition < 5000 ){
digitalWrite(ledPin1,LOW);
digitalWrite(ledPin2,LOW);
digitalWrite(ledPin3,HIGH);
}
}
Click to Expand
This course charts the emergence of the now "connected world" to explore the possibilities for future products and connected spaces.
send your emotion to your loved one without using your phone by simply rotating a dial.