How to Make a Smart Security Camera with a Raspberry Pi Zero
HTML-код
- Опубликовано: 8 фев 2025
- In this video, we use a Raspberry Pi Zero W and a Raspberry Pi camera to make a smart security camera! The camera uses object detection (with OpenCV) to send you an email whenever it sees an intruder. It also runs a webcam so you can view live video from the camera when you are away.
See how we built it, including our materials, code, and supplemental instructions, on Hackster.io: www.hackster.i...
Make sure to look out for our behind the scenes video! • Behind the Scenes: Sma...
USEFUL LINKS:
Follow Hacker Shack on Instagram:
/ hackershackofficial
Subscribe to Hacker Shack: goo.gl/qHjz4j
Visit our website for parts and project updates: www.thehackers...
View our code on Github: github.com/Hac...
OpenCV Install Guide: www.pyimagesear...
Get our 3D printer: robo3d.myshopif...?rfsn=1004615.c5abe
MATERIALS:
Raspberry Pi Zero Wireless × 1
Amazon Affiliate Link - goo.gl/Zsxm7k
Raspberry Pi Camera module × 1
Amazon Affiliate Link - goo.gl/4kR632
Check out the NoIR camera for night surveillance
Amazon Affiliate Link - goo.gl/fT7oL9
Raspberry Pi Zero Camera Cable x 1
Amazon Affiliate Link - goo.gl/pBVZb1
Micro-USB to USB Cable × 1
1/4" MDF Board × 1
90 Degree Angle Bracket × 1
Outdoor Mounting Tape × 1
M4 X 20mm Long Machine Screws × 2
M4 Hex Nuts × 2
M2.5 Machine Screws × 4
#8 X 3/4" Long Machine Screws × 1
#8 Hex Nut × 1
#8 Wing Nut × 1
MUSIC:
/ joakimkarud
Disclaimer
The methods shown in this video should be used
as a guide only.
HACKER SHACK ACCEPTS NO RESPONSIBILITY FOR
ACCIDENTS OR INCIDENTS ARISING FROM INDIVIDUALS
UNDERTAKING ANY OF THE TASKS DESCRIBED. IN
PARTICULAR, IF UNSURE YOU SHOULD ALWAYS CONTACT
A QUALIFIED TRADESMAN BEFORE PROCEEDING.
rather than dealing with MDF, I think I would mount it in an electrical box. The steel ones are modular, cheap and durable. Plus, you can mound an unwired outlet in it, which isn't the sort of thing most people would think twice about seeing.
Man Finally this project I have been trying to create for a minute...i need it LOL!
This is a great project. One of my students built something similar, except she used the project to feed her cat by sending emails to the DIY cat feeder! :)
Always test your electronic components to make sure they function properly before mounting them in a "permanent" way. Great video.
How do you know he didn’t ?
The wood needs sealing and priming otherwise it will swell up and come loose etc , in case anybody is thinking of building this.
Pretty cool. Useful for those who just want something that basically works out of the box.
This is 2 years old but its worth point out... This is the complete opposite of "works out of the box".... Literally you even have to MAKE the box...
@@Chris_t0 I scrolled through the internet in the office and suddenly I had to start laughing out loud. Best comment I read in a while!
@@Chris_t0 Well, I think... That was the joke :D
why am I just finding this youtube channel now!? I love you guys!
Awesome Prj!!!
I love the use of multiple skills to get the job done.
At 10:45, you go through allowing the insecure login. You should instead just generate an App Password support.google.com/accounts/answer/185833?hl=en and use that in place of your real password to begin with. You never want your Google password stored in plaintext anywhere.
+AndrewAlex92 good idea. I can update the docs tonight
updated
Or you could just buy a piece of PVC pipe, two end caps mount it in that and have a waterproof security camera.
Travis lol, true, but to each their own. But i like your style better.
Personally I'd just get a plastic project box and drill a hole for the wires / camera. It would be flat and alot more water proof than MDF. This could be done alot easier.
that would look sleek. will definitely look better.
Or by a hollow plastic skull or gargoyle or statue of a poster of Big Brother with a plastic electrical gang box behind the eyes.
Wouldn't there be the potential for excess humidity to condense on the inside of the pipe thereby endangering the electronics? The MDF is more porous and wouldn't do this as much. Of course, if left outside, the MDF will fall apart eventually because it's garbage.
Inkscape is awesome for drawing up templates. Free, runs on Windows, Mac, Linux. I use it for laying out all my laser cutter designs. Probably would have saved some time on this project.
If i made that here in Brazil im pretty sure that they will steal my camera...
adriano sousa lol you gotta bolt that stuff down!
Make the housing blend into the surroundings. It doesn't have to be a black box..
If I put this up here in the USA, thieves will avoid wasting time at my house and probably drop a couple bucks in my lawn so I can go buy a better camera system.
But what if they steal what it's bolted down to?
If there's one thing I' know about Brazil from watching videos on the internet, it's that there's no shortage of off-duty police officers to save the day.
I'm 42, do I still need a parent to help me cut out the MDF?
Yes, even if you're 95 year old, you need a parent to help you cutting the MDF. Without a parent it won't work :(
*Illegal without a parental guardians assistance and approval*
If you need to ask, yes.
yes
@Cloudy_lotus no no no u have to do Orochimaru's reanimation jutsu from Naruto.
Thanks a ton, guys! This is one project I've been working on recently. Next steps could be to detect the face on the camera and match with the voice and commands of the visitor to unlock the door if authorized. If you guys plan on doing something like this, it will be of great help.
Hello bro
I am planning to do the Same. Can You Please contact me
Best Tutorial for home made security cams
Top 10 anime security cam tutorials
Excellent ! In the event of image detected, have you given thought to consider switching a light bulb via I/O pins in conjunction with a optoisolator or something like that ?
Very user friendly vid..well done
Great tutorial and appreciate the time and effort it takes to record, edit and upload. It's already been done, but please consider an updated version using Raspberry Pi 3 B+. Wyze data mines it's customers, can't be used with iPhone 4S and has no customer service number, so your hack is a great alternative.
Cheers
You have no idea now we'll timed this video is! I just got a pi zero camera kit (with suction cups for a window) and was researching the code when I found your video :)
hi can you help pls me why mine has sign in and it said your connection to this site is not private? i m using raspberry pi 4b
I am using elements of this tutorial for my own robot. I am using a Raspberry Pi Model B, a Raspberry Pi camera for face recognition, and some small servos to move parts of the robot.
Thanks Davis!
A jigsaw is not the best thing to use to cut straight lines. You can get straighter lines with a plain handsaw. Before painting the MDF you can seal the surface with white or wood glue (or actual wood sealer) to seal it against excessive paint absorption, reducing the number of coats required for full coverage.
Hi, Project is Fantastic, Is possible to make Drowsiness detection only? no video is required, only will take a snap while detecting drowsiness?
Well done guys, as always.
This project is great, thank you for sharing!
Brilliant video
That ruler used to draw the line was so precise & appropriate. By the way nice video
What other kinds of Raspberries are supported / useable? How low can you go? Can you use a Raspberry 1 Mod. B as well? I have a Camera Rev 1.3. Will this be accurate enough?
Tool suggestion: For drilling the recess for the lens, a Forstner bit would be useful. They're capable of drilling flat-bottomed holes.
For night vision, get the NOir camera and some ir LEDs
I can access the webcam on the local network, but how do we access it over the internet? From outside the private network?
Ngrok
I'm going to do it. Excited. Thank you guys.
Awesome project. Will definitely give it a try.
Thank you so much for the tutorial...
How to fix "error sending email?"
The error that I am getting is "Error sending email: "
Which OS should I install for my Raspberry Pi 3? Before I get into configuring the Camera when the code starts in the video. Thanks!
It works, it's better if you read the instructions of the GitHub page, cause have many differences for python 3 or 2 , in my case I needed to changed the route because was different, in my case was: Smart-Security-Camera-Master/.
Also I needed to download the VIM, just sudo apt-get install vim, and that's it
What sort of frame rates are you getting? I was thinking the Pi Zero W would be tool slow for this application. The form factor and price are nice, though.
Hey guys i would like to say one thing that is instead of human detection you can add facial detection using tensorflow or the same open cv and you can make a smart door lock.
What all componets and how much would it cost!
Haven't watched the video yet please reply
HI thanks for this great tutorial. But, may I know can I add alarm function when it detect the person?
I need replacing Pi camera with webcam via USB please what is edit code to do that
How much power does this setup require? If I wanted to build one of these and make it solar powered, how big of a solar panel would be needed?
Smart guys !
I wonder if you could have a Bluetooth connection or something and have multiple cameras 🤔 awesome video! Airsoft turret!!! That's sweet I wanted to build one of those In seventh grade. That was in 2010, makes me think I should try building one now!
3d printing camera housing would be a great idea.
Good work done
you should sell this thing, awesome!!
The system detects fine but I have a question, what will happen if it sees a photo ? Can it differenciate "it's picture"
Can i use raspberry pi 3 model b instead of raspberry zero
You could easily become a teacher! Thanks for the video!
Nice work with the jigsaw dude. I am surprised you don't have one with a shop-vac attachment.
the browser takes long time to fetch the video feed, is it an internet speed problem or frame rate prob?
can this be done on the raspberry pi b+ 1st gen
Thanks! Now I could no when my parents come into my room😂
Is the code you provided only suitable for pi camera? Can I use other webcam instead?
Hi there, Excellent video. One question is this setup is capable with Raspi 4 B?
Good video guy's
nice one i loved it
how did you open the code?
what program did you use?
Can somebody help please😥
Hey for booting should we need Ethernet or Wi-Fi will work please reply
but why do this instead of using motion eye OS? are there any advantages over motion eye O?
whcih is the better way to go what the pros and cons of each method and are there any better OS solution in the same vein as motion eye OS?
was all of the raspberry pi stuff done on the pi zero?? if so how did you plug in the keyboard and mouse?
Use a temporary usb OTG adapter
amazing...i should definitely try this dude
Can multiple cameras be used on the same network? Any tutorials or resources available for that?
Hi,can i reforward this video for another site without commercial purpose?
can we do it in rasp 3 i mean is it same process or not
Excelent project guys!! I imagine the v2.0 where you install night vision to this security camera.
How do you make this more secure network wise and do you know the code to arm and disarm this so that way I am not getting an alert every time someone passes by it when I am at home???
Hi I just wanted to make a small sized video camera how can I make it?
accidentally stumble upon your channel .. you guys are doing amazing job :)
So can this camera feed be viewed when not on the same network?
Hi great vid how about a vid on the esp32 from start to finish thank you Ha
What's the best way to implement video storage for y'all's setup? Write a script where you can store the video in a micro-sd card and overwrite 3 min clips at a time after the storage gets full like on dash cams? Or store them through a server?
Server storage is probably the best option for a scalable solution, but the 3 min hack would probably work as well.
The best thing for a camera at the front door off Angel is, put a small led ligh. That lights the entrance, then the person looks at the light by curiosity and BAM a nice picture of the front view of there face lol. Talking from experience here too 😉
Any suggestions on how to save short video files or images to a usb or sd card once motion has been detected?
Also suggestion on using a usb camera instead of a raspberry pi camera?
Im coming from the wood building/car diy side of the youtubes but am I missing something? How or where does it get power from? And how is it connected to the home network? Does the raspi have a battery? Or WiFi? Can you get different camera sensors for different resolutions? Or some night vision sensors?
instead of moving object, can i use this for face recognition? i mean when the camera recognize unknown face then sent gmail
Nice work, thx for the tutorial
Nice video. Will it work with RPi-B+ and night vision camera during daytime and night?
First off, great video. Can this work with a 3B+? Do you have an .stl for the case and not one out of mdf?
Good day, Is it possible to merge or connect this project to another project which is Smartphone Connected Home Door Lock as one project? Does the raspberry pi 3 can run them simultaneously? Thank you
I liked the video instructions and materials list and code available, I did not like the background music. Why is it necessary. I just need the instructions. I am sure that a lot of other hearing challenged viewers feel the same.
I noticed there was internal ip, can I access this from outside my home. Via cellphone perhaps?
Yes you can access any computer on your network, but you have to set up your router to do so. You need to open ports through your firewall corresponding to the Pi, and then remember your router's public IP address.
Simon thank you.
+Abel Villa you could also use Ngrok to expose a local tunnel
Can you run this on solar + powerbank the way it is?
Christoph Puetz Yes, as long as it can supply 2 Amps you're good.
This is cool. Is it possible to setup a record function that saves the footage somewhere secure?
And make a remote you use to switch on the camera when youre going out?
Your genius bro
what sensors do you use?
Nice tutorial...i have a plan to make security camera using raspberry pi like this. Can we take picture/snapshoot while the camera detecting motion so we can upload itu via http to server or send it along with the email attachment?
Is it hard to create a new object model?
Is there a wait time before it takes another picture or does it spam me with mails when someone is moving in front of the camera for a longer period of time?
+RiskyStrats waits 10 minutes between emails by default, but it's configurable
thanks :)
@5:40 Wait. Lucky supermarket store still exist? This was my childhood go to market. Still the same font used.
Thank you guys
I works for me but how to access cam for a different network from anywhere.
Pls help me...
Hello,
You should edit your routers routing table. An example below
Public IP x.y.z.t
internal IP a.b.c.d
You should route your public ip's some port to internal ip's some port
x.y.z.t:9999 -> a.b.c.d:8888 then on a public WiFi, if you write your xyzt:9999 to the browser's address bar, you will see your camera. But it is not secure. Anyone that knows your routing table(camera port?) and public IP(may be static or dynamic ip) can see your house:)
can it work with NOIR camera?
Question: can i use a pi 3? with a USB webcam?
have you done it yet
Can this be added to the smart mirror
Can be made this camera with a Raspberry Pi 3 Model B?
Can i train the object detector using my own dataset on a pc and then deploy it on a Raspberry Pi as i want to build a security system which classifies between threat and no threat.
can we run the same code on laptop using webcam and show the results live?Please help.