Sad Cat Fixer: Kitty Cat Mouse Chase

by pamela_soltero in Circuits > Arduino

244 Views, 0 Favorites, 0 Comments

Sad Cat Fixer: Kitty Cat Mouse Chase

KCMC Initial Idea.png

Sad Cat Fixer is a project where the goal is to make sad cats happy. The Kitty Cat Mouse Chase is a cat's toy to fulfill this goal.

Supplies

  • Arduino board
  • Breadboard
  • DC motor
  • Motor driver
  • Real-time clock
  • Ultrasonic sensor
  • Jumper wires
  • Screwdriver
  • Wire cutters (if necessary)

What Was the Initial Idea?

The idea was to create a cat toy that would keep a cat well entertained. The Kitty Cat Mouse Chase is a toy with a mouse that moves in a 360° pattern. This simulates prey running from predator, the prey being the toy mouse and the predator being the cat. This also stimulates the cat's natural hunting instinct to catch anything that moves.

The mechanical components will be hidden underneath the durable fabric as well as in the "tree" part of the toy. This is because the ultrasonic sensors will function best when elevated at a height were it can detect a cat in range. The toy mouse will also be durable and long-lasting, and will also have a pocket to hold catnip to keep the cat healthy, happy, and engaged.


What About The Components?


The plan was to use a stepper motor and driver to create this 360° pattern the mouse toy will be moving in, as well as a buzzer to mimic the squeaks of this mouse. The ultrasonic sensor in the center will detect the cat's movement and will use this information to move the toy for the cat to chase. To make things more interesting, chances would also be programmed into the toy. For example, there could be a 40% chance the toy mouse moves towards the cat instead of away because after all prey isn't perfect, and this toy should simulate a more realistic hunting experience.


How Do These Components Communicate With Each Other?


The Kitty Cat Mouse Chase would have 2 modes, automatic and manual. The toy will automatically go into automatic mode unless a button is pressed. The toy would have the option of being controlled by the owner using a joystick instead of using the ultrasonic sensors. Whatever angle the joystick would be put at would be mirrored on the toy's 360° pattern, and the mouse would move to the desired angle.

The ultrasonic sensors will send information to tell the stepper motor where to go based on where the cat is. There would be 2 sensors, one on each side of the toy to be able to sense the cat moving from any direction. As stated previously, using this data from the sensors, there will be a calculated chance of the mouse going toward or away from the cat.

The buzzer used to mimic the squeak of the mouse will continue to make noise periodically when there is movement at the sensor. While on manual mode when the sensors are not in use, the buzzer will be going off randomly.

The real-time clock will be used as a timer and will allow the toy to perform the same actions, but on a selected time limit to make sure the cat does not over exhaust itself and to prevent the toy from running when not in use.


Any Brief Changes To The Initial Plan?


After pitching my idea, there were suggestions and feedback regarding what would and would not work on a cat toy. I learned that a buzzer would not be a good idea because to get it to mimic the squeak of a mouse is difficult to do on a buzzer and might end up scaring the cat away from the toy.

The Building Process and My Experience

Notes Picture.jpg
The DC Motor completed.jpg
DC Motor Real-Time Clock Ultrasonic Sensor together 2.jpg
DC Motor Real-Time Clock Ultrasonic Sensor together.jpg
The DC Motor completed 2.jpg

My plan was to start building each part of the toy individually as well as learning how to code each component by making test programs. Coincidentally, teacher Mr. Birch had begun the same project as a personal one, and gave me what he had done so far along with notes. Instead of using a stepper motor and driver, I now was going to learn to use a DC motor and motor driver. Using the notes provided and online resources, I was able to get the motor running in both a clockwise and counter clockwise motion.

Winter break came right after, along with the 2 week lockdown of schools. This hindered my progress on the project very much, so I decided to come up with a plan similar to the initial idea, but more time permitting. I was going to continue using the DC motor and motor driver, 2 ultrasonic sensors, a real-time clock. I decided to leave the joystick as just an idea, as well as programming chances into the Kitty Cat Mouse Chase. With this new plan, I continued my work from home. During this time I learned how the ultrasonic sensor worked and how to add it to the existing work I had. I hooked up the real-time clock as well, and read up on how to code these 2 components. I had gathered resources online on how to create test programs, and tried to access already made test codes but unfortunately was not able to.

Once the 2 weeks of lockdown were complete, I continued work in class. I created and tested the ultrasonic sensor, but no matter what I tried I could not get the second sensor to work so I decided with the time left, one will do. There could've been an error in may code preventing the sensor from working that I just could not see. It is also possible there was a problem with the ribbon wires I was using. Nevertheless, I continued with the real-time clock until I came across another obstacle.

I was not able to upload code into the Arduino, and thought maybe the port was wrong but found the port menu to be greyed out. According to the error message, this meant there could be a problem with the USB cable or a driver issue. As I picked up the Arduino to figure out what was going on, part of it burned me and I quickly realized it was not normal for the Arduino to be so hot. After talking to Mr. Birch, the conclusion was there is a short circuit somewhere. I disconnected everything that was hooked to the Arduino and tested the board itself and it worked, meaning the board was not damaged. I slowly started to hook everything back in, checking that the 'port' menu did not grey out with every cable. To be sure, I also stripped and put the pins back on the wires that looked like would fall out soon. Once everything was back in place, it worked and I was able to continue with the real-time clock.

I was able to find the library used in a test code provided to ensure that the real-time clock runs properly. With the test code working, I could now combine all the components to create the code for the Kitty Cat Mouse Chase using a Pseudo code made previously.

Unfortunately, the code is unfinished. I provided comments for everything I was able to complete and comments for what I wanted to include.

Circuit Diagram & Code

Circuit Diagram.png

Here is the circuit diagram and code.

Downloads

Final Thoughts

To conclude, the Sad Cat Fixer is a project in where we aim to make sad cats happy by creating a product, and though my project was not fully completed in the end, I enjoyed the challenge and would've liked to see the Kitty Cat Mouse Chase fully functioning like with all components and ideas as initially planned. I learned a great deal in the process with every obstacle I came across, and learned how to fix these problems such as the short circuiting. If I were to do this project again I would attempt to create my product, though hopefully with less lockdowns.


Resources

Here are the links to the tutorials as well as a link to the needed library for the real-time clock.


Motor:

https://create.arduino.cc/projecthub/ryanchan/how-to-use-the-l298n-motor-driver-b124c5


Ultrasonic Sensors:

Arduino - Ultrasonic Sensor (tutorialspoint.com)

Arduino - Ultrasonic Sensor | Arduino Tutorial (arduinogetstarted.com)


Real-Time Clock:

How to Use a Real-Time Clock Module (DS3231) - Arduino Project Hub

Lesson 22 Real-time Clock Module - sunfounder

https://github.com/rodan/ds3231