meowPi is a Raspberry Pi program that emits a meow when a trip wire is activated.
Every person has a responsibility to himself and the world. As Gandhi once said: "Whatever you do will be insignificant, but it is very important that you do it."
Unfortunetly Gandhi wasen't alive to see the creation of RPi meowers, but if he were alive today, I'm sure he'd change his quote to reflect the importantace of these devices.
Anyways, let's get started.
In this tutorial you'll be building a ultrasonic based tripwire for your Raspberry Pi that'll play a "meow" sound when activated.
Sonar works by emitting a pulse of sound, and timing how long it takes for that sound to to bounce back to a reciever. Since we know how fast sound travels (~340m/s) and we can figure out how long the sound took to get there and come back, we can calculate the distance of the object.
To play sounds we'll be using the pygame.mixer library. This library should already be installed on your RPi assuming you're using wheezy.
- Raspberry Pi
- Cobbler Breakout Kit
- Ultrasonic Sonar (HC-SR04)
- 330 and 470 Ohm Resistors
- Speakers with 3.5mm jack
The software is split into 4 main files:
- meowPi.py: Top level file. Checks for difference in sonar distance. Emits a meow if within certain range.
- meow.py: Driver for playing meow sounds.
- sonar.py: Driver for sonar.
- debug.py: Simple debug output
To run the code, simply run the command in terminal:
And when an object is within a certain distance of the sonar, a meow is played.