Flight of the Bumblebee

The hedgehogs are long gone, now able to feed on other than the cat food we left out, but I spotted a bumblebee coming in and out of one of our stone walls: time to deploy hogcam.  I swapped the camera for the IR-filtered one, and set it up facing the hole and left it running for a while:

Incoming

Incoming

Landing gear down

Landing gear down

Landed safely

Landed safely

Into the hangar

Into the hangar

I’ve had to crop them and highlight the bees.  These photos were taken minutes apart; hundreds of blank wall shots were produced.  I’ve also edited these to increase the contrast in general, along with cropping off some junk at the bottom.

Conclusion: I’ll stick with Hedgehogs!

And in other news…

the hedgehogs are back in our garden:

Welcome back!

Welcome back!

This is a combination of the PiNoIR camera (v.1) along with this IR motion detector (the sensor is expensive because it’s digital), and some near-IR LEDs.  Below is a picture of the older model – the newer one runs on an A+ (for size and power reasons) and has been updated to Jessie, and now the LEDs are switchable by GPIO via a mosfet to provide lighting for the camera only when needed.  The upgrade to Jessie means she boots without WiFi at night, and the next morning, I can add the WiFi dongle to connect and check the results.

HogCam

HogCam

Code

#!/usr/bin/env python
# NiteLite - a python daemon process started at system boot, and stopped on shutdown
#          - the default LED pattern is twinkling but if motion is detected, one of 4
#            different patterns are chosen and these are used for 10s after motion detection
#
# Please see our GitHub repository for more information: https://github.com/pistuffing/nitelite/piglow
#

import signal
import time
import RPi.GPIO as GPIO
import os
from datetime import datetime
import subprocess

#------------------------------------------------------------
# Set up the PIR movement detection
#------------------------------------------------------------
GPIO_PIR = 18
GPIO_IR_LED = 12
GPIO.setmode(GPIO.BOARD)
GPIO.setup(GPIO_PIR, GPIO.IN, GPIO.PUD_DOWN)
GPIO.setup(GPIO_IR_LED, GPIO.OUT)
GPIO.output(GPIO_IR_LED, GPIO.LOW)

#------------------------------------------------------------
# Final steps of setup
#------------------------------------------------------------
keep_looping = True

def Daemonize():
	os.setpgrp()

#------------------------------------------------------------
# Once booted, give the user a couple of minutes to place the camera
#------------------------------------------------------------
time.sleep(2 * 60.0)

try:
    while keep_looping:
        #----------------------------------------------------
        # Block waiting for motion detection
        #----------------------------------------------------
        GPIO.wait_for_edge(GPIO_PIR, GPIO.RISING)

        #----------------------------------------------------
        # Turn on the IR LED
        #----------------------------------------------------
        GPIO.output(GPIO_IR_LED, GPIO.HIGH)

        #----------------------------------------------------
        # Take a snap
        #----------------------------------------------------
	now = datetime.now()
	now_string = now.strftime("%y%m%d-%H%M%S")
	camera = subprocess.Popen(["raspistill", "-rot", "180", "-o", "/home/pi/Pictures/img_" + now_string + ".jpg", "-n", "-ISO", "800", "-ex", "night", "-ifx", "none"], preexec_fn =  Daemonize)

        #----------------------------------------------------
        # Turn off the IR LED after 5s
        #----------------------------------------------------
        time.sleep(5)
        GPIO.output(GPIO_IR_LED, GPIO.LOW)

        #----------------------------------------------------
        # Wait 30s before checking for motion again
        #----------------------------------------------------
        time.sleep(30.0)
except KeyboardInterrupt, e:
        pass

GPIO.cleanup()

Save it as /home/pi/hogcam.py and make it executable:

chmod 775 /home/pi/hogcam.py

Load on boot

Raspian uses systemd for running on boot.  In /etc/systemd/system, create a new file called hogcam.service:

[Unit]
Description=HogCam

[Service]
ExecStart=/home/pi/hogcam.py

[Install]
WantedBy=multi-user.target

Save it off.  You can then enable, start and stop it thus.  It will also start on boot.

sudo systemctl enable hogcam.service
sudo systemctl start hogcam.service
sudo systemctl stop hogcam.service

Close encounters of the garden kind.

It’s that time again to start feeding the hedgehogs ready for their winter sleep, and to put out my IR Raspicam with IR LEDs and passive IR motion detector.

Slugs

Slugs

Rat

Rat

Bovril, one of our cats

Bovril, one of our cats

Sadly, no hedgehogs yet.

This is pretty much the same as I used last year with two minor changes:

  • I’m using brighter LEDs in a better range of the IR spectrum (840nm)
  • The LEDs are now only turned on for 10s for each photo – previously they were lit all night.

Who’s been eating my porridge?

We’ve been leaving some cat biscuits in our garage for a homeless cat that’s adopted up.

And at the same time, the separate hedgehog food bowl in the garden was no longer visited.

And here’s why, as provided by the PIR motion detector + RaspiCam NoIR:

Ginge, our adoptee

Ginge, our adoptee

One of the 'hogs

One of the ‘hogs

86 photos were taken last night; the camera takes shots once a minute once movement is detected; we definitely has 3 clear visits from the stray cat, and regular hedgehog visits over the course of 6 hours suggesting more than one hog is feeding here.

I need to install the brighter IR LEDs that I bought to get better pictures.  Once we’re back from Devon perhaps as long as Phoebe is behaving well enough for the CamJam.

Hedgehog Pi Recipe

Ingredients:

Hedgehog breakfast

Hedgehog breakfast

Here’s the finished build:

HogCam

HogCam

Over the course of last night, 58 shots were taken when motion was detected.  After each shot, there’s a delay of 1 minute to prevent too many shots being taken.

I’m in the process of getting the code on GitHub – I’ll update the post when it’s there.
The code is now on GitHub.

Next step is to take video for say 1 minute for each motion detected.