The Raspberry Pi Zero is an amazingly powerful and cheap device, and since it behaves more or les...
Public Lab is an open community which collaboratively develops accessible, open source, Do-It-Yourself technologies for investigating local environmental health and justice issues.
Public Lab chatroom
Reset your password
Read more: publiclab.org/n/15289
partsandcrafts was awarded the Basic Barnstar by stevie for their work in this research note.
The Raspberry Pi Zero is an amazingly powerful and cheap device, and since it behaves more or less like the kinds of desktop computers most people are familiar with it is, in a lot of ways, relatively user-friendly. Here we'll show you how to set it up with the Raspberry Pi Camera module (v1 or v2) and connect to it to take photographs from your laptop.
(For a full overview of this project, go to Raspberry Pi Microscope Build.)
The biggest hurdle that I've found for actually succeeding in doing anything with the Raspberry Pi is actually just getting it plugged in and turned on and attached to some kind of keyboard and display. This is how you'd use it in the traditional way, with all the cables:
If you don't have exactly the right set of peripherals and cords and dongles getting the Pi up and running can feel extremely daunting, and getting all of the required components, if you don't happen to have them lying around, quickly adds up and stops being cheap.
Above: three separate monitors plus a LOT of cables.
Instead, and because of these two factors -- the difficulty that I've seen people outside of tech/computer hobbyists circles have setting up the Raspberry Pi, and the additional cost of getting all of the required components from scratch, I wanted a way for people to use the Raspberry Pi camera as a digital camera without really having to interact with the Raspberry Pi as a computer.
The solution I've come up with is to use the Raspberry Pi Zero W over your local WiFi network, so any computer on your WiFi network can see through the camera using a web browser. The whole camera interface is available on a web page, as long as you're on the same WiFi network. (IMPORTANT: We're using the Raspberry Pi Zero W, not the regular Raspberry Pi Zero, which does not have WiFi built in.)
In a perfect world, our Raspberry Pi Zero W would hook up to the camera, connect to the wifi, and then seamlessly know to display a live image on a website.
If you just plug in your Pi and go to http://raspberrypi.local, nothing will happen. Before we get started, we'll need to:
Following these steps, we have prepared an SD card image with the software already set up. You can get this disk image here:
Download it (it's very big -- ~8 gigabytes!) and write it to your microSD card using Etcher -- https://etcher.io/
In a workshop or classroom setting, microscope users can be given a pre-flashed SD card with the appropriate software installed and will only need to edit a single text file to provide their WiFi login and password. This is admittedly a somewhat daunting task for many casual computer-users, but it can be explained in a step-by-step manner pretty easily.
You'll be connecting to the microscope over WiFi, so it needs to be connected to your network first.
Once you've written the SD card it will probably show up as two different drives on your computer. If you're using Windows you will see a "boot" partition (in my case, E:) and then an unreadable partition with a file system that Windows does not understand (in my case F:). Windows will throw some errors about this second partition and say that you need to reformat this second partition to use it. Ignore these errors.
If you open up the "boot" partition you'll see a file called "wpa_supplicant.conf" Open it in any text editor and you'll see something like this:
The only thing you need to do is replace "SSID_NAME" with your wifi network's SSID (the name of the network as it is displayed when you try to connect to it) and "PASSWORD" with your network's password.
If there's no password on your WiFi network, see the comments for how to set this file up.
After you make these changes, save the file and eject the SD card.
(If you've done this once and want to change the WiFi information, you may find that the file has disappeared. Download a new file here: wpa_supplicant.conf)
Now you're ready to boot it up. Put the SD card in your Raspberry Pi and plug it in with the USB power cable where you see the circular power symbol (not the USB port, which looks similar!).
It will take a little while to boot, but after it does you should be able to visit http://raspberrypi.local on your laptop's web browser and -- connected wirelessly to the camera -- see a live image.
Note for Windows Users
If you are using Windows, your computer might not be configured to find the Raspberry Pi on your network using the http://raspberrypi.local address. Newer updates of Windows 10 seem to support this feature, but older Windows installations may not.
The simplest way to enable this functionality is to install Apple's Bonjour print services, either the older version 2.02 as a standalone program -- https://support.apple.com/kb/dl999?locale=en_US -- or the newest version, bundled with iTunes -- https://www.apple.com/itunes/download/ (although it may seem strange, the utility comes with iTunes!)
More information is available here -- https://learn.adafruit.com/bonjour-zeroconf-networking-for-windows-and-linux/overview
I did this Help out by offering feedback!
None yet. Be the first to post one!
@stevie awards a barnstar to partsandcrafts for their awesome contribution!
Oh! The docs say "Clicking on the image will toggle between normal and full screen mode." Awesome!
Hi, @partsandcrafts @wmacfarl @kgradow1 @bmela - i'd be happy to do some formatting work on this post if you want to add my username as a coauthor -- with:warren -- thanks!
Awesome -- i used the image and it worked perfectly!
Broke out the idea of a USB-only connection in this question! https://publiclab.org/questions/warren/12-15-2017/how-can-we-set-up-a-raspberry-pi-camera-as-an-ethernet-usb-device-to-avoid-using-wifi
We found that for WiFi networks with no password, you can get it to log into any open network with:
And also, that once you've set the wifi network, you can re-set it by editing /etc/wpa_supplicant/wpa_supplicant.conf
Hi @partsandcrafts @bmela @wmacfarl @kgradow1 - I broke out the "install on an SD card" steps into a separate activity:
That made it possible to simplify this one a lot. What do you think?
Is this a question? Click here to post it to the Questions page.
You must be logged in to comment.
This is marked this as an activity for others to try.
Try it now
Click here to add some more details.
How long does this activity take?
How hard is this activity?
What kind of activity is it?
What is it's current status?