Page 1 of 1

New to Pi... Is this Trail Cam project possible?

Posted: Fri Dec 29, 2017 4:16 am
by GSlings
Hello everyone, I'm new to the Raspberry Pi world. Not sure why it took me so long to get into it, but I'm here now!

I've been in the IT field for 20-22 years and currently a systems administrator for the past 13 or so years.

My project is to build an actual Trail Camera for monitoring wildlife on some of my property. We currently own and run around 30 commercial trail cameras. Most are all made in China and the really good ones cost a fortune. We have them ranging from $50 - $800.

My goal is to start building our own, which will make them cheaper to start with, plus I can work on / repair them myself.

Here is the basics of what I want for now:

I want to build an app that lets me configure the camera however I want (set time, date, set amount of photos taken per trigger, set trigger delay, etc.). I want a motion sensor attached (obviously a must), and I want the ability to set a timelapse if I want to (set the camera to take x amount of photos every x amount of minutes between specified hours).

I need a way to power on the Pi in "setup" mode so I can adjust settings, view battery life status, etc. And I need a way to either trigger it to go into trail cam mode, or a separate way to boot directly into trail cam mode.

I will worry about keeping it powered later. Right now I just need to get it functioning as needed. Power I can deal with later (battery bank + solar).

Is what I'm doing possible to do? I'm sure it has to be. It sounds a little more complicated than it actually is. Right now I have the latest Pi 3 B+ and latest camera module. I figured later I would use a cheaper or lower power consumption version.

Re: New to Pi... Is this Trail Cam project possible?

Posted: Fri Dec 29, 2017 7:33 am
by Jednorozec

Re: New to Pi... Is this Trail Cam project possible?

Posted: Fri Dec 29, 2017 7:37 am
by Gavinmc42
This one is probably the most developed one. ... e-cam-kit/

Pi3 are the most power hungry,
Zero or A+ are better for battery operation.
Zero W uses more power for the WiFi/BT.

Longest battery life is if you use the PIR to turn power on to the Pi, it takes video then turns itself off.
Fast booting time helps, I use Ultibo which means about 3 secs boot to snap vid/image time.

You will need a RTC to keep date/time, this could be used to turn power on/off at set times.

Motion based cameras using MotionEye OS or Pikrellcam on Raspbian Lite need the Pi and camera on all the time.
I use both for fixed installs, MotionEye works well with secondhand Sony PS3 Eyecams, $2-6.

A separate Smart Bluetooth module with RTC on board can be used to configure the PI without needing to wake the Pi.
An Adafruit Feather with LoRa could give you long range configuration or checking on vid/image status
This could also be triggered by the PIR sensor.

I have yet to see a very good solution for this using Pi's.
For solar you will need a panel of around 20+Watts on a Zero based system.
I was involved in the first low power cameras for this company
Even now, nearly 2 decades later, very hard to beat that original low power design but resolution is much better these days ;)
Very few people could do it back then, it was hard to get actual sensors and data sheets, situation still similar today ;)
Now just about anyone can with Pi's and big enough batteries :D

A simple solution is a Power bank, Zero, Pi Camera and PIR, shoved into a plastic clip-it type kitchen container.
Software wise the PIR can trigger a GPIO wakeup on halt mode, I think that may already be in Raspbian on GPIO4?

Night time with NOIR and you will need IR leds.
Osram have new IR LED with 60 degree angle that nearly matches the standard Pi camera lens.
You can strobe the LEDs to save power, normal Pi cameras don't have the strobe from the sensor coming out but there is a software solution.
Basically you turn the LEDs on for about 2ms at frame rate, getting that synced is the hard bit.

NiMH batteries for solar are easier than special charging circuits for Lithium Ion/polymer.
But I am tending towards LiFePO4 designs until Sodium Ion ones are available.
A good solar design will have a MPPT circuit for optimum solar usage, depends on solar world location.

A Pi solution will not be optimum but it can be quick and mostly off the shelf.

Re: New to Pi... Is this Trail Cam project possible?

Posted: Fri Dec 29, 2017 5:41 pm
by Paul Hutch
I am using PiZero W with camera bundles for nest cams around my log cabin. Buying them that way avoids the one per person ever limitation on purchasing PiZero W's. None of mine are battery powered or have IR yet, but it was fun watching the Eastern Phoebe's and American Robin's growing up this year.

Currently I'm just using the RPi-Cam-Web-Interface system to access and control the nest cams.

I also haven't yet added a solution for the shutdown at -20°C/0°F problem that I've anticipated and just observed this week.

Re: New to Pi... Is this Trail Cam project possible?

Posted: Sat Dec 30, 2017 1:59 am
by Gavinmc42
The high altitude balloon guys uses Styrofoam boxes to keep Pi's warm.
If you can do that or maybe even bubble wrap to keep the heat in.
Pi still make heat, even Zero's, if you can stop the heat from escaping then the temp should not get below ?C
Stop cold air getting to the Pi and keep the PCB warm by insulating it.

Related post about snow/ice

Re: New to Pi... Is this Trail Cam project possible?

Posted: Sat Dec 30, 2017 5:45 pm
by GSlings
Thanks for the info guys.. Gives me some more stuff to look into.

I think what I'm wanting is relatively simple. Most of what I'm seeing out there already (have already done numerous hours of googling and searching) is pretty complex or just not really what I'm wanting to do.

Essentially, I want to build an GUI interface to program my trail camera (set the time, give the camera a name so it can appear on the images along with time/date stamp, set how many photos to take per trigger, set the "resting time" (time the camera stops taking photos in between triggers), and a couple other misc. settings that any commercial camera has.

After that, I want to be able to boot the Pi into the camera app. I'm not sure if this can even be done... 'I'm pretty new to Linux in general, and the RPi itself.

I want it to be in a "sleep mode" until it detects motion and takes the number of pics I want, then go back into sleep mode until it detects more motion (once my resting time has been met).

Is it possible to even "boot into an app?" Or do I actually have to boot into Raspbian and then have the app run automatically? If so, that's what's going to kill the battery power. If you've ever used a trail camera, you just simply power it on, wait for the camera interface to boot up, set your settings, then just turn the cam on and walk away.

I wish I knew someone who had some trail cameras and was familiar enough with the Raspberry Pi to help me out. (managing our 30+ cameras and have to purchase new ones and pay for repairs is a killer). This would make my life so much easier if I could get this worked out.

Re: New to Pi... Is this Trail Cam project possible?

Posted: Sun Dec 31, 2017 3:08 am
by Gavinmc42
I think what I'm wanting is relatively simple.
Yes and no.
My coding Rule of thumb, you can get 90% of the code working in 10% of the time, that last 10% takes 90% of the time ;)

The problem with Pi's is there is no "sleep", Pi's do not have a low power sleep mode.
Pi's use DRAM which need to be refreshed and so cannot got to sleep.
That said, the self refresh low power mode for the LPDRAM is about 3ma, but I think the VC4 GPU is controlling this?
Still 5ma sleep is much better than 70ma, if someone can figure this out.

You can "halt" Pi's, the lowest current is about 70ma on a Zero, A+
With Pi, camera, motion software running 300ma.

If you switch power off and use PIR detector to turn it on, then you cannot take a picture until the OS has booted.
That's why I use Ultibo, <3 seconds for this. Some guys have done 12-15secs for a Linux OS boot time.
PiCore is around that time, which is why I use that Linux distribution on Pi's ;)

Play with the three main aps, see which feature you like and how easy/hard they are to use.
They all run from boot on start up if setup that way.
PI's are great because you can swap between these by changing SD cards

And yes all three of these are complex, but they have grown over the years as more features got added
ttps:// ... it=web+cam

Managing 30+ cameras?
Another reason I am going for Ultibo, the app might be 3-4MB compared to Raspbian lite OS SD card 1.3GB but on a 16GB card.
Plus I am not a Linux guy either, even though I have spent the last 5-6years with Pi's nearly daily.

If you do not need pretrigger video and are ok with 3 second boot then then PIR + duino type mcu plus Ultibo/Zero would be simple software.
If you can get within meters of camera for bluetooth configuring, then use a smart bluetooth duino module.pcb, longer range loRa duino.

Adafruit Feathers are probably the easiest to use as the documentation is better than most others.
Plus you have options for WiFi, Bluetooth, LoRa or even packet radio. 433mhz will give you longest range configuration?
You will need to power budget 20ma if you want the rf transceivers on all the time.

Re: New to Pi... Is this Trail Cam project possible?

Posted: Thu Jan 04, 2018 5:19 pm
by GSlings
So far, I found a blog from someone who started a similar project. He built his "PiTrailCam" using a python script. He has constant power via PoE, so his setup isn't necessarily exactly like mine (mine will be remote, solar + battery power). Anyway, I'm currently trying to get his app to run on my Pi (I'm new to python so I'm having some trouble with his code not wanting to work correctly). If I'm right though, basically he has this script set to run at boot up and just stay running. That's where I want mine to be different...

Ideally, I want to be able to turn on my Pi and have it boot directly into my camera application (GUI), where I change/check settings, set the time, date, etc.. and then hit a "Run" button to arm the camera and then have the screen turn off after "x" seconds. That's the big picture of it anyway.... What I'm wanting to know is, first of all, is this even possible? Secondly, what programming language to I need to do this in? If I understand correctly, Python seems to be better for running scripted apps, rather than apps with GUIs?

** On a good note, I am able to detect motion via PIR, turn on an LED array for 2 seconds while the camera snaps a photo, and then turn back off and wait for more motion! Not much, but it's a start!

Re: New to Pi... Is this Trail Cam project possible?

Posted: Thu Jan 04, 2018 8:30 pm
by morticiaskeeper
I have a few cameras set around the property for security purposes.

They are all Zero W with the standard PiCamera, using RPI -cam-web-interface.

That software will do all you need, including motion detection. if you would like PIR motion detection, attach a PIR sensor using the GPIOZero interface library and write a couple of lines of Python to send the trigger to the camera software.

I use this for internal security, but have the addition of MAC address sniffing for family mobile phones, so that it will only respond to a PIR trigger event if no family members are in the house.

All of this can be built using an SSH connection, so no keyboard or monitor are required for the pi.

Re: New to Pi... Is this Trail Cam project possible?

Posted: Thu Jan 04, 2018 9:43 pm
by GSlings
basically, I'm wanting to build a trail camera (you could call it a security camera, they pretty much do the same thing), where you open the case that I have it in, power it on and it boots to my application where I can adjust settings such as trigger delay, amount of photos to capture, how long to wait until the PIR sensor "re-activates", etc... Just like on a commercial trail camera you buy at the store, except mine will be a computer running it, rather than a simple piece of hardware that is programmed specifically for only being a trail camera.

I'd like to end up having 3 buttons at startup. 1 button for going into settings and making changes. 1 button to just simply "initiate or run" the camera (ie. open it up, tap run, close it and leave). and 1 button to boot it into the regular Raspbian OS (should I need to do so for whatever reason).