Back to Parent

Like many cats, Marcel stays home alone for most of the day while the humans are away. Most cats like to play with interactive toys, and most cats grow bored without any stimulation during the day. The goal of this connected device is to detect movement when the cat walks by, and then trigger a servo motor to move a stick with an attached string  in a compelling motion for Marcel to play with.

Components: This project will require the following materials

Particle microcontroller

Breadboard

PIR Motion Sensor

Servo motor

Toy assembly, mounted to servo

LED

Misc. resistors and wiring

Process:

First step was setting up the PIR sensor.  I first wired the PIR motion sensor as well as an LED so that I could get feedback on how the PIR sensor was working. I input some simple code to light up the LED if the sensor was triggered. After confirming that the Particle was receiving a signal from the PIR, it seemed to be a constant signal unless the PIR was completed covered up. To prevent the PIR from triggering due to ambient light and movement, I put the sensor inside a toilet paper roll (upcycling!). This solved the issue, and the sensor was only triggered when I wave my hand directly in front of the roll. 

Next came the servo. I wired in the servo and input basic servo code that controlled from a cloud function so that I could confirm the servo was wired correctly (see Sources). The full circuit diagram can be found at the end of the post.  

Next, I needed to tie together the PIR trigger and the servo movement. Daragh helped me to implement a counter to instruct the servo how long to run after the trigger. I also "randomized" the movement of the servo by inputing a random number as the servo position. See full code below. 

Finally, I used IFTTT to populate a spreadsheet, in case I theoretically wanted to know how many times the toy was being set off. I published an event whenever the sensor was triggered (Particle.publish(''catmotion"), and created an applet to populate a spreadsheet in google drive. 


Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0