Armed only with a bucket full of enthusiasm, a wiki full of miss-information and a 2 digit IQ, the good Captain seeks not only to understand the modern world, but also fix one or two bits of kit along the way.

Category

Saturday, 16 November 2013

BirdBoxPiCam 2014; #2a Activity Based Power Control Details

Following on from an earlier post, I now have a prototype circuit undergoing testing.

This seems to be behaving as expected, and draws very little current when in standby.

Just to recap, this circuit will power-up my RaspberryPi when activity is detected at the entrance to a bird box (e.g. a bird or an insect breaking the beam between an infrared source and a detector).

Once the RaspberryPi is running, a program on the RPi keeps the power connected by periodically triggering a monostable. This program may also monitor the detector at the box entrance, report the count, and allow the power to be shut down during long quiet periods.

The Prototype

Initially the prototype is just controlling an led while I carry out basic checks on the circuit.

My 555 has 16 pins!...OK, its a 556

In standby, the controller draws 12mA, of which 8mA due to the iRed diode, which provides the source for the "bird detection" circuit.

When energised, this circuit still only draws about 20mA, thanks to the relatively high resistance of the reed relay coil.

The Circuit In Detail

When power is first applied to the circuit, the relay contacts are in their normal open state, so the RaspberryPi is not powered. The infrared from the diode causes the photo-transistor to conduct, pulling the input of IC1a (one section of the ULN2003) low. The output of this Darlington is high, and as it is an open collector, the output is pulled high by the 10k resistor.

If a bird enters the nest box, the IR beam is broken momentarily, the photo-transistor stops conducting, and the input to IC1a goes high, then low again as the beam is restored. This pulse is inverted by IC1a, and triggers IC2 (the 555 monostable).

There is nothing new about the 555 configuration. Did the late Hans Camenzind realise, when he designed this chip back in 1971, that it would still be in production over 40 years later? Is there a circuit configuration that has not been used before, thousands of times?

So in my circuit I'm using a standard retriggerable monostable arrangement. It needs to be retriggerable so that I can keep sending trigger pulses to stop the output dropping low.
The 555 output is inverted in IC1c, which energises the relay and powers-up the RaspberryPi.

...which is much longer than the 45 seconds that is takes for my RaspberryPi to boot and load my controller program.

The chosen relay has a 500 Ohm coil, so the relay current is only 10mA.

Once the RaspberryPi is running, a program will pulse one of the GPIO lines at an interval less than the 555 output pulse duration, therefore keeping the power on the RaspberryPi. This mechanism also acts like a watchdog, so if the RaspberryPi hangs, or the controlling program crashes, the 555 will not be triggered, the output will eventually fall, and the RPi will be powered off. Further activity at the entrance to the box should then restart the Pi.

The photo-transistor detection signal is also fed to the RaspberryPi GPIO, so a detection count can be recorded.

Note that the maximum voltage on the GPIO should be no more than 3.3Volts. The 10k resistor feeding the photo-transistor results in a voltage of 1.95V on my prototype. This appears to give reliable switching, but if this resistor value needs to be reduced, make sure you don't exceed the GPIO voltage.

2 comments:

I do hope you get a pair of blue tits to nest April/May 2014 conwaychallenger.

During the early weeks (March & early April) you should see birds checking out the nest. They often peck around the entrance hole, so its difficult to interpret the count at this stage, but at least it shows they are interested.

Once they have produced chicks, they tend to fly straight in/out of the nest without lurking at the entrance. So dividing the count by 2 then gives a reasonable approximation of the number of visits to the nest. When food is plentifull they can top 3 visits/minute. Here is some data from a great tit nest (22nd May 2011). The time is the start of a 1 hour period (so 06:00 count is from 6am to 7am):-