The universe is a mysterious place. Nature abounds with questions that cry out to be answered. What is the nature of dark matter? Where does consciousness arise from? What is written in the Voynich manuscript? And, most importantly, what the heck has been pooping on my porch for the past year? I can’t find the answer to all of these questions, but I can find the answer to at least one of them by using a Raspberry Pi to build an infrared camera trap.

👁 A Raspberry Pi can't replace everything.
4 reasons you should overclock your Raspberry Pi

If your Raspberry Pi is feeling a little sluggish, then it might be time for you to overclock it

What you’ll need

  • Raspberry Pi Zero W - the silicon heart
  • Raspberry Pi Camera Module 2 NoIR - the all-seeing eye
  • 15 pin to 22 pin ribbon cable - the delicate nerves
  • Power bank - the vital force
  • Infrared lamp - the light which reveals
  • The Raspberry Pi Zero W is the first upgrade to the original Zero, now with the power of Wi-Fi and Bluetooth giving this tiny SBC the power of wireless.

  • Raspberry Pi Camera Module 2 NoIR
    Brand
    Raspberry Pi
    Sensor Size
    1/4.0
    Video Resolution
    1080p30, 720p60, 640×480p90
    Photo Resolution
    8MP
    Connection
    CSI 15 pin
    Size
    25×24×9mm

    The Raspberry Pi Camera Module 2 has been a workhorse of Raspberry Pi hobbyists since 2016. The NoIR version pushes the envelope by removing the infrared filter to allow for night photography.

Putting together your Raspberry Pi infrared camera trap

Start by assembling it

The best place to start with this project is by putting together the hardware. The first thing to do is attach your camera to your Pi. If you’re using a Raspberry Pi Zero (which is a good choice due to its low power draw) you’ll need a 15 pin to 22 pin ribbon cable. The camera comes standard with a 15-pin cable, but the RP0 uses a smaller 22-pin CSI camera port, so you’ll have to switch out the cable.

To do this, gently pull the clips away from the ports. These clips are delicate and should only move about a millimeter. Pay attention to which side of the ribbon cable has the exposed contacts. The contacts should be facing towards the PCB for both the camera and the Pi. Gently insert the ribbon cable into the CSI ports and push the clips closed.

These ribbon cables aren’t fragile, but they are easy to permanently damage if you’re not careful with them.

👁 The Raspberry Pi 5 and its camera module
Getting a camera working on Raspberry Pi 5 is easy; here's how it's done

Since the Raspberry Pi 5 features new four-lane MIPI ports, you'll need to follow a different strategy when connecting a camera module to the SBC

Adding the software to your Raspberry Pi camera trap

The software for this project is relatively easy since, at a minimum, you just need to download an IMG file (direct link) and flash it to your Raspberry Pi. Once that’s done, you can pop it into your Pi and test your camera. If everything has gone according to plan, your Raspberry Pi Zero W should create its own Wi-Fi network called MyNaturewatch-###### with the numbers being unique to your Pi. Initially, connect to this network with the password badgersandfoxes then enter the IP address 192.168.50.1 into your browser of choice.

This is not an ideal way to access your camera. Jumping in and out of Wi-Fi networks is a hassle, but there is a better way. The only caveat to this method is that you have to do a clean install of the IMG file. For example, if you’re using the Raspberry Pi Imager to flash your SD card, do not apply OS customization settings. Doing so will overwrite the contents of the file you will need to edit.

  1. After you flash your SD card, open it up in your computer (you may need to reinsert it).
  2. Find the file mynaturewatchcamera-wpa-supplicant.txt and open it in the text editor of your choice.
  3. Scroll down until you find the section that says WPA/WPA2 secured. Delete the # symbols in front of the network information and enter your own Wi-Fi network name and your password.
  4. Save the file and close the text editor.

At this point you should be good to test your camera unless you “lucked” into getting a particular batch of Raspberry Pi Zeros. The units in question have a chip next to the CSI port marked with H•, and printed on the back is an Anatel number. If you have one of these units, there’s unfortunately one more change you need to make, otherwise your Pi will randomly crash when using the camera.

  1. Open up the same mynaturewatchcamera-wpa-supplicant.txt file.
  2. Scroll to the bottom of the file and add the text over_voltage=4.
  3. Save and exit.

Once you’re done, fire up your Pi and wait for it to jump on your network. Find its IP address (you’ll have to hop on your router or check your mesh network app) and enter it into your browser. You should see the My Naturewatch interface. If not, double-check your ribbon cable connections and make sure there are no typos in the file you edited.

👁 A person holding a Raspberry Pi Pico
5 Raspberry Pi projects you can wear

Take your Raspberry Pi everywhere you go - literally.

By  Simon Batt

Building an enclosure for your infrared camera trap

There’s no wrong way to build your camera enclosure. You can use anything you want from a legit waterproof project box to an old Tupperware you have lying around. Or you can embrace the jank (like me) and use an old Amazon box. The most important thing is that you make a sturdy platform for your camera to sit on that won’t blow over after a few hours.

If you anticipate rain, you’ll probably want to choose an enclosure material more sturdy than cardboard, but a metal box might interfere with your Wi-Fi signal, in which case an old Tupperware might be the best choice. Other builds of this project use part of a plastic bottle attached with Sugru or hot glue as a protective shroud for the camera lens.

Setting up your Raspberry Pi infrared camera trap

Now that you have the software and the hardware put together you’re ready to deploy your trap. The Raspberry Pi Camera Module 2 has a depth of field between 10 cm and ∞ so your camera will need to be at least 10 cm away from the area you intend to capture. Place your camera where you think it should be, then check the live preview on the web app to perfect your placement and adjust your camera settings. This is also a good time to fine tune where your IR light is shining. Infrared cameras need an infrared light source to capture an image in the dark.

This is another one of those things where you can be as creative as you want to be. In my case, I knew the general area of where the phantom pooper was showing up, and I had some idea of what it was, so I set out some bait (watermelon) and fine-tuned my camera position based on that.

👁 Raspberry Pi Zero 2 W connected to a camera module
7 ways to use rpicam-apps for your Raspberry Pi project

Raspberry Pi includes a robust camera software package, rpicam-apps. Here are seven ways you can use it in your projects.

By  Jeff Butts

Gotta catch ‘em all

Especially if they’re leaving “presents” on your porch

The camera trap works much better than I expected it to. The images captured are good (1920×1080) considering the homebrew nature of the project, and I was pleasantly surprised that it had video capability as well. For those of you wondering, my nighttime visitor turned out to be a ringtail cat, and despite the nightly gifts he’s been leaving, I’ll do my best to keep him around and well!