DIY Security Camera
![5591509450e1b6956a00053d.jpeg](/proxy/?url=https://content.instructables.com/FN0/V77X/IBHRQJPB/FN0V77XIBHRQJPB.jpg&filename=5591509450e1b6956a00053d.jpeg)
![559177f12e7fb629110002fb.jpeg](/proxy/?url=https://content.instructables.com/FJ0/9G5Y/IBHRYJDH/FJ09G5YIBHRYJDH.jpg&filename=559177f12e7fb629110002fb.jpeg)
![Screen Shot 2015-06-29 at 12.55.18 PM copy.png](/proxy/?url=https://content.instructables.com/F7U/WPRG/IBHRY91K/F7UWPRGIBHRY91K.png&filename=Screen Shot 2015-06-29 at 12.55.18 PM copy.png)
This instructable show you how build your own DIY Security Camera, which takes a picture of the person at the door and send an email with the picture to your email box, so that you'll know if it's some you know or its an intruder..
The DIY Security Camera uses
- an Arduino Yun as it's brain, which is connected to your home WiFi network
- a PIR sensor to detect some one approaching the door
- and a USB webcam to take a picture which is then send in an email
- In addition 3D Print the enclosure using the STL files attached and to house the electronic components .
Components You'll Need to Complete the Build
![IMG_7285.JPG](/proxy/?url=https://content.instructables.com/FBY/VY4V/IBFS3R4N/FBYVY4VIBFS3R4N.jpg&filename=IMG_7285.JPG)
![5591787d45bceb08a4000095.jpeg](/proxy/?url=https://content.instructables.com/FI9/MCK3/IBHRYRX7/FI9MCK3IBHRYRX7.jpg&filename=5591787d45bceb08a4000095.jpeg)
![IMG_7287.JPG](/proxy/?url=https://content.instructables.com/FWY/BJSP/IBFS3R96/FWYBJSPIBFS3R96.jpg&filename=IMG_7287.JPG)
Here are the electronics components you'll need
- Arduino Yun
- PIR sensor, in my case i am using one which I purchased at Radioshack
- LED to aid in testing
- *USB web cam(i am using Logitech c270 webcam)
- Female to male breading boarding wire
- Micro SD card
- Micro B USB cable
3D printer to print the STL files attached , in my case I am using
- Printrbot Simple Metal
- Hatchbox 1.75mm black PLA
In addition you'll also need the
- Pliers
- Screw drivers
- Screws - (6-32 X 1/2 in (at least 5) and 6-32 X 1 in(at least 4))
- Mount mechanism to mount the camera , in my case i am using a simple door hinge.
Note*: To check if your USB Webcam will be compatible check the following Wiki link ,i am using Logitech c270 webcam.
Setting Up the Arduino Yun
![Screen Shot 2015-06-24 at 5.40.04 PM.png](/proxy/?url=https://content.instructables.com/FKF/FLFK/IBFRXSLJ/FKFFLFKIBFRXSLJ.png&filename=Screen Shot 2015-06-24 at 5.40.04 PM.png)
![Screen Shot 2015-06-24 at 5.43.20 PM copy.png](/proxy/?url=https://content.instructables.com/F37/AXOI/IBFRXSVV/F37AXOIIBFRXSVV.png&filename=Screen Shot 2015-06-24 at 5.43.20 PM copy.png)
![Screen Shot 2015-06-24 at 5.43.29 PM.png](/proxy/?url=https://content.instructables.com/F4T/LA1K/IBFRXSLT/F4TLA1KIBFRXSLT.png&filename=Screen Shot 2015-06-24 at 5.43.29 PM.png)
To get started, configure the onboard WiFi on the Arduino Yun using the following steps
- Connect the Micro USB able to a power outlet or your computer USB.
- Connect your computer to the Yun's Wifi , in the Wifi setting of your computer , basically once you power up the Yun in a few second you should see Wifi called "ArduinoYun-XXXXXXXXXXXX" in your network setting .
- Using a browser enter http://yun.local as shown in the picture above
- A web should display asking you for the password , here enter "arduino"
- Now a configure button will appear
- Once you hit the configure, select your WiFi router name and enter the password as shown in the second screen shot above
- Now you may choose to change your Arduino Yun name, password and play around with the other setting.
- Once done hit the Configure and Restart button, this will connect your Yun to your home WiFi.
For more details refer to the guide on the Arduino website at the following link
Connecting the PIR Sensor and Test
![IMG_7267.JPG](/proxy/?url=https://content.instructables.com/F9V/TI3P/IBFRXZ9Y/F9VTI3PIBFRXZ9Y.jpg&filename=IMG_7267.JPG)
![Screen Shot 2015-06-28 at 5.00.55 PM.png](/proxy/?url=https://content.instructables.com/FL4/7BAW/IBFRY08H/FL47BAWIBFRY08H.png&filename=Screen Shot 2015-06-28 at 5.00.55 PM.png)
![Screen Shot 2015-06-28 at 4.55.55 PM.png](/proxy/?url=https://content.instructables.com/F86/0JIY/IBFRY08I/F860JIYIBFRY08I.png&filename=Screen Shot 2015-06-28 at 4.55.55 PM.png)
Now to Upload sketches to the Yun you will need the latest version on the Arduino IDE, basically Arduino IDE 1.5.4 installer or later.
Connect the PIR sensor to the Arduino Yun
- Connect VCC on the PIR to 5V
- GND to GND
- And Out on the PIR to pin#2 on the Yun
- In addtion connect an LED to PIN 13 , so that you can see it from far away while testing
Download the Basic PIR testing sketch and upload it to the Yun. Before hitting the upload button in the board section select Arduino Yun as shown in the second screen shot.
Downloads
SSH Into the Arduino Yun
![5590ae83deafa434f70002e0.jpeg](/proxy/?url=https://content.instructables.com/F0C/43HY/IBFS7S19/F0C43HYIBFS7S19.jpg&filename=5590ae83deafa434f70002e0.jpeg)
![Screen Shot 2015-06-29 at 12.40.41 AM.png](/proxy/?url=https://content.instructables.com/FQX/QVZU/IBFSH6RS/FQXQVZUIBFSH6RS.png&filename=Screen Shot 2015-06-29 at 12.40.41 AM.png)
SSH into you Arduino Yun using the Terminal on your Mac, or using a tool like Putty if you are using a windows machine
ssh root@yun.local
Note: if you are not able to resolve the IP for yun.local, find out the IP address of your Yun and use the IP address instead (like ssh root@192.168.1.8)
Accept the RSA key by typing in Yes
Now you can run a few of your favorite shell commands like ls,df etc..
For more details on using command line communication using SSH refer the following link
Installing Fswebcam and Test Your Camera
![IMG_7271.JPG](/proxy/?url=https://content.instructables.com/FOD/9VA9/IBFS14VJ/FOD9VA9IBFS14VJ.jpg&filename=IMG_7271.JPG)
![Screen Shot 2015-06-29 at 12.48.26 AM copy.png](/proxy/?url=https://content.instructables.com/FNW/X36J/IBFSHIXV/FNWX36JIBFSHIXV.png&filename=Screen Shot 2015-06-29 at 12.48.26 AM copy.png)
Connect the Yun to the USB webcam and insert the micro SD card.
Now at the SSH prompt of your Yun type in the following command to install the fswebcam package which will help us take pictures
start with updating the package manager
opkg update
install the UVC drivers for the webcam
opkg install kmod-video-uvcfinally
install the fswebcam utility
opkg install fswebcam
Now to take a picture , you'll have to first mount the SD card
cd /mnt/sda1
to take a picture
fswebcam PicturefromWebCam.png
to check if the picture was taken
ls -l
Note*: To check if your USB Webcam will be compatible check the following Wiki link ,i am using Logitech c270 webcam.
Uploading Python Code Using FTP Client
![FTP-openSHH-blog.png](/proxy/?url=https://content.instructables.com/FVI/D12J/IBFS7RAT/FVID12JIBFS7RAT.png&filename=FTP-openSHH-blog.png)
![Screen Shot 2015-06-24 at 5.48.08 PM.png](/proxy/?url=https://content.instructables.com/FP7/FHK2/IBFRY883/FP7FHK2IBFRY883.png&filename=Screen Shot 2015-06-24 at 5.48.08 PM.png)
![filezillaoptions.png](/proxy/?url=https://content.instructables.com/FMS/59FP/IBFS7TQE/FMS59FPIBFS7TQE.png&filename=filezillaoptions.png)
To access the files and upload python code to your Arduino Yun's SD card, you can use a FTP client like FileZilla ,WinSCP.
Start by installing SFTP server on your Yun using the following commands
opkg update
opkg install vsftpd openssh-sftp-server<br>
Now download and install an FTP client like FileZilla from https://filezilla-project.org/
Once installed open FileZilla and go to File --> Site Manager -->click on New Site.
- Enter the following detailsHost : Protocol: select SFTP
- Logon Type: select Normal
- User: root
- Password: xxxxxxxx
Note: the default password is arduino, if you have not reset it as part of the setup process
Click the connect button which will take you to the main screen, where you can access the root folder as shown in the picture above , in my case I using the SD card from my Camera, because of which you see quite a few folders.
For more features refer to the FileZilla wiki
Downloads
Upload the Sketch Attached to the Yun
![IMG_7270.JPG](/proxy/?url=https://content.instructables.com/F3L/LENP/IBFS14XY/F3LLENPIBFS14XY.jpg&filename=IMG_7270.JPG)
![Screen Shot 2015-06-29 at 3.06.48 AM.png](/proxy/?url=https://content.instructables.com/FSJ/1RPN/IBFSIIVB/FSJ1RPNIBFSIIVB.png&filename=Screen Shot 2015-06-29 at 3.06.48 AM.png)
![Screen Shot 2015-06-29 at 3.06.28 AM.png](/proxy/?url=https://content.instructables.com/FAN/SH96/IBFSIIW0/FANSH96IBFSIIW0.png&filename=Screen Shot 2015-06-29 at 3.06.28 AM.png)
![55915281937ddbe19a0005a4.jpeg](/proxy/?url=https://content.instructables.com/FUX/481X/IBHRQN1W/FUX481XIBHRQN1W.jpg&filename=55915281937ddbe19a0005a4.jpeg)
Download the Sketch attached and Upload it to the Arduino Yun via the USB cable.
And since the Yun is connected to WiFi you can also upload the sketches via Wifi.
Now once motion is detected you''ll receive an email as shown in the screen shot above , with the picture taken by the web cam.
Note : To upload sketches to the Arduino Yun you will need the latest version on the Arduino IDE, basically Arduino IDE 1.5.4 installer or later.
Downloads
3D Print the STL Files Attached
![IMG_7280.JPG](/proxy/?url=https://content.instructables.com/F61/ZEPK/IBFS0KG4/F61ZEPKIBFS0KG4.jpg&filename=IMG_7280.JPG)
![IMG_7262.JPG](/proxy/?url=https://content.instructables.com/FM4/FDA8/IBFRXOKY/FM4FDA8IBFRXOKY.jpg&filename=IMG_7262.JPG)
![Screen Shot 2015-06-28 at 3.57.40 PM.png](/proxy/?url=https://content.instructables.com/F36/TUTC/IBFRXNSC/F36TUTCIBFRXNSC.png&filename=Screen Shot 2015-06-28 at 3.57.40 PM.png)
![IMG_7261.JPG](/proxy/?url=https://content.instructables.com/FPJ/022Y/IBFRXOI4/FPJ022YIBFRXOI4.jpg&filename=IMG_7261.JPG)
![IMG_7252.JPG](/proxy/?url=https://content.instructables.com/F3X/5SHO/IBFRXON7/F3X5SHOIBFRXON7.jpg&filename=IMG_7252.JPG)
Download the STL file attached and load it in your printer software and slice the file, based on your printer setting,the webcam Holder
- Slicing the STL file should take about 8-9 Seconds
- And the print time should be about 10- 15 mins
3D print the fake Antena
- Slicing the STL file should take about 5-6 Seconds
- And the print time should be about 12- 15 mins
Download and 3D print the from of the security camera which holds the PIR sensor and webcam
- Slicing the STL file should take about 4-5 Seconds
- And the print time should be about 25-30 mins
In addition I wanted to give a shout out francisperea who create and awesome bare minimum bumper case(YunCase.stl) which you can find at : Arduino Yún Bumper - created by francisperea
In my case I am using the Printrbot Simple Metal and Hatchbox black 1.75 mm PLA
3D Print the STL Files Attached With Support
![IMG_7278.JPG](/proxy/?url=https://content.instructables.com/FQ0/T6RA/IBFS0KOY/FQ0T6RAIBFS0KOY.jpg&filename=IMG_7278.JPG)
![IMG_7246.JPG](/proxy/?url=https://content.instructables.com/FTZ/LUOJ/IBFRXPHS/FTZLUOJIBFRXPHS.jpg&filename=IMG_7246.JPG)
![Screen Shot 2015-06-28 at 4.15.06 PM.png](/proxy/?url=https://content.instructables.com/FV9/LN9J/IBFRXP3I/FV9LN9JIBFRXP3I.png&filename=Screen Shot 2015-06-28 at 4.15.06 PM.png)
![IMG_7259.JPG](/proxy/?url=https://content.instructables.com/FEL/F4LU/IBFRXP8G/FELF4LUIBFRXP8G.jpg&filename=IMG_7259.JPG)
Now to 3D print these parts you'll have to change the slicer setting to print with support as shown in the second picture above.
3D print the Bottom Yun holder
- Slicing the STL file should take about 25-30 Seconds
- And the print time should be about 55- 60 mins
Download and 3D print the top case
- Slicing the STL file should take about 20-25 Seconds
- And the print time should be about 45- 50 mins
Putting It All Together
![IMG_7292.JPG](/proxy/?url=https://content.instructables.com/FRU/GFC8/IBFSAFEQ/FRUGFC8IBFSAFEQ.jpg&filename=IMG_7292.JPG)
![IMG_7296.JPG](/proxy/?url=https://content.instructables.com/F59/DXXG/IBFS438X/F59DXXGIBFS438X.jpg&filename=IMG_7296.JPG)
![IMG_7332.JPG](/proxy/?url=https://content.instructables.com/FIK/5J05/IBFS3IEQ/FIK5J05IBFS3IEQ.jpg&filename=IMG_7332.JPG)
![IMG_7300.JPG](/proxy/?url=https://content.instructables.com/FT9/9MFW/IBFS438W/FT99MFWIBFS438W.jpg&filename=IMG_7300.JPG)
![IMG_7304.JPG](/proxy/?url=https://content.instructables.com/FI6/Y60C/IBFSEI64/FI6Y60CIBFSEI64.jpg&filename=IMG_7304.JPG)
![IMG_7324.JPG](/proxy/?url=https://content.instructables.com/FBW/QC3Y/IBFS43SH/FBWQC3YIBFS43SH.jpg&filename=IMG_7324.JPG)
Now once you have 3D printed your part putting the electronic components together is pretty self explanatory
Attach the Yun to the bumper and added it to the bottom part of the case using screws
Attach the PIR sensor to the front 3D printed part using the longer screws and nuts.
Complete the circuit using bread boarding wire, here
- Connect VCC on the PIR to 5V
- GND to GND
- And Out on the PIR to pin#2 on the Yun
Now add a screw to the webcam holder and snap it to the webcam and then attach it to the top case using a nut.
Now attach the fake Antenna using a screw and neatly tuck the web cam wire.
Installing It the Security Cam
![IMG_7326.JPG](/proxy/?url=https://content.instructables.com/F2B/R1XO/IBFS43SG/F2BR1XOIBFS43SG.jpg&filename=IMG_7326.JPG)
![IMG_7339.JPG](/proxy/?url=https://content.instructables.com/FAX/UI4Q/IBFS3IEJ/FAXUI4QIBFS3IEJ.jpg&filename=IMG_7339.JPG)
![IMG_7368.JPG](/proxy/?url=https://content.instructables.com/F3S/QQ8S/IBHRQ14A/F3SQQ8SIBHRQ14A.jpg&filename=IMG_7368.JPG)
![IMG_7349.JPG](/proxy/?url=https://content.instructables.com/F7S/5PMQ/IBHRPZHY/F7S5PMQIBHRPZHY.jpg&filename=IMG_7349.JPG)
The 3D printed case has two mounting options, one using a hinge type mechanism at the top of the housing and the second is for a swirl type mechanism at the bottom.
I am plan on using the hinge type mechanism which is simple of the two, which fits perfectly on back door.
A tip here when selecting the mechanism is to take the 3D printed part with you to the hardware store like a Home Depot and select the mechanism that suit your mounting point for the DIY security camera.
And in addition since the Arduino Yun is powered by a USB cable you'll have to find a way to tunnel your USB cable to power socket.