We all know how hard it can be sourcing a webcam right now, and while there are some alternatives like the Wyze Cam V2 we did a guide on, here’s another fun one, especially for those of you who are DIY inclined! In this guide we will work through converting a Raspberry Pi Zero into a webcam that you can plug in as if it were made to come that way. There are two different methods: a simple one using a pre-made kit Micro Center created, and a do-it-yourself guide for those of you who want see exactly how it all works
The method using the pre-made image is the simpler of the two, because we have already created a custom Raspbian OS image with all the coding and setup done already for this purpose. Pretty much all you have to do is download it, write it to a microSD card, then put it all together and plug it in.
Click here to be taken to the guide using our pre-made image
The DIY guide is much more in depth, and will cover everything needed to do this from scratch. All the steps used in the DIY guide are what we used to make the custom image ourselves, so if you want to do all the coding and see how it works, you can take it step by step.
Click here to be taken to the DIY guide
Hardware you will need:
First we need to assemble everything. Our Pi case comes with a few swappable top pieces, but we are going to be using the top with a hole in the middle.
1. Take your Pi camera and detach the cable that comes with it. To do this, you must push up both sides as shown below.
2. Lightly pull the cable out. Now we need to insert the cable that came with our case.
3. Insert the larger side of the cable into the camera interface with the pins facing the same side as the camera.
4. Push the piece back down so that it locks the cable in place.
5. Now unlock the Pi’s camera interface and insert the smaller end of the cable. The pins should be facing the back side of the Pi.
6. Once we have the cable pushed in, lock it down as we did with the camera interface. Put in the microSD card, then we can insert our Pi into our case. (It may be a tight fit, that is normal). Insert it so the ports on the PI match up with the holes in the case. The Pi should lock in place and fit snug in our case by pushing it down, there are a few pegs that line up with the holes on each corner of the Pi. The cable may need to be bent to fit in, but don’t worry about that, the cables are made to handle this. Now grab the top we mentioned earlier and fit the camera into it. It will only fit one way, so once we have that seated, we can pull the top onto the pi to finish assembling the case. The final product should look like this before closing the lid.
7. We need to download IP Camera Adapter 3.1. Go to https://ip-webcam.appspot.com/ and click download, then run the .msi file it downloads. If it pops an error saying a module failed to install just press ignore and finish the installation. Now we just need to open it up and point it to our Pi. Type camera adapter into your taskbar and open Configure IP Camera Adapter
8. In the Camera feed URL, type or copy/paste raspberrypi.local:8080/?action=stream and click Apply and OK. If this works, it’s time to test this out for real!
Open up your app of choice. If using Skype, make sure you download the standalone desktop client from https://www.skype.com/en/ (Microsoft Camera and other default Windows 10 apps cannot see our MJPEG camera device, so the built-in version of Skype in Windows 10 will not work). Make sure your camera is set to MJPEG Camera to show you the proper feed. Once set, you’ll see the Pi Camera and that’s it. Enjoy your webcam!
Software you will need:
1. Insert the microSD card into your computer. You may need a USB microSD card reader if your system doesn’t have an SD card slot built-in
2. Open Etcher and press Select image
4. Select your microSD card (MAKE SURE TO SELECT THE RIGHT ONE – Selecting the wrong one could result in data loss)
5. Click Flash! Then click OK on the User Account Control prompt. This may take a few minutes to complete depending on your hardware, maybe go grab a coffee while you wait.
6. Eject the microSD card/drive and re-insert it.
7. A new drive should appear called Boot. If it does not automatically open, navigate to File Explorer or My Computer and open the drive (it should be listed on the left). We need to modify two specific files: cmdline.txt and config.txt
8. Right-click and open config.txt with Wordpad and add this to the bottom: dtoverlay=dwc2. Make sure you save before you close it.
Or…
10. Make sure your folder view in File Explorer allows you to see file extensions. Go to View at the top and check “file name extensions.”
11. Next, we need to create a new file called SSH
12. Eject your microSD card and insert it into your Pi.
Now we need to assemble everything. Our Pi case comes with a few swappable top pieces, but we are going to be using the top with a hole in the middle.
13. Take your Pi camera and detach the cable that comes with it. To do this, you must push up both sides as shown below.
14. Lightly pull the cable out. Now we need to insert the cable that came with our case.
15. Insert the larger side of the cable into the camera interface with the pins facing the same side as the camera.
16. Push the piece back down so that it locks the cable in place.
17. Now unlock the Pi’s camera interface and insert the smaller end of the cable. The pins should be facing the back side of the Pi.
18. Once we have the cable pushed in, lock it down as we did with the camera interface. Now we can insert our Pi into our case. (It may be a tight fit, that is normal). Insert it so the connectors match the ports on the case. The Pi should lock in place and fit snug in our case by pushing it down, there are a few pegs that line up with the holes on each corner of the Pi. The cable may need to be bent to fit in, but don’t worry about that, the cables are made to handle this. Now grab the top we mentioned earlier and fit the camera into it. It will only fit one way, so once we have that seated, we can pull the top onto the pi to finish assembling the case. The final product should look like this before closing the lid.
19. Now it’s time to boot up our Pi for the first time. We need to plug our USB to microUSB cable into the computer and into our Pi. Since our Pi has two micro USB ports, we will be using the port closest to the middle so we can SSH into it from our computer. SSH is how we interface with the Pi over a data connection, think of it like a gateway to our terminal. Since Windows doesn’t have an SSH client, we will need to download one. The most common SSH client is known as Putty, and it can be downloaded here: https://the.earth.li/~sgtatham/putty/latest/w64/putty.exe
20. Yours will be empty if this is your first time opening it. First, we need to create a new connection. To do this, type a name for your pi into the saved sessions box, then type raspberrypi.local into the hostname box and click save. If done correctly you will see your new saved session below the saved sessions box.
21. Double click on the name you gave it and you should now be presented with a warning of a potential security breach. This is normal to see if this is your first time connecting to your Pi. Once you click yes, it will not pop up again. Now it’s time to sign into your Pi. Raspbian’s default user is pi and default password is raspberry. While typing your password, it won’t show you anything on the screen. This is done for security reasons, so enter raspberry and press enter and you’ll be logged into your Pi. Now we need a network to continue.
22. With your Pi still powered on and connected to our computer, search in the taskbar for network status and open Network Status. You can also click your Start Button, go to Settings, then open Network and Internet and you’ll be in the status menu. Click Change adapter options and a new window will open up and show you all of your network adapters. One of them will have “USB Ethernet/RNDIS Gadget” under the name. Remember which connection show that because that is the connection to our Pi. My pi’s connection name is Ethernet 4 and my primary internet connection is named Ethernet 1.
23. Right click on your primary internet adapter and click properties. At the top you will see sharing. Click this and check the top box to allow other network users to connect through it and select your Pi’s connection. Click ok to close the window. Now unplug the pi and plug it back in. This will reboot your Pi and share your connection. This will also terminate our SSH session. For now, we will close Putty.
24. It may take up to 90 seconds for our Pi to fully reload. Open Putty again and double click our sessions name to log back in. Same details as last time, pi for username and raspberry for password. Now we can move onto installing the required software. Type the following command and hit enter:
25. After our above command finishes, we need to type and run sudo raspi-config and navigate to interfacing options. Select Camera and enable it. Navigate to finish and press enter to save everything. It will ask to reboot, select yes and let it reboot, then restart Putty.
26. Now we need to get mjpg-streamer. We will be using this to stream our webcam via our network on the Pi. Run the following command:
27. Once that finishes, run this command:
28. Once that command finishes, we need to run a test to ensure it works. While in the ~/mjpg-streamer/mjpg-streamer/experimental directory, run this command:
29. If you see a red light on your camera, you’re live! It’s time to set it up so our camera starts automatically when we plug in the Pi. We need to first close out of our running stream. To do this, hold down ctrl and press C. Wait a few minutes and you should see our pi@raspberry:~ $ line again. If not, hold ctrl and press Z to get back to that line.
30. Now we need to make a script to run at startup. Type and run nano ~/cam.sh, then paste in the following.
Make sure the lines match up exactly as they are listed here. Now hold ctrl and press X. It will ask if you wish to save, press y for yes and enter to save and close.
31. Run the command chmod +x ~/cam.sh , then run the command crontab -e
32. It will ask which editor you prefer, press 1 for nano and enter to confirm. Now you will see our Pi user’s crontab. At the top, press enter to make a new line, and add PATH=~/bin:/usr/bin/:/bin:/usr/local/bin/, then go to the bottom of the file and enter @reboot /home/pi/cam.sh, like so:
33. Just like our cam file, hold ctrl and press X, then hit y and enter to save and exit. Now we just need to reboot the pi to confirm it works. Run sudo reboot and wait for it to reboot. In about 30 seconds, your camera should light up red again. This means our script works and now we can work on getting our camera streaming to our PC.
34. We need to download IP Camera Adapter 3.1. Go to https://ip-webcam.appspot.com/ and click download, then run the .msi file it downloads. If it pops an error saying a module failed to install just press ignore and finish the installation. Now we just need to open it up and point it to our Pi. Type Camera into your taskbar and open Configure IP Camera Adapter
35. Now in the Camera feed URL, enter raspberrypi.local:8080/?action=stream and click Apply and OK. If this works, it’s time to test this out for real!
Submit photos and a description of your PC to our build showcase
See other custom PC builds and get some ideas for what can be done
Services starting at $149.99