This is a great weekend project undertake using a Raspberry Pi and a Pi Camera module, which will also double up as a security camera for your living room or study room. Also wanted to mention that the inspiration for this project is an instructable called Hidden GoPro Security Camera , which used a GoPro camera instead of a Raspberry Pi Camera.
In my case I am using an old project holder which I don’t use any more, but you can follow along with an old book as you see in the instructable Hidden GoPro Security Camera.
For the software on the Raspberry Pi Zero W, I am using motionEyeOS which turns your Pi into a surveillance device, and you can also trigger other things in you house like a speaker or lights to scare the intruder. In my case I am using IFTTT to turn on my Phillips HUE lights at home and send my self an email.
Step 1: Things You'll Need
Here are the list of electronic components and Tools you will need in addition an old project holder or an old book.
- Raspberry Pi Camera
- Raspberry Pi , in my case I am using a Raspberry Pi Zero but you can use any version of the Pi B+ or higger. -Raspberry Pi Camera cable , this will depend on which version of the Pi you plan to use. Here I have link the Pi Zero connector cable which is different when compared to the other Raspberry Pi
- SD card
- USB mini cable and mobile phone power wall outlet.
In addition, you will need something to hold the Pi Camera and the Pi, if you have a 3D printer handy you can use the STL files in the step below, or use the official Raspberry Pi zero case.
And you will also need some glue or a hot glue gun.
Step 2: 3D Print the STL Files Attached (Optional If You Have a Case)
This is an optional step , if you have a 3D printer handy. Download the STL files attached and add them to your slicer and 3D print the files. In my case, I am using Hatchbox brown PLA + which kind of matches the project folder.
For slicing I am using Slic3r with –
- Layer height as 0.3mm
- Fill density to 15 %.
- Temperature 205 C Printing the files will take about 30-40 mins,depending on your printer settings.
Step 3: Setting Up MotionEye on the Raspberry Pi
To stream video via the Pi camera you have a bunch of options from using a simple package as mjpg-streamer to something more complex and involved like OpenCV. In my case I am using MotionEyeOS because it easy to setup and gives you fair bit of configuration parameter you can play with which I will be discussing in the next step. Here are the steps you will have to go through to setup Raspbian on the Pi.
Download the latest version of the motionEyeOS from -https://github.com/ccrisan/motioneyeos/releases
Start by running the following commands to write the SD card
wget https://raw.githubusercontent.com/ccrisan/motione... sudo ./writeimage.sh -d /dev/mmcblk0 -i "/path/motioneyeos-raspberrypi-20171008.img" -n 'yourWiFiRouterName:yourWiFiRouterPassowrd'</p>
As part of this command, if you are using a Raspberry Pi zero W you can modify the command above to include your WiFi router username or password.
In my case, I am using the Ubuntu 16.04 as my host operating system to write a 16 GB SD card, but if you are using window you can use a tool like etcher or use the terminal app if you are using an Mac.
For more info check out the motionEyeOS wiki.
Step 4: Gluing the Pi Camera and Pi Zero to the Project Folder
Once you have tested the video stream from the Pi Camera using a browser like Chrome on your laptop/mobile, it is now time to add everything to your project folder or book.
In my case I had to cut out about 4 sleeves from the folder, and then drill a hole to the end as shown in the pictures above. I then used hot glue to secure the 3D printed parts to the folder.
Finally add the project folder to your bookshelf, and plug in the USB cable to your mobile phone wall power adapter
Step 5: Configuring MotionEye
MotionEye has a sleek web UI and bunch of configuration parameter for detecting motion, taking picture, video , sending an email when motion is detected and many more as you see in the pictures above.
Once you login for the first time using admin and you should update the admin and user password via web UI and reboot you Pi.
Now since this is hidden cam you may want to go to the advance setup and turn of the "Enable CSI camera Led" as you see in the first screenshot above. And you can also update working schedule which is basically time during the day when you are at school or work.
For motion detection and depending on where you setup the hidden camera in the room you may want to change the Frame change threshold to detect movement and prevent false positives.
Step 6: Setting Up Hue Light Using IFTTT to Scare the Intruder
This is an optional step, but is a great addition to scare the intruder. As part of my setup I am using IFTTT recipe to turn on all the Phillips Hue lights in the house once motion is detected.
To setup the recipe head over to ifttt.com , create an account and click on the new applet. On the IF side of the applet choose maker webhook and create a trigger event called "HUE_on" and on the then side of the applet selected Phillps HUE and select the light you would like to turn on from the drop down, in my case I am choose to turn on all the lamps in the house. You will also have to setup Phillps HUE channel first by login into your HUE account.
Once you are done make a note of your webhook setting key which you will find at this link. Then modify the URL below with YOURKEY and add it to web Hook URL in motionEye as shown in the first screenshot above.
Now run a quick test and adjust the Frame change threshold setting under the motion detection section if required.