Streaming Video with the Raspberry Pi Zero W & Pi Camera

IR-CUT Camera Module    Send article as PDF   
I needed a really tiny yet cheap camera so I thought of the Raspberry Pi Camera module. The Version 2 Camera Module does 8MP with good quality, although a 5MP  IR-Cut Camera better suited my needs.

About the IR-CUT Camera

The IR-CUT Camera works on Normal Mode by default. There are two ways to toggle between Normal Mode and Night-vision Mode.

1. By editing the config.txt file:

and append:

exit with save and restart your Pi then the camera will work on Night-vision Mode.

To revert to the Normal Mode, please remove the line disable_camera_led=1 then save and restart your Pi.

2. By changing the level on this position:

IR-CUT Camera Board

Thus, you can connect the GPIO from your Pi to this position, and toggle modes by changing the GPIO logic level. (HIGH –> Normal Mode, LOW –> Night-vision Mode)

Setting up the Raspberry Pi Zero ‘W’

I use Raspbian Lite because the only thing we’re doing with this Pi is using it as a camera. Setting up Raspbian Lite is awkward with only a Pi Zero W because the wireless has to be configured. This setup will work with any version of Raspbian Jessie or later.

If you don’t have a Linux system around, boot the Raspberry Pi with a monitor and keyboard.

If you already have a Raspberry Pi or a working Linux system you can just create the ssh file and the wpa_supplicant files as shown below and add them to the sdCard. This will let the PI Zero W connect to your wireless and enable SSH.

Setup using Keyboard and Monitor

Connect a keyboard and monitor to your Raspberry PI. Boot and then follow the next two sections.

Setup Wireless

To add the wireless setting to the wpa_supplicant.conf file:

You can set the wpa_supplicant.conf access back to 600 if you want to revert to original (otherwise a hacker could theoretically access your wifi).

Enable ssh

To enable ssh add an empty ssh file to the boot partition. Then ssh will come up enabled. You can also do this via raspi-config.

Remove the keyboard and monitor and reboot. From here on use ssh. I use Putty as a client but other clients work fine.

After Booting with Wireless and SSH enabled

Enable the camera

Enable the camera. This is done in raspi-config. There’s no reason to show the GUI and it changes anyway. Find the enable camera option and do that.

Let the system reboot once the camera is enabled. To test that the camera is working:

This should note that one camera was detected and connected.


Install UV4L and WebRTC

Recently (April 2018) the folks at linux-projects have written a raspberry pi driver that streams all by itself. I haven’t extensively tested it but I have tried it out and it seems to work. It’s painless install (nothing to compile) and supports h264 as well as a myriad of other formats. There is even documentation (gasp).

Installation instructions are here. Or, if you’re running Raspbian Stretch: start by adding the linux-projects repo (requires a key and a line added to /etc/apt/sources.list).

Next, update the source holdings and install the uv4l stuff:

If you want simple access and a GUI add the WebRTC shell.

Then reboot the PI and browse to the uv4l server at http://raspberryip:8080 from your desktop. The video stream is at http://raspberryip:8080/stream

Helpful Commands

Show Camera’s Chip Temperature

Show the current chip temperature (vcgencmd is in /opt/vc/bin):

Show CPU usage:

This requires systat for a simple rolling cpu usage view.

sudo apt-get install sysstat

sar -u 2 # every two seconds show usage

Previous Post

Run a Program On Your Raspberry Pi At Startup

The method that I usually use to run a program on your Raspberry Pi at startup is to use the file rc.local. In order to have a command or program run when the ... Read more

Next Post
Neo-6M GPS Module

Raspberry PI: Connecting a Neo-6M  GPS Module

I built a project using a Neo-6M  GPS Module with the Raspberry PI. Now there are several USB solutions, and apps that work with them, but I wanted to show how ... Read more

Short URL:

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Do NOT follow this link or you will be banned from the site!