Our lovely cat is often alone at home. We decided to create a device that could entertain him.
The device remains in stand by until the cat presence is detected by the PIR sensor.
1- Then the lasers are activated (by the code which can select one, two or all the lasers or random selections).
2- The laser lights perform randoms trajectories thanks to the two servo motors (the speed of the movement, and the vertical and horizontal range can be defined by python code).
3- The activity keeps on until the cat is detected by the PIR sensor. Every minutes it checks the presence. The waiting time can be increased or reduced by the code.
4- Every time the sensor is triggered an entry is created on the application logs, which allow to monitor the cat's activity during our absence.
5- In addition, in case the cat reaches and start to play with the device, a tilt sensor detects the activity and it reduces the risk of damage by stopping the device.
Building Steps1- On the box attach the pan and tilt base, then create the needed holes
- for the lasers connections
- for the PIR sensor
- for the raspberry Pi power supply.
2- 3d print the holder for the laser leds, and the box for the PIR container.
3- following the circuit diagram below attach all the elements.
Please note for each element there is a script to check whether is working correctly. (check the repository https://github.com/EnzoCalogero/CatFitBot/)
- Laser Leds (https://github.com/EnzoCalogero/CatFitBot/blob/master/hardware_tester/leds.py)
- P|R (https://github.com/EnzoCalogero/CatFitBot/blob/master/hardware_tester/sensor_PIR.py)
- Servos (https://github.com/EnzoCalogero/CatFitBot/blob/master/hardware_tester/servos.py)
- Tilt-switch (https://github.com/EnzoCalogero/CatFitBot/blob/master/hardware_tester/tilt_switch.py).
4- Once all the circuit elements have been tested.
- Insert the laser led on their holder (you may need some hot glue to make them stable).
- Insert the PIR sensor on its box. (you may need to adjust the distance range and sensibility).
- Insert with some tape or hot glue the tilt button to oner corner of the box.
The picture below shows few important details for the building:
5- Finally, if you want to run the script automatically:
- Configure the Raspberry PI to start in out-logon with CLI (not Desktop).
- append the line below to the.bashrc file in the home folder of the user pi.
- (please modify the script path, based on where you have copied or saved the script).
python /home/pi/CatFitBot.py
Comments