Chickens are notorious for breaking ranks and becoming mutinous. Ducks on the other hand lend themselves more to precision marching and even exhibit this in the wild.
That is a bit scary. I suppose that since geese fly in formations, they too might fall under the control of military precision.
I miss my chickens. I had 3 gorgeous Rhode Island reds before the twins, raised from Easter chicks. But then LA Animal control came a-knocking. I guess Huey, Duey & Louie failed to charm one of my neighbors...
LA has long allowed chickens (not sure about roosters) as long as you had the back yard for it. Not enough room in those new fangled tract homes, though. Don't know what kind of setbacks you have, but where we are we're allowed up to six chickens, as long as they're at least 35 feet from the neighbors (but then, I'm sure, only if they object). While we do have such a setback, it would mean a very small run for the chickens.
Put a chicken in your back yard and you will not have a bug or spider problem.
I live in Taiwan''s second largest city. But Asia being what it is, I have a neighbour somewhere nearby that has 4 or 5 free range chickens that wander the streets. People simply respect the fact that they are someone else's and do not molest them.
If they lay eggs, I have no idea where.
I've seen other people keeping goats, pigs, and even a cow or two on vacant lots. And we still have the occasional rice paddy wedged between buildings in the urban environment.
Chickens will generally head home to roost. Home is easily imprinted by raising the chicks where you want them to roost. Then when they are big enough give the more room to roam.
BTW, here's the code: (and I attached the spin file)
'' coop door test
'' 9/3/2012
'' Paul A. Willoughby, DVM
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
CdS_PIN = 0 'ADC pin (not to be confused with P0)
RELAY_PIN = 14
MOTOR_PIN = 15
UPPER_SWTCH_PIN = 1
LOWER_SWTCH_PIN = 0
DUSK = 7
DAWN = 50
ON = 1
OFF = 0
UP = 1
DOWN = 0
OBJ
HB25 : "HB-25"
adc : "PropBOE ADC" ' A/D Converter on PropBOE
pst : "Parallax Serial Terminal Plus" ' Terminal communication tools
VAR
long lightValue, doorState
PUB Main
Initialize
repeat
lightValue := adc.In(CdS_PIN) ' Get AD0 analog to digitla conversion
GetDoorState
Display
if (lightValue < DUSK) & (doorState == UP)
CloseDoor
if (lightValue > DAWN) & (doorState == DOWN)
OpenDoor
waitcnt(clkfreq / 5 + cnt) ' Delay for 50 ms
OUTA [RELAY_PIN] := OFF
''waitcnt(clkfreq * 5 + cnt)
PRI OpenDoor
OUTA [RELAY_PIN] := ON
waitcnt(clkfreq * 3 + cnt)
HB25.SetMotorS(1650,1500)
waitcnt(clkfreq * 2 + cnt)
HB25.SetMotorS(1500,1500)
waitcnt(clkfreq + cnt)
doorState := UP
PRI CloseDoor
OUTA [RELAY_PIN] := ON
waitcnt(clkfreq * 2 + cnt)
HB25.SetMotorS(1400,1500)
waitcnt(clkfreq * 2 + cnt)
HB25.SetMotorS(1500,1500)
waitcnt(clkfreq + cnt)
doorState := DOWN
PRI GetDoorState | switchVal
switchVal := INA [LOWER_SWTCH_PIN..UPPER_SWTCH_PIN]
pst.Str(String("Switches = "))
pst.Bin(switchVal, 2)
pst.NewLine
case switchVal
%01 :
doorState := UP
%10 :
doorState := DOWN
PRI Initialize
DIRA [RELAY_PIN..MOTOR_PIN]~~
DIRA [LOWER_SWTCH_PIN..UPPER_SWTCH_PIN]~
OUTA [MOTOR_PIN] ~
waitcnt(clkfreq * 5 + cnt)
HB25.SetMotorS(1500,1500)
HB25.Start(MOTOR_PIN)
''uncomment to use as debug
PUB Display
''Display Method
''Sends cursor home, then displays ad=value and clears
''to right of value.
''pst.Home ' Home position on screen
pst.Str(String("CdS value = ")) ' Display CdS value =
pst.Dec(lightValue)
pst.ClearEnd
pst.NewLine
pst.Str(String("DoorState = "))
case doorState
UP :
pst.Str(String("Up"))
DOWN :
pst.Str(String("Down"))
pst.NewLine
pst.Home ' Clear to the right of the value
An idea stemming from Chris Savage's post in the project thread on Savage Circuits suggested I need to add a method that takes the average of some number of values from the CdS Photo Resistor to cancel out spikes of light, for example kids with flash light, lightning, car passing by and such.
I'm thinking something like: (have not tested yet, don't know for sure it will compile)
Nice idea to get some kind of average light level before making any logic decisions.
I think I can see what you are doing with the results of "GetLightLevel" method.
Results of one run though that method determines if and when to change the state of the door.
You want to eliminate false triggers for the door opening, correct?
Just wondering if 4 seconds long enough time.
Sure, sure, most of the time it will be enough.
You could easily stretch out that sample time to one or two minutes, for example.
After all, this is a decision that is made once in the morning and once at night. Why rush it?
... this is a decision that is made once in the morning and once at night. Why rush it?
Looking forward to results of your field test.
excellent point! Once I have it finessed to my satisfaction I'll do that. Testing goes much quicker with faster loops. Also I expect to drop the clock speed down to save on current draw.
...how about using one of them cog thingies to act as a basic 24 hour clock "filter" which would determine the proper operating window of the light sensor?
...how about using one of them cog thingies to act as a basic 24 hour clock "filter" which would determine the proper operating window of the light sensor?
Sounds good in my head, anyway...
I thought about something like that. It could work I think, but I don't believe it's really necessary with this new GetLightLevel method.
Doggiedog ,
have you seen my tread about the wiznet connected to the prop measuring temp & humidity.HERE
and displaying them along with a graph. keeping a relay onder control .
maybe just wat you were looking for . nice barn by the way
Yeah it is! After I finish this automatic door project I'm going to expand the coop.. Then I'd like to........... set up a web server for it.
Paul
Ok I admit I was only joking when I suggested you train one of the chickens to close the door in your other thread but giving your chickens access to the internet I think is taking it a little too far!
Comments
That is a bit scary. I suppose that since geese fly in formations, they too might fall under the control of military precision.
cuz, yeah. I'm lazy.
You could hook up a motor or servo to a seed spreader
http://www.homedepot.com/h_d1/N-5yc1v/R-100664982/h_d2/ProductDisplay?catalogId=10053&langId=-1&keyword=seed+spreader&storeId=10051#.UE4Vto0iYuA
Think of the big wheels as mechanical advantage.
The handheld version works, but you have to shake it up.
Hmmm.... spreader may have some advantages.
Or maybe fire up the animatronic Colonel Sanders sallying forth an empty bucket.
That's a great contraption you've got there, Doc.
LA has long allowed chickens (not sure about roosters) as long as you had the back yard for it. Not enough room in those new fangled tract homes, though. Don't know what kind of setbacks you have, but where we are we're allowed up to six chickens, as long as they're at least 35 feet from the neighbors (but then, I'm sure, only if they object). While we do have such a setback, it would mean a very small run for the chickens.
Put a chicken in your back yard and you will not have a bug or spider problem.
Nice project there, DD!
-- Gordon
(Go in to 0:25 or so..).
-- Gordon
Thanks GM - BTW I really like your Kickstarts Book!
Paul
If they lay eggs, I have no idea where.
I've seen other people keeping goats, pigs, and even a cow or two on vacant lots. And we still have the occasional rice paddy wedged between buildings in the urban environment.
I'm thinking something like: (have not tested yet, don't know for sure it will compile)
Then just call GetLightLevels in the main loop instead of reading the CdS pin directly from the main loop.
Comments? Corrections? Is this "elegant" enough?
Paul
It seems to work fine. This creates a 4 second buffer for the light value reading and assigns the average reading to the global var lightValue. Yay!
I think I can see what you are doing with the results of "GetLightLevel" method.
Results of one run though that method determines if and when to change the state of the door.
You want to eliminate false triggers for the door opening, correct?
Just wondering if 4 seconds long enough time.
Sure, sure, most of the time it will be enough.
You could easily stretch out that sample time to one or two minutes, for example.
After all, this is a decision that is made once in the morning and once at night. Why rush it?
Looking forward to results of your field test.
LOL, good point.
PS Congratulations on being named Project on the Week.
Sounds good in my head, anyway...
Paul
have you seen my tread about the wiznet connected to the prop measuring temp & humidity.HERE
and displaying them along with a graph. keeping a relay onder control .
maybe just wat you were looking for . nice barn by the way
Glad to see you got it working in the end.