WebControl in the chicken coop

bgriffith

Member
I mentioned my chicken coop controller in the recent discussion about active-low relay modules.  Here's a picture of it:
 

(click on it to see it on PhotoBucket where you can zoom in.)
 
A little bit below and to the right of center you can see the ULN2803A Darlington transistor array that I used to more easily control active-low relay modules.  It also controls the power to the voltage regulator (top side of the box) that powers a small wifi router (Edimax BR-6258n).  One of the relay modules is high on the left side of the box.  That one controls the motor for opening/closing the door.  The voltage regulator for the WC is below the relay module.
 
The door slides up to open / down to close.  At the top and bottom are limit switches, through which the signals to the relays are wired.  When the door reaches the top, the signal to the "open-door" relay is cut off.  In addition, the switches are monitored so if the door takes unusually long to open or close the relay is turned off and an email is sent, resulting in an alert on my cell phone.
 
The door open and close times are determined based on sunrise/sunset times because that's how chickens operate.  The sun times are calculated by the server in my basement and fetched via WEBSET.  I couldn't figure out how to calculate them on the WC because the equations involve arcsin and arccos.  I tweaked some code I found online to get the times in a format that I could use.
 
The door operation is the most useful function.  I've had it working well for about a month.  Chickens like to go outside when it's light, regardless of time or temperature, and it's nice to not have to worry about that or closing them up safely at night. 
The hardware for other functions isn't installed in the coop yet, but I have PLC code written for food and water level sensors, as well as water temperature sensor and heater (a light bulb in a cookie tin under the water bucket).  I plan to put a temperature sensor in the bottom of each nest box also (the 1-wire line to the water bucket goes through all of them anyway, so why not?).  When the WC sees the temp go up it will conclude that a chicken is sitting in the nest box.  When the temp goes back down it will assume there's an egg and increment a counter.  A switch on the nest box lid will reset the counter, and an email will go out if eggs are in danger of freezing, or if there are still eggs waiting when the door closes for the night.  We'll see how well that actually works.  I don't know whether the chickens sometimes go in there just to have some "alone" time and not lay an egg.
 
It's been a fun project.  My kids think the automatic door is pretty cool, especially the older one who used to have the job of letting the chickens out in the morning. 
 
-Ben
 
If there is an IR sensor to count chicken and warning not all chick inside after door closed, that would be fun, too.  Just don't know how to count if two chicken squeeze in at the same time.
Code:
http://www.ebay.com/itm/251235732621
 
They're always in well before sunset, and I have the door closing 15 minutes after sunset.  That sensor would probably cover the whole pen, so installed outside it could detect a straggler or a predator.
 
A straggler sensor sounds like an excellent idea! And of course could also be used as a foreign animal alert - great!
 
Your knowledge of electronics far surpasses mine (also using WC8 in the coop and run).
 
Rainer
 
Moving this conversation here to keep the chicken coop controller talk all together.
 
From rfeyer's "Minimum working temp" thread:
Hi Rainer,
 
I'm also using a WC board in a chicken coop:
http://cocoontech.co...e-chicken-coop/
 
It opens/closes the door using a hacked cordless drill, turns on/off a light to keep the chickens' day long enough so they keep laying through the winter, monitors a level switch and temp sensor in the water bucket, and controls a heater under the bucket to keep the water from freezing.  The times for the door and light are based on sunrise/sunset times.  I have code for a food level switch and temp sensors in the nest boxes (an attempt at detecting when there are eggs), but haven't gotten the hardware for those installed in the coop yet.
 
What have you got yours doing?
 
-Ben
Ben,
 
that sounds like a great project - would be good to see pics some day
 
Currently I am only using WC8 for temp readings of outside inside and Water temps as well as humidity.
I am using a IPPower control unit simply to turn on and off power to water pumps which fill one of two buckets which in turn pull up or down the hen door.
Your idea with a drill is interesting as I have a 12V DeWalt who's batteries are shot and could be converted.
I also have security cameras (Hikvisions) in coop which give visual confirmation of eggs.
Will give link to pics when I get a chance tonight. Maybe a separate thread or moving this to BackyardChickens maybe? Though this forum will still be great for continuation of electronic portions of these projects.
Great to hear someone else in this WC8/ chicken hobby :)
 
I recently converted from the same water/gravity powered door to the cordless drill.  I had been using two big juice bottles and a windshield washer pump.  Originally I had planned to switch from water to RV antifreeze for the winter, but I read that it turns to slush at temps in the teens(F).  I used a drill rather than just a plain motor because I wanted the clutch to prevent things from getting ripped apart if something gets stuck.  I've got the clutch set pretty low and if I block the door while it's opening the drill just goes "click-click-click" until a 10 second timeout expires, then the WC8 turns off the drill and sends me an email alerting me to the problem. 
Cordless drills have a PWM module with a linear variable resistor attached to the trigger.  The PWM module controls a MOSFET to give you variable speed.  Direction control comes after those two components, and trying to control direction at the battery terminals instead will fry them.  What I did was move the PWM module and MOSFET to my peripheral board (after the above picture was taken).  The PWM module is a little bit finicky because the slider for the variable resistor just slips onto the edge and is prone to getting bumped as I put the box together.  A better solution probably would have been to use an I2C PWM module rather than mickey-mousing in the one from the drill.  Without the variable speed parts to slow it down, the drill would raise and lower the door too quickly.
All this is for six hens in a 4'x8' "tractor" with elevated 4'x4' house.
I'll get some pictures of the setup this weekend.
 
-Ben
 
If you keep using the same PWM module, you could have few resistors to simulate the finger trigger positions.  So that you can set a few different speed by turn on different TTL output.  However, if you like to try the I2C PWM, it will give you a real variable speed. Let us know if you need any help with that.
 
This I2C motor control is probably overkill for the door control, but it can be controlled from PLC through I2C interface
Code:
http://www.ebay.com/itm/111298731619
 
You posted an I2C PWM module to another thread recently.  I think that would take the place of the PWM module from the drill trigger and work with the MOSFET from the drill, though a transistor would be needed to go from the 5V I2C module to the 12V MOSFET. 
I'll probably stick with what I've got though.  I don't need variable speed, I just need one slower-than-full speed.  Now that it runs at an acceptable speed I shouldn't need to change it again.
 
Here are some pictures showing the door opener:
 

Drill mounted on the ceiling
 

Latch hits microswitch when door is closed.  When I was using water/gravity to open/close the door I had to reduce the weight of the door a bit, thus the holes.
There's another microswitch that the door hits when it's fully open.  The TTL signals for the open/close relays go through those switches, so the switches are what turns off the drill, not the WC8.  There are also inputs monitoring the switches, so if the door is taking too long to open/close the WC8 can turn off the drill and send an email alert. 
 

The view of the whole thing (and a hen who's wondering what's up with the cell phone sticking out of her nest box). 
The water bucket in the lower left has a temp sensor under the insulation, and a water level switch.  A phone cable and jack make for easy disconnecting for cleaning.  The bucket sits on top of a cookie tin with a 40W light inside.  When the water temp gets low the WC8 turns on the light until it warms up enough.
I insulated the bucket with what looks like foil-faced bubble wrap.  The chickens pecked at it so I covered it up with one of the kids' old plastic place mats. Another place mat is stapled to the wall, hanging over the bucket at a slope to keep the chickens from sleeping up there because they make a mess when they do. 
 
Rainer, I haven't figured out how to link to individual pictures in Google Drive, only whole albums.  I use Photobucket for posting in forums and it works well. 
 
-Ben
 
Wow - it's been that long?
Before sounding my usual electronically ignorant self, i did a bunch of research and finally purchased two 12VDC 1A-5A reversible motors and believe I may have found a workable example online as how to make the motor reversible using a OMI-SH-212D DPDT relay as well as 2 TIP120 transistors.
Once the motors arrive I will give it a try and report how it went.
 
Electronics is NOT easy!
Rainer
 
rfeyer said:
Wow - it's been that long?
Before sounding my usual electronically ignorant self, i did a bunch of research and finally purchased two 12VDC 1A-5A reversible motors and believe I may have found a workable example online as how to make the motor reversible using a OMI-SH-212D DPDT relay as well as 2 TIP120 transistors.
Once the motors arrive I will give it a try and report how it went.
 
Electronics is NOT easy!
Rainer
 
All you need is one DPDT relay to set direction, and one SPST to say "on or off".
 
The DPDT is wired as a simple reversing... connect each NO contact to the opposite ones NC contact.
Apply power to one NC, and ground to the other NC, connect your motor to the two commons.
Simply energising the DPDT relay will reverse the polarity.
Now, a SPST relay in series with the power OR one of the motor wires will let you turn the motor on or off in the required direction.
Two output pins from the WC will let you fully control the motor.
 
CAI_Support said:
If there is an IR sensor to count chicken and warning not all chick inside after door closed, that would be fun, too.  Just don't know how to count if two chicken squeeze in at the same time.

http://www.ebay.com/itm/251235732621
Thats aweseome. Put RFID tags on them! :)
 
Yes, electronics are tough... I almost destroyed my hvac system learning some simple things.
 
If there is an IR sensor to count chicken and warning not all chick inside after door closed, that would be fun, too.  Just don't know how to count if two chicken squeeze in at the same time.
Code:
http://www.ebay.com/itm/251235732621
Weigh them in a narrow passage way when the MS is triggered?
 
TH RossW - I will do a little more reading on the H-Bridge, possibly try to figure out possible need for Diode and resistor (I will let you know what I come up with, you can tell me if I'm right or wrong).
The on off (load vs no load) I will do with the WC8 once I get that figured out.
 
Rainer
 
Back
Top