IoT Part 1 - Raspberry, Dog, Spy

I've been thinking about writing this post for a very long time. Unfortunately I couldn't find the time (lame excuse, I know).

Brian the dog Anyway, last year we got a dog. When I don't take him to work with me, he stays at home doing some dog stuff, and I wanted to spy on him.

While assessing the options, I saw a lot of 100$+ cameras that can detect motion in the house and upload the recorded clip to the cloud.

I thought that this is a cool option, but where is the challenge?
Luckily, I got the honor to work with Erik Zaadi, the man and the Raspberry Pi. He heard that I'm considering to buy a camera and told me about motion linux package.
There it is, the challenge.

So, instead of going out for a beer I started working on this. First, the expectations:

  1. Record on a movement
  2. Auto turn on/turn off
  3. Upload recording to cloud
  4. See live feed
  5. To be able to tell our dog to get off the couch

After getting the dust off my Raspberry, I found out that the first issue got solved very quickly with aforementioned motion package. I apt-geted it, set some configurations related to the lightening in my house, and it worked.

Worked is an understatement, as it kept on filming us while at home.
In order to get back our privacy, I wrote a tiny (and hacky) module that waits for start and stop commands. Later my girlfriend moved in and I added some code to make sure that the camera will turn on only if both of us call start.

To call these commands from everywhere, I use noip.com that integrated with my router, which keeps my ip up-to-date with noip.com services, and expose the wanted services with nginx.
What now? GPS, WiFi or Bluetooth? Well, I started with GPS Geo fencing, and it didn't work well. Now we use AutomateIt to watch our WiFi connection and work accordingly (off when connected, on when disconnected)

Ok, so we have recordings of movements, and they don't contain us. Next thing is to upload them to a cloud service.
After I ran into a nice module called Dropbox-Uploader, I thought that it's probably going to be the simplest way to upload the recordings, and set it up.
Simple script that uploads the files and then deletes them, call it every minute with crontab, and we have it.

I wanted to spy on my dog when he eats his bone, and not a minute later, and to get the live feed was actually pretty easy as we set almost everything up.
All that needed to be done was to wire nginx to the local motion feed and get to it with the previously set noip.com address.

Last thing I want to do is to be able to speak with my dog (he doesn't have to answer). That's my next task. I'm considering to use HTML5 microphone support to send the data to the Raspberry and to play it immediately after it receives it. Any ideas?

Noam.

Noam Shemesh

10 years of programming experience, and still love it. Currently live in Tel Aviv.

comments powered by Disqus