sparkfun Raspberry Pi Zero Wireless Camera Kit User instructions

Required Materials
You'll need a microSD card, a sufficient power supply, and a micro-B USB Cable. We do not recommend the pre-
installed NOOBS card, as it may not include a recent enough version of the Pi operating system to support the Pi
Zero W.
Required Tools
You'll need a few tools to assemble this kit: just a standard soldering iron, solder, a small screwdriver, and a pair of
side cutters.
microSD Card with Adapter - 16GB (Class 10)
COM-13833
Wall Adapter Power Supply - 5.1V DC 2.5A
(USB Micro-B)
TOL-13831
USB micro-B Cable - 6 Foot
CAB-10215

Suggested Reading
Very little of this kit requires anything but following our step-by-step guide; however, you might want to check out
our through hole soldering tutorial as you'll need to do some soldering to put the pins in place on the Pi Zero W
and the Pi Servo Hat. Other, tutorials you might be interested in reading include:
Solder Lead Free - 15-gram Tube
TOL-09163
Soldering Iron - 30W (US, 110V)
TOL-09507
Flush Cutters - Xcelite
TOL-14782
Tool Kit - Screwdriver and Bit Set
TOL-10865
How to Solder: Through-Hole Soldering
This tutorial covers everything you need to know about
through-hole soldering.
Hobby Servo Tutorial
Servos are motors that allow you to accurately control
the rotation of the output shaft, opening up all kinds of
possibilities for robotics and other projects.

Prepare the MicroSD Card
To prepare the microSD card, we need to:
Download the latest Raspberry Pi Raspbian Jessie image.
Create an microSD card that contains this boot image.
Edit the "config.txt" file on the microSD card to enable the serial debug console.
Create a "wpa_supplicant.conf" file on the SD card to enable WiFi.
Let's walk through these steps in more detail!
Download the Latest Raspbian Jessie Image
You can find the image on the Raspberry Pi Foundation Website. It's a fairly large download so go get a snack or
play a game or something.
Note: Make sure that you don't download "RASPBIAN XYZ LITE", as the Lite installation is lacking several
utilities and programs we'll need to get things moving. Note that XYZ is a placeholder for the release name of
the distribution; at the time of this writing, that name is "Stretch".
Burn the Image to an MicroSD Card
To write the image to the card, there exists an excellent utility for Mac/Linux/Windows called Etcher. Simply
download and install it to your computer. Then select the image you downloaded earlier, the drive you want to
install to (Etcher won't let you install to anything but a removable drive, and if only one drive is available, it will
select it automatically!), and click "Flash!"
This is another long-ish process, requiring several minutes to complete. Once complete, the window will display a
"Flash Complete!" message.
Pi Servo Hat Hookup Guide
This hookup guide will show you how to connect and
use the Pi Servo Hat in a project.
Getting Started with the Raspberry Pi Zero
Wireless
Learn how to setup, configure and use the smallest
Raspberry Pi yet, the Raspberry Pi Zero - Wireless.

By default, Etcher "ejects" the card after it has created the image, so you'll need to pull it out and reinsert it to get
your computer to reload the disk.
Edit the "config.txt" File on the MicroSD Card
To continue, we're going to need to edit a file on the microSD card. This file will be visible from any operating
system, although on a Linux system it's in a slightly different location.
On a Windows or Macintosh, the files will be loaded in the root directory of the microSD card, so when you open a
window of the drive, you'll see them directly. In Linux, the card will be mounted, and you'll have to navigate to the
"Boot" directory on the card to find the file we're looking for.
Here's a list of all the files in the directory of interest.
Click the image for a closer look.
Open the file "config.txt" in your favorite text editor (i.e. Notepad++, TextWrangler, ConTEXT Editor, etc.) and add
this line to the very end:
enable_uart=1
Note: Despite the presence of a hash ('#') in front of the other lines in this file, you must not put one in front
of this line. That would comment it out, causing it to be ignored. Adding this line will enable the UART on the
GPIO pins so you can complete the rest of the process without having to hook your Pi Zero W up to a monitor
and keyboard. Pretty nifty!
Create a "wpa_supplicant.conf" File on the MicroSD Card to Enable WiFi
Troubleshooting Tip: For users having difficulty enabling WiFi on Pi Zero in this step, you could use the
PIXEL desktop GUI if you access to a monitor and mini-HDMI adapter to connect to your network. You can
also enable the camera, I2C, and SSH through Preferences > Raspberry Pi Configuration from the
desktop menu.

The last thing we need to do to prepare the microSD card is to create a "wpa_supplicant.conf" file on the card.
This file contains the information needed for your local wireless network setup.
Create a new file using your favorite text editor. On Windows we recommend Notepad, as it provides WYSIWYG
content and allows you to save a file with an arbitrary file extension. On MacOS, TextWrangler seems to be the
easiest. For Linux, your default system text editor should be fine.
The contents of the file can be quite simple. Most likely, you can get away with something that looks like this:
network={
ssid="YOUR_SSID"
psk="YOUR_PASSWORD"
key_mgmt=WPA-PSK
}
Once added, modify the network ID and password for your WiFi network. Then save the file as
"wpa_supplicant.conf" to the microSD card.
Important Note: On the on the "Save As..." screen for Windows users, you'll need to change the file
extension type under the field "Save as type:" from "*.txt file" to "All files". Then you will need to explicitly
name the file "wpa_supplicant.conf", or Notepad will automatically append ".txt" to the file name, breaking
this functionality. See the image below.
Click the image for a closer look.
Some variation of this "Save as..." and removing the appended ".txt" suffix is necessary in Mac OS and Linux
as well, but should be equally simple.
Pull the MicroSD Card and Insert It into the Pi Zero W
This is all we need to do in preparation of our first boot. You can now remove the card from your computer and put
it into the Pi Zero W. Don't power it up yet, though!

Hardware Assembly
To assemble the hardware, we need to:
Solder headers to the Raspberry Pi Zero W.
Solder headers to the Pi Servo Hat.
Install the Pi Servo Hat on the Pi Zero W.
Assemble the pan-tilt hardware and connect the servos to the hat.
Let's walk through these steps in more detail!
Solder Headers to the Raspberry Pi Zero W and the Pi Servo Hat
We recommend soldering the male header to the Pi Zero W and the female to the Pi Servo Hat. If you have any
issues with soldering, please check out our learn to solder tutorial.
Assemble the Pan-Tilt Mechanism
Assembly of the pan-tilt mechanism is fairly straightforward. The trickiest part is making sure the servo motors are
centered during assembly.
Here's the family portrait of the stuff that comes in the kit. You won't be needing the servo horns that come
packaged with the servo motors, just the ones that come packaged separately.
Heads up! The servo hardware may vary depending on the supplier. You may need to clip the arm servo
horn with 6 holes and use the screws that were packaged separately.
Start by identifying the servo horn with two long arms and two short arms. You'll need to clip off the long arms, as
shown below.

Identify the smallest screws in the baggie of screws that came with the kit. These will be used to affix this horn to
the base of the pan-tilt mechanism.
Place the horn in the base as shown, then screw it down by inserting the screws from the bottom and threading
them into the horn. Note that there will be extra screws, even beyond the ones to be used later. This is generally
true of all the screws in this set.
Next, identify the larger self-tapping screws. These will be used for assembling the next part of the mechanism.
Find the two pieces pictured below that will sandwich the first servo. Note the orientation of the servo in these
pieces.

Here's the sandwiched servo. Again, note the orientation for proper assembly.
Here, you can see where the screws identified a couple of steps ago fit into our servo sandwich. Tighten them
down, but not too much.
Now fit the shaft of the servo into the fitting on the horn that you previously installed into the base. This is the point
where you need to make sure that the shaft is roughly centered in order for the entire assembly to work properly. I
do this by turning the shaft all the way to one extreme, then turning it 90 degrees back in the other direction. Then,
I remove the base and line it up with the body of the servo motor.

Find the two longer screws that came with the horn kit in the set to attach the base to the servo. There will likely be
only two of these, and you need both, so don't lose one! Insert the screw to the bottom and tighten the screw to
attach the two parts together.
You'll now need the single arm servo horn with 5 holes, as shown in the image below on the left. If the single arm
servo with 5 holes was not included in the kit, you will need to modify one of the servo horn with 6 holes that was
packaged separately. Shorten the horn by clipping off one hole as shown in the image below on the right and
checking to see if it fits the mold on the tilt bracket. Be careful when clipping and make sure that you do not clip off
too much of the horn.
Single arm servo horn with 5 holes. Single arm servo horn with 6 holes being clipped.
Install the single arm servo horn as shown below. You'll need two of the small self-tapping screws from the first
step to affix it to the mechanism.

Attaching the single arm servo horn. Attaching the clipped single arm servo horn.
Note: If necessary, you can loosen screws on the brackets placed around the servo in order to attach the
clipped single arm servo horn to the bracket. This will keep the screws straight when tightening the screws.
You'll now need the second servo motor and the last piece of the mechanism. The image below shows the relative
orientation of these two pieces.
Here's a picture of the two pieces assembled to one another.
Now, find the longest machine screws in the baggie, as shown below. Once again, you'll find that there are more of
these than you need.

Thread these screws through the stand off wings on the servo motor and into the last piece of the mechanism. You
can use nuts for these if you like, but I've found it to be unnecessary as they thread into the mechanism quite
snugly without the nut.
Note: For this tutorial, we used the longer screws. The shorter screws found in the baggie can also work.
Depending on your personal preference, you can also use the shorter screws. They are long enough to hold
the servo in place and reduces the possibility of the wires snagging against the longer screw.
Now connect the two major pieces of the assembly together. The image below shows the orientation of these two
parts.
You may need to assemble and disassemble these two parts a couple of times to find the right rotational position
of the servo motor so that the tilting portion has its full range of motion. Here's an image of the two bits put
together.

Take the final screw that you identified above as a horn attaching screw and use it to secure the horn to the servo
motor.
Congratulations, you've finished assembly of the pan-tilt mechanism!
Solder the Headers onto the Pi Zero W and Pi Servo Hat
We suggest soldering the male headers onto the Pi Zero W.

My favorite trick for this type of situation is to solder down one pin, then melt the solder on that pin with the iron
held in my right hand and use my left hand to adjust the header until it sits flat as shown below. Make sure that you
are soldering with the header's shorter side and the longer pins are on the component side. After tacking down
one pin, finish soldering all the pins down to the Pi Zero W.
Repeat the steps with the female header and the Pi Servo Hat.
Make sure to insert the short pins from the bottom of the board and add solder to the component side so that the
Pi Servo Hat stacks on top of the Pi Zero W's male header pins. You will also need to make sure that the header is
sitting level before soldering down all the pins.
Affix the Camera Module to the Pan-Tilt Mechanism
Start by affixing the double stick foam tape to the pan-tilt mechanism as shown in the image below.

Next, attach the flex cable to the camera module. Take note of the copper "fingers" on the end of the cable. The
side with the fingers on it should be facing the camera module circuit board. See the image below.
Thread the flex cable through the pan-tilt mechanism as shown below, then press the back of the camera board
against the double stick tape to adhere it to the pan-tilt mechanism.
Insert the flex cable from the camera into the Pi Zero W. As was the case with the other end, the side of the cable
with the copper fingers should be facing the circuit board. Don't forget to close the clamping mechanism!

You may now attach the Pi Servo Hat to the header on the Pi Zero W.
Connect the Servo Motors to the Pi Servo Hat
The servo motors need to be connected to channels 0 and 1 on the Pi Servo Hat. Connect the "pan" servo (the
one on the bottom) to channel 0 and the "tilt" servo to channel 1.
Pi Servo Hat (CH
0)
Pan Servo (Bottom of Pan-Tilt
Mechanism)
Pi Servo Hat (CH
1)
Tilt Servo
SIG Control Signal (Orange) SIG Control Signal
(Orange)
POW Vcc (Red) POW Vcc (Red)
GND GND (Brown) GND GND (Brown)
Once connected, your setup should look like the image below.
This completes the necessary steps of the hardware assembly!
Configure the Raspberry Pi
Now that we've hooked up our Pi Servo Hat and assembled the hardware, we're ready to boot the Raspberry Pi
Zero W for the first time! To configure the Raspberry Pi, we need to:
Power the Pi Zero W.
Connect the Pi Servo Hat's Serial-to-USB Converter.
Connect to the serial debugging console on the Pi Zero W.
Enable camera interface, I2C, and SSH on the Pi Zero W.

Update the software on the Pi Zero W.
Download and install the camera interface software from GitHub.
Make some changes to enable the pan-tilt control functionality.
Download the Pi Servo Hat interface software from GitHub.
Make some changes to start the Pi Servo Hat interface software on boot.
Let's walk through these steps in more detail!
Power the Pi Zero W
Using a sufficient 5V wall adapter, we can power the Pi Zero W. Plug the wall adapter into a wall outlet for power.
Then connecting the micro-b from the power supply to the Pi Zero W's micro-b connector labeled as "PWR IN."
Connect the Pi Servo Hat's Serial-to-USB Converter
With the Pi Servo Hat stacked on the Pi Zero W, take a micro-B USB cable and connect it to the Pi Servo Hat's
micro-B connector. Insert the other end to a computer's standard USB port. This will allow you to connect the Pi
through a serial port connection.
Open a Serial Terminal
Tip: This setup uses a headless setup to configure the Raspberry Pi Zero. You could use the PIXEL
desktop GUI if you access to a monitor and mini-HDMI adapter to enable the camera, I2C, and SSH through
Preferences > Raspberry Pi Configuration from the desktop menu.
Start by checking out our serial terminal basics tutorial. This will get you up and running with a serial terminal.
Open a serial terminal program (i.e. PuTTY) to connect.
When you make your connection to the Raspberry Pi, you'll need to connect the serial terminal to the COM port
that it enumerated on and connect at a baudrate of 115200. Failure to use the proper baud rate setting will result in
weird characters and your connection failing to work.
To figure out which port to connect to, I recommend using the Arduino IDE. Under the "Tools" menu, there is a sub-
menu for "Port". Since we had connected the USB cable to a computer's COM port already, make note of the
items on the listed COM Ports. Then unplug a micro-B USB cable from your computer. Give it a few seconds, then
re-open that sub-menu to see what item has disappeared. By process of elimination, we can determine the COM
port that the Raspberry Pi enumerated to. Reconnect the cable to the COM port to verify. The COM port should
reappear as the same COM number in the sub-menu.
Installing FTDI Drivers: It's possible that you'll need to install FTDI drivers to get the COM port to appear. If
the following instructions don't result in a port appearing in the list, visit our FTDI driver installation tutorial.

Windows
If you don't have the Arduino IDE installed and don't want to install it, you can find the same information using built
in tools. Under Windows, open up your device manager (if you don't know how to do this, do a search online for
OS specific information on how to do it since it's slightly different under various versions of Windows). Take note of
the devices on the list, then unplug the Pi and see which port on the list disappears. The port which disappeared
from the list is the one you want.
Mac
Using a Mac OS, you'll need to open a terminal window. To figure out which port the Pi has connected to, type this
command:
ls /dev/cu.usbserial-*
This will return a list of USB-Serial converter ports on the system. Take note of the devices on the list, then unplug
the Pi and see which port on the list disappears. The port which disappeared from the list is the one you want. You
can then connect to the port in question by typing
screen /dev/cu.usbserial-XXXXXXXX 115200
where the XXXXXXXXX is replaced by information gleaned from the first command.
Linux
Under Linux, the process is similar to Mac OS, only use this command to identify the serial port:
ls /dev/ttyUSB*
You may use "screen" to connect to the Pi:
screen /dev/ttyUSBX 115200
Again, the "X" should be replaced with information gleaned from the ls command above. If you receive an error
about screen not being installed, you can install screen by typing this command:
sudo apt-get install screen
Then re-enter the above command to connect via screen .

Log In to the Pi
When the Pi finishes booting (about 30 seconds) you should see a prompt on your serial terminal screen that looks
like the image below. If you don't, try hitting the enter (or return) key. This will bring up the login information if it
printed before you had your serial terminal ready.
Log in to the system using the username "pi" and the password "raspberry". You're now logged in to the Raspberry
Pi, and everything else we do we'll do from this command prompt.
Use the raspi-config Utility to Enable Camera, I2C, and SSH
There's a nifty text-only utility called "raspi-config" that will allow you to enable the camera interface, I2C, and
remote access via SSH. To use it simply type this command:
sudo raspi-config
If you're curious, the "sudo" portion of the command tells the OS to run the command as a superuser -- basically, a
user with full system permissions. This is the menu that you'll then be presented with:
From here you can make several changes. The first change you should make is to change the password for the
default user. Highlight option 1 and hit enter. You'll get a warning that you will be asked to change the password,
then a prompt will appear at the bottom of the screen asking you to enter a new password. You'll be asked to
repeat it, just to make sure that the password is as you intended, then you'll receive a message that the password
has been changed.
Please change your user password! Leaving the default user password with SSH enabled is a security risk
that could allow a malicious user to take over your device remotely.
Now, use the arrow keys to move down to choice 5, "Interfacing Options". You'll be presented with this menu:

Highlight option "P1 Camera", and hit enter. That will bring up this screen:
Highlight "Yes" and hit enter. You'll receive a confirmation message:
Hit enter to leave this screen. You'll be back at the main menu. Return to the "Interfacing Options" menu again and
repeat the process two more times, once for the "I2C" option and once for the "SSH" option.
This concludes the work you need to do with the raspi-config utility. From the main menu, press tab twice to
highlight "Finish", then hit enter. If you're asked whether to reboot now, select "Yes" and hit enter. Again, it will take
as much as 30 seconds for the login prompt to reappear.
Configure the /etc/network/interfaces File
You'll now need to tell the Raspberry Pi to use the "wpa_supplicant.conf" file that you created earlier. Type the
following command in the serial terminal:
sudo nano /etc/network/interfaces
Add the following lines to the end of the file:
This manual suits for next models
1
Table of contents
Other sparkfun Digital Camera manuals