The mink is gone and our new chicken coop door is working like a champ!

JohnR2010JohnR2010 Posts: 405
edited November 2015 in General Discussion Vote Up0Vote Down
For those of you who have been following my wife's chicken coop drama I thought I would give a quick update. As you may recall about 6 weeks ago we lost 3 of our 4 hens in a in coop massacre leaving one petrified hen and rooster to carry on. At that point our coop's door was automated by a webcam's TTL output connected to a relay. We had to click on the camera's URL to close the door after we watched the chickens go up for the evening. Well that night both my wife and I forgot to close the door and that Mink got in and ripped them apart it was a bloodbath! He only took one but killed the other two just for sport. The next day she bought 5 baby chicks moved my car out and set them up in the garage. She was not going to put them in the coop until I made improvements.

Fast forward to today: Our trapper took care of the Mink (Sorry Loopy I don't have the tail) and I have version one of Coop Boss up and running. My goal was to make a reliable and simple coop door control that would automatically close and open the coop door based on Sunset and Sunrise. Chickens (with religion) go into their coop just before sunset they cant see in the dark so its just mother nature.

Since the Coop Boss is standards based (ZigBee HA public clusters) it will work with existing ZigBee HA networks. SmartThings and their dev environment allows you to create custom device types for custom hardware. So at the 1000' level the propeller spends all day monitoring the ambient light level, a button on the side of the coop, and an xBee for command packets. This is a cake walk for the propeller. Via the xBee ZigBee radio the propeller gets commands from the SmartThings cloud and responds to them. It also sends reports of the current status (door open or closed, current light level, current temperature) to SmartThings. SmartThings presents this data to the iPhone (as seen below)

Hardware:
- Propeller based custom PCB
- ZigBee radio (xBee ZB SMT),
- Photo resistor to measure sun light
- Solid state relays to control 12v DC actuator
- 12 DC actuator connected to coop's door (same actuator that was connected to Web Cam)

Software:
- ZigBee SPIN library you can find details in this older post: http://forums.parallax.com/showthread.php/157233-Propeller-to-SmartThings-(communicating-with-the-ZigBee-HA-public-profile)?p=1291123&viewfull=1#post1291123
- Supported ZigBee Clusters 0x0000: Basic, 0x0101: Door Lock, 0x0402: Temperature, 0x0011: Proprietary X Modem Firmware Uploader

- SmartThings custom device type (JAVA code that runs in the SmartThings cloud)
- Auto Close on / off
- Auto Open on / off
- Report Current Light Level and Temperature
- Send Open door, Close door commands
- Set Close door light level to current light level
- Set Open door light level to current light level
- Reset back to factory

-Other features:
- EEPROM upload via xModem and XCTU from Digi. This allows you to change the Spin code and upload it over the ZigBee network.

Keep in mind since the circuit uses ambient light level to open and close the door the SmartThings network or my local internet connection could be completely off-line and our coop door will still close at night. We noted the ambient light level when the chickens go in for about a week and set the close door light level to be about 1/2 hour after they go in. This way if we forget to close the door the propeller will do it for us.

attachment.php?attachmentid=114140

Version two is in the planning stage and I think I will start another post: I want to have some type of sensor for the door as it closes just in case a chicken is in the path. This has not been an issue in the past as we always check our web cam before we close the door. But now that it is automatic I need to have some type of safeguard.
640 x 1136 - 279K

Comments

  • 27 Comments sorted by Date Added Votes
  • ercoerco Posts: 18,654
    edited May 2015 Vote Up0Vote Down
    Too cool, John! Glad you got the mink and now you have the fanciest coop around. I miss my chickens. I had 3 gorgeous RIRs in a backyard coop, one rooster and 2 hens: Huey, Dewey & Louie. Very social & personable birds. Also very quiet, the rooster never crowed. But LA animal control knocked on our door one day to deliver a "get rid of the them" warning, I guess a neighbor must have complained. We found a good home for them. Both hens started laying eggs right after we had to get rid of them. DOH! https://www.youtube.com/watch?v=ofvi2Ls-fzk

    TTYTT I was almost hoping your video showed how you caught the mink. Maybe that's not good family viewing though.
    "When you make a thing, a thing that is new, it is so complicated making it that it is bound to be ugly. But those that make it after you, they don’t have to worry about making it. And they can make it pretty, and so everybody can like it when others make it after you."

    - Pablo Picasso
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited May 2015 Vote Up0Vote Down
    Please don't worry about not sending me the mink tail.. If I really desire one, I suspect I can actually find a business on-line that sells pelts and such. In my pursit of DIY paint brushes, I am finding that a great deal of the fur actually used is claimed to be from something else. I guess the art brush business desires to keep their actual construction secret.

    http://www.peterpalms.com/tails/

    I don't know how well a safety device on the chicken coop door will work. It seems to me that a chicken pursued by a mink may flee into the coop only to be pursued by the mink. Having the door open and close at particular times of day is one thing. Having a door that can sort out chickens from minks is a whole different level of design.
    Hwang Xian Shen, Puddleby-on-the-Marsh.
    All things considered, I can live and thrive without Microsoft products. LINUX is just fine.
  • JohnR2010JohnR2010 Posts: 405
    edited May 2015 Vote Up0Vote Down
    Please don't worry about not sending me the mink tail.. If I really desire one, I suspect I can actually find a business on-line that sells pelts and such. In my pursit of DIY paint brushes, I am finding that a great deal of the fur actually used is claimed to be from something else. I guess the art brush business desires to keep their actual construction secret.

    http://www.peterpalms.com/tails/

    I don't know how well a safety device on the chicken coop door will work. It seems to me that a chicken pursued by a mink may flee into the coop only to be pursued by the mink. Having the door open and close at particular times of day is one thing. Having a door that can sort out chickens from minks is a whole different level of design.

    Agree. The best approach is to keep the door open all day so the hens and chicks can go in and out as they please. The predators only come out at night and if the door is closed the chickens are safe. What got them last time was we left the door open by mistake and the Mink got in. Now if we forget to close it the propeller will do it for us.
  • JohnR2010JohnR2010 Posts: 405
    edited May 2015 Vote Up0Vote Down
    erco wrote: »
    Too cool, John! Glad you got the mink and now you have the fanciest coop around. I miss my chickens. I had 3 gorgeous RIRs in a backyard coop, one rooster and 2 hens: Huey, Dewey & Louie. Very social & personable birds. Also very quiet, the rooster never crowed. But LA animal control knocked on our door one day to deliver a "get rid of the them" warning, I guess a neighbor must have complained. We found a good home for them. Both hens started laying eggs right after we had to get rid of them. DOH! https://www.youtube.com/watch?v=ofvi2Ls-fzk.

    Sorry to hear they took your chickens that would be enough to make me move. We live close to town out on a small farm so I can't image that happening hear. I bet your rooster would have started crowing when he got a little older. Ours started around 4 to 5 months. I can tell you one thing if he crows after dark something is extreamly wrong and you better check on it. If your going to free range your chickens a rooster is must have he is all about protecting his hens. You cant even talk to our chickens without him getting between you and the hens. I have seen our rooster chase off a 100 pound Black Lab and a Pit Bull. The Pit Bull still comes around to play with him. Well the dog is playing Roo isn't. Of course its all bluff if the dogs only knew they could kill him in one bite. He thinks hes 10 feet tall and all the world shall yield to his desires.
  • NikosGNikosG Posts: 605
    edited May 2015 Vote Up0Vote Down
    I have also a story with lost chickens!
    Here is “Pipiloulis” an amazing white rooster in my mother's arms.

    attachment.php?attachmentid=114277&d=1432371285

    That Rooster was extremely aggressive with unknowns, but every time my mother called him, he run into her arms!
    That was completely amazing!
    My parents had “Pipiloulis” and a small group of 4-5 hens living free during the day in their farm in an area 150m x 50m with lemon and olive trees, and a fence around.

    attachment.php?attachmentid=114279&d=1432371335

    Every evening chicken come back into the coop and my parents secure them until the next morning.
    Unfortunately one day 3 months ago, “Pipiloulis” never come back in to the coop.
    I checked carefully the farm as well as all the neighbor’s farms but nothing.
    No one sign!
    My parents suspect that somebody stole “Pipiloulis” because in the past unknowns intruders had stolen (twice) several metal objects like tools and cables from the farm.

    I had tried to make a remote system with the parallax PIR sensor and a mobile Phone to call in my home’s phone when something detected in the farm but I failed.

    attachment.php?attachmentid=114278&d=1432371320

    When the servo pressed the call button of the mobile phone, the electromagnetic field of the mobile made “crazy” the servo……. So I gave up….
    Anyway…It was a great lost especially to my mother and the problem with intruders is still open as very often we find cuts in our fence…. .

    Mayby a system with cybernated flying patrols using ELV8 could help the situation
    389 x 519 - 173K
    814 x 708 - 119K
    557 x 769 - 202K
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited May 2015 Vote Up0Vote Down
    Way back in 1973 or so, I was driving from Eugene, Oregon to San Francisco in an old 1951 Chevy PU that gave out in Gold Beach, Oregon. I needed a new radiator and would have to wait a few days as it was just after Christmas and going into the New Year's holiday. So I stayed with a couple of gals that I knew and had moved to a cabin up the Rogue River where they set up a weaving studio.

    They also attempted a bit of farming and had two 'pet' chickens. One was named 'Thanksgiving dinner' and the other 'Christmas dinner'. Both were quite alive, even though both holidays had come and gone.
    Hwang Xian Shen, Puddleby-on-the-Marsh.
    All things considered, I can live and thrive without Microsoft products. LINUX is just fine.
  • JohnR2010JohnR2010 Posts: 405
    edited May 2015 Vote Up0Vote Down
    Why I picked a Propeller for this solution:

    1) Years of proven performance in the field. We have propeller based products running in the bone chilling winters of Alaska to the hot summers of New Mexico and I have found that the Propeller meets and exceeds its specs.

    2) Ability to isolate critical code from non critical code. The CoopBoss uses two of the Propeller's 8 Cogs to control the door's motor, monitor ambient light levels, monitor the open / close button on the coop, and determine if it is time to open or close the door based on sunset / sunrise. These two Cogs are started first at boot and run independently of the other 6 Cogs allowing this code to be isolated and secure. I use additional Cogs for communicating with the ZigBee radio (in API packet mode), calculating check-sums, parsing the ZigBee cluster commands, and spin up new Cogs as required to communicate with the SmartThings hub.

    Since the critical code is running in dedicated cogs it wont be affected by a ZigBee network outage, an Internet outage, or a SmartThings cloud outage all it needs to close the door at sunset is 12v DC power. In fact you can completely boot the system without a ZigBee network or SmartThings network as the code that controls the coop door is launched first in dedicated cogs and will run just fine. Running critical code in dedicated cogs allows you to build complex solutions and at the same time keeping the core function isolated and secure. My wife and I learned the hard way the door not closing creates an opportunity for an attack and the loss of chickens. With this solution we will not loose chickens because our local ISP lost its connection to the Internet or some server in the cloud is backed up and not responding.

    3) Easily expandable. As with many projects the CoopBoss started out with a core set of features (hardware and code) with the intent to expand based on user feedback (my wife). I already mentioned the benefit of having critical code running in dedicated cogs well there is also a benefit when it comes to adding new features. Often new features are added with an additional piece of hardware the Propeller needs to communicate with. It is very easy to write the code to communicate with it so it will run in a cog and interface with your existing code. This way you can build on your code base instead of rewriting it to accommodate the new hardware.

    The Propeller has 32 CMOS I/O pins 4 of which have dedicated functions leaving 28 pins to do whatever you like with. They are identical to each other and can be assigned as input or output. All of my completed projects end up as a custom circuit board placed in an off the shelf case. During the PCB lay-out process I try to cram as much as I can in as little space as possible (reducing the cost often the case is the most expensive part). Since the Propeller's I/O pins are identical it is extreamly useful to reassign the function of a pin based on the placement of a component on the PCB. For example if you have a header to the right of the propeller on your PCB you can pick the pins that are physically closest to the header since all the I/O pins are identical. This is extreamly useful during PCB layout minimizing the number of layers and overall size and cost.

    4) The Propeller cost $8.

    Well trust me I could keep going and if you made it this far I bet you already know all this anyway.

    The CoopBoss just won the "Show us Your SmartThings" contest. They did a nice writeup if your interested: http://blog.smartthings.com/stories/a-smart-chicken-coop/
  • mindrobotsmindrobots Posts: 6,489
    edited May 2015 Vote Up0Vote Down
    Pretty darn cool, John!

    Congratulations!!!
    MOV OUTA, PEACE <div>Rick </div><div>"I've stopped using programming languages with Garbage Collection, they keep deleting my source code!!"</div>
  • xanaduxanadu Posts: 3,138
    edited May 2015 Vote Up0Vote Down
    Nice job on the project and contest! Agree on why you chose Propeller, I will have to check out Smart Things.
  • Hi All,

    I am working on a environment monitoring project but I have not been able to download the link to github on the smartthings app from : http://forums.parallax.com/showthread.php/157233-Propeller-to-SmartThings-(communicating-with-the-ZigBee-HA-public-profile)?p=1291123&viewfull=1#post1291123

    Does anyone have any luck ? Since i am not experienced in programming the smart things so i m looking for some sample code to play with.

    Thank you,
    rc
  • JohnR2010JohnR2010 Posts: 405
    edited October 2015 Vote Up0Vote Down
    @rchung, sorry about that I have updated that project and needed to go back and change the link in that post (It should work now).

    That simple button app has been updated to a button with an Adafruit NeoPixel Ring inside. You push and hold the button to have it walk through 12 colors and when you take your finger off it selects that color and then walks through 6 brightness levels. Once you select the color and brightness it sends them to a Hue bulb connected to SmartThings.

    A propeller inside the box does all the work and is based on the library i laid out in that previous thread.

    Here is the SmartThings script:
    https://github.com/JohnRucker/Nuts-Volts/blob/master/devicetypes/nutsvolts/push-button-with-color.src/push-button-with-color.groovy

    Here is a short video of it controlling a Hue bulb:


    Tell me more about your project, sounds interesting! I would be very happy to help.
  • For the latest information on the Chicken Coop Door controller go to Http://CoopBoss.com
  • Hi John,

    Thank you very much for the updated link. Your project is very interesting. I am still trying to get the xbee to talk to the ST Hub since I m new to parallax setup, coming from the Rpi and Arduino hardware. Please keep us posted on your activity and thank you for sharing.

    thx
    russell
  • JohnR2010JohnR2010 Posts: 405
    edited November 2015 Vote Up0Vote Down
    rchung wrote: »
    Hi John,
    I am still trying to get the xbee to talk to the ST Hub since I m new to parallax setup, coming from the Rpi and Arduino hardware.
    thx
    russell

    Couple of quick questions. What xBee are you using? It has to be an xBee ZB preferably xBee ZB SMT as I stated in my previous post. Can you get it to join the SmartThings ZigBee network? It should do that without even being connected to the propeller just plugged into the USB programmer.

    I work with this stuff almost every day so its no problem to help.


  • Hi John,

    I used the SMT version that you called out in the post they shows the steps in soldering, etc. The link you provided went straight to digikey and I purchased from there. I was able to join the network as shown using your propellor zigbee-HAcomnunication.spin code as shown in the PST below:

    On Line.
    Network Join Status: Successfully joined a network
    IEEE Add 13A200-40DA3DFD

    Waiting for packet
    Unknown packet ->Err Unknown RX API ID<-
    Pkt ->7E 00 0C A3 D0 52 A8 26 3A E8 00 01 00 00 00 49 <-


    I also use the nutnvolts link you referred to me on giyhub to publish the app. There are some steps changes in the smart things developer web site. I think i have not been able to link a randomly created devices to the new device types you groovy code contains.

    I did try to ask my phone app to connect to new device but no connection so far to the zigbee device because in the PST there is no indication of a proper connection.

    Thank you very much for your help.

    Thx
    russell

  • Hi John,

    correction on my previous post: the phone app does see your groovy code and the interface on the Hue light.

    But should I see some output from the PST to say things are connected. I will get the RGB hardware to check out your code too because it is fun to have an affordable hue light connected to the smart things. I have not connected a LED on the propeller board either.

    Thanks again.

    russell
  • JohnR2010JohnR2010 Posts: 405
    edited November 2015 Vote Up0Vote Down
    @rchung you are very close. We need to make sure the SmartThings custom device type is assigned to your propeller based ZigBee device. I may have confused things by putting the link to the color button in my previous answer. Make sure you use this custom device type. It sends the commands the Propeller is expecting to see. To use the color button device type you will need to update the code on your propeller to support the new cluster commands. I haven't released that yet, more on that later.

    You will manually need to assign the SmartThings custom device type to your device in the IDE. To do this please follow these three steps:

    1) You need to know the name SmartThings assigned your device when it joined its ZigBee network. To find the name click on the "My Devices" tab in the IDE to open your device list. Under the ZigBee ID column find the ZigBee address of your Propeller (0013A20040DA3DFD) and click on it to open it. If it is named "Thing" you may want to click the Edit button and rename it to Propeller or whatever you like.

    2) Now create a new custom device type by clicking New Device on the "My Device Types" tab. Click on the "From Code" tab to open a empty code window, we are going to paste the custom device type script into this code window. Open another web browser window to the custom device type "raw view". Highlight all the text with a [ctrl a] and then copy to your clip board with [ctrl c]. Navigate back to your other window and past the content [ctrl v] into the blank window, push the "Create" button at the bottom of the window. Now push the "Save" button then the "Publish" + "For Me" buttons. Now you have the device type installed and all we need to do now is assign it to your device.

    3) Assign the custom device type to your propeller by opening the device type created in step 2 and clicking on Set Location and then under the drop down find you device "Propeller" select it and hit install. You will see a virtual button you can click on that will now send commands to your propeller. You will also see a "logs" window that shows the traffic to and from your propeller.

    Your done, at this point back on the Parallax Serial Terminal you should see packets coming in when you push the button in your IDE or on your phone. Your SmartThings app on your smart phone will also have this device listed under the "Things" section. You can click on it there and control it as well.

    As a reference here is my SmartThings Driver Installation instructions for the CoopBoss. It walks you through the above process in more detail but for the CoopBoss custom device type. It has screen shots and references a video. It may help if you get stuck.

    If you cant find your device in step 1 your device may need to be removed from the network and re-added. I can walk you through that as well. Let me know how it turns out.
  • Hi John,

    Thank you so much on being very patience in walking me through this. I must be missing something because I still cannot get the zigbee pro S2C to show anything meaningful except a message showing joined the network on the PST.

    Please bear with me and i am going to show you all the steps I took following various postings:

    1. I followed this post to setup ZB firmware config setting for HA(XCTU_Cfg.zip) compatibility and also use the Propeller ZigBee Home Automation driver (ZigBee-HA_Communications.zip):

    http://forums.parallax.com/discussion/157233/propeller-to-smartthings-communicating-with-the-zigbee-ha-public-profile/p1

    ZB module is programmed and spin code is loaded to Propeller brd.

    2. Powered up ZB module and propeller brd, PST shows network is joined and the IEEE ID provided. For one instant, i was able to get more than network join message but most of the time, it will be:

    Waiting for packet
    Unknown packet ->Err Unknown RX API ID<-
    Pkt ->7E 00 0C A3 D0 52 A8 26 3A E8 00 01 00 00 00 49 <-


    3. Use the groovy code "Custom Device type for Parallax Propeller ZigBee HA demo" for the custom device type, successfully published it and also was able to interact from the ST IDE to phone and vice versa. However, I think the communication is only from hub to phone app because even i powered down the propeller brd, it will still communicate.

    I reviewed your very well documented article on the driver installation with the CoopBoss project also, I think I got those steps correctly.

    The remaining issue is that I could not see the device on step 1 as you described in the previous post. I think I need to "connect new things" to allow discovery of the propeller-ZB S2C combo. For some reason, i could not get the router to see it at all.

    Thank you again for your help again. This ST hub I think is very powerful because it has so much infrastructure in place but somehow getting it to talk is not easy.

    Thank you,
    russell


  • Hi John,

    Additional observations: If i turned off the ST router, i still get:
    On Line.
    Network Join Status: Successfully joined a network
    IEEE Add 13A200-40DA3DFD


    I think that may be the root cause for me not able to follow your steps and get the results as described.

    Thanks,
    russell

  • JohnR2010JohnR2010 Posts: 405
    edited November 2015 Vote Up0Vote Down
    rchung wrote: »
    Unknown packet ->Err Unknown RX API ID<-
    Pkt ->7E 00 0C A3 D0 52 A8 26 3A E8 00 01 00 00 00 49 <-

    Russell, the above packet is from your SmartThings hub. It is a one to many route request packet the hub sends out to all nodes. My ZigBee Spin driver just doesn't do anything with it that is why it is Unknown. So since your getting that packet you are connected to the SmartThings network and the hub can communicate with you. So what may have happened is the device was allowed to join the network but for some reason it didn't get registered in the SmartThings cloud.

  • rchung wrote: »
    Hi John,

    Additional observations: If i turned off the ST router, i still get:
    On Line.
    Network Join Status: Successfully joined a network
    IEEE Add 13A200-40DA3DFD


    I think that may be the root cause for me not able to follow your steps and get the results as described.

    Thanks,
    russell

    Yep we have to get step 1 above completed. I think you should remove your device from the network and rejoin. Let me look at my code and see what method you need to call. It has been awhile since I made that post. Hold on.

  • Okay take a look at the Pub IPL method of the ZigBee-HA_Communications.SPIN file. Look for a command called 'LeaveNetwork. Remove the remark from in front of the command so it will execute. Run the program one time and put the remark back. The leaveNetwork method sends a command to the xBee instructing it to leave the PAN. The xBee will start looking for a network to join you will see this in the PST. While it is searching go to your smartphone and tell SmartThings to open up the network for joining by adding a new device.

  • Hi John,

    Everything is working as you prescribed in the post now. It turned out one line in the Propeller spin code was commented out so it will not go through the normal joining and discovery process, and go straight to the network joined message.

    Sorry I should have read the code more carefully:

    '***************************************
    ' Un-Remark the next command to force xBee to leave Network and reset
    '***************************************
    LeaveNetwork

    There is only one remaining question I have regarding the joining process: should the phone app find the "thing" during the connection process. For some reason, I have to restart the app to do that, Is it something we can do to join without restarting the phone app ?

    Thank you again,
    russell
  • JohnR2010JohnR2010 Posts: 405
    edited November 2015 Vote Up0Vote Down
    rchung wrote: »
    Hi John,

    There is only one remaining question I have regarding the joining process: should the phone app find the "thing" during the connection process. For some reason, I have to restart the app to do that, Is it something we can do to join without restarting the phone app ?
    russell

    Yes if everything is setup correctly the SmartThings Custom device type will find the propeller based on its supported clusters. This is done by matching the propellers supported clusters to the finger print in the custom device type. However, for this to work the custom device type must be installed before you try to join to the SmartThings network.

    For more information take a look at the Simple_Desc_req method in the ZigBee-HA_Communications.Spinn file. It formats a ZigBee packet with the clusters supported by the propeller. You can see it has two input clusters 0x0000 (basic) and 0x0006 (on/off) those cluster numbers are sent to the SmartThings Hub to tell it what it is capable of.

    Glad to hear it is working!! Keep us informed with what you do with it!! The guys on this forum love to help and see what people are doing with the propeller! Especially someone who use to be an Arduino programmer! Smile.
  • rchung wrote: »
    Hi John,

    Everything is working as you prescribed in the post now. It turned out one line in the Propeller spin code was commented out so it will not go through the normal joining and discovery process, and go straight to the network joined message.

    I just reread this. You should put the comment back into the code you don't want the xBee to leave the network every time it boots. I understand now what you were asking. No you should only have to join the SmartThings network one time.

    Normally you don't have to leave the network once you join. That is why I commented out the LeaveNetwork you normally don't need to call that method.

    For my hardware I call that method if I pull a pin low during boot. That way if you need to leave the ZigBee network you remove the power hold down a button and turn the power on. But that requires a hardware change.

  • John,

    Just read your article in Nuts and Volts. Congrats on getting published!
    Nice plugs for Parallax products.

    Infernal Machine
  • JohnR2010JohnR2010 Posts: 405
    edited December 2015 Vote Up0Vote Down
    Thanks! The CoopBoss was a fun project!! Of all the pics I sent them to represent the article I think it's funny they picked the picture of my wife's rooster. It's not photo shop, I put him up on my bench and as he stood there plotting his vengeance I held up the PCB and took the photo.

    Nuts&Volts SmartThings and the Device Maker.

Sign In or Register to comment.