c0nrad / meowPi

A meower for the Raspberry PI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MeowPI

meowPi

meowPi is a Raspberry Pi program that emits a meow when a trip wire is activated.

Introduction

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.

Background Information

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.

Sonar

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.

Parts

Hardware Setup

First up we'll be wiring the sonar to the RPi as follows : Wiring
Image courtesy of Matt Hawkins

Software

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:

python2.7 meowPi.py

And when an object is within a certain distance of the sonar, a meow is played.

Enjoy!

About

A meower for the Raspberry PI


Languages

Language:Python 100.0%