Stress Cat

by elkhuu in Circuits > Arduino

2137 Views, 4 Favorites, 0 Comments

Stress Cat

InstructionImages_cat_Artboard 3.jpg

Feeling fidgety or on edge while working from home? Don’t have a pet to torment play with? Pet, poke, and smoosh this office companion instead! See what makes it purr or lash out 😼.

Remix suggestion:
Not into cats? How about making a dinosaur, or unicorn?

Supplies

CIRCUIT

  • Loomia Mini Pressure Matrix
  • Loomia Serpentine Bus
  • Arduino Nano Every with header pins and micro USB cable
  • Vibration motor (x2)
  • LED (x1)
  • Resistor, at least 150 ohm (x1)
  • Wire
  • Breadboard
  • Candybar battery pack with 2AMP draw and micro USB cable
  • Soldering iron, solder
  • Hot glue

CAT

  • Cushion foam, or other stuffing material
  • Spandex
  • Embroidery thread (for face)
  • Velcro and/or snap button tape
  • Thread
  • Sewing needles/sewing machine

Start With the Circuit!

InstructionImages_cat_circuit-09.jpg
InstructionImages_cat_circuit-11.jpg
InstructionImages_cat_circuit-12.jpg
InstructionImages_wire-05.jpg
InstructionImages_cat_circuit-10.jpg

I used two motors. Use more or less as you please/as your power source allows!

Extend the wire length of the vibration motors

  • Solder the ends of the vibration motors to longer wires. Mine were ~6" long.
  • Apply hot glue around the insulation and the exposed wire. This reliably provides strain relief and prevents the vibration motors from ripping themselves off of the wire!

Solder wires onto the LED

  • Bend the wires on the LED into loops. Trim the excess wire.
  • The pictured wires are ~11" long

Solder wires to the the serpentine bus

  • On one end of the bus, solder four wires onto the pads. Two will be used for power, and two will be used for ground. I recommend color coding the wires so you know which are the voltage wires versus ground wires.
    • If you’re using stranded wire, twist the strands together and solder them.
    • If you press the wires directly into the breadboard like I did, you can add a dab of hot glue around the wire where it exits the insulation to provide some strain relief!
  • On the other end of the bus, solder the vibration motor wires to the pads. Check that your power and ground wires are on the correct pads!

Solder wires onto the pressure matrix

  • Solder the wires to the pads of the pressure matrix
  • I recommend using 6 different colors for easy recognition later!
    • Again, if you’re using stranded wire, twist and solder the wires together.
    • You can also use the hot glue trick again 😉.

Connect all the components together - use the image for reference!

Use the Arduino IDE to Load the Code Onto the Arduino. Test It Out and Try Customizing the Cat's Reactions!

/*
This code adapts code originally found at https://www.kobakant.at/DIY/?p=7443
Pressure Sensor Matrix Code
parsing through a pressure sensor matrix grid by switching individual
rows/columns to be HIGH, LOW or INPUT (high impedance) to detect
location and pressure.

Instead of using additional resistors, this code uses the resistors
embedded in the Arduino.
*/

#define numRows 3
#define numCols 3
#define sensorPoints numRows*numCols
#define minRead 500

int rows[] = {A0, A1, A2};
int cols[] = {5,6,7};
int outputPin = 9;
int outputVib =3;

int incomingValues[sensorPoints] = {};
int sensorValue = 0;
int voltage = 0;

////////////////////////////////////Functions
// Check all the incoming values from the pressure matrix

bool ifSquished(void) {
  for(int i=0; i < numRows*numCols; i++) {
    if ((incomingValues[0]< minRead) || (incomingValues[1]< minRead) || (incomingValues[2]< minRead) || (incomingValues[3]< minRead) || (incomingValues[4]< minRead) 
    || (incomingValues[5]< minRead) || (incomingValues[6]< minRead) || (incomingValues[7]< minRead) || (incomingValues[8]< minRead)) {
      return true;
    }
  return false;
  }
}

bool ifPoked(void) {
    for(int i=0; i < numRows*numCols; i++) {
        if ((800 < incomingValues[i]) && (incomingValues[i] < 1015)) {
            return true;
        }
    }
    return false;
}

bool ifScratches(void) {
    for(int i=0; i < numRows*numCols; i++) {
        if ((minRead < incomingValues[i]) && (incomingValues[i] < 800)) {
            return true;
        }
    }
    return false;
}


bool nothingPressed(void) {
 for(int i=0; i < numRows*numCols; i++) {
        if (incomingValues[i] < 1015) {
        return false;
        }
    return true;
    }
}

////////////////////////////////////Main Code

void setup() {
  // set all rows and columns to INPUT (high impedance):
    for (int i = 0; i < numRows; i++) {
      // Enabling 5V on all sensors
    pinMode(rows[i], INPUT_PULLUP);
    }

    for (int i = 0; i < numCols; i++) {
      //Turning off GND from all sensors
    pinMode(cols[i], INPUT);
    }

  pinMode(outputPin, OUTPUT);
  pinMode(outputVib, OUTPUT);
  Serial.begin(9600);
  Serial.println("Cat Code");

}


void loop() {
  
 ///// Read the incoming sensor values
 
    for (int colCount = 0; colCount < numCols; colCount++) {
      pinMode(cols[colCount], OUTPUT); // set as OUTPUT
      digitalWrite(cols[colCount], LOW); // set LOW

    for (int rowCount = 0; rowCount < numRows; rowCount++) {
      incomingValues[colCount * numRows + rowCount] = analogRead(rows[rowCount]); // read INPUT
      }// end rowCount

    pinMode(cols[colCount], INPUT); // set back to INPUT!

    }// end colCount

  // Print the incoming values of the grid:
    for (int i = 0; i < sensorPoints; i++) {
    Serial.print(incomingValues[i]);
    if (i < sensorPoints -1) Serial.print("\t");
    }
    
    Serial.println();
  
 ///// Do stuff based on the incoming sensor values
 
   if (ifSquished()){
    // turn off the LED
        analogWrite(outputPin, 0);
        Serial.print("squished");
        Serial.print("\t");
        
        // freak out, max analogWrite output
        analogWrite(outputVib, 255);
        delay(3000);   
     }

    else if (ifScratches()) {
      // turn off the LED
        analogWrite(outputPin, 0);
        Serial.print("scratches");
        Serial.print("\t");
        
        // purr
        analogWrite(outputVib, 100);
        delay(1500);
          
    } 
     
    else if (ifPoked()) {
      // turn off the LED
        analogWrite(outputPin, 0);
        Serial.print("poked");
        Serial.print("\t");
        
         // meow
         analogWrite(outputVib, 185);
         delay(300);
       
    }    
    
   else if (nothingPressed()){
    // turn on the LED
        analogWrite(outputPin, 255);
        Serial.print("atRest");
        Serial.print("\t");
      }
      
    // turn off motor
    analogWrite(outputVib, 0);   
    delay(20);
}

Time to Make the Cat (or Creature of Choice)

cat.jpg

This is a good moment to customize your creature!

Change its proportions and size.

If you want a smaller creature, try using a different bus!

Make the Squishy Body

cat_foam.jpg
InstructionImages_cat_foam-13.jpg
battery-spot.jpg

Layer cushion foam

  • I cut 6 pieces of 1” cushion foam. Each piece was 7”x11”.
  • Glue the pieces together, letting it dry completely before handling.
    • Use enough glue to hold the layers together without covering the entire surface. This will come in handy later when you have to tuck the circuit and battery into the body. (I used a squiggle.)

Sculpt the cat

  • Use a craft knife to carve into the foam. I made mine chunky and bean-like.
    • If you keep some of the scraps, you can use them to stuff the tail (optional).
  • Cut ears. Attach with glue, and hold in place with straight pins while the glue dries.
  • Cut space for the battery between layers in the bottom of the cat.
    • This extra weight will help keep your cat stay upright on its own.

Cover Up!

cat_top1.jpg
cat_top2.jpg
cat_top3.jpg
cat_top4.jpg
cat_bottom1.jpg
cat_bottom2.jpg
cat_bottom3.jpg
cat_bottom4.jpg
InstructionImages_cat_cover-14.jpg
cat_face.jpg

Make the covering for the cat

  • Spandex is stretchy and forgiving, making it easy to create a snug cover for the cat body.
  • Sew a tube that fits snugly around the body of the cat. Pull the spandex tighter around the top/bottom for better shape definition.
  • To shape the fabric around the head and bottom, I folded the fabric like I was wrapping a present, and pinned sewed it in place.
    • Leave an opening/flap at the top of the cat for the bus to tuck into.
    • Pull the fabric tighter around the ears for more definition and sew to secure it.
    • Use velcro and/or snap button tape at the bottom, so you can access the battery/circuit and remove the cover entirely.
  • Sew a long button hole for the bottom of the bus and wires to tuck into.
  • Use the embroidery thread to sew on the face.
    • I used the sticky parts of Post-It notes to test the placement and expression of the cat before sewing it. Marking the main points of the features will help you sew them on later.

Final Assembly

cat_back_final.jpg
InstructionImages_cat_final-15.jpg
cat_circuit_final.jpg
InstructionImages_cat_final-16.jpg
IMG_20200826_013612.jpg

Put it all together!

  • With your cat covered up, adhere the serpentine bus to the back of the cat.
    • Separate the bus from the breadboard for easier application.
    • Tuck the ends of the bus into the openings at the top and near the bottom of the cat.
    • It’s helpful to peel and place the bus bit by bit, smoothing it out as you go.
  • Run the vibration motors to the left and right sides of the cat body.
    • Pulling up the bottom of the cover will give you easier access to the motors. (Aren’t you glad you used a stretchy material?)
  • Pull the power and ground wires towards the bottom of the cat.
    • Optional: Cut a slit into the foam to hold the wires and route them to the breadboard.
  • Insert the battery into the space you cut for it.
  • Place the breadboard and circuit between the next two layers of the cat.
  • Reconnect the lower bus wires to the breadboard.
  • Run the pressure sensor to the belly of the cat, and the LED up to the ear.
  • Now that the breadboard is all wired up, I added a twist tie to keep everything in place.
  • Connect the Arduino to the battery and tuck everything away.
  • Optional: Make a tail for the cat and use a slip stitch to sew it to the body.

Congratulations!

squish.gif

You've completed this build 🎉 !

Close up the bottom of the cat and try it out!
The LED should turn off and the motors should buzz whenever the cat is triggered.

Make tweaks as you see fit.
Enjoy ✨.