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

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

JohnR2010JohnR2010 Posts: 431
edited 2015-05-19 21:09 in Propeller 1
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).

Does anyone have a recommendation on a DC current sensing IC? I like to keep things simple and not build a custom A/D converter if I don't have to.

I prefer the current sensing solution to say a photo sensor as there is often something in the way of the door such as straw or wood chips.
«13

Comments

  • mindrobotsmindrobots Posts: 6,506
    edited 2015-05-12 09:58
    INA-219 DC Current Sensor

    Would this work? There was a thread from Ken just the other day asking for BS2 code to support it. Propeller code already exists on the product page.
  • Heater.Heater. Posts: 21,230
    edited 2015-05-12 10:03
    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!
  • Tracy AllenTracy Allen Posts: 6,658
    edited 2015-05-12 10:28
    And now, current passing through them as they run for the coop! Seriously, how does current detect the chickens? Current to the actuator under load?

    The Omron D6T is a body heat sensor with either 4 x 4 pixel or 1 x 8 pixel. It could I think detect a chicken present on the ramp. Rather expensive though.
  • Heater.Heater. Posts: 21,230
    edited 2015-05-12 10:37
    I thought the idea was to detect the extra current in the motor as it tries to close on a hapless chicken. Not to pass current through the chickens.

    Of course the door may then close on a vicious killer mink, and the open again when the current threshold is detected. Oops.
  • JohnR2010JohnR2010 Posts: 431
    edited 2015-05-12 10:48
    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!

    Smile well the goal is to not close the door on their necks. The door takes about 10 seconds to close and the chickens run from it when they hear the motor start up so about the only time it would be an issue is if one gets startled and shoots through it at the last second. We have had this door hooked up to a camera and manually pushed a button to close it for the past three years. And over all that time there hasn't been one close call but in case it does happen I would prefer to not trap the chicken in the door overnight but instead release it and then close again.

    These are free range chickens (no fence to keep them in or protect them) so yea there is not only Mink wondering around outside but the neighbor's Dog, Coyotes, Fox, and Raccoons. The one common thing is they all hunt after sunset except for the dogs (Rooster takes care of the dogs) so if the door is closed (with the chickens in) all is good.
  • JohnR2010JohnR2010 Posts: 431
    edited 2015-05-12 11:04
    mindrobots wrote: »
    INA-219 DC Current Sensor

    Would this work? There was a thread from Ken just the other day asking for BS2 code to support it. Propeller code already exists on the product page.

    This is exactly what I'm looking for! Thanks Rick!!
  • TappermanTapperman Posts: 319
    edited 2015-05-12 11:33
    JohnR2010 wrote: »
    Does anyone have a recommendation ...

    Instead of sensing current ... could you use a servo to spook them .. like a scare crow? Then the path would be clear for closure.

    ... Tim
  • JohnR2010JohnR2010 Posts: 431
    edited 2015-05-12 11:36
    Heater. wrote: »
    I thought the idea was to detect the extra current in the motor as it tries to close on a hapless chicken. Not to pass current through the chickens.

    Of course the door may then close on a vicious killer mink, and the open again when the current threshold is detected. Oops.

    Yep your correct Heater. Don't know how we got on the topic of passing current through the chickens. I have to grin on that one.

    The goal is to monitor the current of the door's actuator through the first half of the closing say for 5 seconds. This will set a base line for the last 5 seconds and if the current jumps open the door send a message and try again a few minutes later. I will repeat this process two more times sending an alert to my smart phone every time the door doesn't close. Then wait about 15 minutes and then close one last time all the way regardless of the current used by the actuator. The 15 minute delay wold give me enough time to react to the alerts with my phone and cancel the auto close command if I need to.

    This may not work at all as this actuator is geared very low and the current difference may be so small that I cant really detect it.
  • JohnR2010JohnR2010 Posts: 431
    edited 2015-05-12 11:40
    Tapperman wrote: »
    Instead of sensing current ... could you use a servo to spook them .. like a scare crow? Then the path would be clear for closure.

    ... Tim

    Yea I thought about some type of wiper that would go across the door first and then start the close process. I fear it would be too complex as a klump of straw may keep the wiper from going through its cycle and the door not shutting. As for the alarm the chickens know the sound of the door and they get away from it when it is closing. Its pretty loud.

    Thanks
  • TappermanTapperman Posts: 319
    edited 2015-05-12 11:43
    JohnR2010 wrote: »
    Yea I thought about some type of wiper that would go across the door first and then start the close process. I fear it would be too complex ...Thanks

    What about an old 'jack in the box' .... it makes a noise and then pops up the top ... any thoughts?

    ... Tim
  • JohnR2010JohnR2010 Posts: 431
    edited 2015-05-12 11:57
    The Omron D6T is a body heat sensor with either 4 x 4 pixel or 1 x 8 pixel. It could I think detect a chicken present on the ramp. Rather expensive though.

    Tracy, you have my interest peeked with this sensor. The average body temperature of a chicken is 105 to 113 degrees Fahrenheit I wonder if this sensor can be used to actually read that temperature? If so I wonder if I could use it to detect a chicken vs a Mink and selectively open the door. This way I could keep the door closed all day and only open it when a chicken is on the ramp. Today when the door is closed and the chickens want to get in they will walk all the way up the ramp and stand there in front of the closed door and wait, some times for minutes waiting for the door to open. This is where I was going to go the RFID route with a leg tag but I have given up on that for several reasons. But if I could measure their temperature that may be the way to go!!

    Another reason to keep the door closed all the time is to keep wild birds out of the coop. They bring in lice and leg mites as well as carry diseases that can make the chickens sick.

    I think I may get one of these sensors and do some testing.

    Thanks!
  • mindrobotsmindrobots Posts: 6,506
    edited 2015-05-12 12:01
    Doesn't OSHA require a klaxon and a set of flashing yellow lights on any automatic door? I don't think we can support any solution that does not meet OSHA guidelines.

    Remember, safety in the workplace starts with you!!
  • T ChapT Chap Posts: 4,203
    edited 2015-05-12 12:05
    Use an infrared emitter and detector with a tight pattern. I think a mink is much shorter than any grown chicken, so only if an animal as tall as a chicken walks up will it open the gate. You cannot easily detect the difference in temp from two different animals/birds using the Omron. You can use 2 IR beams, one low and one higher to help prevent a bird flying past the beam as it must break the top and bottom.
  • Heater.Heater. Posts: 21,230
    edited 2015-05-12 12:20
    Use a PIN code. I have seen experiments done with pigeons where they were taught the correct sequence of pecks on a button required to get food. I presume a chicken is about as smart as a pigeon.

    Hopefully the minks and such never get to practice enough to learn the PIN.
  • JohnR2010JohnR2010 Posts: 431
    edited 2015-05-12 12:20
    T Chap wrote: »
    Use an infrared emitter and detector with a tight pattern. I think a mink is much shorter than any grown chicken, so only if an animal as tall as a chicken walks up will it open the gate. You cannot easily detect the difference in temp from two different animals/birds using the Omron. You can use 2 IR beams, one low and one higher to help prevent a bird flying past the beam as it must break the top and bottom.

    Yep been down this road in my mind. The ramp to the coop is outside and let me tell you it can get clumped up with straw and mud. I often have to wash it down. I have thought about going the IR beam route but that would require a sensor on each side of the ramp and it would get wet and knocked around. I liked the Omron sensor as it could be placed up away from the ramp looking down on it from a distance.

    Do you think the Omron could tell the difference between a chicken and say a small bird? The predators are not a problem during the day not too worried about picking them out.
  • JohnR2010JohnR2010 Posts: 431
    edited 2015-05-12 12:30
    @Heater

    SMILE. Um I know your kidding but I did quite a bit of reading on this topic. Turns out the chickens are just taught to peck at lights and not all chickens can do it. I was even going to setup a training feeder with a flashing red light that would release food when the chicken pecked on it. But I read that roosters are not trainable most of those tic-tac-toe games are with hens. Roo is the first one in most nights he likes to go in and out several times as the hens walk up the ramp. I like to think he is protecting them but in reality he is looking for an opportunity to jump on one. I don't think he will be too happy if he has to have a hen enter the pass code to let him in.
  • T ChapT Chap Posts: 4,203
    edited 2015-05-12 12:37
    You can put a chicken in there and get an average of the temperature, and then only detect triggers if the temp is in that window. Then put in a bird and see how it shows up in the temperature read. A small bird will surely show up less than a larger bird. But what if the coup is hot and not obviously different from the chicken temp? The coup can get hot in the sun, so you'd need to collect a rolling average and only trigger on a difference +/- of some amount. The set point for the trigger would have to be dynamic accounting for differences in seasons and sunlight, the average would require a gradual change. This gets really tricky. I have hundreds of hours into the Omron, and it is ideal for controlled conditions. Your's does not sound like a good candidate, although with a ton of work you could dial it in maybe.

    The IR detector/emitter could be mounted many feet from the actual area where it could get wet, even inside an enclosed area. However this does not handle blockage from straw etc.
  • JohnR2010JohnR2010 Posts: 431
    edited 2015-05-12 12:44
    T Chap wrote: »
    You can put a chicken in there and get an average of the temperature, and then only detect triggers if the temp is in that window. Then put in a bird and see how it shows up in the temperature read. A small bird will surely show up less than a larger bird. But what if the coup is hot and not obviously different from the chicken temp? The coup can get hot in the sun, so you'd need to collect a rolling average and only trigger on a difference +/- of some amount. The set point for the trigger would have to be dynamic accounting for differences in seasons and sunlight, the average would require a gradual change. This gets really tricky. I have hundreds of hours into the Omron, and it is ideal for controlled conditions. Your's does not sound like a good candidate, although with a ton of work you could dial it in maybe.

    The IR detector/emitter could be mounted many feet from the actual area where it could get wet, even inside an enclosed area. However this does not handle blockage from straw etc.

    I think I will get sensor and collect data for awhile. I would think they would have some way of taking out the ambient heat but I bet your right if the outside temp is around 100f and the chicken's temp is 105f it may not see anything.
  • T ChapT Chap Posts: 4,203
    edited 2015-05-12 12:49
    The sensors have a tight grid pattern they watch. But there is no ability to "take out" anything. It just reads what comes into the lens. The only way to attempt this is with a rolling average, so that the change must be AVG +/- OFFSETVal = a trigger event.
  • ChrisGaddChrisGadd Posts: 300
    edited 2015-05-12 13:17
    Howabout some type of pressure mat? That one looks to a be simple switch type of sensor, you could build a scale with a pressure transducer--or maybe cannibalize an off-the-shelf digital scale--to only allow a specific weight range through.
  • JohnR2010JohnR2010 Posts: 431
    edited 2015-05-12 13:30
    ChrisGadd wrote: »
    Howabout some type of pressure mat? That one looks to a be simple switch type of sensor, you could build a scale with a pressure transducer--or maybe cannibalize an off-the-shelf digital scale--to only allow a specific weight range through.

    The coop is home to baby chicks as well as the bigger full grown birds. I'm guessing the weights would be from 7lbs to much less than a pound. I think this is the most viable solution but I don't think it is worth all the work. As the ramp gets muddy or wet it will get heaver so I will have to have some type of moving base line to detect the chicken's weight.

    Now that I think about it, the previous idea of using a heat sensor to detect a chicken vs a bird wouldn't be able to differentiate between a baby chick and barn swallow. I think I just need to keep the door open during the day and close it at night like we have done over the past three years. As long as we close the door at night we will be fine.

    Thanks
  • frank freedmanfrank freedman Posts: 1,977
    edited 2015-05-12 13:42
    On seeing this thread, I was tempted to say use image recognition to do a slow close or stop if a bird was in the doorway or a high-speed steel blade if the obstruction was a fox or other predator. But actually if you look over on the savage circuits site for a poster called "Doggie Doc", he has a chicken coop project that I think has been up and running for a while now.

    FF
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2015-05-12 15:49
    If it's a door that slides up and down, can you make it travel twice the distance? If so, you could add a curtain to the bottom of it. The curtain would close first, which the chickens would see and think the door was already closed; then the door would close on top of the curtain.

    -Phil
  • cavelambcavelamb Posts: 720
    edited 2015-05-13 02:38
    On seeing this thread, I was tempted to say use image recognition to do a slow close or stop if a bird was in the doorway or a high-speed steel blade if the obstruction was a fox or other predator. But actually if you look over on the savage circuits site for a poster called "Doggie Doc", he has a chicken coop project that I think has been up and running for a while now.

    FF

    My first thought was an IR detector across the doorway.

    I've done this before using tiny mirrors glued to the structure to bounce an IR beam
    across, up and back to better allow for variations in size.
    Or just use two circuits, one located high (mid body), one lower (smaller chicks)?

    For this project, maybe use one of the modulated sensors (38Khz), strip all the
    character decoding out of one of the TV Remote objects and just detect the
    carrier. Code one cog to make the 38khz signal and feed that to an IR LED.

    No carrier, the door is "occupied".
  • JohnR2010JohnR2010 Posts: 431
    edited 2015-05-13 04:59
    If it's a door that slides up and down, can you make it travel twice the distance? If so, you could add a curtain to the bottom of it. The curtain would close first, which the chickens would see and think the door was already closed; then the door would close on top of the curtain.

    -Phil

    The curtain is one I hadn't thought of. I like it. However my door is horizontal in the floor of the coop. The coop is elevated about 4 feet above the ground and the ramp leads up into the bottom. Here is picture from the dropcam inside the coop:

    attachment.php?attachmentid=114165

    attachment.php?attachmentid=114166

    As you can see its easy for straw a other stuff to get in the way of the door. Not sure how I can make the curtain idea work but I will walk outside this afternoon and take another look from the underside of the coop.

    Thanks
    1024 x 585 - 190K
    1024 x 580 - 170K
  • kwinnkwinn Posts: 8,697
    edited 2015-05-13 06:36
    How about having the door close from below the opening. That way any straw or other debris would tend to fall off, and a switch under a piece of wood across the top of the door could detect something blocking the door.
  • redheadedrodredheadedrod Posts: 78
    edited 2015-05-13 08:58
    Or what about something like a radar sensor? Something that will only trip on solid objects and not things like a few strands of hay that will trip up an IR detector.

    Otherwise a camera hooked to a computer running a computer vision setup that can identify the objects could work as well. They can certainly be able to detect the difference between a bird and a predator. And depending on the sophistication of the software you should be able to detect the difference between a chicken/rooster and a different bird but you may still trip on similar birds. Obviously Computer Vision will be beyond the capability of a propeller.

    You could potentially also use a couple of the laser sensors with pan and tilt attachement and do a 3d scan of whatever is in the doorway... This could possibly be done with a propeller. The Lidar-lite sensors are less than $100 apiece. You could do a constant 2d laser scan of the door way to check for objects blocking it otherwise and count how many "hits" next to each other that you get and if you get too many you know something other than a couple strands of hay is in the entry way.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2015-05-13 10:13
    Do chickens hate being blown on? If so, how about a fan or blower aimed at the door opening that comes on just before the door closes and stays on until it's shut?

    -Phil
  • JohnR2010JohnR2010 Posts: 431
    edited 2015-05-13 14:06
    Do chickens hate being blown on? If so, how about a fan or blower aimed at the door opening that comes on just before the door closes and stays on until it's shut?

    -Phil

    Fan Blower. Love it! I don't know if chickens will react or not. I need to come up with a test.

    I do know Chickens are very audible they have clicks and sounds for everything. The rooster can clear all the chickens out of the back yard in 5 seconds by making his airborne predator sound. The first time we heard it we had no clue what was going on. The Rooster was standing in the middle of the flock out in the open back yard and all of a sudden started making a deep clicking / roar sound. The chickens all scatted to the nearest bush or tree and got real low to the ground. Roo had his head tilted sideways looking up into the sky at a Red Tail Hawk flying over the house swooping down eating mice out in the pasture.

    I wonder If I have a two stage warning system. Turn on a fan and at the same time make some type of a sound. I bet if I do that every-time I close the door the chickens will eventually understand whats coming next. But will they get out of the way and stay out of the way?? I have got to think if the fan was strong enough the chickens would move away from it. I bet it needs to be as strong of a stream as a hair dryer puts out. Now that I think about it that strong of an air stream is going to make a loud noise so I bet it would work! Wonder what I could use for a fan?

    Good call Phil!! Thanks.
  • JohnR2010JohnR2010 Posts: 431
    edited 2015-05-13 14:13
    Or what about something like a radar sensor? Something that will only trip on solid objects and not things like a few strands of hay that will trip up an IR detector.

    Otherwise a camera hooked to a computer running a computer vision setup that can identify the objects could work as well. They can certainly be able to detect the difference between a bird and a predator. And depending on the sophistication of the software you should be able to detect the difference between a chicken/rooster and a different bird but you may still trip on similar birds. Obviously Computer Vision will be beyond the capability of a propeller.

    You could potentially also use a couple of the laser sensors with pan and tilt attachement and do a 3d scan of whatever is in the doorway... This could possibly be done with a propeller. The Lidar-lite sensors are less than $100 apiece. You could do a constant 2d laser scan of the door way to check for objects blocking it otherwise and count how many "hits" next to each other that you get and if you get too many you know something other than a couple strands of hay is in the entry way.

    I have one of Parallax's active microwave motion detectors. Do you think it would ignore the door closing and still detect a chicken standing in the door way? I would bet the door closing would also reflect microwaves back and give a false reading.
Sign In or Register to comment.