Looking back at my last 2 posts, I started thinking about how I might incorporate a Picaxe into the BirdBoxPi2015 controller.
Although the 8 pin Picaxe is a little more expensive than the 555 timer currently used, it does offer more flexibility.
My RaspberryPi bird box system runs from a 12Volt, 12Ahour “mobility” lead-acid battery.
Although the RaspberryPi only consumes a couple of watts, I don’t want it running all the time, draining the battery every couple of days. Especially during the early weeks of the nesting season when there is not a lot going on.
So the system normally sits in a low power standby mode, and a controller is used to power the RaspberryPi on and off depending upon the level of activity.
The existing controller circuit
The design used during 2014 is best explained using this simple diagram
Initially, power is only supplied to the 555 timer circuit, not the RaspberryPi.
An activity sensor is positioned across the entrance to the box. When activity is detected (e.g. a beam is broken) a pulse triggers the 555 timer which is configured in monostable mode.
The output from the timer turns on the power to the RaspberryPi for about 90 seconds. This is long enough for the Pi to boot and start the kicker program, which re-triggers the 555 timer every 30 seconds. Therefore power is maintained and the RaspberryPi continues to run.
Any further triggers from the activity sensor are recorded and used to produce an activity count. If there is no activity for 30 minutes, the RaspberryPi stops kicking the 555 timer and the power to the Pi is turned off.
Using a Picaxe
The 8 pin 555 timer could be replaced by a Picaxe of the same size. Here is the block diagram for one possible arrangement.
Instead of using a timer with a fixed C-R time constant, the Picaxe can be programmed as required. When a trigger pulse occurs, the Picaxe can power-up the RaspberryPi as before.
But during quiet times (when there is no activity) the Picaxe can send a signal requesting the Pi to shutdown, and then remove the power maybe a minute later, providing a much cleaner shutdown process.
Other possibilities include:-
- initially ignore solitary trigger pulses or the first ‘n’ pulses, so the RaspberryPi is only switched on if activity is persistent
- assess the pulse length. Only turn on the Pi if the trigger pulse is longer than ‘x’ milliseconds
- use the Picaxe to count activity (rather than the Pi) and pass the count to the Pi via a serial connection
- maintain more than one count of activity (e.g. counts for pulse < 300ms & for >300ms)
- connect an LDR (light dependent resistor) to the Picaxe, so only daylight activity turns on the Pi
For more detail: