View Single Post
Old 12-16-14, 09:34 PM   #1
Bosco
Lurking Renovator
 
Join Date: Dec 2011
Location: Western Australia
Posts: 20
Thanks: 0
Thanked 1 Time in 1 Post
Default Keeping Poultry safe from foxes

Here in Australia we have a problem with foxes which were introduced in the first half of the 19th century for sport.

I keep poultry and have adapted a spare MTM Scientific Picaxe solar tracker board to raise and lower a door in my poultry house to keep foxes out at night.

The system only uses one sensor (west) as I removed the biasing resistor to the east sensor and replaced the sensor with a 330 ohm resistor in series with a 5 volt LED to indicate when the door is open. (If the door fails to close I can see the glow of the LED from my house after dark.)

I have bridged the east and west limit switch terminals and rely on timing to raise and lower the door. It took a few days to match the 'raise' and 'lower' timings to ensure the door returned to the exact same place.

The circuit drives a 12 volt car windscreen wiper motor with a roller on it and a steel cable over a pulley to raise the door. Here are a couple of photos.





and here is the software:

'This program controls a solar tracker relay H-Bridge using a Picaxe-08M, used in this case to open and close a poultry house door
'Output 0 and Output 1 are used to control the relays
'Input 4 (West) monitors the photocell
symbol west = w1 'west is a 10 bit ADC number reading
symbol sun = w3 'threshold for sun detect (Usually 93)
symbol dark = w4 'threshold for dark detect (Usually 1000)
symbol u = w2 'indicator of door up (1) or down (0)
'Initialize all the pins for their respective functions
output C.0 'used for relay control
low 0 'initialize low
output C.1 'used for relay control
low 1 'initialize low
output C.2 'LED control
low 2
input C.3 'slow/normal switch
input C.4 'west photocell
sun = 300 'threshold adc reading for sunlight
dark = 1000 'threshold adc reading for darkness
pause 1000 'pause for 1 second to stabilize power supply, etc.
u = 0 'set door as down
main: read b0,u 'check position of door
if u = 1 then night 'if door up wait for darkness
readadc10 C.4,west '10 bit adc read west photocell
if west > dark then close
if west < sun then open
goto main
open: 'Routine for raising door
low 0 'strictly a blow-through preventing command
high 1 'energize relay
pause 9000 ‘ON time is 9 seconds to raise door
low 1 'stop energizing relay
u = 1 'set door indicator to up
write b0,u 'and store it
high 2 'turn LED on
night:readadc10 C.4,west '10 bit adc read west photocell
if west > dark then close
pause 1000 'pause for 1 second
goto night 'repeat the sensor scan
close: 'Routine for lowering the door, double check signals first
pause 100 'slight delay and then double-check darkness
readadc10 C.4,west '10 bit adc read west photocell
if west < dark then night
'Double-checking completed, proceed with the parking mode
low 1 'strictly a blow-through preventing command
high 0 'energize relay to lower door
pause 7300 ‘7.3 seconds to lower door
low 0 'stop the parking action and wait for dawn
u = 0 'set door indicator to down
write b0,u 'and store it
low 2 'turn LED off
dawn: 'Start the wait for first light to start tracking again
readadc10 C.4,west '10 bit adc read west photocell
if west < sun then main
goto dawn 'continue looping while waiting for dawn


Last edited by Bosco; 12-16-14 at 09:51 PM..
Bosco is offline   Reply With Quote