Simple Raspberry Pi Camera Trap Made From a Food Container




Introduction: Simple Raspberry Pi Camera Trap Made From a Food Container

About: I work as an I.T. Support Technician for my 9 to 5 but my true passion is designing, engineering and making, or just generally fiddling with things.
"It seems to me that the natural world is the greatest source of excitement, the greatest source of visual beauty, the greatest source of intellectual interest. It is the greatest source of so much in life that makes life worth living."
- David Attenborough, English broadcaster and naturalist

Do you like to sit back and admire the beauty and wonder of the natural world while the birds happily tweet and sing their songs? You may also like the idea of seeing nature up close and personal without the need to disturb it. If so, why not consider making yourself a Simple Raspberry Pi Camera Trap!

'What is a Camera Trap?' you might ask.. basically it's a camera with motion sensing capability that triggers the capturing of still or video images whenever something comes into view (such as nature's wildlife!).

Camera traps commonly use a PIR to trigger the taking of a photo or the recording of a video. Unfortunately this can sometimes result in the the best camera shot being missed or the target disappearing altogether before the camera is triggered. With this camera trap we can solve that problem by doing away with the PIR and instead using a detection system that is based on pixel changes in the image. We can also capture the events that take place prior to motion detection (thanks to the capability of the software), which increases the chance of getting that perfect photo or video sequence.

With the unusually good weather we've been having here in Wales lately there has never been a better time to make it, and fortunately it's also a bank-holiday weekend so the perfect opportunity to throw one together (mostly from some bits I have lying around the house already).

Grab hold of a Raspberry Pi and rummage around the kitchen cupboards for a plastic food container (if you're married I recommend you check with your partner first, they may not appreciate you raiding the kitchen), and you can throw this thing together in around 30 minutes.

Tip: If you use the No-IR Pi Camera Module (without the Infra-red filter) and some IR LED's, you can make a camera trap with night vision capability.

To make things really simple we're using MotionEyeOS with the Raspberry Pi. It's intended for CCTV but it's perfect for our camera trap as it supports still images as well as video, HD quality recording, and it has the motion detection capability. Let's move on to the first step and find out what else you'll need...

Step 1: What You'll Need

To build this simple camera trap you will need the following items:

Optional Items you may want to consider:

  • Additional Camera(s) - for multi-directional recording.
    • Note that the Pi only has one native Camera Module connection, any additional cameras will need to be connected via USB.
  • Wire/Fabric mesh to cover the optional ventilation hole.
  • USB HDD- adds extra storage capacity but will consume your battery faster.
  • Rain shield - I used a plastic knife, now things are getting technical.

You'll require a small selection of tools:

  • Philips Screwdriver.
  • Hot-melt Glue-gun.
  • Power-drill.
  • Drill-bit(s) - I used a cone-cutter.
  • Dremel Multi-tool (or equivalent)- not essential, but comes in handy.
  • Sharpie Pen - or any other fine point marker pen.

Software and Downloads:

  • MotionEyeOS- download the relevant image file for your Pi model.
  • Win32DiskImager- this is used to write the MEYEOS image file to the MicroSD card.
  • WinSCP- not required, but handy to download multiple media files from the Pi in one go.

Step 2: Building the Camera Box

Building the Camera Box is real easy, just follow the basic steps below:

  1. Using your sharpie draw the outline of the camera lens on the wall of the container (including IR LED's, if using).
  2. Using the drill with the cone-bit, drill from the center of your outlines and cut-out the holes until you can no longer see the pen marks.
  3. Use the Dremel multi-tool to trim and clean up the holes, if necessary.
  4. If you're fitting the optional rain shield (or knife), cut it to size and secure in place with hot-melt glue.
  5. Attach the flat camera cable to the camera module (follow the instructions provided with your camera to confirm which way round it should be installed as it may vary).
  6. Use hot-melt glue to secure the camera module in place - try to avoid getting glue onto the module's components, this will make it easier to remove the camera from the box at a later date.
  7. Place everything in the box and see how it all fits :-)

Tip: Drill an additional hole in the box and cover with wire/fabric mesh to provide ventilation. If your box is likely to be left out in the sun for any length of time it is recommended that you allow your Pi (and particularly the battery) fresh air for cooling purposes.

With your camera box ready it's time to move on to setting up the Raspberry Pi..

Step 3: Setting Up the Raspberry Pi

If you are already familiar with the Raspberry Pi this step will probably be a breeze, but If you are new to the Pi I would recommend some additional reading. Take a look at the below:

Installing Operating Systems

Note: We are using a MotionEyeOS image, so there is no need to download Raspian.

To set-up your Raspberry Pi follow these steps:

1. You can download the latest release of the MotionEyeOS image file from their GitHub.

2. Once you've downloaded the image you need to extract it, for this I use RAR.

3. Insert the MicroSD card into your computer and write the image file to it as described in the articles above. In my case I have Windows, so I used Win32DiskImager.

4. Once image writing is complete remove the MicroSD card from your computer and insert it into your Raspberry Pi, then power it on.

5. Once the Pi has powered on and booted up (usually takes around 30 seconds) it can be accessed via a web browser, you just need to find out its HostName or IP address then enter this into your browser's address bar. If you are unsure of how to do this I recommend this additional reading from Raspberry Pi: About IP Addresses.

Note: You'll want to connect an RJ45 ethernet cable from the Pi to the router for the initial setup, it will be easier to do this at in the first instance then set-up the Wi-Fi connection later.

Tip: An easy way to find your Pi's IP address is to access the web management console of your internet router. This is typically done by entering its IP address in a web browser address bar (e.g.

Step 4: Configuring MotionEyeOS

Okay so you've built your box, prepared your Pi's SD card, powered everything up and accessed the MotionEyeOS web console, so what now? It's time to tweak and configure MotionEyeOS to suit your requirements.

When you first attempt to log-in to MotionEyeOS it will prompt you for credentials, the default username is: admin and the default password is: --blank--.

For a complete guide on how to set-up and configure MotionEyeOS I recommend you read the HowTo guide, we will be covering the basics, but the web interface is fairly intuitive so you shouldn't have much trouble:

  1. I recommend setting a password for the two default accounts (Admin and User).
  2. Set the correct Time Zone so the media files have the correct time stamp on them.
  3. Enable the Wi-Fi and enter your Wi-Fi credentials so you don't need to hard-wire with an Ethernet cable.
  4. Set your desired camera framerate and resolution (I used 1-10 fps and 1920x1080).
  5. Set your file storage - leave as default if using the SD card, amend if using a USB HDD.
  6. You can choose whether to capture still images or video, or both simultaneously.

Tip: The interface includes a hover-over help-tip for every option and setting. If you don't know what something does just hover your mouse cursor over the (?).

As this is a camera trap we will be using the 'Motion Detection' feature. This allows a motion event to trigger the capture and recording of images and/or video. Motion Detection is achieved by detecting changes in the pixels of the camera image, subject to the various parameters that are customisable.

I am using the following Motion Detection settings, but I suggest you have a play around with the options until you find what works for you as every scenario is a little different.

  • Frame Change Threshold = 1.5%
  • Auto Noise Detection = Off
  • Noise Level = 12%
  • Light Swith Detection = 0% (disabled)
  • Despeckle Filter = Off
  • Motion Gap = 5 seconds
  • Captured Before = 5 frames
  • Captured After = 10 frames
  • Minimum Motion Frames = 5 frames

MotionEyeOS also provides you with the option to enable a detection mask, this allows you to exclude areas of the image from motion detection.

Once you have finished making changes to the settings select the 'Apply' button, it will take around 10-20 seconds to refresh. Note that some changes will prompt for a reboot of the Pi.

Step 5: Deploy Your Camera Trap Box

Now that you're camera is all set-up it's time to deploy it. How you do this will largely depend on what you are trying to capture, so you may want to take some steps to hide the camera box.

I decided to cover mine with some tree cuttings, this should help it to blend in with the surroundings, we don't want the box to scare the wildlife off now do we!

Tip: As an alternative to covering in foliage you could cover your box in a vinyl camouflage wrap.

Be sure to cover as much of the box as possible but don't obscure the lens. If you are using infrared LED's for night-vision capabilities you also need to make sure you don't shade those either.

Once you are happy with everything, walk away and let your camera do the work.

I alternate my camera box between using a regular Pi Camera Module and the No-IR version (with IR LED's) to give my camera trap night-vision. I made an extra hole in the box to accommodate both cameras. I just swap the camera cable when I need to.

Note: To maintain accurate time stamping of your media files the camera box needs to remain connected to an internet enabled Wi-Fi connection. If one is not available or is out of range the camera will continue to record but the timestamps may not inaccurate. Also you won't be able to remotely manage it.

Tip: Remember to connect your Raspberry Pi to the battery pack before sealing and covering the camera box, otherwise you'll be starting over, Oops!

Step 6: And Finally.. See What You Caught

How long you leave your camera trap deployed will largely depend on the capacity of the battery you used and whether you have any additional items that consume power (i.e. IR LED's, USB HDD). In my case I get an average of around 2-3 days run-time before I need to retrieve it. Once you're ready grab your box and find out what you've captured. If you're lucky enough to be able to maintain Wi-Fi connectivity while it's deployed you can also check out your captures remotely (as long as your camera box battery hasn't given up yet of course!).

MotionEyeOS gives you the option of viewing the captured images and video direct from the web interface, which is rather convenient. It also allows you to download individual media files and save them to your device for viewing later and sharing.

If you need to download a batch of files in one go I would recommend a third party utility such as WinSCP or FileZilla. This will allow you to connect to your Pi using SSH and download the files using SFTP (SSH File Transfer Protocol).

Tip: If your camera trap has captured a large number of false-positives (i.e. motion detection is too sensitive) try adjusting the motion detection settings accordingly.

Thanks for reading, I hope you found the Instructable helpful. If you have any questions or comments please let me know, I endeavor to respond to as many as possible.

MotionEyeOS is the copyright © of Calin Crisan, many thanks to him for making this great software freely available. Visit the GitHub for more information and to support development of the software.

Microcontroller Contest

Participated in the
Microcontroller Contest

2 People Made This Project!


  • Make It Bridge

    Make It Bridge
  • Big and Small Contest

    Big and Small Contest
  • For the Home Contest

    For the Home Contest



Question 2 years ago on Introduction

i have a question:
how to take this to another location than your house? I want to take it to a place, where i can set this up with no wifi. Is there a possibility of using mobile data? And how to do that?


Answer 2 years ago

The WiFi is only really necessary to live stream the video, it will start recording as soon as it is switched on and the MotionOS boots-up if you configure everything beforehand.

WiFi would be helpful to check you are happy with the cameras point-of-view, but it may be possible to achieve that by setting the MotionOS to connect to your phones hotspot. You could also use a Mi-Fi box to connect it to the internet.

Alternatively you can configure the Pi to work as a WiFi access point and DHCP server so that your laptop or mobile device can then join the Pi's WiFi, this will work locally but won't provide remote access via the internet. As it's Pi based the options are almost limitless.


2 years ago

Hey, just made this project, with the nonIR filter camera. Excellent results!
Just one question, the battery life seems rather short and the ir LEDs get very hot. With a 10,000ahr batter pack I get about 6hrs. Is this normal?


Reply 2 years ago

Hi, glad you got some good results. With regards to the battery consumption, it's been a while since I used the camera trap but I was using a 26,800mAh battery and pretty sure I was getting around 3 days continuous use out of it. When running the IR and the USB hard disk for storage at the same time I was obviously getting less runtime, but pretty sure it was still around 24 hours, maybe more. The IR LEDs will get hot, guess it's a question of how hot is too hot. My IR LEDs are mounted outside of the enclosure, this prevents the IR light from reflecting from the clear plastic and also allows them to cool in the ambient air.


4 years ago on Step 6

Hi, do someone has setted up a wifi hotspot?


Question 4 years ago


Recently returned home and tried , as recommended, and found that it was the data ribbon that was at fault. So now it recognises the camera and it automatically initiates the camera when IP address is called. The problem now is that it is running MotionEye and not MotionEyeOS consequently none of the advance settings are available, so cant set up camera with dat/time or initialise for WiFi. It appears that you cant upgrade for MotionEye to MotionEyeOS but have to do a complete install. So I thought I would try your second suggestion and followed link at the bottom of your reply. Reformatted SDcard and clean installed Raspian and followed instruction from link and copied and pasted all the instuctions as listed and I am getting errors on a number of the actions. Don't know enough about Linux to solve the errors. Do you know why my image of MotionEye loading MotionEye not MotionEyeOS?



Answer 4 years ago

Hi, as far as I am aware there are no significant differences between MotionEye and MotionEyeOS, other than the fact that MotionEyeOS is easier to get up and running as it is ready to go 'out-of-the-box'.

If you are using the Raspberry Pi 3 you should use the following download link for the latest releaseof MotionEyeOS (at the time of writing) to flash straight to your SD card:

With regards to not seeing the advanced functions, have you logged in to MotionEye as admin? There is a user login icon (silhouette of a persons head) on the top bar, click this to login as admin (username: admin password: --blank--).


Question 4 years ago on Step 3

I am trying to build your project using a Raspberry Pi 3 B+ and the camera you suggested. I have downloaded the right image file and flashed it to the SD card. The Pi boots up and I am able to see the install in my browser. The first MotionEye screen after logging in says 'you have not configured a camera yet. Click here to continue. It then shows this screen (see image). The first two if you select show under 'Camera' (no cameras). The others do not seem appropriate for this the project. What am I doing wrong. Thank you.

Screenshot (57).png

Answer 4 years ago

Hi Maljg, normally MotionEyeOS will auto-detect the camera so you don't need to manually add it, but for reference the PiCamera is a 'Local MMAL Camera'.

I would first double check that the camera is connected properly; try re-seating the ribbon cable (the blue pull-tab on the cable should face the Pi's USB ports, on the camera I believe it should face the same direction as the lens).

If it still doesn't work I would recommend flashing the SD card with Raspbian and try using the camera. If it doesn't work in Raspian either I would try another ribbon cable and/or another camera as there may be a fault with either. It's always worth making sure the connectors on the Pi and the camera are clean as well, just give it a good puff of air to move any dust. If you're still having no luck and you happen to have another Raspberry Pi, try it with that too.

If the camera works in Raspbian but still refuses to work in MotionEyeOs, try installing MotionEye on Raspbian instead of using the MotionEyeOS image. Instructions for this can be found here:

Good luck!

Kink Jarfold
Kink Jarfold

4 years ago

As a firm believer, I'm still waiting for a really good one of Bigfoot!


4 years ago

Using a Banana Pi Zero and a cheap camera like its OV5460 should be also interesting.

This should even be better to consider using it with a solar powerbank to get an autonomous solution.


Reply 4 years ago

I'm aware of the Banana Pi but never used one before. MotionEyeOS do provide a BananaPi image as well so it would be real easy to swap the Raspberry Pi for one. The solar powerbank would be a great addition, never thought of that!


4 years ago on Step 6

I enjoy using camera traps and this project solves a common problem. To save power, commercial traps use PIR to start recording. Often the target has come and gone before the trigger is activated. (PIR delay). Using this set up, you can be constantly recording and set the trigger to include the previous preset time. An IRcut filter would be nice to have so you have accurate color in normal light. Thanks for this project


Reply 4 years ago

Thanks, I'm really glad you liked it.

The motion triggering seems to be a real bonus as some of my best shots have come prior to or after the motion event occurred. It is a bit of trial and error with getting the motion detection sensitivity right though, especially on a windy day!