MEET YOUR LOVING CATPANION

by snoopylovescat in Circuits > Sensors

77 Views, 0 Favorites, 0 Comments

MEET YOUR LOVING CATPANION

IMG_2301.JPG
IMG_2302.JPG

Have you ever desperately wanted to be productive, only to find yourself spiraling into a procrastination loop? We have.


As college students, we know the feeling: the pressure builds up until it’s "too mighty for our mortal bodies to contend with." We seek refuge in the glimmering blue light of our phones, only to end up "coiled up" in guilt because we simply couldn't stop scrolling. We often demonize our tasks cumulatively and lose track of reality. We ended up in this question:


How might we create a gentle yet firm physical presence that prevents college students from spiraling into phone-induced procrastination?


Our solution is this: meet CATpanion—your tiny, adorable guardian against the digital abyss.

The CATpanion is an interactive desktop assistant designed to bring you mindfulness and pull you back to the present. Using an ultrasonic sensor, it monitors your phone holder based on different focus modes; if you cave into temptation and pick up your phone during a focus session, the cat gets an angry face and starts trembling (in a cute way)! To soothe its rage, you’ll have to interact with its touch sensor and "caress" it back to calm.

With its glowing LED cat bell and constant presence, the CATpanion ensures you’re never alone in your "grinding sessions." It’s not just a tool; it’s a cute reminder that your time is yours to reclaim in a gentle way you've never seen before.

Watch our demo video via this link to a google drive.

Supplies

  1. Arduino board: Arduino Uno or Nano
  2. Ultrasonic sensor
  3. haptic sensor
  4. TM1637 4-digit display
  5. RGB LED light
  6. Vibration motor
  7. Button Switch
  8. Jumper wires to connect the materials
  9. Cardboard, tapes and marker pen

Build Up Your CATpanion's Nervous System

In this step, we connect all the electronic "organs" to the Arduino board. The CATpanion relies on various sensors to perceive the world:

  1. Eyes & Ears (Sensors): Connect the Ultrasonic sensor (Trig to Pin 12, Echo to Pin 13) to detect your phone. The Touch sensor (Pin 3) acts as the cat's head for you to stroke.
  2. Expression (Output): Use a TM1637 4-digit display (CLK to Pin 4, DIO to Pin 5) to show the cat's facial expressions.
  3. Emotions (Lights & Vibration): Wire an RGB LED (Red: Pin 6, Green: Pin 9, Blue: Pin 11) for mood lighting and a Vibration motor (Pin 10) for tactile feedback.
  4. Mode Switch: A Button (Pin 2) allows you to toggle between "Working" and "Leisure" modes.


Breathing Life Into Code

Now, let's look at the logic that makes the CATpanion "feel" neglected. The code uses a timerValue to track the cat's mood, ranging from 0 (Happy) to MAX_TIME (Angry).

  1. The Procrastination Trigger: In Working Mode, the cat uses the ultrasonic sensor to check if your phone is within 3cm. If you pick it up (distance > 3cm), the timerValue increases, and the cat begins to get annoyed.
  2. The Emotional Scale: As you procrastinate, the RGB LED fades from white toward a deep red. The 4-digit display will cycle through four distinct expressions: Calm (OuuO), Slightly Annoyed, Very Annoyed, and finally Angry.
  3. The Guilt Trip: Once the cat is fully "Angry" (at 100% procrastination), it will physically shake via the vibration motor every 2 seconds to demand your attention.
  4. Seeking Forgiveness: You can soothe the cat by putting your phone back or by touching the sensor to "caress" it. The recovery speed is 3 times faster than the rate it gets angry—the cat is forgiving, but you must put in the effort!

Copy and paste the following code into the Arduino IDE. This code includes the custom "segment-mapped" facial expressions.

#include <TM1637Display.h>

// Pin Definitions
const int BTN_PIN = 2;
const int TOUCH_PIN = 3;
const int CLK_PIN = 4;
const int DIO_PIN = 5;
const int RED_PIN = 6;
const int GREEN_PIN = 9;
const int BLUE_PIN = 11;
const int VIB_PIN = 10;
const int TRIG_PIN = 12;
const int ECHO_PIN = 13;

// Parameters
const long MAX_TIME = 120000; // 2 minutes to reach full anger
const float RECOVERY_SPEED = 3.0;
TM1637Display display(CLK_PIN, DIO_PIN);

// Facial Expressions
const uint8_t FACE_LEISURE[] = { 0x3F, 0x1C, 0x1C, 0x3F }; // OuuO
const uint8_t FACE_SLIGHTLY_ANNOYED[] = { 0x3F, 0x0C, 0x18, 0x3F }; // O_| |_O
const uint8_t FACE_VERY_ANNOYED[] = { 0x5D, 0x0C, 0x18, 0x5D }; // Frowning
const uint8_t FACE_ANGRY[] = { 0x41, 0x0C, 0x18, 0x41 }; // Angry Eyes

enum Mode { LEISURE, WORKING };
Mode currentMode = WORKING;
float timerValue = 0;
unsigned long lastUpdate = 0;
bool lastTouchState = LOW;
long vibrationEnd = 0;

void setup() {
pinMode(RED_PIN, OUTPUT); pinMode(GREEN_PIN, OUTPUT); pinMode(BLUE_PIN, OUTPUT);
pinMode(VIB_PIN, OUTPUT); pinMode(BTN_PIN, INPUT); pinMode(TOUCH_PIN, INPUT);
pinMode(TRIG_PIN, OUTPUT); pinMode(ECHO_PIN, INPUT);
display.setBrightness(0x0a);
lastUpdate = millis();
}

void loop() {
unsigned long now = millis();
float deltaTime = now - lastUpdate;
lastUpdate = now;

// 1. Mode Toggle [cite: 21]
if (digitalRead(BTN_PIN) == HIGH) {
currentMode = (currentMode == LEISURE) ? WORKING : LEISURE;
timerValue = 0;
startVibration(100);
delay(500);
}

// 2. Non-blocking Vibration [cite: 23, 33]
if (now > vibrationEnd) digitalWrite(VIB_PIN, LOW);

// 3. Ultrasonic Logic [cite: 29, 30]
long distance = getDistance();
if (currentMode == WORKING) {
if (distance > 3) { // Phone removed
timerValue = min((float)MAX_TIME, timerValue + deltaTime);
} else { // Phone present or petted
timerValue = max(0.0f, timerValue - deltaTime * RECOVERY_SPEED);
}
// Angry Shaking
if (timerValue >= MAX_TIME && now % 2000 < 150) digitalWrite(VIB_PIN, HIGH);
updateSystem(timerValue / MAX_TIME, 255, 255, 255); // White to Red
} else {
// Leisure Mode Logic [cite: 27]
timerValue = min((float)MAX_TIME, timerValue + deltaTime);
updateSystem(timerValue / MAX_TIME, 255, 200, 0); // Yellow to Red
}
}

void startVibration(int duration) {
digitalWrite(VIB_PIN, HIGH);
vibrationEnd = millis() + duration;
}

void updateSystem(float progress, int startR, int startG, int startB) {
analogWrite(RED_PIN, startR);
analogWrite(GREEN_PIN, startG * (1.0 - progress));
analogWrite(BLUE_PIN, startB * (1.0 - progress));

if (progress < 0.25) display.setSegments(FACE_LEISURE);
else if (progress < 0.50) display.setSegments(FACE_SLIGHTLY_ANNOYED);
else if (progress < 0.75) display.setSegments(FACE_VERY_ANNOYED);
else display.setSegments(FACE_ANGRY);
}

long getDistance() {
digitalWrite(TRIG_PIN, LOW); delayMicroseconds(2);
digitalWrite(TRIG_PIN, HIGH); delayMicroseconds(10);
digitalWrite(TRIG_PIN, LOW);
long d = pulseIn(ECHO_PIN, HIGH, 30000) * 0.034 / 2;
return (d == 0) ? 999 : d;
}

Building the Body (Craft & Housing)

IMG_2300.JPG

Using your cardboard, tapes, and markers, it's time to build the physical CATpanion:

  1. The Shell: Cut out a cat shape from the cardboard and the bottom plane, add fish like ours if you want. Ensure there is a stable "holder" area for your phone.
  2. Mounting the Eyes: Place the TM1637 display in the center of the cat's face. This is where its personality lives.
  3. Hiding the Sensors: Secure the Ultrasonic sensor as it's cute feet at the base of the phone holder so it can accurately "see" if the phone is present.
  4. Touch Interaction: Tape the Haptic/Touch sensor to the top of the cat's head so it's easy to pet.
  5. Finishing Touches: Use your Markers to draw whiskers and fur patterns. The RGB LED can be placed on its neck to create a glowing aura that changes color with the cat's mood.


DONE!!!