0

I am going camping in a few months and I want to build a motion sensor alarm for my tent entrance for while I am asleep. Chances are nothing will set off the alarm, but if a bear or coyote comes sniffing around my tent I want a headstart. So the device needs to be able to see in the dark, set off an alarm if there is motion and maybe (but this last part is optional) it takes a photo when the alarm goes off. I can program in python so I will use that. One last thing that you probably figured out from the description: the device needs to run on battery power.

What I Have:

  1. the pi + plenty of wires for connecting the GPIO
  2. an external battery power source that takes 4 AA batteries (but I do not think that will be strong enough so I'll probably have to get a new one)
  3. The idea
  4. Experience writing python programs.

What I Need:

  1. Pi Camera w/ Night Vision or some sensor that will work
  2. A new, stronger power source
  3. Some software that already work as a motion alarm for the pi

Ideally I would find a well-documented open-sourced project for this, buy the equipment list, download their software, build it and be done but I didn't see one when I looked. I am not completely against figuring this out as I go and writing my own program, but a documented project would be better. Anyone know of such a project or the pieces I need to buy to do this?

  • TBH I would not use a Pi - they eat too much power. I would look at the generic atTiny boards and a simple ultrasonic sensor. Build in a delay to allow you to turn it off when you go in the tent... Forgot - add a light dependant resistor to work out day or night for you. – Andyroo Jun 18 at 17:54
  • If you are serious about wanting a picture, I would use a pi-zero with an attached camera (either the pi specific one, or a usb webcam) and then I would use opencv in python to detect motion (basically just comparing two images and if there is enough of a difference then it processes that as motion.) From there it would be easy to toggle an output line to set off your buzzer or alarm, and you could also save the image to the pi (or even better, a video of the 10 seconds before the motion and 10 seconds after) You will need more power, but a battery bank (to charge a phone) works. – Chad G Jun 18 at 23:46
  • Using the method I talked about also would allow you to make timelapse videos (saving an image every 30 seconds or minute), it would also allow you more control over what is detected as motion by deciding how large of a difference triggers it, or even setting it up to only look at a certain amount of the image. – Chad G Jun 18 at 23:49
  • @ChadG thank you, yes I am going to use the pi zero and OpenCV to analyze the pictures. 1. This night vision camera is pricey and it looks like it requires lights to be on all the time which will require a lot more power than I want to include. amazon.com/Raspberry-Camera-Vision-IR-Cut-Longruner/dp/… Do you know of a cheaper camera option that does not require a light to be on at all times? 2. Does OpenCV get each video frame and allow me to break that frame down into pixels? – porker7 Jun 20 at 21:12
  • you wouldn't need light "all" the time, you could turn on IR led array for 100ms while you take a frame from video. this would only be on 10% of time. but that may still be too much. open cv does allow you to look at each pixel, but there are already functions/processes to do what your trying to do, there are plenty of motion detection tutorials online, and once you learn that, you can work on using only a section of the frame, or tweaking it to detect the right amount of motion (mouse/rat maybe doesnt need to trigger it) – Chad G Jun 21 at 2:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.