StickyCam: an Infrastructure-Free Surveillance Camera

Introduction: StickyCam: an Infrastructure-Free Surveillance Camera

About: I'm an applied-physicist-turned-corporate-innovator. I'm into flying things, cameras, and flying cameras. If I can't open it, I don't own it.

Unsupervised Napping

I have a two year old. He's so awesome. The thing is, I also have friends, and sometimes they throw parties, and sometimes I like to go to those parties - and sometimes, when I bring him along, the kiddo needs to take a nap. Worst-case, it's next to the cheese dip. Best-case, it's in another room. But if he's in another room, and the friend I'm visiting doesn't have a babycam in that room, then it's hard for me to know how he's doing without breaking conversations every 5 minutes to check. That's rude, and I run the risk of waking him every time I open the door. None of those are good things. (And if they do have a babycam, then I have to fiddle with getting on their wifi network just when the kid is getting drowsy. That's also not good.)

Enter StickyCam

I figured that if I could make a rudimentary surveillance camera that doesn't need to ride on someone's wifi, then I might be able to enjoy parties and the occasional hotel bar while not worrying about the kiddo's status. (Just kidding about the hotel bar.)

So I did, and this is how.

Step 1: Get Your Parts

    Here's what you need to make this work:

    • A full-size Raspberry Pi connected to the network, for easy configuration.
    • Raspberry Pi Zero 1.3 (if you can get your hands on a Raspberry Pi Zero W, DO.)
    • Pimoroni Raspberry Pi Zero 1.3 case
    • A Raspberry Pi camera of your choice (I chose a wide-angle), and a roughly 7" ribbon cable
    • USB Wifi Dongle + USB OTG adapter (If you have a Raspberry Pi Zero W, don’t worry about buying the wifi USB dongle and adapter. These instructions work with the W.)
    • A Mount (like this, for example)
    • Optional: A Battery (I use one of these)

    Step 2: Set Up the OS

    First off, make sure you're using the latest Raspbian distribution. The Jessie Lite version works great, especially since we're operating headless. If you don't know how to do this, I recommend starting at the Raspberry Pi Foundation's website here. Head there, follow those instructions, get Jessie set up, and come back here.

    Start with a full-size Pi (model 2 or model 3); we'll be swapping the sd card from the big one to the Zero later in this process, but it's far easier to do the setup and configuration on a big Pi.

    Once you've got a working Pi, go to the terminal, update the OS,

    sudo apt-get update

    and configure it to work with SSH and the camera via the raspi-config utility. You might want to change the hostname (I chose stickycam).

    sudo raspi-config

    Step 3: The Part About Network Connectivity

    Head back to the terminal, and enter the following to install all the relevant packages:

    sudo apt-get install git apache2 php5 hostapd isc-dhcp-server iptables iptables-persistent -y

    I’d love to take credit for the next part, but I can’t. Adafruit went to the effort of publishing the instructions for a digital free library based on a Pi Zero (here: and I used most of their connectivity steps here. I’m a cook, not a chef.

    Edit a few lines of /etc/dhcp/dhcpd.conf


    option domain-name
    option domain-name-servers

    and change them to

    #option domain-name
    #option domain-name-servers

    Then add this to the bottom of the file:

    subnet netmask {
       option broadcast-address;
       option routers;
       default-lease-time 600;
       max-lease-time 7200;
       option domain-name "local";   option domain-name-servers,;

    Then edit /etc/default/isc-dhcp-server





    Then edit /etc/network/interfaces to show:

    auto lo
    iface lo inet loopback
    iface eth0 inet manual
    allow-hotplug wlan0
    iface wlan0 inet static

    Enter the following to establish your wireless network's IP address:

    sudo ifconfig wlan0

    Then create /etc/hostapd/hostapd.conf, so your wifi transceiver will act as an access point:


    Then edit this: /etc/default/hostapd




    And finally, edit /etc/init.d/hostapd


    goes to


    To run this all on boot, enter the following at the command prompt:

    sudo update-rc.d hostapd enable 
    sudo update-rc.d isc-dhcp-server enable
    sudo reboot now

    If you did everything correctly, you should see your "stickycam" access point live now! Try connecting to it.

    Step 4: So As to Watch Things

    It seems like an awful waste of time to write your own code to stream your camera, especially when so many great open-source implementations are out there. Flask, MJPG-Streamer, and others are out there, but I really like Silvan Melchior's work on the RPi-Cam-Web-Interface project. To use this code, just follow the onscreen instructions!

    sudo git clone
    cd RPi_Cam_Web_Interface
    sudo chmod u+x *.sh
    sudo ./

    If you navigate to your Pi's address in your computer's browser, you should see a page showing "Index of /". If you see that, it worked!

    Step 5: Getting to the Page Without Too Much Work

    Finally, you'll want to be able to use your browser as a virtual app, so that you just load it up and get to the camera without fiddling with settings.

    Use iptables to forward any traffic using the wlan0 interface to your webpage by entering the following commands into the terminal:

    sudo -i
    echo "1" > /proc/sys/net/ipv4/ip_forward
    iptables -t nat -F
    iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
    iptables -t nat -A PREROUTING -i wlan0 -p tcp -j DNAT --to-destination
    sudo reboot now

    Before we wrap things up on the big Pi, connect to the stickycam access point with your browser, and try to go to any ip address - if everything worked right, you should see a camera interface page with a broken video icon. If you got greedy and installed the camera on your big Pi already, then you'll see a camera interface page with an image!

    Step 6: Final Assembly

    Now it's time to out it all together.

    • Pop your SD card out of the full-size Pi
    • Jam the SD card into the Zero W
    • Assemble the PiMoroni case
    • Connect the camera's ribbon cable to the camera and the Pi Zero's camera connector, and wrap it around the case.
    • Secure the camera to the case using a wire twist tie. The holes on the camera align perfectly with the holes on the case and Pi. I get the feeling that that's not by accident.
    • Optional: if you're using a standard Zero 1.3, now is the time to connect your wifi dongle to the board with the USB OTG adapter.

    Step 7: Check It Out!

    That's it! You're done! Turn on your pi, give it a minute to boot up and turn on the access point, then try to access any ip address. If you've done it right, you'll go straight to a page showing the view from your camera. What's extra neat about Silvan Mechior's implementation is that it lets you save photos and video clips, so I'm throwing a few in for your viewing pleasure. (I'm obviously not going to show the internet a photo of my kid, but me and my dog on a Saturday morning should suffice.)

    Now go put your kid down for a nap in an unusual location, set up the camera near them, and go do something else!

    Step 8: Addendum

    Next up, I'm going to work on a more "professional" power solution, because this is kind of kludgey. I know it. And it's okay, you can say so in the comments.

    Be the First to Share


      • Pocket-Sized Speed Challenge

        Pocket-Sized Speed Challenge
      • Audio Challenge 2020

        Audio Challenge 2020
      • Maps Challenge

        Maps Challenge

      4 Discussions


      3 years ago

      What a cool idea! Thanks for sharing!


      Reply 3 years ago



      3 years ago

      Do you have an idea on how long the battery lasts? I'm considering adapting this for an outdoor solution looking at my front doorstep.


      Reply 3 years ago

      My test this weekend showed at least 5 hours, but i wasn't streaming for much of that time. I imagine streaming will tax the processor more than sitting around doing nothing, so probably less than 5 for your application.