Hello, How May I Help You?

Snoopdoll

Do you often have guests over and wonder what they’re doing when you’re not looking?  Perhaps, they’re getting too comfortable and have stopped asking before they open your drawers in the kitchen, bathroom, bedroom, etc. to get what they need? 

Hello, How May I Help You? is an adorable and friendly solution for such people like you.  Simply place the doll into a drawer of your choice, and turn on the switch before guests arrive.  If they snoop into your drawer, the doll will "greet" them with a message when it opens.

http://vimeo.com/moogaloop.swf?clip_id=2619450&server=vimeo.com&show_title=1&show_byline=0&show_portrait=0&color=ffffff&fullscreen=1
How May I Help You? (Final Form) from Fuki on Vimeo.

Originally, I had ears on the doll.  But it looked quite interesting without them, so I didn’t include them:

Sketch_2Cimg2431

Behind the scene:

Cimg2428Cimg2432

Cimg2465Cimg2467

Cimg2469
Cimg2438

Cimg2440Cimg2472

Cimg2443

The face of the doll can be changed to any characters you’d like.  Another variation I attempted is below:

Cimg2476

Other forms that were tried prior to the final one:

Cimg2288_2

Cimg2289Cimg2292

The code that was used for this project is here:

/*Fuki
Final Project: How May I Help You?
Wireless Toys
*/

/* Parts of the code also taken from:
* Analog Average – Rolling Buffer
* Jeff Gray – 2008
* ——————
* Averaging Code, modified from Dave Millis example
*/

// INPUT: IR Sensor should be connected to 5V and GND
int irPin = 3; // IR Sensor output connected to analog pin 3
int irVal = 0; // Variable to store the input from the IR Sensor

// OUTPUT: Use digital pins 9 & 10, the Pulse-width Modulation (PWM) pins
int playPin = 9;   // Play,   connected to digital pin 9
int fwdPin = 10;  // Forward, connected to digital pin 10

// Program variables
int playVal = 0;   // Variables to store the values to send to the pins
int fwdVal = 0;

int average[100];  //an array to calculate the average
byte counter = 0;
int averaged;

int DEBUG = 1;          // Set to 1 to turn on debugging output

void setup()
{
  pinMode(playPin, OUTPUT);   // sets the pins as output
  pinMode(fwdPin, OUTPUT);   

  if (DEBUG) {           // If we want to see the pin values for debugging…
    Serial.begin(9600);  // …set up the serial ouput in 0004 format
  }
}

// Main program
void loop()
{
   irVal = analogRead(irPin);   // read the IR sensor value at the input pin
   average[counter] = irVal;
 
  byte c;
  int total = 0;
 
  for(c = 0; c < 100; c++){
    total += average[c];
  } 
 
   averaged = total / 100;
 
  if(counter = 100){
    contrlPlay();
  }
 
  counter = (counter + 1) % 100;
 

  if (DEBUG) {                     // If we want to read the output
    DEBUG += 1;                    // Increment the DEBUG counter
    if (DEBUG > 10)               // Print every hundred loops
    {
      DEBUG = 1;                   // Reset the counter
                                   // Serial output using 0004-style functions
      Serial.print("irVal:");    // Indicate that output is play value
      Serial.print(irVal);       // Print play value
      Serial.print("\t");          // Print a tab
      Serial.print("averaged:");          // Repeat for grn and blu…
      Serial.print(averaged);
      Serial.print("\n");   

    }
  }
}

void contrlPlay(){
    if (averaged <= 8) {  // Middle of IR sensor range
      playVal = LOW;  // play
      //delay(300);
      fwdVal = HIGH; 
      delay(300);
    }
      else if (averaged >= 8) { // Middle third of IR sensor range
      playVal = HIGH;
      //delay(300);
      // play
      //fwdVal = HIGH;
      delay(300);
    }
      else  // Catch anything else
    {
      playVal = HIGH;
     //delay(300);
      fwdVal = HIGH; 
     delay(300);      
    }

    //delay(300);
    digitalWrite(playPin, playVal);   // Write values to the output pins
    //delay(300);
    digitalWrite(fwdPin, fwdVal);
  }