Shop OBEX P1 Docs P2 Docs Learn Events
Sensor to detect object in chicken coop door as it closes. - Page 2 — Parallax Forums

Sensor to detect object in chicken coop door as it closes.

2

Comments

  • KeithEKeithE Posts: 957
    edited 2015-05-13 14:30
    Off topic, but one of the best tech writers that I ever worked with (at Weitek) ran away from Silicon Valley back to Oregon and has been publishing and re-issuing some poultry related books. http://www.nortoncreekpress.com/poultry.html
  • JonathanJonathan Posts: 1,023
    edited 2015-05-13 15:28
    What about a simple ultrasonic sensor from above? Should be able to detect the difference between the floor and a chicken. Maxbiotics makes some nice rugged models.

    Jonathan
  • varnonvarnon Posts: 184
    edited 2015-05-13 19:07
    Ultrasonic might work. I've heard they don't work for "fluffy" things, so down covered babies wouldn't be easily detected (probably not chicken butts either!). I have found that, at least with pigeons, the primary flight feathers (and maybe tail feathers) can reflect sound away from the sensor. The covert and contour feathers seem to reflect the sound back at the sensor pretty well though. I had pretty good luck with pigeons except from a few angles. For a bigger bird, an ultrasonic sensor might work pretty well from above.

    P.S. I love threads on this project. Keep posting.
  • JohnR2010JohnR2010 Posts: 431
    edited 2015-05-14 03:47
    Jonathan wrote: »
    What about a simple ultrasonic sensor from above? Should be able to detect the difference between the floor and a chicken. Maxbiotics makes some nice rugged models.

    Jonathan

    I think the sensor will be triggered when the door closes. I need to detect a chicken that moves into the the path of the door as it is closing. This would work if I just needed to detect a chicken in the hole before I closed the door but not so good as the door closes.

    Thanks!
  • MrBi11MrBi11 Posts: 117
    edited 2015-05-14 18:26
    What about using ambient light shining thru the door (seeing how it only be functioning in daylight hours).
    A photoresistor wired to the Prop could measure the average resistance and when a chick blocks the doorway (and therefore the light).
    Wouldn't be able to detect fowl from predator (unless you did lots of test to determine size???
  • W9GFOW9GFO Posts: 4,010
    edited 2015-05-14 22:06
    An idea, not about chicken detection but mink rejection. Swap out the wooden ramp for a metal one. Have zones that are insulated from each other but far enough apart that it is impossible for a chicken to bridge between two. Use an electric fence controller to energize the ramp. When a larger creature attempts to go up the ramp it gets a nice dose of electrons.
  • JohnR2010JohnR2010 Posts: 431
    edited 2015-05-15 04:37
    W9GFO wrote: »
    An idea, not about chicken detection but mink rejection. Swap out the wooden ramp for a metal one. Have zones that are insulated from each other but far enough apart that it is impossible for a chicken to bridge between two. Use an electric fence controller to energize the ramp. When a larger creature attempts to go up the ramp it gets a nice dose of electrons.

    I like this one but the dang ramp always has straw and "stuff" on it. I would be afraid if it got wet things wouldn't work as planned.

    I'm not too worried about filtering out the Mink as he will only come in at night. I'm more concerned about detecting a chicken when the door is closing. One thing I have been thinking about is dropping the ramp away from the door when it starts to close. This way if a chicken is standing on the ramp they will be lowered out of the path of the closing door. These are all plan B.

    Plan A is a current sensor on the door's actuator motor. As soon as I get my sensor set up I will see how sensitive I can make it. If I can get it to detect a pencil in the door based on an increase in motor current without breaking it I will be in good shape.

    Thanks
  • JohnR2010JohnR2010 Posts: 431
    edited 2015-05-15 04:47
    MrBi11 wrote: »
    What about using ambient light shining thru the door (seeing how it only be functioning in daylight hours).
    A photoresistor wired to the Prop could measure the average resistance and when a chick blocks the doorway (and therefore the light).
    Wouldn't be able to detect fowl from predator (unless you did lots of test to determine size???

    I need to give this one some thought. I use a photo sensor now to detect the light level at sunset and then close the door. The coop has windows so their is more light coming in from the windows, but there would still be a change. I think it could be done. One way to do it may be to have a light under the coop that shines up through the hole and measure that. As the door closes the light will be less and less I could build a table of expected light levels through the close process. I like it! It made the list.

    Thanks
  • edited 2015-05-15 05:19
    How about a light curtain?

    An IR Transmitter Assembly Kit ( Parallax 350-00017 and an Infrared Receiver for SumoBot ( Parallax 350-00014 ) mounted on the leading edge of the slide. If the beam is broken the door would stop until the chicken or whatever moved away.

    Sandy
  • edited 2015-05-15 05:23
    DELETED - SEE PREVIOUS MESSAGE
  • MJHanaganMJHanagan Posts: 189
    edited 2015-05-15 05:47
    How about a limit switch to detect if the door closed properly? Activate the door to close then check to be sure it trips the switch withing a certain period of time. If closure not confirmed then open the door to release old Milly and try again. If that sounds too boring (and to me it is, then add an XBee WiFi module so it will text you if it fails to close after three attempts).
  • kwinnkwinn Posts: 8,697
    edited 2015-05-15 06:12
    Wouldn't a hinged door eliminate or at least reduce the chance of of a chicken getting caught in the door as it closes. Something along the lines of the household pet doors, motorized if needed, but hinged above and closed by gravity if the chickens could push it open. If motorized the action of the door would tend to push the chickens along.
  • TorTor Posts: 2,010
    edited 2015-05-15 06:21
    W9GFO wrote: »
    An idea, not about chicken detection but mink rejection. Swap out the wooden ramp for a metal one. Have zones that are insulated from each other but far enough apart that it is impossible for a chicken to bridge between two. Use an electric fence controller to energize the ramp. When a larger creature attempts to go up the ramp it gets a nice dose of electrons.
    I see a problem.. if a bunch of chickens are queing up at the ramp then they could possibly be in touch with each other when crossing the zone.

    -Tor (who still remembers an episode when I, as a teenager, happened to touch the shoulder of a friend and we both got shocked with live household AC - there was an electrical problem with an item on the floor that he was touching, but nothing happened before I touched him. My feet were at ground plane, his werent..)
  • homosapienhomosapien Posts: 147
    edited 2015-05-15 11:25
    Phil's idea of something to 'soft' block the door before 'hard' blocking the door sounds like the simplest.

    Or, you could instead of a' guillotine' type of door, make it more like a drawbridge, except take it a bit further by making the actual door be the shape of a 1/2 cylinder on its side. The framed opening for the door height would have to be 2x the radius of the cylinder, the actual usable door opening would be equal to the radius of the 1/2 cylinder, the width of the door would be the length of the cylinder.

    When open, the flat side of the cylinder would be the floor of the door area, the round part would be below. The center line of the flat side of the cylinder would be in the middle of the threshold, running side to side.

    When closing, the 1/2 cylinder would rotate 90 degrees on an axle that runs down the middle of the flat side of 1/2 cylinder. This way you could mechanically rock the 1/2 cylinder to get any chickens off the flat side/threshold before fully closing. If you closed it so the round side was facing where the chickens would be when closed, there would be minimal chances of pinch-points meeting the chickens when opening.


    Nate
  • redheadedrodredheadedrod Posts: 78
    edited 2015-05-17 23:36
    For the radar sensors I was envisioning something that would actually be on the non moving side of the gate and measure the distance to the gate. Since you know how long the gate should take to close you should know how far away it is. If all of a sudden it should be 2 feet away and it is 2 inches away you know you have a chicken in its path...

    Another way to do it is to have the sensor above the closing gate but mounted to it so it would continuously look in front of it. You would of course know when the gate closed as normal and would be able to detect this with the radar sensor. If a bird moved in front of the gate you could stop the gate until they clear out of the way. And if the gate took too long to close you could have it trip an alarm that calls you to check on it.

    I still think the lidar-lite type Laser will be the best bet. Put it on a tilt mechanism on the receiving end of the gate and you can measure the distance from the laser to every spot on the ground, up the gate and to the top of the gate. You should be able to calculate what the laser should be returning and be able to look for bogus distances that would indicate something like a piece of hay in the way.. You could come very close to measuring how big an item is in the door way. If I were doing it I would atleast look at this setup. It might be the easiest thing to do since using geometry you should be able to calculate the proper distances and the laser will only return the distance... You could control the tilt mechanism with the Propeller and have total control. The ONLY issue I see with laser is that it can damage the birds eyes possibly if they stare at it while it is aiming right at them. Another good reason to mount it high...

    Rodney
  • JohnR2010JohnR2010 Posts: 431
    edited 2015-05-18 06:03
    Thanks everyone for all the great suggestions. I have a ton of things to try now. I will report my results and final solution in another post.
  • Jeff HaasJeff Haas Posts: 418
    edited 2015-05-18 19:54
    Just to toss some other ideas out there...the concept of a microcontrolled chicken coop has been done a lot. I even remember one guy who had RFID tags on the birds' feet - so he got text messages when they came in for the night. Another one where there was a sensor that counted how many birds came in when it was dark and then closed the door (which wouldn't work with your rooster!) Search for "microcontroller chooks" for more ideas ("chooks" is British/Aussie slang.)
  • KeithEKeithE Posts: 957
    edited 2015-05-18 21:29
    You might consider browsing around the site that I mentioned earlier. It looks like there's a lot of interesting advice about chickens up there. He's up in Oregon and I don't know if the conditions in your area dictate a different strategy but here's one quote of interest:

    "Predators can be a serious problem. I use a two-strand electric fence of the kind used to keep raccoons out of gardens (one strand at about 4″ off the ground and another at about 8-10″). This works pretty well, though I sometimes have to use snares on predators who insist on getting past the fence. Permanent fencing can be more reliable than this.

    Before the fence, I discovered that predators would show up at dusk, before the chickens were willing to go inside for the night, so having a door I could close at night wasn’t enough. Not unless I wanted to keep guard for an hour or so every night, until the last chicken went indoors. Since I’m not willing to do this (or to get up early to let the chickens out again), I don’t put doors on my chicken houses."

    It looks like he's a big believer in what they call fresh air houses. Anyways if you search for "predators" on his site there are plenty of horror stories about bobcats, raccoons,...
  • JohnR2010JohnR2010 Posts: 431
    edited 2015-05-19 05:09
    KeithE wrote: »
    You might consider browsing around the site that I mentioned earlier. It looks like there's a lot of interesting advice about chickens up there. He's up in Oregon and I don't know if the conditions in your area dictate a different strategy but here's one quote of interest:

    "Predators can be a serious problem. I use a two-strand electric fence of the kind used to keep raccoons out of gardens (one strand at about 4″ off the ground and another at about 8-10″). This works pretty well, though I sometimes have to use snares on predators who insist on getting past the fence. Permanent fencing can be more reliable than this.

    Before the fence, I discovered that predators would show up at dusk, before the chickens were willing to go inside for the night, so having a door I could close at night wasn’t enough. Not unless I wanted to keep guard for an hour or so every night, until the last chicken went indoors. Since I’m not willing to do this (or to get up early to let the chickens out again), I don’t put doors on my chicken houses."

    It looks like he's a big believer in what they call fresh air houses. Anyways if you search for "predators" on his site there are plenty of horror stories about bobcats, raccoons,...

    Oh no you didn't say the fence word! That would be too easy. We are free range dang it and there will be no fences (or so I have been told <smile>). Its kind of big deal to not have fences. Supposed to get more eggs since the chicken's have less stress and go where they want. Our chickens will walk over ~3 acres each day looking for bugs and food in the grass around our farm. They travel as a group led by the rooster my wife enjoys keeping track of "what they are up to now"!

    Sounds like he just needs to build a better fence so his predators can't get in.

    Thanks for the input!
  • bte2bte2 Posts: 154
    edited 2015-05-19 06:16
    Heater. wrote: »
    I really feel for those chickens.

    There they are living in a coop surrounded by marauding mink and other wild life. Now they have door closing on their necks when they go home for safety!

    I was working on a machine at a customer's farm a couple weeks ago. I brought my wife because it was late in the day. On the way there I told her "his son keeps ducks in the back". She was wandering around while I was working and came in and told me that the ducks all had blood on the backs of their heads.

    I finished the job and the guy came out and mentioned that he was losing poultry livestock- a dozen turkeys dead and 6 or so of the two dozen ducks he had. He couldn't find tracks and wondered if it was maybe a hawk. We walked over to the pen and the ducks were very nervous.

    Suddenly a mink ran out of the pen and into a biggerish brush pile. He got the Bobcat and started pushing the pile and it (the mink) came running out. I said, "Should I shoot it?", and he said yes.

    We were among his equipment so I couldn't immediately take a shot, so I chased it to the open field. I landed a perfect headshot on a running mink at just over 25 yards.

    Yes I was proud to make that shot with a pistol.

    I went back the next day to check up on the machine and asked if his kid was happy. He said the kid was real happy that he didn't have to remove dead ducks and needed the break. The turkeys were dinner, and the ducks were pets.

    Sorry off topic.

    As for the coop door, have you considered a CMUCam?
  • bte2bte2 Posts: 154
    edited 2015-05-19 06:46
    JohnR2010 wrote: »
    I have a 12 volt actuator that controls our chicken coop's door. I would like to add a sensor to detect if a chicken is in the path of the door and I was thinking of going the current sensing route. So if the actuator's current jumps up during the close I can reverse it with the propeller (just like a car window will stop going up if it senses an object).

    Forgive me for sounding like a boob, but I was thinking of your question in the shower.

    Presumably, your coop door is automatic, which begs the question, "why have a door then?". If it's not automatic, then just watch to make sure. If it is remote, how do you ensure that you don't lock any chickens out?

    Logically, I see three scenarios-
    a fully automatic door which is useless as a door (if the chickens can just come and go as they please they don't need a door),
    a manual electric door but then you need to be present and can ensure that no chickens are harmed, or
    the remote door but then you don't know if your chickens are fully wrangled in.

    The more I think about it the more I like the CMUCam approach- you can paint the chute black and easily see white chickens, and you may be able to program so a mink can't get in.
  • KeithEKeithE Posts: 957
    edited 2015-05-19 08:36
    JohnR2010 wrote: »
    Oh no you didn't say the fence word! That would be too easy.

    In one presentation he describes the "fence" as follows - he runs a free-range operation with at least 500 hens, turkeys, and pigs. (http://nortoncreekfarm.com)

    "The front wall extends only about 20” up from the ground (low enough for me to step over).
    The chickens hop up to the top of the front wall and then into the house.
    Predators, who have to climb, run into the electric fence wire strung on insulators nailed to the front wall"

    Anyways regardless of what you do for your door, Robert is a good writer and you may find some useful information on his site.
  • JohnR2010JohnR2010 Posts: 431
    edited 2015-05-19 14:12
    bte2 wrote: »
    I was working on a machine at a customer's farm a couple weeks ago. I brought my wife because it was late in the day. On the way there I told her "his son keeps ducks in the back". She was wandering around while I was working and came in and told me that the ducks all had blood on the backs of their heads.

    I finished the job and the guy came out and mentioned that he was losing poultry livestock- a dozen turkeys dead and 6 or so of the two dozen ducks he had. He couldn't find tracks and wondered if it was maybe a hawk. We walked over to the pen and the ducks were very nervous.

    Suddenly a mink ran out of the pen and into a biggerish brush pile. He got the Bobcat and started pushing the pile and it (the mink) came running out. I said, "Should I shoot it?", and he said yes.

    We were among his equipment so I couldn't immediately take a shot, so I chased it to the open field. I landed a perfect headshot on a running mink at just over 25 yards.

    Yes I was proud to make that shot with a pistol.

    I went back the next day to check up on the machine and asked if his kid was happy. He said the kid was real happy that he didn't have to remove dead ducks and needed the break. The turkeys were dinner, and the ducks were pets.

    Sorry off topic.

    As for the coop door, have you considered a CMUCam?

    That was an awesome shot with a pistol. Glad you got it. I live in southern Illinois and about 100 miles from our farm there was a mink farm and rumor has it they had over a thousand minks in a barn. Well about three years ago someone broke into the barn and released them all. I know they though they were doing the right thing by the minks but it has sure been tough on us chicken owners. I now several people who have lost their chickens to mink attacks.
  • JohnR2010JohnR2010 Posts: 431
    edited 2015-05-19 14:20
    KeithE wrote: »
    In one presentation he describes the "fence" as follows - he runs a free-range operation with at least 500 hens, turkeys, and pigs. (http://nortoncreekfarm.com)

    Oh my 500 hens. That is way over our head. We had 4 hens and going to now have 6. That is enough to keep two of us in eggs most of the time and more than enough chicken poop for me to clean up. I understand now why he has the fence set up the way it is. Our coop is on an island in the middle of our lake with a foot bridge to it. The chickens use the bridge to get to and from the island but the water does provide some level of protection. I just went to his sight he sure looks familiar I know I have seen some of his work.

    Thanks!
  • JohnR2010JohnR2010 Posts: 431
    edited 2015-05-19 14:48
    bte2 wrote: »
    Forgive me for sounding like a boob, but I was thinking of your question in the shower.

    Presumably, your coop door is automatic, which begs the question, "why have a door then?". If it's not automatic, then just watch to make sure. If it is remote, how do you ensure that you don't lock any chickens out?

    Logically, I see three scenarios-
    a fully automatic door which is useless as a door (if the chickens can just come and go as they please they don't need a door),
    a manual electric door but then you need to be present and can ensure that no chickens are harmed, or
    the remote door but then you don't know if your chickens are fully wrangled in.

    The more I think about it the more I like the CMUCam approach- you can paint the chute black and easily see white chickens, and you may be able to program so a mink can't get in.



    Nope you don't sound like a boob at all. You may have missed some details earlier in this post. When I say automatic door I mean the door will Auto Close and Auto Open based on Sunset and Sunrise. Chickens with religion go into their coop and jump up on a perch just before sunset. It has been bred into them over the years you can count on it like clock work. They have unbelievable vision (during the day) at night they are blind as bats so they don't like being out after dark. My wife and I lost 3 hens a couple of months ago because we forgot to close the coop door and a mink got in and killed them. So I modified one of our propeller based circuits to control the coop door based on ambient light. It works great if we forget to push the button to close the door it does it for us. I started this tread asking for a good current sensing circuit as I would like to since the current of the actuator as it closes the door and if I detect a high draw I know I have trapped a bird and need to open the door to release her. I got the answer I was looking for in the third post back on page one and I have parts on order. In the mean time I have got a ton of other great ideas to try and enjoyed the input from everyone.

    Now for the CMUCam. I bought one of those last year for this very purpose and I have to say I was extreamly disappointed in its performance. It can only pick out highly saturated colors and in perfect light. That is a long way from real life but hey looked good tracking a bright orange ping pong ball across a brightly lit table. Our chickens are not bright saturated colors and there is no way my wife is going to let me tie orange ping pong balls around her hen's necks. Maybe the rooster, I think she would like to tie something else around his neck. Smile.

    Its funny how a thread can get so large it looses its original focus and the details are overlooked.

    Oh I have to say its a little strange that you are thinking about my chickens while you take a shower! LOL
  • bte2bte2 Posts: 154
    edited 2015-05-19 20:45
    I know, right? ;-)

    I bought a CMU PIXy cam that I found disappointing for the opposite reason- I wanted to do edge detection and pixel mapping so I could tell the difference between a human and a piece of blowing trash or animal or whatever. The idea was an alarm that alerted before any screens were actually cut- if it was a human shape and near the window, send a text message with a photo (or something like that).

    The plain-Jane CMU cams would output a bitmapped image that could be analyzed, and the PIXy had a lot of that preprocessing already done and worked best to plot the size and XY coordinates of the object it was looking at. I did a quick test with a black box and a rolled up sock and was able to detect both size and position easily. Even better when I shined a couple white LEDs into the box.

    I just bought the newest CMUcam without reading enough into it or I would have bought the (I think) CMUCam 4.

    It was not a complete waste though- I was contracted to measure stainless tanks of hot oil to determine when they were full. The tanks were already in service and I could not install any more bungs into them (and besides, I couldn't find a tank level sensor that could tolerate the heat), so I installed some piping and clear tubing (to get it away from the hot) and used a float which is watched by the camera. When the XY position of the float was at the full mark on the tank, the camera would output the position over the serial link and trigger the alarm that way. In that case, it sends the dispatcher an email requesting a truck to empty the tank.

    It's nice because it is adjustment-free. It really works good. It seemed like a similar problem to yours (kinda).

    No I don't have a chicken fetish :-)
  • KeithEKeithE Posts: 957
    edited 2015-05-19 21:09
    A funny one you can watch since you're talking about computer vision a bit:

    "Militarizing Your Backyard with Python: Computer Vision and the Squirrel Hordes"

    https://www.youtube.com/watch?v=QPgqfnKG_T4
  • JohnR2010JohnR2010 Posts: 431
    edited 2015-07-06 16:36
    Update!

    Here is a video of my new chicken coop door controller now with object detection (anti chicken smash) feature.

    634efbcad1cbb9c0482921727c34cb.png
    You can find the details of the circuit in this thread: http://forums.parallax.com/discussion/161172/noise-from-12v-actuator-causing-random-reboot-even-with-fly-back-diodes#latest

  • John, great progress!
  • John,
    Very impressive. You put a lot of work into that. I'm interested to learn how you interfaced to the ZigBee HA clusters. Are you willing to share your code so I can learn from it? 
Sign In or Register to comment.