X

Break New Ground

How to build a Raspberry Pi webcam, plus the surprising links between Pi and Oracle Cloud Infrastructure

Do you need a better webcam, or a second or third webcam for live-streaming? I recently discovered how easy it is to build a webcam using the Raspberry Pi Zero and a Raspberry Pi camera. I'll take you through the steps like it's your first Pi project ever — because it was mine! Not only does it work great, it only costs $25.

This is an easy way to get started in the world of Raspberry Pi. But what does it have to do with Oracle developers, you ask? Well, it turns out Oracle engineers love Raspberry Pi for all sorts of hobby, enterprise and demonstration projects. In fact, the Raspberry Pi supercomputer (which I got to help  assemble in the final stages) made worldwide news.   

There’s a long history of running Java projects on Raspberry Pi, and Frank Delporte’s recent article in Java Magazine can start you down that road.

Oracle also offers Oracle Linux images for the Arm architecture, specifically for use with Raspberry Pi 4B, Raspberry Pi 3B and Raspberry Pi 3B+. Included in the development preview is Unbreakable Enterprise Kernel Release 6, based on the up-stream 5.4 kernel.

Finally, lest you think hobby computers have no utility for enterprise applications, this engineer needed a Site-2-Site Tunnel between a customer’s in-house data center and the OCI Frankfurt region. For ease of testing, he set up a separate VPN tunnel to his own development network using libreswan on a Raspberry Pi. (You can find the Oracle libreswan documentation here https://docs.oracle.com/en-us/iaas/Content/Network/Reference/libreswanCPE.htm).

 

Now, let’s get to the tutorial.

Supplies:

  • Raspberry Pi Zero or Raspberry Pi Zero W (wireless)
  • Raspberry Pi Zero camera cable
  • Micro SD card
  • Raspberry Pi camera of any resolution
  • USB micro to regular USB cable

Steps:

  1. Connect your camera of choice (in my case, I am using the lowest quality camera available, the version 1) using the cable that fits the Raspberry Pi Zero. Use your fingernails to gently pry the corners of the cable clamps loose so they very slightly wiggle. Install the cable with the shiny metallic connections facing the surface of the board. Use your fingernails to push down on the clamps on either side to secure the cable at each end.
  2. Download and install the Raspberry Pi imager from https://www.raspberrypi.org/software/.
  3. Go to https://github.com/showmewebcam/showmewebcam and click “tags” to find the most recent version.
  4. Choose the latest image (I used v1.70) and download it.
  5. Put your SD card in your computer’s card reader.
  6. Open Raspberry Pi Imager. Choose “Custom” for the operating system and select the showmewebcam image you just downloaded (mine was called sdcard-raspberrypi0-v1.70.img). Choose your SD card and click “Write”.
  7. When the card has been formatted, remove it and put it in your Raspberry Pi Zero.
  8. Attach the USB cable to the port in the middle of the Raspberry Pi Zero, not the one closer to the end. Connect the USB cable to your computer.
  9. In Zoom, choose PiWebCam in your video preferences; or, in or OSB, choose a new source by clicking the + and “Video Capture Device”, and choosing PiWebCam in the next screen. Presto, it works!
  10. Now you may wish to build a small case for it. You can use cardboard or foam board, a 3D printed design or a wooden or plastic box, or buy a ready-made one if you’re using the high-quality camera. This one even has a little spirit level on it so that you can be sure your camera is positioned the way you want it.

Why it works:

The showmewebcam code is Linux-based firmware for the Raspberry Pi Zero that boots very quickly, lets your Pi Zero gain power from the computer like any other dongle, and tells your computer that what you have attached to it is a camera, not another computer. When you have connected the PiCam, the LEDs on the board and the camera both light up briefly. When the camera is ready for action, the green LED on the board blinks 3 times rapidly (that’s a tweakable setting included in the image.)

The Show-me webcam works with Linux, Windows 10 and Mac operating systems, and various video streaming services including OBS, Zoom, Teams, Jitsi, Firefox and Chrome.

To change the camera settings, use the following shell commands in Terminal:

  1. Discover the name of your specific camera by typing:
  2. ls -l /dev/tty.*
  3. Copy the number after /dev/ttyusbmodem (for example, screen /dev/tty.usbmodem141103).
  4. Type the following (adding 115200 after the number you found in the name of your Pi Zero device): screen /dev/tty.usbmodem141103 115200
  5. “Your webcam at your service!” appears. For piwebcam login, type root.  For password, type root again.
  6. Type this: /usr/bin/camera-ctl
  7. A small menu that lets you adjust the parameters of your camera pops up. You can make permanent or temporary changes (permanent ones require writing to the camera.txt file on the SD card).  Press S to save, and command Q to quit Terminal.

That’s it! I want to give credit to David Hunt for first popularizing this build. It has since been simplified, as evidenced in this tutorial, thanks to Hunt and the other contributors of the showmewebcam Linux firmware. Enjoy your new camera!

Join the discussion

Comments ( 1 )
  • Dave Thursday, March 18, 2021
    Nice focused use of Raspberry Pi Zero, wasn’t aware of a dedicated, lightweight OS build solely for camera use. Thanks
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.