The Lazy Cat Lady's Cat Toy

by emmas19 in Circuits > Arduino

152 Views, 0 Favorites, 0 Comments

The Lazy Cat Lady's Cat Toy

catwithtoy.jpg

Playing with your cat shouldn't be exhausting! With our new pulse driven cat toy, you can play with your cat without even moving. And, the motor speed increases with your heartbeat, so if you get moving your cat will too!

This was done with 3 major components: an Arduino, a motor, and a pulse sensor. The pulse sensor conveniently attaches to the user's ear with a clip. The speed of the motor is directly proportional to your heart rate and once the pulse sensor detects a pulse, the toy will start to spin, controlled by the Arduino.

The motor will then be attached to a cat toy that will spin for your kitty's enjoyment!

Supplies

L298.jpg
breadboard.jpg
motor.jpg
pulse sensor.jpg
arduino.jpg
  • Arduino
  • Breadboard
  • Alligator clip wires
  • Male to male wires
  • Male to female wires
  • Pulse sensor
  • 3V DC motor
  • 2 Resistors (100Ω)
  • Cat toy
  • Ear clip
  • L298N motor driver
  • LED

Set Up the Pulse Sensor

pulse sensor circuit.PNG

Plug your pulse sensor into the Arduino as shown in the figure above. Test that the pulse sensor can get heartbeat measures by connecting the Arduino to your laptop or PC and seeing if there is an output. Make sure to add the PulseSensor Playground to your Arduino code library before testing the pulse sensor. The code we used worked in tandem with the circuit shown to create a pulse reading output of heartbeats per minute(BPM).

CODE:
// Variables

const int PulseWire = 0;

const int LED13 = 13;

int Threshold = 550;

PulseSensorPlayground pulseSensor;

void setup() {

Serial.begin(9600);

pulseSensor.analogInput(PulseWire);
pulseSensor.blinkOnPulse(LED13);

pulseSensor.setThreshold(Threshold);

if (pulseSensor.begin()) {
Serial.println("We created a pulseSensor Object !");

}
}

void loop() {

int myBPM = pulseSensor.getBeatsPerMinute();

if (pulseSensor.sawStartOfBeat()) {

Serial.println("♥ A HeartBeat Happened ! ");

Serial.print("BPM: ");

Serial.println(myBPM);

}

delay(20);

}

Add the Motor

Biofeedback1.jpg

Once you are sure that the sensor is accurately getting pulse readings, add the motor to the circuit as shown in the figure above. Check that the motor works before continuing by uploading the attached file for the code to your Arduino. The pulse sensor circuit from step 2 was modified to have 2 100 ohm resistors in series instead of a LED. An L298n Motor Driver is connected to the DC motor, the 9V battery, and the Arduino Uno. The connections between each element are sown in the picture above. The Pulse Sensor code is modified to include the motor and make it spin at a rate that matches the BPM. If connected correctly, the motor should spin at the correct rate.

CODE: (Integrate this code with the code from the previous step)

int enB = 9;
int in3 = 8;

int in4 = 7;

void setup(){

pinMode(enB, OUTPUT);
pinMode(in3, OUTPUT);

pinMode(in4, OUTPUT);

digitalWrite(in3, LOW);

digitalWrite(in4, LOW);

}

void loop() {

digitalWrite(in3, HIGH);
digitalWrite(in4, LOW);

analogWrite(enB, myBPM);

delay(2000);

}

int getBeatsPerMinute(){

int myBPM = analogRead(4);

constrain(myBPM, 0, 255);

return myBPM;

}

Make Your Cat Toy

In order to make this motor into a cat toy you must determine how you wish to connect the laser. Get creative! You can do this in many different ways, and depending on the angle at which the laser is affixed to the motor, you could have you cat toy viable for the floor or on a surface, depending on your preference. For our cat toy (as shown above), we created a base for the motor to sit in and attached the laser using tape at an angle that allowed for the toy to be placed on the ground. Before doing this step, disconnect the motor from the circuit and once completed, the motor can be reconnected.

Decorate (optional)

4B07FC32-1C75-4708-8380-2A641906DD3D.png

If you are fine with using a boring ear clip on the pulse sensor, you're done! If not, time to have some fun. In order to make our sensor more aesthetically pleasing, we decided to make it a cute set of clip on earrings. We made ours using polymer clay and hot glue, but you can do anything (just don't make the earrings too heavy or the ability of the pulse sensor to stay on your ear using just an ear clip may be lost).