Recent Changes - Search:

Main
Intro to PComp Home
Weekly Topics & Assignments
Wednesday Class Dates

Links:

Final Projects


Midterm Projects

PmWiki

edit SideBar

PetCombatRoyale

Blanka Lenart
Tim McNerney

Concept
Pet Combat Royale (PCR) is an advanced electronic playpen for the furry loved ones in your life. If you have two pets who like to play, then you probably already know how entertaining it can be to watch them chase each other around. Enhance the experience with the PCR advanced playpen set!

Inspiration
Meet Nike the dog

and Taxi the cat.

Originally we got excited about making a project with wearables. Then we started getting into the idea of doing something with Nike and Taxi. This led us to think about wearables for animals. We came up with the idea for Pet Combat Royale one day while hanging out at Blanka's place watching the two animals play. The two are very similar in size but amazingly different in the way they move, making for very entertaining wrestling matches.

Pet Combat Royale is based in animal play and does not promote violence toward animals in any way. No animals were hurt in the making of this project. PCR plays with the idea of a perceived activity. The animals appear to be fighting, but they are play-wrestling.

Components

  • Advanced electronic playpen featuring 2 sensing sides: "turf A" and "turf B".
    • Turf A has an IR sensor in the middle of the side.
    • Turf B has a hall effect sensor on the other side.
  • Two enhanced pet wearables (for small dogs and/or cats.) One wearable contains an IR emitter. The other contains a magnet.
  • Light-up LED action! Lights go off when the sensors are triggered.
  • Scoreboard: analog slide-along snowflakes providing an interface for human interaction with gameplay
  • Easy-gate velcro door: fourth wall can lay flat on ground for ease of entry/exit.
  • "Winter snow" look

Code
Hall Effect Sensor

//////////////////////////////////////////////
/* PET COMBAT ROYALE
   MAGNET

    Final Project
    Phys Comp Fall 2006
    12/13/06

    Tim McNerney, code warrior
    Blanka Lenart, design maven
*/        
//////////////////////////////////////////////

// declare variables:
int hesPin = 2;      //  digital input pin for the hall effect sensor
int LedPin3 = 3;   //  digital output pin for an LED
int LedPin4 = 4;   //  digital output pin for an LED
int LedPin5 = 5;   //  digital output pin for an LED
int LedPin6 = 6;   //  digital output pin for an LED
int hesState = 1;    // the state of the hall effect sensor

void setup() {
  pinMode(hesPin, INPUT);       // set the hes pin to be an input
  pinMode(LedPin3, OUTPUT);   // set the LED pin to be an output
  pinMode(LedPin4, OUTPUT);   // set the LED pin to be an output
  pinMode(LedPin5, OUTPUT);   // set the LED pin to be an output
  pinMode(LedPin6, OUTPUT);   // set the LED pin to be an output}
}

void loop() {
  // read the hes input:
  hesState = digitalRead(hesPin);

  if (hesState == 0) {
    // if the switch is closed:
    digitalWrite(LedPin3, HIGH);    // turn on the LED
    digitalWrite(LedPin4, HIGH);    // turn on the LED
    digitalWrite(LedPin5, HIGH);    // turn on the LED
    digitalWrite(LedPin6, HIGH);    // turn on the LED
    } 
  else {
    // if the switch is open:
    digitalWrite(LedPin3, LOW);   // turn off the LED
    digitalWrite(LedPin4, LOW);   // turn off the LED
    digitalWrite(LedPin5, LOW);   // turn off the LED
    digitalWrite(LedPin6, LOW);   // turn off the LED
  }
}

Infrared Sensor

//////////////////////////////////////////////
/* PET COMBAT ROYALE
   INFRARED

    Final Project
    Phys Comp Fall 2006
    12/13/06

    Tim McNerney, code warrior
    Blanka Lenart, design maven

    Special thanks to:
      Team Lightbox: Greg Stringer, Minsoo Lee, Rory Nugent
        -- the IR code was taken from their midterm.
      Nike the dog and Taxi the cat
        -- no animals were harmed in this production.
*/        
//////////////////////////////////////////////

// Infrared sensor in analog pin 0
// triggers YELLOW LEDs in digital pins 2, 3, 4, and 5

int irSensor = 0;          // analog IR sensor #0 pin
int irValue = 0;           // analog 

// YELLOW LED lights for infrared sensor

int lightLED2 = 2;
int lightLED3 = 3;
int lightLED4 = 4;
int lightLED5 = 5;

//////////////// M A G I C ////////////////////

int irNoiseSensor = -1;    // noise readings from each sensor
unsigned long time = 0;

void setup()
{
  Serial.begin(9600);
}

void loop()
{
   time = millis();       // read current run time in milliseconds
   if(time < 3000)        // initialize lightbox if time is less than 3 seconds (3000ms)
     Initialize();
   else if(time >= 3000)
   {
     //read analog values from the IR detectors (nearby IR light)
     irValue = analogRead(irSensor);

     calibrate_readings();  //calibrate the analog IR readings (i.e. remove noise and limit values from 0-255)

     //write analog readings to the LEDs
     analogWrite(lightLED2,255-irValue);
     analogWrite(lightLED3,255-irValue);
     analogWrite(lightLED4,255-irValue);
     analogWrite(lightLED5,255-irValue);

     Serial.print(irValue);
     Serial.print("\t");
     Serial.println();

     delay(10);
   }
}

// initialize the light box by running start-up sequence and scanning for ambient infrared noise
void Initialize()
{
  int tempRead = 0;

  //turns on LEDs according to the time
  if(time >= 0 && time < 1000) {
    analogWrite(lightLED2,0);
    analogWrite(lightLED3,0);
    analogWrite(lightLED4,0);
    analogWrite(lightLED5,0); }

  else if(time >= 1000 && time < 2000) {

  tempRead = analogRead(irSensor);  //grab an analog reading from each sensor

  //check to see if the new analog reading is higher than the stored noise reading, if so make the new reading the new noise value
  if(tempRead > irNoiseSensor)
    irNoiseSensor = tempRead;
  }
}

void calibrate_readings()
{
    //remove ambient noise from readings
    irValue = irValue - irNoiseSensor;

    //be sure no values go below 0
    if(irValue < 0)
      irValue = 0;

    //truncate all values at 255
    if(irValue > 255)
       irValue = 255;
}

Assembly

  1. PCR playpen enclosure (white foamcore, velcro, fabric)
  2. Sensors: Hall effect and Infrared
  3. 2 Arduino boards, solderless breadboard
  4. Wires, LEDs, power

Here is the constructed pen, before decorations

We took a break from building to make this xmas tree!

The finished product


Play testers in action (video)
http://itp.nyu.edu/~mcnert01/files/playtest1.mp4

Going Forward

Improvements
The sensors need to be able to detect a wider angle.

Have a happy holiday everyone!


Edit - History - Print - Recent Changes - Search
Page last modified on December 13, 2006, at 07:12 PM