4 months ago

How to Create a Wireless Spy Camera Using a Raspberry Pi « Null Byte :: WonderHowTo

Surveillance is usually always a useful tool in a hacker’s arsenal, whether deployed offensively or defensively. Watching targets yourself isn’t always practical, as well as also traditional surveillance camera systems can be costly, lacking in capabilities, or both. Today, we will use motionEyeOS running on a Raspberry Pi Zero to create a little, concealable Wi-Fi connected spy camera in which is usually both affordable as well as also easily concealed.

What Do I Use the item For?

What couldn’t you use a 1 inch, sub $40 spy camera for? genuinely though, sophisticated surveillance has traditionally been out of reach to most people, as well as also the item’s only been recently in which boards like the Pi Zero W have been powerful enough to make these cool devices. Thanks to the almost plug-as well as also-play nature of the Raspberry Pi, throwing together a customizable day or night vision camera is usually cheap as well as also easy.

So at This kind of point in which you can make one easily, there are two main ways a hacker can use a spy camera. The first is usually to help secure a compound coming from physical entry with the classic CCTV setup. This kind of is usually what the build we are generating today is usually best configured for.

Don’t Miss: How to Hack CCTV Private Cameras

Prior to launching an attack, the camera can also be used to perform stealthy recon to observe target behavior in an area, as well as any security measures. If put in place within the target area, the item could be used to gather information, like watching targets type their passwords, taking pictures of keys, as well as also observing how users respond to attacks.


To make This kind of build as quick as well as also simple as possible, we will be using a custom image for the Raspberry Pi called motionEyeOS.

MotionEyeOS is usually a Linux distribution in which turns 1-board computer into a video surveillance system. The OS is usually based on BuildRoot as well as also uses motion as a backend as well as also motionEye for the frontend.

— motionEyeOS

To put the item in simple terms, This kind of will let us set up as many Raspberry Pi cameras as we want, all connected on 1 pretty web interface in which we can forward to the internet, as well as also view anywhere inside the globe. Additionally, we will be able to set up motion detection, to ensure in which we don’t have to watch hours as well as also hours of nothing happening.

Regular Camera vs NoIR Camera

There are two types of camera boards in which we can use for the Pi. Both are 8 Megapixel, as well as also shoot in 1080p. The standard camera is usually just like the camera you have on your smartphone, although not quite as high quality. The NoIR camera is usually a little different. As the name implies, the item has no IR (infrared) filter. This kind of means the item can see more of the light spectrum than a standard camera, giving the item the major advantage in night vision, although at the cost of appearing washed out during the day.

You can see the differences more clearly inside the video below, skip the first 40 seconds to get right to the action.

All the Cases

The case you use is usually very important just for This kind of build, as well as also there are a lot of choices out there. Some of the things you may want to consider are:

  • Are you using a Raspberry Pi or Pi Zero?
  • is usually the camera going to be placed outside or inside?
  • How durable does the item need to be?
  • How conspicuous do you want the item to be?
  • Do you need an IR light source? If so do you want the item inside the case or somewhere else?

With those questions in mind, you can search Google for the perfect case for your needs. The default choice would certainly be a generic camera case coming from Amazon. If you have access to a 3D printer, then Thingiverse is usually a not bad place to look for various other options.

(1) Or you can 3d print your own case. (2) 3d printing a case for the Pi Zero W spy camera. Images via Null Byte

If you are using a Pi Zero, the ZeroView as well as also Pigeon are both not bad choices.

The open source Pigeon PI Zero W case. Image via Geraldo Ramos

All the Rest You’ll Need to Get commenced

If This kind of is usually your first time buying a Raspberry Pi, then a Canakit kit is usually a generally great choice as well as also has everything you need. The most cost-effective will always be the Pi Zero CanaKit as well as also the Pi 3 CanaKit. Otherwise here is usually what you need just for This kind of build:

  • Raspberry Pi: While any of the Pis would certainly work, the real choice here is usually between the Pi 3 as well as also Pi Zero W. The built-in Wi-Fi makes them super easy to set up, the difference is usually inside the performance as well as also size. If size is usually more important, use the Zero although the item may have performance issues such as slower frame rates. Keep in mind, you can use a longer ( 2 meters) camera ribbon cable, which would certainly make the item easier to hide the Pi, as only the camera Module itself would certainly need to be visible.
  • microSD card
  • microSD card reader
  • power supply

Step 1: Download the motionEyeOS Image

First, we need to download the custom Raspberry Pi image coming from motionEyeOS’ Github Discharge page. Once you navigate to the website, download the latest style for the type of Pi you are using. Remember in which for the Pi Zero, you need to download the original Pi style.

Don’t Miss: How To Hack Into & Switch On Anyone’s Webcam Remotely

The download is usually in archive format, so we need to extract the image coming from the item before we can flash the item. On Windows, you can use 7-Zip, as well as also on a Mac, you can use Keka. You can also use WinZip on both. WinZip costs money, although you can usually get away with using the free trial. Once you have one of those on your computer, click on the archive as well as also extract the files.

Step 2: Flash the Image to the MicroSD Card

at This kind of point, we need to write the image to your microSD card. Best practice is usually to unplug any external hard drives or various other USB devices you have, as well as also then insert your microSD into its adapter as well as also plug the item in. This kind of is usually important because you don’t want to accidentally flash the wrong device.

If you already have a program to flash the image to the card, then you can use in which. Otherwise, download Etcher, as the item’s the easiest to use. the item works on Windows, Mac, as well as also Linux while also having the simplest user interface. Etcher should detect what operating system you are using, although if not, make sure you download the correct style based on your operating system (OS) as well as also follow the on-screen installation directions. Open Etcher (if the item doesn’t automatically after installation), as well as also select the image you just downloaded.

Next, be sure the proper drive is usually selected as well as also flash the image. Once the item’s done, the item will safely eject the SD card. There is usually a rare chance in which Etcher will cause an error. If in which does happen, you can use ApplePiBaker for Mac or Win32 Disk Imager for Windows.

Step 3: Configure Wi-Fi

We can use ethernet to connect our Pi to the network. in which will give us the fastest as well as also most stable connection in which can’t be jammed by a simple Wi-Fi Deauth attack, although sometimes we want or need to use a Wi-Fi connection, so let’s take a quick look at how to do in which.

If you are using windows download Notepad++ or else you will have problems with how the item saves line breaks. Once you download the item, open the item as well as also go to “Edit” then “EOL Conversion” as well as also click on “UNIX”

To hold the Pi connected to the network on boot, we need to give the item the network credentials. We can do This kind of which has a file called “wpa_supplicant.conf” which we add to the boot partition of the SD card. Etcher will have ejected the SD card, so physically remove the item as well as also reinsert the item. In Windows, you will need to enable File name extensions under the view tab of File Explorer to ensure in which you can edit the file type.

Then, using a text editor such as Notepad++, create a file named “wpa_supplicant.conf”. Here, I first made a brand new text document, then renamed the item.

Copy inside the following, replacing the SSID as well as also PSK with your information, although don’t remove the quotes. If you live outside the US, you can look up your country code as well as also replace in which too.



After in which is usually done, save the file as well as also safely eject the SD card. If you do a lot of Pi builds, This kind of can be a useful file to keep on your desktop as well as also copy over to every brand new Pi you set up to quickly connect the item to the Wi-Fi network.

Step 4: Putting Together the Device

The most important part of the assembly is usually to connect the camera. Let’s look at how the item should be done on the Pi as well as also Pi Zero.

First, lift up the black plastic part of the ribbon connector, found between the HDMI as well as also audio ports on the Pi 3.

Image by Hoid/Null Byte

Then, insert the ribbon cable with the copper connectors facing the HDMI port as well as also press the black piece back down.

Image by Hoid/Null Byte

On the Pi Zero, the item is usually very similar. Pull out the black plastic part of the ribbon connector.

Image by Hoid/Null Byte

at This kind of point, insert the ribbon with the copper leads facing the PCB as well as also press the black piece back in.

Image by Hoid/Null Byte

After in which, you should do the same with the various other end of the cable as well as also the camera module, with the copper leads facing the PCB.

Image by Hoid/Null Byte

Insert the SD card into the slot at the bottom of your Raspberry Pi. The last stage is usually to put the item all in whatever housing you have chosen. Here, I hold the Pi Foundation case in which comes inside the CanaKit.

Image by Hoid/Null Byte

Remember not to bend the cable too much, particularly at too sharp of an angle. the item can take a bit of force to snap the camera in place, so don’t worry too much about breaking the item.

Image by Hoid/Null Byte

Finally, plug the Pi into power.

Step 5: Start Your Pi

The Pi can take a few minutes to boot up the very first time so you can go grab some coffee or get commenced flashing another SD card if you are generating more than one. After three to all 5 minutes the item should have booted, so we need to find the item on our network.

The IP address can be found several ways, including opening your router’s admin page as well as also looking at connected devices or using a program like Nmap, Fing, or Angry IP Scanner. If you can’t locate the item, then the most likely problem is usually the “wpa_supplicant.conf” file. Double check the item as well as also make sure the info there is usually correct.

Once you find the Pi’s IP address, plug the item into your browser of choice. You will be taken to the login page for the camera. The default username is usually admin as well as also no password.

If everything has been done correctly, then inside the top left corner we should see the live video feed at This kind of point.

the item may be necessary to physically rotate the camera to get the image to be upright.

For obvious reasons, the first thing we need to do is usually set an admin password as well as also user password. Click the three horizontal bars on the top left of the screen, as well as also then click “General Settings”.

Unfortunately, you can’t change the admin username, although you can change the “Surveillance Username.” As the name implies, This kind of user can only view the cameras although has no power to change settings. Go ahead as well as also set passwords for both of these accounts.

While you are inside the menu, you may also consider changing the “Camera Name” under “Video Device”. This kind of is usually very helpful when you have a lot of cameras or, you have someone unfamiliar with the camera setup watching. After in which, click “Apply” on the top bar, as well as also the camera will restart.

When the item’s done restarting, we need to check for updates. Go to the “General Settings” tab as well as also click on “Advanced Settings.” The tab will then expand, as well as also then click “Check” beside “Software Updates.” You should get in a regular habit of doing This kind of.

You may want to change the timezone as well as also Hostname. This kind of is usually also where you should go to shutdown the Pi safely.

Step 6: Fix IP Address

To make the item easy to add cameras as well as also find the web page inside the future, the item is usually nice to set a static IP address. Find the Network tab inside the settings as well as also open the item. Then, change IP configuration to static, setting the IP to the one the item currently has.

Step 7: Adding Cameras

In any type of real-world usage, more than 1 camera will be needed. Our current setup can be visualized like This kind of.

Image via motionEyeOS

However, This kind of won’t work well, as we would certainly have to visit a different web page for each brand new camera. We have two options for adding cameras. The first is usually to hold the Pi host more than one camera, which could be done by adding web cameras to the Pi. This kind of can be useful if one area needs several cameras to cover all angles, although is usually limited by the processing power of the Pi. Depending on how you set the resolution as well as also frame rate settings, you might get away with This kind of on the Pi 3, although not on the Pi Zero.

Image via motionEyeOS

To add to the network This kind of way, go to the top left of the page as well as also open the “Settings” tab then click on “Camera 1” as well as also “add camera.”

Then a window will appear, by default, the item will look for any more local cameras on the Pi. I didn’t have any although if you do there will be a drop-down menu beside “Camera.” Select the one you want to add as well as also click “OK.”

The second way we can set This kind of up is usually to have one motionEye remotely control another motionEye camera. We can even designate one of the motionEye devices as a hub as well as also add all of the various other motionEye-based cameras to This kind of hub as remote motionEye cameras. This kind of works best for our Pi based build, because of the limited CPU power of each individual Pi. Pi Zeros make great remote cameras which has a Pi 3 acting as a hub.

Image via motionEyeOS

Go to the “Add Camera” menu as before, although This kind of time select “remote motionEye.” You will then need to provide the information, with the URL being the static IP address we set. If in which Pi has more than one camera, then you can pick which one to add.

Step 8: Set Up Motion Detection

at This kind of point in which we hold the cameras up as well as also running, we need to select our motion detection settings. These are some general starting points, although you will have to experiment with these until the item works the way you want.

If you have problems with false positives, then turn “Mask” on, as well as also you will be able to select portions of the camera frame to hold the software ignore. This kind of is usually genuinely useful if you have trees in which move inside the wind, or cars driving by on a street.

Putting the item All Together

Today we have learned how to set up one or many Raspberry Pi cameras running motionEyeOS, as well as also form them into a network.

There are far more settings we can look at, such as port forwarding so we can see the camera coming from anywhere on the internet, triggering scripts based on motion events, as well as also employing the GPIO pins. We will look at some of these features in a future article. Until then, explore the rest of the settings on your own, as well as also don’t forget about the tooltips in which will pop up to the right of each setting as you mouse over the item.

If you have any questions, feel free to leave them inside the comments or on Twitter!

Cover Photo by Kai Hendry
Screenshots by Hoid/Null Byte

Leave a Comment

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

fourteen − seven =