automated chicken coop door


20 posts
by guyute74 » Thu Feb 07, 2013 5:13 pm
I currently use a miniblind motor to automatically open and close our chicken coop door. The motor activates on an outlet timer and I was hoping to replace the timer with my Pi. Can I control the power to the motor with the pi or should I scrap this method and move on to building a stepper motor replacement? Basically, I'd like to put the Pi between the motor and the outlet and turn the power on twice a day to the motor.

Thanks
Christopher
Posts: 17
Joined: Thu Feb 07, 2013 5:05 pm
by Ravenous » Thu Feb 07, 2013 5:29 pm
The raspi can't directly drive a motor - not enough current. There have been lots of posts about using varous motor drivers to do it though.

Note the raspi as standard doesn't have a real time clock - i.e. it doesn't know the time & date when you power it up. So you'll probably want a RTC unit adding on. Apparently they're not expensive and easily added - lots of posts have been made about these, but I haven't been following them in detail.
Posts: 1233
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK
by redhawk » Thu Feb 07, 2013 5:33 pm
Assuming your Pi has internet access you could always periodically synch the clock with NTP.

Richard S.
User avatar
Posts: 2951
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1
by bblood » Sat Feb 09, 2013 12:57 am
What is wrong with the current setup? I use a blind motor and a deer feeder timer for my coop door....i have an rpi in the coop to provide webcam temperature and battery status...i decided to leave to door completely independent of the other stuff to keep it reliable....you could control the door with the pi, but it would never be as reliable as the simple timer....i may put a sensor on the door so i can check the door position via a web interface....

My coop doesnt have power so i have to run everything on solar/battery which is proving to be a challenge....
Posts: 40
Joined: Sat Sep 22, 2012 1:54 am
by guyute74 » Wed Feb 20, 2013 12:33 am
The current setup works fine - I guess I was over engineering it. I love what you've got setup.
I have the door motor running off an extension cord but have a battery/solar panel option in mind. I was just about to starting looking into a temperature sensor for the pi and saw your reply... I like the battery status monitor. Gonna look into that.
As far as door position... I have mine monitored the old fashioned way. A webcam aimed at the coop and a rope showing door position.. but I can't confirm the door is closed - it could be snagged?
So, the pi monitoring door position, temperature and battery status.
Perfect!

I'll hit you up for advice after I do some digging around.
Posts: 17
Joined: Thu Feb 07, 2013 5:05 pm
by guyute74 » Thu Feb 28, 2013 4:55 am
Okay... I've got the Pi connected to a thermometer, magnetic contact switch and motion sensor and everything is running great. Now I need to work on the scripts needed to push this information out to a webpage. I know nothing about python (an hour ago I never soldered!) so now it's time to start reading up. I have the basic .py script running showing temp and motion in an ssh window but nothing more than that.
Thanks for the inspiration.
Taking our coop to the next level!

Christopher
Posts: 17
Joined: Thu Feb 07, 2013 5:05 pm
by gordon@drogon.net » Thu Feb 28, 2013 1:43 pm
guyute74 wrote:Okay... I've got the Pi connected to a thermometer, magnetic contact switch and motion sensor and everything is running great. Now I need to work on the scripts needed to push this information out to a webpage. I know nothing about python (an hour ago I never soldered!) so now it's time to start reading up. I have the basic .py script running showing temp and motion in an ssh window but nothing more than that.
Thanks for the inspiration.
Taking our coop to the next level!

Christopher


I think some of the fun of keeping my own chickens is going down to the garden to let them out in the morning.. I have seen automatic door openers for coops, but sometimes I wonder if it's just technology for technologys sake...

-Gordon
--
Gordons projects: https://projects.drogon.net/
User avatar
Posts: 1421
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
by feverish » Thu Feb 28, 2013 3:05 pm
Have you thought of using a solid-state mains relay driven directly from the Raspi?
Posts: 251
Joined: Wed Jun 27, 2012 2:29 pm
by guyute74 » Thu Feb 28, 2013 8:15 pm
Oh, it's a toy. But, that being said, I am away from home a few days a week and automation helps keep the chickens in check.
I have the setup all ready to go, I just need to learn some basics of python scripting.
Posts: 17
Joined: Thu Feb 07, 2013 5:05 pm
by gordon@drogon.net » Thu Feb 28, 2013 8:28 pm
guyute74 wrote:Oh, it's a toy. But, that being said, I am away from home a few days a week and automation helps keep the chickens in check.
I have the setup all ready to go, I just need to learn some basics of python scripting.


Have to say though - if I had power anywhere near my garden, then all sorts of automation, etc. would be going on!!!

-Gordon
--
Gordons projects: https://projects.drogon.net/
User avatar
Posts: 1421
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
by poing » Thu Feb 28, 2013 8:32 pm
How do you get the chickens back in at night? Might want to build a PiBot for that, chasing them back inside :D I mean, if they go by themselves, why the automated door?
Posts: 1090
Joined: Thu Mar 08, 2012 3:32 pm
by gordon@drogon.net » Thu Feb 28, 2013 8:40 pm
poing wrote:How do you get the chickens back in at night? Might want to build a PiBot for that, chasing them back inside :D I mean, if they go by themselves, why the automated door?


Chickens will naturally go inside to their roosting place when it gets dark, so you just need to lower the door when it's darker than their own concept of "dark".

You close the door to keep them warm and to keep foxes (and other predators) out.

-Gordon
--
Gordons projects: https://projects.drogon.net/
User avatar
Posts: 1421
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
by 3gws » Thu Feb 28, 2013 10:24 pm
Gordon I like your lo-Tech approach by just ambling down the Garden and letting them out.

My wife wants a few chickens and as we live quite close to a Grave Yard which has a family of foxes living in it we would be constantly under attack from them and I would need a machine gun post to keep the foxes out. That said it would be nice to walk down the garden and fetch the eggs and come back to the house and cook them for breakfast.

Post some photo's when you have it up and running I thought of Wallace and Grommet when I saw this post.

Cheese Grommet !!!!.
Posts: 49
Joined: Sat Oct 20, 2012 10:32 am
by gordon@drogon.net » Thu Feb 28, 2013 10:30 pm
3gws wrote:Gordon I like your lo-Tech approach by just ambling down the Garden and letting them out.

My wife wants a few chickens and as we live quite close to a Grave Yard which has a family of foxes living in it we would be constantly under attack from them and I would need a machine gun post to keep the foxes out. That said it would be nice to walk down the garden and fetch the eggs and come back to the house and cook them for breakfast.

Post some photo's when you have it up and running I thought of Wallace and Grommet when I saw this post.

Cheese Grommet !!!!.


You can have a quick look at mine here:

http://www.youtube.com/watch?v=3x39UULyrzo

-Gordon
--
Gordons projects: https://projects.drogon.net/
User avatar
Posts: 1421
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
by 3gws » Fri Mar 01, 2013 8:30 am
Wallace & Gromit : Cracking Contraptions !!!!!!!

http://www.youtube.com/watch?v=aSVD3nzs ... 487SHcyBnU
Posts: 49
Joined: Sat Oct 20, 2012 10:32 am
by nauticus25 » Sun Mar 03, 2013 1:19 pm
guyute74 wrote:Okay... I've got the Pi connected to a thermometer, magnetic contact switch and motion sensor and everything is running great. Now I need to work on the scripts needed to push this information out to a webpage. I know nothing about python (an hour ago I never soldered!) so now it's time to start reading up. I have the basic .py script running showing temp and motion in an ssh window but nothing more than that.
Thanks for the inspiration.
Taking our coop to the next level!

Christopher


'Sup Chris. It's funny that I found your post in my search for RPi chicken coops. What are the specs on your motor and what was your solution for controlling it with the RPi? The chicken tractor design I'm considering has a drawbridge type door so I was thinking of getting a power window motor to handle the heft. I'm planning on a couple of magnetic switches to sense that the door is fully open/closed along with some LEDs for easy visual confirmation from the house. What will you be using the motion sensor for?

I've been going through the RPi tutorials on Adafruit and will start in with learning some Python soon. Keep me posted on your progress!

Scott
Posts: 1
Joined: Sat Feb 16, 2013 7:02 pm
by guyute74 » Wed Mar 06, 2013 6:58 pm
I've been using this motor to automate the door.
http://www.amazon.com/Add-A-Motor-D20-C ... B007IZJWNQ

I have a webcam aimed at the coop and an rope hanging so I can see the position of the door.

But, after buying a raspberry pi I figured I could take our coop to the next level and learn something along the way.

I think the plan is going to be to use the pi to monitor temperature and door position and provide both on a webpage. I would also like to add a usb webcam to the pi for monitor the hens from inside the coop.

I am having issues with the scripts for both currently... but that is because I am learning as I go.

Christopher
Posts: 17
Joined: Thu Feb 07, 2013 5:05 pm
by bblood » Fri Mar 08, 2013 12:40 am
My RPI has been offline for a while....it has been snowing for about a week up here and my solar system could not keep up....I just fired it up today...still cloudy, but I managed to produce an amp or so for an hour.....maybe 2.... Anyway I have mounted my pi, arduino, and power supply to a piece of perf board with zip ties and I hung (screwed) it on the wall. I will post my poor attempt at python scripting and arduino sketch if you would like..... Most of the code was copied/pasted and modified....there is a lot of slop and not so much in the comments....My next project is to connect a couple relays to power some lights so I can check on the chickens/door at night...I also spend a fair amount of time away and don't want to leave the hens in for days on end....

Code: Select all
#!/usr/bin/env python
#from __future__ import print_function
import serial
import datetime
now = datetime.datetime.now()
from time import sleep

s = serial.Serial(port='/dev/ttyACM0', baudrate=9600)


sleep(2)
s.write('a')
sleep(1)
print s.readline().strip(),
#print 1
print now.strftime("%Y-%m-%d %H:%M")


This code gets the string from the rpi and adds a date/time stamp
The s.write('a') is there for a reason....can't remember why....I think I put it there as a place holder for a time when I want to use my relay board....I can send a character to the arduino to turn on/off the light or any other relay I want to activate...Or maybe I just put it in there to get a fresh string from the arduino rather than a buffered value.... not sure, but, like I said, it works.
Code: Select all
31.65 degrees F :Voltage = 11.64 :Current = -0.43 Amps 2013-03-07 19:30


I set up a cron job to run this every 10 minutes and add it to a text file (log) that I close out each day and start over...the name of the file has the date in it so I can look at any day/time I want to see the status....

Code: Select all
//TMP36 Pin Variables
    //#define aref_voltage 3.3         // we tie 3.3V to ARef and measure it with a multimeter!
    int tempPin = A0; //the analog pin the TMP36's Vout (sense) pin is connected to
    //the resolution is 10 mV / degree centigrade with a
    //500 mV offset to allow for negative temperatures
    const int voltageInPin = A1;  // Analog input pin that the the voltage divider is connected to
    const int CurrentInPin = A2;  // Analog input for the current sensor
    /*
    * setup() - this function runs once when you turn your Arduino on
    * We initialize the serial connection with the computer
    */
    int voltageValue = 0;        // initial value for voltage sensor
    int incomingByte = 0;   // for incoming serial data...place holder only
    int currentValue = 0;
   
    void setup()
    {
    Serial.begin(9600); //Start the serial connection with the computer
    //to view the result open the serial monitor
    //analogReference(EXTERNAL);
    }
    void loop() // run over and over again
    {
     
    // send data only when you receive data:
        if (Serial.available() > 0) {
                // read the incoming byte:
                incomingByte = Serial.read();
         // say what you got:
         //       Serial.print("I received: ");
         //     Serial.println(incomingByte, DEC);
       
     
    incomingByte == 0;
    //getting the voltage reading from the temperature and voltage sensor
    int reading = analogRead(tempPin);  //This is the temp sensor pin
    voltageValue = analogRead(voltageInPin); // this is the voltage sensor pin
    currentValue = analogRead(CurrentInPin);
    // converting that reading to voltage, for 3.3v arduino use 3.3
    float tempvoltage = reading * 5;
    tempvoltage /= 1024.0;
    // print out the voltage
    //Serial.print(tempvoltage); Serial.println(" volts");
    // now print out the temperature
    float temperatureC = (tempvoltage - 0.5) * 100 ; //converting from 10 mv per degree wit 500 mV offset
    //to degrees ((volatge - 500mV) times 100)
    //Serial.print(temperatureC); Serial.println(" degrees C");
    // now convert to Fahrenheight
    float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
    Serial.print(temperatureF); Serial.print(" degrees F :");
    Serial.print("Voltage = " );
    Serial.print(voltageValue*0.0245);
    Serial.print(" :Current = ");
    Serial.print((.0245*currentValue)-13.1); Serial.println(" Amps");
    delay(1000); //waiting a second
        }
    }


Here is the sketch for the arduino....not pretty, but it works...Any suggestions are welcome....
Posts: 40
Joined: Sat Sep 22, 2012 1:54 am
by guyute74 » Sun Mar 17, 2013 7:48 pm
I'm making progress.

http://www.3storks.com/blog/coopcam/

So far I have the pi in the house and it is reading the temp and broadcasting it out. I have a webcam aimed at the coop but plan to stick a usb cam on the pi for some inside shots of the coop when I get it mounted.
While I still have the mini blind motor up and running on a timer, my next step is to rig up a magnetic switch to broadcast door position to the website above.

I've got the switch working, just figuring out how or where to upload the data.

thanks for all your help so far.
Also on the list is to get all this on battery power.
Posts: 17
Joined: Thu Feb 07, 2013 5:05 pm
by bellehumeur » Sun Feb 02, 2014 11:47 am
I have the coop automated with a raspberry pi. I'm using fhem to control everything (fhem.de). I'm using the same software to control the house. It has a nice web interface and plotting utilities and it's open-source perl.
So far I have the door, lights and two waterer temperature automated.
I'm using plastic toilet tanks with nipples for the waterers. They have built-in float valves, mounting hardware, are insulated and are designed to hold water. I'm really happy with those.
Coop temperature is monitored and the water level in each waterer as well.
Water level is monitored with a cheap ultrasonic sensor (HC-SR04) on top of the toilet tanks.
One one them died already so if anyone is doing the same, I would like to know if they have found a more reliable level sensor.
Now I'm working on monitoring noise with a USB microphone.
I hooked up speakers and play a 'hawk' sound when they make too much noise but that is not stopping the 'egg song' :-(
I wait until spring and try spraying/misting water in the run when they make a racket. That will at least force them inside the coop.
Other things I plan to try is a 'poop rain gutter' that would be flushed automatically a few times a night.
Also, feeder weight would be nice to keep track of food usage.

So far I'm quite happy with the system and we can go for 10 days vacation without worrying about the coop.
Posts: 5
Joined: Tue Jul 30, 2013 7:36 am