Raspberry Pi based security camera
Yes, I know there are a lot of projects like this on the net, but I had to investigate the options. I settled on using Linphone and writing a custom server script that detects motion, takes a photo and emails it, and also sends a chat message to a list of people that motion was detected. You can also connect to the camera with Linphone to monitor in real-time. However, you will not get email notices/photos while you are monitoring so it will be up to you to record those sessions, if you want them. (You must be recording from Linphone *before* an event happens for this to work.) For these reasons, this may work better as a “hands-off” solution because with the automated emails at least you’ll have proof all the time.
This project is checked into my personal Github repository, here: Raspberry-Pi-Security-Camera You should always find the latest executable code in this main branch (or the trunk). I want to use Github more so I encourage you to post your thoughts as issues, if you’re so inclined. I would appreciate the input and you might just get a feature for free! 😉
I intend to post a lot more about this project. But for now, you can find everything you’d need to build a device, by way of a Fritzing file in the project. However, the ePIR sensor I’m using in this version has been discontinued.
I am currently building one of these devices as a permanent circuit. (A “hardware device”.) One thing I need to do is upgrade it to use either the ePIR or the very common PIR (Passive Infrared) sensor. So I plan to post pictures of the project, sloppy soldering and all. 🙂
For now, have a look at the project. The main Python file is only 314 lines (at last check). It’s amazing what I can do in such a small amount of code and I am already hooked on the Raspberry Pi. For later, check back here for more information on this fun project.
<later> As promised: sloppy soldering and all! BTW, I just finished testing everything so far. Do NOT solder with your multimeter underneath it! 😉
I’m excited to be using Adafruit products for this build. I won’t say who my customer is, but I already guaranteed my work so it must be good. So Adafruit was a very good choice, IMO. Economical quality and reliability. (Hey, they should pay me for this stuff! LOL)
It’s working! I will post some more pictures later and upload the code to Github because it is working with the new style of PIR sensor, not the discontinued ePIR SBC (module).
This is sorta funny because I built an entire circuit board yesterday and tested the continuity of each solder point to make sure I had no shorts, so I was puzzled. I thought that if I got a good night’s sleep, I would figure it out. So this morning I arose determined to figure it out and the first thing I checked was the problem! I had the GPIO cable backwards! I know… I’m lucky i didn’t fry the Pi, or parts of it, by doing this. But fortunately my script is fairly simple as far as the circuit board goes and it did not cause any problems. (Whew!)
And if you’ve been paying attention you’ll notice the fact that I started another circuit board yesterday. That’s because I had started the first one with the Pi T-Cobbler, which will not work with the Raspberry Pi 2/B/B+ because they have 40 pins and this breakout is for the older number of pins. (I forget right off, was it 28 pins?) Except that if I want to use one of the PiTFT screens, I do need the smaller breakout because it plugs into the back of the screen and not the GPIO header because that’s where the screen is! (Am I rambling yet? :D)
As promised, here are a couple of more images. (That “gap… oops!” has now been fixed. Needed a larger hole for the ribbon cable. Sits perfectly square now.)
In the “It’s alive” photo you can see the new custom circuit board, along with some notes. The second image is to show the holes I cut in the case to pass the cables out of.
Now I think the only thing remaining is some type of mount/case for the camera and dangling GPIO-connected circuit board. (UPDATE 2016.03.14: My customer vetoed a case. He is going to make one and said he loves the way it looks right now. What can I say?)
Other than update the Fritzing file for the new PIR sensor and documenting the new changes to do a commit. (It’s not on Github, yet. I will update here when it is. I want to get the Fritzing file ready, first, so that it matches the script.)
Here is a preliminary “case” that I have for it:
The zip-ties may be temporary. I may just hot-glue them in place. That should hold it, but if I need to disassemble to fix a part, it should pop off easily enough. I’m still not 100% sure what to do with that camera….
And you know they ARE alive. They’re reproducing, too! Check this out and inspect it closely for details!
I just did another commit to the Github master branch. Once again, you can always find the latest and greatest code and Fritzing files here: https://github.com/lelandg/Raspberry-Pi-Security-Camera
Odysseus requested an actual security image from a darkened room. First, here’s one of me from across the room.
And here’s the same shot in a totally darkened room. (Looks like I jostled the camera slightly because it’s moved a bit. You can still tell what’s going on.)
*** Update *** That camera is a Waveshare Infrared. It is focusable, which is why the images just are slightly blurry. That’s a plus and a minus, IMO. It has a real lens, which is a plus. But you have to focus it manually, which is not a plus. In fact, your fingers get in the way so much you have to turn it, then let go to see how you did. That’s definitely a minus. Grand total: Zero! No, i do like the camera. And for night vision, I don’t think you can beat the price and quality. Even if it’s this sharp, you could identify someone, I think. Don’t you?
As you can see, you could easily identify someone in a totally darkened room. And by the time they could figure it out, you’ll have the email with their picture! Seriously folks! I am still excited about this project!
Oh, and there’s audio. When you’re streaming video you can talk to the person if you’ve got a sound card and a speaker on your Raspberry Pi. Add a microphone and they can talk to you, too. They just can’t see you. Perfect! Bug Notice: Right now there’s a problem with two-way audio. This is working one-way, only, from the remote client. So you can talk to them but they cannot talk to you.
I think I will use this on a robot. It could be my remote eyes and ears. But that will be for another build log!
Well, I already have another inquiry for a camera! There were some questions that came up. Here are my answers:
The PiCams, alone, weigh-in from 0.3 Oz (“normal” camera) to 0.6 Oz (for the night-vision, including two infrared lamps to illuminate everything). The one I have built weighs a total of 180g (6.3 Oz), plus a battery pack or power. I could easily add a 9V or 18650 for power supply. Actually, I weighed this and it’s 4.2 Oz (116g) for this version.
For portable power, I’ve just been using my AllPowers solar charger. There’s a non-solar one on Amazon, too… but they’re both about $15 right now, and one charge lasts more than all day, so it’s fine for me. And with the solar charger, you can deploy anywhere outdoors that gets regular sunlight (preferably hidden, but it doesn’t have to be).
Right now I’m working on compiling Linphone for the Raspberry Pi to get some bug fixes. However, this is very non-trivial, and I’ve worked with make files a lot. Stay tuned for more details (and hopefully I can actually document the entire build process). Lots of good ideas for Section9 posts are coming from this project already. 🙂
I have also added text-to-speech (TTS) so it will automatically talk to the intruder. It says things like, “An image has just been emailed to security. A video is being recorded of you even as we speak!” and “Incoming call. You are being watched!” 🙂