For our final project we initially wanted to make a phone case that would alert a third party if the user was in danger and unable to text. However, we realized that this information wouldn’t be particularly useful unless the recipient was given a way to act on the information; we thought that having the button press on the phone case send the GPS coordinates of its location would be a good solution, but we didn’t feel that that was a reasonable goal given our experience.
Our next idea was to pitch the same basic messaging system a a means of communication for parents and children who are too young to use cell phones but whose parents would want to hear from them throughout the day. After many iterations of this design, we settled on a teddy bear that would, when squeezed or hugged, send a message to the parent’s computer saying “I miss you” along with an audio file to get the parent’s attention if they are away from their computer. When the parent clicks the window, an LED lights up in the bear to show the child that their parent has received their message. Somewhere between inadvertently settling on red and black as a color scheme for the bear and having a little too much fun mixing the audio file, however, we seemed to have taken a turn for the satanic but decided to run with it in the name of memorability.
The benefits of teamwork: saving time and combining efforts. Anna is responsible for the teddy-bear design, embedding the Arduino, figuring out the circuit schematic, working on the basics of the coding, and building a prototype; Sam then built a second prototype using a smaller breadboard, added to, refined, and debugged the code, and added the audio file. Both of us spent a considerable amount of time working together to ensure that the Arduino was embedded properly and the teddy was working consistently.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
int fsrAnalogPin = 1; // the FSR and 10K pulldown are connected to a1 int fsrReading; // the analog reading from the FSR resistor divider char val; // Data received from the serial port int ledPin = 13; // Set the pin to digital I/O 13 //boolean ledState = LOW; //to toggle our LED void setup(void) { Serial.begin(9600); pinMode(ledPin, OUTPUT); // Set pin as OUTPUT //initialize serial communications at a 9600 baud rate Serial.begin(9600); establishContact(); // send a byte to establish contact until receiver responds } void loop(void) { fsrReading = analogRead(A0); Serial.println(fsrReading); Serial.print("Analog reading = "); Serial.print(fsrReading); // the raw analog reading if (fsrReading < 800) { Serial.println(" - No pressure"); Serial.println(0); } else if (fsrReading >= 800) { Serial.println(" - Light squeeze"); Serial.println(1); } if (Serial.available() > 0) { // If data is available to read, val = Serial.read(); // read it and store it in val if(val == '1') //if we get a 1 { // ledState = !ledState; //flip the ledState digitalWrite(ledPin, HIGH); delay(2000); digitalWrite(ledPin, LOW); } } else { Serial.println("Hello, world!"); //send back a hello world } } void establishContact() { while (Serial.available() <= 0) { Serial.println("A"); // send a capital A } } // Referenced: www.ladyada.net/learn/sensors/fsr.html */ //and https://learn.sparkfun.com/tutorials/connecting-arduino-to-processing |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
import ddf.minim.spi.*; import ddf.minim.signals.*; import ddf.minim.*; import ddf.minim.analysis.*; import ddf.minim.ugens.*; import ddf.minim.effects.*; import processing.serial.*; Serial mySerial; Minim minim; AudioPlayer file; boolean hasPressed; void setup(){ size(800,600); background(255); println(Serial.list()); String portName = Serial.list()[11]; mySerial = new Serial(this, portName, 9600); mySerial.readStringUntil('\n'); minim = new Minim(this); file = minim.loadFile("MissYou.mp3"); hasPressed = false; } void draw(){ } void serialEvent (Serial _Port){ if (mySerial == null) return; String input = mySerial.readStringUntil('\n'); if (input != null) { //if input is not null, person is in distres, display SOS input = input.trim(); if (hasPressed == false) { smooth(); text("The devil doesn't miss you yet", 40, 100); textSize(50); fill(#F20707); } if (input.equals("1")) { hasPressed = true; background(#F20707); text("Click anywhere to exorcise.", 85, 100); textSize(50); fill(255); file.play(); } if (mousePressed == true) { //if we clicked in the window mySerial.write('1'); //send a 1 println("1"); } // when you've parsed the data you have, ask for more: mySerial.write("A"); } } void mousePressed(){ if (mousePressed) { background(255); fill(0); textSize(60); text("Exorcism successful.", 110, 400); textSize(50); fill(#F20707); } } |