Have you ever wanted a good USB webcam but not sure which one to buy? Why not build one yourself!
Raspberry Pi Zero is a super-compact, hackable, and ultra-low-cost computer. Besides, the Pi Zero features a USB OTG port, which allows us to power it while sending data between the PC and Pi Zero.
Therefore, with proper configurations, we can make the Pi Zero as a low-cost DIY USB Webcam. We can also utilize the processor in the Pi Zero to act as an Image Signal Processor (ISP) which allows us to tune the image such as brightness, contrast, saturation, color effects and many more!
Camera Options (Comparisons)
Note: The images are taken around 60cm apart from the target. The samples shown above are being cropped to fit but not resized. You can see the original images here.
First thing first, we have to prepare the SD card for the Pi Zero. Go ahead and download the latest release of the image file for this project.
Depending on which Pi Zero you are using, the file you download should have a “.img” extension.
Next, to flash the image into the SD card, you can use either Raspberry Pi Imager or Balena Etcher on your computer. Launch the software after installation and insert the micro SD card into your computer.
Option 1: Raspberry Pi Imager
On the Raspberry Pi Imager, click on “Choose OS”. Then scroll down to the bottom and select “Use custom” as shown in the image below:
Search for the image file that you have downloaded previously and click “Open”. Next, choose the destination SD card and click “Write” to start flashing. That should take only a few seconds to complete thanks to the extremely small image file size.
Option 2: Balena Etcher
Choose the image file that you have just downloaded and select proper the SD card. Press “Flash!” to flash the image to the SD card. That should take only a few seconds to complete thanks to the extremely small image file size.
After flashing, you can unplug the micro SD card from your computer and insert it into the Pi Zero. Assemble the camera and case, your final assembly should be something similar to the picture below.
Your Raspberry Pi Zero USB Webcam is ready to use! Connect the micro USB cable to the USB port of the Pi Zero (the one closer to the center) and another end to your PC. If it is the first time connecting it to your PC, it will take some time for it to finish setting up the USB device as a webcam. Otherwise, the USB webcam should be ready to use within 10 seconds!
Using the USB Webcam
Open up the camera app of your PC. If your PC have a built-in webcam, you can switch the camera device by pressing the “change camera” icon.
Other than that, you can use the Pi Zero USB Webcam on other applications such as Teams, Zoom, Chrome and etc. In fact, just treat it like a normal USB webcam out there.
This part focuses on PC running in Windows. If you are using Linux or Mac, please refer to this link instead.
As mentioned in the introduction, the Pi Zero can be used as the Image Signal Processor (ISP) for you to tune the image. To do that, you need to use a software called Putty, which allows us to connect to the Pi Zero via serial interface provided as a ttyACM device.
You can search for the COM port of the Pi Zero from the Device Manager. Right click on the Windows icon of your PC and select Device Manager.
Alternatively, you can search for the application by using the Windows search tool.
Then, look for “Ports (COM & LPT)”. Click to expand it, you should be able to see the COM port number of the Pi Zero (in this case it is COM12).
Now launch the Putty application you downloaded earlier. Under the “Session” category, select the “Connection type” as Serial. Enter the COM port number in the Serial line and set the Speed (baud rate) to 112800.
Click “Open” to start the connection with Pi Zero. Use the username and password as root to log in. Once you have log in to the Pi Zero, enter the following command to use the camera settings:
You should be able to see a user interface similar to the image above. Navigate around it by pressing the arrow keys and play with the settings. You can always reset them to default by pressing “R”.
It’s amazing to see how easily we can make a USB Webcam by using Raspberry Pi Zero. Thanks to all the contributors of the showmewebcam project! You can look for more information about this project here.
Have fun with the USB Webcam! 🙂