Raspberry Pi Zero Wireless – Video for Duet
For this project I’m going to use one of the tiny Raspberry Pi Zero Wireless controllers and a Pi NoIR Camera V2. Using the NoIR as I wanted to try it out, and the NoIR makes it possible to record in the dark using IR lightning.
You also need one of the camera cables for the Zeros, as they are tapered in one end compared to the normal ones. They come in 15cm and 30cm lengths.
- Download Raspian
- Remote Access using VNC
- Attach Camera
- Install Camera Software
- Duet Webcam Integration
Download Raspian or Noobs
Grab newest Raspbian version. I’m using the full version. Maybe Lite is enough for our purpose?
If you downloaded Raspbian and imaged it using Etcher rather than NOOBS, then you will boot directly to the desktop environment of Raspbian and won't need to wait.
I ended up having to download using Torrent which took 8 hours less than the regular download!
You can get the Noobs version (instead of the above Raspbian) – and look at this nice guide:
NOOBS is an easy operating system installer which contains Raspbian. It also provides a selection of alternative operating systems which are then downloaded from the internet and installed.
To make the SD last longer, I strongly recommend getting a proper SD formatting tool, like SD Formatter, and do a format.
Make sure to pick the right drive, give it a name and hit Format.
Unpack and write image to SD
Write image to SD using Etcher – it can open .zip files without extracting it.
Or you can get Win 32 Disk Imager for more options.
Note: For some reason it didn’t want to work with my normal SD card-reader, so had to dig up a different one!
Be patient.. it takes a while.
I had some issues, as mentioned above, so ended up unpacking it manually, which is why the source filename is different in the two images here.
When it goes from writing data to the SD to Validating, Windows might throw some errors at you, but that’s normal, so don’t worry.
Remote Access using VNC
I used usb keyboard and mouse, which I had to switch back and forth, since I couldn’t find my USB-hub, to connect the RPI to my WiFi and to activate VNC.
Windows key to open the menu. Go figure 🙂
Here’s a guide.
Next up I need to get myself a VNC viewer for my PC to connect to the RPI from my PC.
- Do not use it on your RPi to connect to the RPi!
- Just press Got It, on the first welcome screen. It looks like options with the icons above, but they aren’t.
Enter the IP and then use the default username pi and password raspberry to connect.
You want to change these at some point.
I now have access from my PC and am ready for our Camera.
Now lets dig out our RPi camera and the special RPi zero camera cable.
Loosen the tabs on both devices and insert the ribbon cable as shown.
Do not put the devices on top of the antistatic bag. It works the opposite of putting the devices inside it, so don’t do that! I know many people are doing this all over the internet, but you really, really do not want to do that.
We do not need to activate the camera using commands, since we enabled the Camera further up top alongside VNC.
Now we need to update before continuing setting up the Camera.
Enter the Console/Sli and type:
Sudo apt-get update
Sudo apt-get dist-upgrade
If you are used to use sudo apt-get upgrade instead of the dist- you might want to read about the differences.
Lets see if it works, by issuing this command:
raspistill -v -o test.jpg
You can find the test.jpg file using the File Explorer, where the photo should be placed at your home directory.
There is a larger guide here.
Install Camera software
I had planned to install the software Motion, as I had read a nice guide, but it turned out it just didn’t want to work with my Noir V2 camera, so I decided to look elsewhere. I also learned the project is no longer in the hands of the original author and has not been updated for a while.
I decided on using RPI-Cam-Web-Interface instead although it is a webinterface, which isn’t strictly what I want for my Duet WiFi purposes. But I hoped it would make the raw videostream available, which it turned out to do.
The interface options also makes it easier to setup the different options as I’m not much of a linux console kind of guy.
There is a nice wiki guide, which I’m pretty much just following.
Since we allready updated our RPI, we can skip to step 4 to install the actual software via the Console:
1 command pr line. Wait for each to finish.
git clone https://github.com/silvanmelchior/RPi_Cam_Web_Interface.git
chmod u+x *.sh
Short explanation: First it downloads the program, change to the folder, makes all .sh files executable and then installs it.
A window is going to pop-up after a while. I just used default settings under installations.
Accessing RPI Interface
Open you browser and type in the IP of your RPI. If using default settings, you will be presented with a directory listing, where you can click on html link before you see something like this:
All done as we don’t need to do anything here really, but you might want to go into Camera Settings to setup resolution
Duet Webcam Integration
In order to integrate the videostream into the Duet Web Interface, we need the direct url for our videostream.
Lets say the IP is 192.168.1.26 like mine, the address you need to insert into the Duet Web Integration box is:
You put this into the Optional URL to an external Webcam box in Settings -> User Interface – Webcam Integration
Note: I’m not entirely sure what the checkboxes are meant to do. I can find no differences if I check the Embed Webcam Stream or not?