A few weeks ago I received the new version of the Nwazet Camera Box Bundle, re-designed to fit the B+ Raspberry Pi (and the Raspberry Pi 2) and once again designed to make a Raspberry Pi CCTV security system!
It reminded me that I had promised my dad that I would fit a Pi camera system into his porch so he could keep an eye on his beloved motor home when he was in the garden. I’d not got round to doing this as I hadn’t quite found a camera viewing solution that would be easy enough for him to use (and for me to figure out!).
Last week whilst browsing the Raspberry Pi forum I came across a camera viewing application for the Raspberry Pi called MotionPie. It almost turns your Raspberry Pi Camera Module into an IP camera, and is really (really!) easy to set up and use – perfect for old papa Average!
With my new CCTV-style case, and this seemingly simple yet brilliant camera application – a project was born!
The Nwazet camera case is perfect for our CCTV Pi solution as it has an adjustable mounting bracket, a fish-eye lens, and a nice stealty black look. It comes with all the parts you need, and even the fixings for mounting it to a wall.
First on the list is to assemble the case. This is easy with the help of the very detailed guide on their blog. You first need to remove all the protective film on the individual panels, then then put it all together. No point in me covering that part – the instructions that come with the case are very clear.
Here are the parts:
Here’s my assembled case, ready to catch bad guys and burglars:
Installing the camera is simply a case of finding the right spot, drilling a couple of holes and screwing the mount to the wall. Obviously you need to consider things like glare, lighting, moisture, power source and all of the other ‘common sense’ factors. This case isn’t waterproof, so it needs to be installed indoors.
Note: You may want to skip to the camera software section below to set up MotionPie first so you can test where you want the camera before drilling any holes.
First mark where your camera will be mounted. Remove the mount panel and use it as a guide to mark your drill holes:
Now grab your drill and screws/rawl plugs. The case comes with these fixings, but I left those at home so it was off to Papa Average’s workshop to grab some spares. I’m pretty sure this was his favourite part – any excuse to use his tools and supplies:
Use the appropriate drill bit and drill the two holes for the mount where you marked earlier:
Push in the Rawl plugs ready for the screws, to ensure you get a solid mount:
Screw the mount in to the holes. Make sure you get the mount the right way round:
The case should now slide on to the mount, using the small screw at the end to secure it:
There we have it, the camera box fitted and ready to plug in:
This is the part that had me puzzled for a while. There’s a lot of different ways to get your camera streaming to a screen/computer, but I hadn’t had much time to look at them. The few that I did try didn’t quite offer the ‘simple’ factor that is so very important when trying to get my father to adopt new technology!
Then I came across MotionPie. This clever application comes as an image that you simply write to an SD card and put straight into your Pi – no code, no messing around. It feels a bit like cheating, but it does work very well and will keep papa Average happy as it’s so easy to use.
Download the Image
To install MotionPie you need a blank SD card and the MotionPie image available here (hit the big green download button). You can use a 4Gb SD card but you may want something bigger if you want to use the recording features of MotionPie.
Think of an image as an operating system, like Windows. This image is a dedicated image for MotionPie, which makes it very easy to install.
Once the file has downloaded, unzip the files to a folder and move to the next step.
Write the Image to an SD Card
Pop your SD card into your PC (using an SD card adapter if needed) and open up your favourite image writing software – I use Win32DiskImager for Windows.
Open up Win32DiskImager – you should see the drive letter for your SD card in the top right ‘device’ section. Make sure this is right before continuing.
Next we need to tell the application which image file we want to ‘burn’ to the SD card. Click the little folder icon and navigate to the folder you extracted the MotionPie files to. Click the MotionPie.img file and then click ‘Open’:
The file path should now be showing in the ‘Image File’ section.
Now click on ‘Write’ to burn the image on to the SD card. A warning will show, telling you you can corrupt the device. Don’t worry about that, it’s a standard message. Click ‘Yes’ to proceed:
Note: The ‘read’ option is for doing it the other way – reading the SD card and making a file – great for backing up
A progress bar will give you an indication of progress – this image isn’t very large so should only take a few minutes:
Once complete, a message will pop up. Click ‘OK’:
Now we’re ready to remove the SD. Don’t forget to ‘eject’ the device safely using the icon in your taskbar, there’s a chance you could corrupt the SD card otherwise:
Your SD card is ready now, so push it in to your Pi and continue.
We need to connect MotionPie to a wired internet connection for the initial start up (ethernet), as we need to be able to retrieve an IP address. We can’t do any of this via a HDMI screen as MotionPie doesn’t have a video output (you’ll just see a colourful screen).
Once you’ve connected everything, push your micro-USB power supply in to the Pi and turn the plug on. We need to give it at least a few minutes to let the initial setup run, so go and grab a coffee.
You now need to find the IP address of your MotionPie to be able to log in to it. You could log in to your router to find the IP addresses of your connected devices, but I always use the Android ‘Fing‘ app on Android as it’s quick and easy.
You also need the Pi’s serial number which will be visible when you check for the IP address.
I opened Fing, did a scan on my network, and found my MotionPie along with the serial number (the serial number is the part after ‘MP-‘):
This part is easy. Using a laptop/tablet/phone connected to the same network as your MotionPie, simply type in the IP address and hit enter (the same way you would type in a web address). In the example above, I’m using 192.168.1.9.
The slick MotionPie interface should load up. You will at some point be asked for a log in, which is simply ‘admin’ and no password. For remote access such as SSH, the user name is ‘root’ and the password is the Pi’s serial number (which you can see above when we get the IP address).
I used SSH to set up my WiFi adapter so that this camera didn’t need to rely on a wired ethernet connection.
Here’s what MotionPie looks like on my Android phone – it was a bit of a dark day.
The icon top left takes you to the setting menu, where you can adjust all manner of things such as framerate, resolution, brightness, contrast, rotation, storage locations and loads more. I need to have a play with these settings over the next week or so.
You then have icons on the right which take you to full screen mode, camera and video capture and more options. To use the same interface on a PC or tablet, it’s the same process. Simply enter the IP address and away you go.
There currently isn’t a shutdown command on the interface but I have been told that it may be coming soon. You can run more than one Pi camera on MotionPie as well, almost creating a full security interface:
I’m really happy with the outcome of this project, and more importantly, so is Papa Average!
The Nwazet case and mount is solid, looks the part and works very well as a CCTV housing. The fish-eye lens isn’t the greatest quality, looking a bit fuzzy at the edges, so we just removed this part. I’m going to look into drilling some holes in the top panel and wiring some ‘deterrent’ LEDs to make it a bit more visible.
The MotionPie application is very easy to set up compared to fiddling with code and ‘Motion’ yourself, although playback can be choppy if you set the resolution too high. It’s a bit of a lazy man’s solution, but I’d rather concentrate my coding on some of the other projects I have on the go.
I had this case and MotionPie on display at the recent Cambridge Raspberry Jam, which provided hours of entertainment for children running in front of the lens!
Until next time…stay safe Pi people!
**Update** – Check out my next Pi CCTV project here, using a Power over Ethernet HAT.