Poking Teddy Bear

Made by hdw, gracielg and Matthew M · UNLISTED (SHOWN IN POOLS)

To create a teddy bear that pokes people awake.

Created: March 10th, 2018

0

Objective: 

The objective of this project is to create a bear that buzzes the other person awake with input from a remote location. The teddy bears comes as a pair. They buzz the other person awake when they are pressed on. 

0
//COMMUNICATING VARIABLES

// 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;

// VIBRATING VARIABLES
int vibrate = D0;

//BUTTON VARIABLES
int buttonState = 0;
int previousState = 0;
int buttonPin = D6;


void setup()
{
  // vibrator actions
  pinMode( vibrate, OUTPUT ); // sets pin as output
  digitalWrite( vibrate, LOW);
  // button actions
  pinMode( buttonPin , INPUT_PULLDOWN); // sets pin as input
  Particle.subscribe(  "diot/2018/paired/teddybear" , handleSharedEvent);
}


void loop()
{
  buttonState = digitalRead( buttonPin );
  Serial.println(buttonState);
  if (buttonState == 1)
  {
    publishMyEvent();
  }
  delay(1000);
}

void publishMyEvent()
{
  // Remember that a device can publish at rate of about 1 event/sec,
  // with bursts of up to 4 allowed in 1 second.
  // Back to back burst of 4 messages will take 4 seconds to recover.
  // So we want to limit the amount of publish events that happen.
  // check that it's been 10 secondds since our last publish
  if( lastPublishedAt + publishAfter < millis() )
  {
      // Remember our subscribe is matching  "db2018/paired/"
      // We'll append the device id to get more specific
      // about where the event came from
      // System.deviceID() provides an easy way to extract the device
      // ID of your device. It returns a String object of the device ID,
      // which is used to identify your device.
      String pushPaw = "diot/2018/paired/teddybear" + System.deviceID();
      // now we have something like "db2018/paired/0123456789abcdef"
      // and that corresponds to this devices info
      // then we share it out
      Particle.publish( pushPaw, "Paw Pressed" );
      // And this will get shared out to all devices using this code
      // we just pubished so capture this.
      lastPublishedAt = millis();
  }
}
// Our event handlde requires two bits of information
// This gives us:
// A character array that consists of the event name
// A character array that contains the data published in the event we're responding to.
void handleSharedEvent(const char *event, const char *data)
{

  Serial.println("got event");
    // Now we're getting ALL events published using "db2018/paired/"
    // This includes events from this device.
    // So we need to ignore any events that we sent.
    // Let's check the event name
    String pushPaw = 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( pushPaw.indexOf( deviceID ) != -1 ){
      // if we get anything other than -1
      // the event came from this device.
      // so stop doing stuff
      return;   //return call kicks us out of this function
    }
    // otherwise do your stuff to respond to
    // the paired device here
    //if we don't get kicked out of the function, go ahead and blink 5 times;
    beginVibrating();
}

void beginVibrating() {
  digitalWrite( vibrate, HIGH);
  delay(3000);
  digitalWrite( vibrate, LOW);
  delay(2000);
}
Click to Expand
0

Project breakdown

1) Brainstorming & Group Activity

Initially, we rapid brainstormed a list of ideas for three minutes. Some of our favorite ideas were:

a cup that vibrates when it's been empty, full, or untouched for too long (good for social drinking)

a remote app that allows the owner to interact and take care of their pet

an app for detecting the stress level of and soothing a long-distance partner

a remote night-light that allows one to communicate their status, especially if they're up to talk or not.

At the end, we decided we liked the idea of strengthening long-distance relationships. After some time, we chose an idea of a two teddy-bear system that could poke their partner awake. 

0

2.) Iteration

METHOD 1: RELAY

Originally, we started building the project with a clicker, a relay, a resistor and a solenoid. We use a 2.2-5V plug to power the relay that should have needed 9V power and by some stroke of ingenious fate, it worked. 

0

However, because it was incorrect and wasn't actually supposed to work, we tried a different method.

METHOD 2: USING A TRANSISTOR

We tried using a transistor instead of a relay. It was supposed to be more stable, and we were given this diagram for help. However, in the process of trying this out, we killed two Particle devices. Booooo. 

0

This is how we wired it up before the particle short-circuited: 

0

We also sent 12 V through it. When we first did this, we freaked out bc we didn't know what to do without enough particles. We asked the grad class TA, Roberto, for help. 

0

A snippet of remotely diagnosing our Particle device.

After they were confirmed dead, we went home.

METHOD 3: DESPERATION

The next day, we went back bright and early to try again. We ended up with something like this: 

0

We used a volt meter to measure the connection of different parts of the circuit to find where the connections were weak. We followed the frizting diagram to find a model of a working circuit with for Arduino with a solenoid, which we then made.

METHOD 4: Buzzer

0

We tested 2 moffsets with our original solenoid but found that it wouldnʼt connect.

In the end, we changed our clicker interaction into one with a buzzer and it worked with our circuit perfectly.

METHOD (STEP) 5: TEDDY BEAR

After we narrowed our working circuits, we cut open two teddy bears and put in our solenoids into the arm of the bear.

0

Our final procedure was simplified into this:

0

Our final bill of materials:

2 Photon units

wires

2 buzzers

2 solenoids

2 mofsets

2 teddy bears


Our working prototype is shown below: 

0
0
x
Share this Project

This project is only listed in this pool. Be considerate and think twice before sharing.


Courses

49313 Designing for the Internet of Things (Undergrad)

· 22 members

A hands-on introductory course exploring the Internet of Things and connected product experiences.


About

To create a teddy bear that pokes people awake.