Raspberry Pi Zero surveillance cameras [MAKER’S REPORT]

Raspberry Pi Zero surveillance cameras [MAKER’S REPORT]

Are you tired of your dog chewing your
shoes while you’re not around? Let’s build a camera to catch it red-handed.
My name is Kradion, and this is Maker’s Report. It would be nice to have an extra
pair of eyes. Unfortunately, the only ones we have are firmly attached to our head.
So, if we want to do better we need to use technology. In this episode we are
going to build a simple and inexpensive security camera based on Linux. Something
simple, if you want to monitor your aquarium while you’re on vacation,
or if you want to make sure that nobody messes with your lunch box during the
break. So, without any further ado, let’s move to the project plan. Okay, here we are.
I took a few notes of important points that I want to have in this project. So,
first of all this project has to be inexpensive. I want to just buy a few
components, not spend too much money, I want this project to be simple
and accessible to as many people as possible. I want the camera to start
automatically and configure itself automatically. I don’t want to mess
around with network configuration and motion detection configuration,
nothing like that. I just want to take my camera, connect it to a power source, and
we should be ready to go. Then, very important, I want to be able to connect to
the camera through my local network and watch the live video feed. Basically I
want the camera to be used as a proper network camera. Then, of course, it’s a safety
and security camera so it has to provide motion detection, and I want that every
time motion is detected in the image an alert is sent via email, which should not
be complicated, I hope. Then, I would like it to provide a certain degree of night
vision. Now, I think this would greatly increase the flexibility and usability
of the camera. Now, if proper night vision is not possible, minimum would be an
enhanced vision mode that we can use for example when there is a poor lighting
condition, exactly, so having it work in poor lighting conditions will be perfect.
And then last, but very important, no custom hardware.
I want instant gratification for this project, I do not want to build any
custom casing, any custom electronics, I just want to buy components, configure
them, put them together, and have the functionality I need, so anything that
cannot be done with off-the-shelf components will not be done in this
project. And then I wrote it here a couple of nice to have, one would be to
have multiple cameras connected to the same system. Basically to have a
centralized way to control several cameras, to have a network of security
cameras. I think that would be very cool. And then last, having the
possibility to send SMS alerts when motion is detected.
Now, this is truly, absolutely useless, I know, but I think it would be cool to
learn how to do it properly, so I think now is the time to do some shopping. Okay
so we are back from our shopping session. For this project I have decided to use a
Raspberry Pi Zero W. Now, this is a very interesting single board computer
because it is able to run a full-fledged Linux system, which means that we can
download and install any compatible Linux distribution on this 8GB
Class 10 micro SD card, and it will boot just fine, which means that we can
use any Linux compatible surveillance or motion capture software. This is going to
be great in my opinion. Now, this board has also the big advantage that it
supports natively Wi-Fi. It has an embedded Wi-Fi system, which means it is
going to be very easy to connect to the to the local network. But the most
important feature of this board is this connector up here. This is a camera
connector that is compatible with the official Raspberry Pi camera, which I
bought. This camera is the no-IR version, which is an 8 megapixel camera
that has been deprived of the near infrared filter. This means that this
camera is quite sensitive to low levels of illumination and to near-infrared
light, which means that we can use it as a night-vision camera or a low-light
camera. Now, the consequence is that colour rendition would be imperfect for
daytime imaging, but we are not after pretty pictures. So, this should work
quite fine. Now, this cable is way too long for us so I also got a shorter
cable that can be used with the Raspberry Pi Zero, so this is going to be working just fine. Now,
in order to use it properly we also need a proper casing, and I found that the
official Raspberry Pi Zero case is actually exactly what we need. It’s small, it’s plastic,
it’s very inexpensive, and it comes with several tops; one of them has a hole
compatible with the camera, so we can build a camera around this, I think,
presume. Now, the only regret I have is that this case is built in very flashy
colour, very bright colour, which is not exactly ideal for a security camera
that should be quite discreet and not very visible, but I think for this type,
for this prototype, I think it can work. Last component, of course, we need to
provide power to the camera, so I got this micro USB charger that can
provide up to 2 amps of power for the entire camera system. This is going to be
the only connection for the system. And last, but not least, rubber feet: because
every project needs rubber feet. So now we can move on to the software
implementation. And the only software we need is a
custom Linux distribution called MotionEyeOS (link in the description). Just
download the image version for your hardware and get the writeimage script,
then follow the clear installation instructions. Can’t go wrong. the writeimage script allows me to pre-configure the Wi-Fi connection, which is kind of
handy considering the Raspberry Pi Zero has no Ethernet plug, and that MotionEyeOS
can only be accessed from a web interface, so keep your network
configuration at hand. And of course you really want to make
sure you point the writeimage script to the device file of your microSD card.
Like dd this command may wreak serious havoc on your machine if you make
mistakes, so read the command line twice before pressing enter. You have been
warned. Once done, you can proceed to insert the precious memory in the
capable board. Ah, nice feeling… Then you want to connect the camera. Slide
carefully the narrow end of the flex cable into the connector, contacts facing
down, and carefully clip the black latch in position with your finger. Now be
careful with the latch. It’s plastic, it’s fragile, and it will break on you while
you’re recording a YouTube video, so, yeah… Next you want to clip the camera on the
other end of the flex cable. Same procedure, just make sure the camera is
facing down, as we will flip it during assembly later on. Next, if you need
direct access to the device during configuration, you want to attach a
microUSB to USB adapter. Pay attention to which port you connect the adapter to.
The port closer to the camera only provides power, so you want to use the
other one. This will save you a great deal of debugging later on. Also, the
Raspberry Pi Zero has only a micro HDMI port so, if you want to connect a monitor,
you need an adapter for the adult size of HDMI. No big deal.
Last, we need to connect the power supply to the correct port, cross our fingers, and
wait for a solid green LED. Okay, nice. Now, I can go back to my
computer and connect to the IP address I specified while flashing the image on
the card. Apparently I’m greeted by a seriously
pissed owl, and I’m in the camera control panel. So, where’s the image? Oh, the camera
is facing down! There we are. So, framerate sucks, and colours are indeed
washed out, but it’s a first step. Now I can configure the camera to my likings. [Evil laughter] The camera has a truckload of settings. I
will not cover them all, I mean, you can have fun on yourself. There are a few
though that I think require attention. First of all you want to save all
captures to a remote location. For my test, I choose to transfer all files to
my Google Drive. This means that your precious evidence will be safe even if
the invader finds and destroys the camera. Take that, imaginary thief! Then,
you want to configure motion detection. Now, setting these parameters is kind
of a black art. It’s more cooking than science. Just test around until you find
a compromise between the paranoia of continuous false negatives and the
annoyance of continuous false positives. Good luck. Last point, you can send all
alarms and notifications to a specified email address, so we’ll do that. Okay, fingers crossed. Let’s put it together and see if it works. Putting the camera together is a snap.
Literally. You just snap the camera in the case lid, snap the board on the case
body, and snap the two halves together. Boom, done.
Easy as pie. Now, back to the computer, it’s time to
test the basic functionality. I have already seen the live video feed from
the camera, so the network camera functionality is basically covered. Time
to test motion detection. Whoa, this bird… So, I installed the camera in my living
room, and now I think I’ll just walk in front of it.
There we go. The motion has been detected and the camera started recording data
and footage. I can see the frame rate has dropped quite dramatically on the live
view, but I can tell you that the final result actually contains enough pictures
to clearly follow what’s going on, so it works! To test night vision I’ve bought a
very cheap infrared lamp on Amazon. Now, I like this one because it has an embedded
light sensor. This lamp turns on automatically when it gets dark, which is
convenient, so back to the test it is now time for total darkness. Bam! The infrared
picture is surprisingly clear. I was not expecting that. And we can see that
motion detection seems to work perfectly also in the dark, so yay.
That’s another success. OK, so, incredible… All basic functions seem to work.
Let’s have a look at some extra functionality. One camera is nice, but you
know what would be better? Two cameras, and a centralized way to
manage them, of course. To pull this off, we need a central controller, and I
think I happen to have just that. I grabbed a regular Raspberry Pi 3 board
and I have installed MotionEyeOS. Let’s see if I can use it as a hub for
our cameras. Well, it turns out that MotionEyeOS can do just that.
We simply need to connect to the hub device, write our credentials, hello angry
bird, add a new camera, select remote MotionEye camera, and provide the IP
address for the two satellite cameras. And bam! Instant security network.
This was so easy it was almost disappointing. Anyway my last wish in my
list of wishes was simply to set up SMS alarms. This was also very easy.
I subscribed to a service called tesxtlocal (link in the description) and used
their API to send SMS from the interwebs. They have a very simple example in
Python that I have copied to my cameras. I pointed MotionEyeOS to execute my
script upon motion detection, and saved the configuration. Will it work? Let’s see… Yep, there it is. An out-of-focus SMS from
the triggered camera. Boom. Mission accomplished. So, here we have it, a small,
inexpensive, Linux based, security camera. All in all and quite happy with the
result of the project. I think I could implement most of the functionalities
that I wanted, so it was a success. What would you do differently? And how would
you use this type of device? Let me know in the comment section. As always, thank
you very much for watching, and if you like this type of content, feel free to stick around for more. My name is Kradion, and this was Maker’s Report.

99 Replies to “Raspberry Pi Zero surveillance cameras [MAKER’S REPORT]”

  1. Is it possible with motioneyeos to get a still image simply by requesting a URL like
    Can this be done? this way i would be able to integrate it with my Domoticz setup.

  2. Can you access the feed from a phone that’s not connected to the network? I think that would be a basic need with today’s security cameras.

  3. It is really cool to see other software that people are using with their RasPi Zero Camera Setups. I have been using mostly RPi_Cam_Web_Interface and I wonder what the quality differences would be between the two systems.

  4. Great video! I'm on windows and I have not a clue how to preconf my wifi info. what file I have to edit? Any help very appreciated. RPI Zero W

  5. Can u make it that u can access the camera anywhere, like with your phone? I got it to work locally, but not working if I try to connect to the IP with my phone on 4G 🙁

  6. I dont know what i did wrong, but when i boot it, it just says *failed to establish ethernet connection*, and it just keeps rebooting after that… HELP

  7. Please try making your video without music, your voice is fine alone. Your music is way to high

  8. Really cool tutorial, so many ideas. I installed a CCTV system (industrial looking beast) but next place tempted to go down this route as more flexible and lower power. Frame rate a bit low but where needed higher, like for entrance, could use bigger pi.

    Think most improvements would be from printing custom cases, maybe spread the electronics out (with heat sinks) as well. Could have pi and camera in separate housing joined with that long cable. Embedded LED and sensor would be cool but power hungry.

  9. Nice project but you can buy a cheap wireless IP CCTV camera for around $30 which would give you proper night vision and proper IR cut for colour balance during the day. plus all the conectivity you would want with email notifications, motion detection and recording.

  10. Please, please, PLEASE rerecord the video without the music. I'll even promise to subscribe, I,think you are a good teacher

  11. Great video. im hacing a problem setting my camera up to use wireless as it shuts off when i remove the ethernet cable. is this possible? using windows

  12. i have a question when you add the pi hub did you have to add both of the ip addres of the two pi zero

  13. This is one of the best explanatory videos on this topic I have seen. Even with the terrible background musac. Please make more videos. This is great work.

  14. Thank you for the tutorial 🙂

    Does it automatically record video to the SD card or do you need to configure it to?
    I'd like to stream video as well as record locally on the SD card.

  15. Can u tell me the process to burn that image on raspberry pi and what did u hide during configuring motioneyeos

  16. Great video … what did all the components cost you … and how long did it take to fully assemble the camera?

  17. The only difficulty I see is the need for a local power outlet … how much power does the camera consume in standby mode … motion detection recording mode … and full streaming mode?

    What kind of battery pack round you suggest for use with the camera?

  18. You asked for suggestions. I did a similar project with a regular pi. Same thing basically. My major issue is that it needs to be connected to an outlet. Bought a battery about the same size as the pi an it will go for about 18 hours on a charge. Not practical for daily use but portable. Which brings up another problem. What if you want to take it outside of your network? Simple. Just buy a large SD card and record on board. Of course if it is not on a network it won't notify you but still useful for something like a game camera to catch the pesky critters or trespassers. I don't know how to get sound though. Others have commented on the music. Just turn it down to the point where it's not really noticeable.

  19. the frame rate is beyond shit , totally useless
    you can buy a wyze can for like $25 ,
    i got a deal on a pi zero W for like $5 and a cheap chinese camera for it for like 6 or 7 but it is still not even worth it with a frame rate that is that bad and no sound either

  20. How would you mount something like that? I'd love to do set something like this up but I'm curious how it would work in the cold weather outside, and of course how I would secure it to a mount of some sort. Even if I used the Pi3.

  21. interesting video, I've got a personal project and was looking for such solution for another purpose. Is there a tripod which fit with this case ? and in total dark, what is the quality of the picture (without the extra led device ?)
    Thanks again

  22. cool video, what would be the limitation on the amount of cameras you can add? or how many cameras can you add to your current setup right now?

  23. Great video. Can we use CAMERA MODULE V2 instead of PI NOIR CAMERA V2 . All the features like motion detection will work with both? please clarify.

  24. There's an easier way of sending SMS notifications. All you have to do is add another address to the list of emails that get motion notifications. Most mobile providers have their own suffix you can use to SMS via email. For sprint it's @messaging.sprintpcs.com, so all you'd have to do to get an email notification is add [your mobile number]@messaging.sprintpcs.com to the email list and BOOM, text notifications.

  25. I must be missing something, I have installed the image using windows and etcher but there is no place to configure the wifi on the zero w and the initial boot just keeps cycling saying "no network stop motioneyes" any suggestions as to what i have done wrong

  26. this video is only for deaf people !! please that music !!!!! where did you learn listening to music?? in a torture chamber ??? watch 13 seconds and your gonna call your cat mama

  27. Terrible "musik"… Nice slow working/explayning but the stressig background sound made me skipp THE video. Korrealate THE tempos man….

  28. Hi Kradion, thank you for your contribution. Have you thought about audio? I think that audio (mixed together with video) monitoring is very important for a surveillance purpose. Thank you again for your effort!

  29. Nice video, so thank you! But the background "music" is just unbearable. Why such a shitty music? Why background music at all??

  30. I got a "Pi Camera 5MP HD Webcam OV5647" I could get a test image from the command line. So it is working but I can't get it to work with MotionEye. Any idea how to get this to work? could really use some help

  31. Maybe far fetch, but is it possible to get snapshots emailed to me? So even if the camera is taken i know who took it, moving to a shared house without locks on the doors. Thanks

  32. Please remove ALL MUSIC from ALL videos

    We want to listen to people TALK not beeps and MUSIC which is LOUD and changes focus

  33. Why do you need a hub to connect multiple cameras? Can't you just put multiple IP addresses into the angry bird interface?

  34. With how difficult it is to get ahold of a Pi Zero at times, I think a normal Pi 3 would do fine. You could also use multiple webcams with it, with less choppy frames.

  35. They never fixed those poorly made Pi cases full of defects. They dont deserve my business if they dont care

  36. Nice stuff…. it would be good to be able to use this as a security system in my camper but only 12v is available and there is no gsm in the raspberry pi available. any suggestions?

  37. Hey, thank you so much for explaining all of the setup and even more! This was so helpful. I am a total beginner and this helped a lot. I just wanted to ask you if you would be willing to try an uv pass filter on any of those cameras? I saw a thread on a forum where a guy used one of these pi noir camera with an uv pass filter and it turned it turned it into an uv camera that could see sunscreen! (shows up as black). It was so cool and that would be my goal to do. I would be so thankful if you could try that? Are you interested? It is so cool, and you could also use the camera to take uv photographs! Thank you….

  38. Great video, excellent and engaging presentation but would love it if it didn't have the background music playing. Otherwise please do more as your project planning and explanation are excellent. Are you a teacher by trade?

  39. You show this build with Pi Zero Ws running the remote cameras, but they really aren't powerful enough to be useful in this role. In the video you can see that you are getting 4 fps or less off the remote cameras. That really isn't usable video for security purposes…

  40. This is a great tutorial. Could you provide additional insight with the txtlocal api python code? Did you just use the API KEY, then add your phone and subject/message? Any other parameters removed or added? Thanks once again. Cheers…

    This is their sample:

    #!/usr/bin/env python

    import urllib.request
    import urllib.parse

    def sendSMS(apikey, numbers, sender, message):
    data = urllib.parse.urlencode({'apikey': apikey, 'numbers': numbers,
    'message' : message, 'sender': sender})
    data = data.encode('utf-8')
    request = urllib.request.Request("https://api.txtlocal.com/send/?")
    f = urllib.request.urlopen(request, data)
    fr = f.read()

    resp = sendSMS('apikey', '447123456789',
    'Jims Autos', 'This is your message')
    print (resp)

  41. I've been trying to get this to work for forever now. I can log into the control panel and see the camera feed and everything but after about 30 seconds the camera freezes and the website tells me to refresh. Once refreshed the camera works again however again in about 30 seconds it freezes. Could it be the usb webcam im using? Tia

Leave a Reply

Your email address will not be published. Required fields are marked *