Desperate for Chicken Assistance

I am creating a device to count my three chickens as they go in and out of their coop. I have two motion sensors, a light sensor, and an arduino duemilanove. I plan to use one motion sensor on the entrance (x) and one on the exit (y). I want each of these sensors to count the chickens as they pass by and calculate the difference to know when all three chickens are inside (x-y=3). At this point the program would close the door except during daylight hours. I thought I could determine this by putting some sort of light sensor-based restraint on the door closing mechanism. As I am a relative novice with program writing I need help. Please, please help me. I care very deeply about my chickens. :'(

what parts have you tried and what difficulties are you having?

I have little or no idea how to write the programming. I'm guessing I will just be using a bunch of conditional statements. I'm looking for some structuring help and the basic setup mainly. I think I can tweak it from there.

Since this is in the hardware forum, and arguably you need hardware just before software…

Motion sensors usually have a pretty wide reception range, at least in chicken coop scale… does this device have a part number so you can look up the specs?

Define light sensor, I assume you mean a CdS photocell, like on automatic lamps? or something different?

Basic feasibility question: is there a mechanism that ensures your chickens must enter through the “entry” and can only exit through the “exit”?

You probably also need to figure out how to tell the difference between one chicken entering/exiting slowly and one following right behind another so the door doesn’t close between them.

Could you mark them with RFID tags?

Ran

Yes, chickens can only enter through the entrance and exit through the exit. I considered RFID but it would be too expensive. Would it work to write a counting program with the current setup?

Most intruiging subject title in a long time!

Nice idea for a project, I'm guessing you'll need to do a lot of testing to make sure false triggers don't mean a chicken is locked out all night.

Good luck!

Ah, but the Foxes might be able to count also? 8-)

Lefty

Would it work to write a counting program with the current setup?

Well, since they've already hatched, I guess it's okay to count them ;)

I would definitely start by doing that, and running it for at least a week or two to make sure that it was counting correctly, before turning control of the locks over to the Arduino.

Ran

Well when I had chicken the all went to roost as it was getting dark, once they went there were no stragglers so I recon you could just do it on light levels alone.

How do you make what is in effect a diode (one way gate) for a chicken?

The best way to let them in or out only one way, is to use bars that can only be pushed in one direction and are stopped by a block in the other. The bars are suspended by a single rod at the top, so they can flop both forward and back, but once the block is placed on one side, they can only flop one way.

why not just monitoring the movement of the gate itself. If you construct both gates as mantrap, you can be quite sure, your chicks can't be counted twice.

btw, in my country it's not allowed to have three of them, neither to lock them in!