Chicken Coop Lighting System

Posted by:

Chicken Coop Lighting | Arduino Automated Chicken Coop Lighting | Chicken Coop Interior Lights (star lights)

David Naves

About the Author:

Hi, I'm Dave Naves... a daddy, a drummer, a web nerd and currently live evain Grass Valley, California with a dog, 2 cats, and 8 chickens. You can typically find me making noise out on Google+, Twitter and Facebook


  1. Mark Ashcraft  December 27, 2015

    Ok, I will adjust the code…. as it is written on your page should I always have voltage from pin 45, or should the voltage be cut once the photocell picks up light?

    • David Naves
      David Naves  January 28, 2016

      Hi Mark,

      If you look carefully at the code, the relay will turn on when the door is still open and the light level is between 4 and 120 (dusk) (my relay is set to “normally closed,” so I used “digitalWrite (relayInteriorLight, LOW);”) and the relay will turn off, simply when the door is closed (bottomSwitchPinVal == 0)

      Make sense?

      Hope that helps,

  2. Mark Ashcraft  December 23, 2015

    Do you have a part list for this? just for some bench testing I used an LED to pin 5 but no matter if it’s dark or door open or closed the LED is always on? Could you clear this up? Thanks

    • David Naves
      David Naves  December 23, 2015

      Hi Mark,

      Thanks for the questions.

      Parts list: all parts are listed on the main controller page:

      As far as the LEDs, there are 3 states: door open (red led on) | door closed (green led on) door stuck (red led blinks)
      i.e: There’s always an LED on. =)


      • Mark Ashcraft  December 24, 2015

        I guess I should have clarified.. Im talking about the interior lighting… you mentioned in the code pin 45 for the interior light relay.. so to simulate an “interior” light I connected an LED to pin 45 but no matter the light level / door status I cannot get the LED to shut off leaving the interior light always on.

        • David Naves
          David Naves  December 24, 2015

          Ah, the interior lights… thanks for clarifying.

          Hmmm… my first thought (if you’ve done/pinned everything I have is that your relay may be normally closed instead of open) If so, try switching the digitalWrite (relayInteriorLight, LOW); to HIGH and vice versa… see if that works. If not, let me know exactly what you’re doing to test. i.e., it’s difficult to test this function, in that the light should only goe on when the light levels read > 4 & < 120 and close when the bottom door switch is closed. Keep me posted. =) Cheers! Here's an article on NO/NC: For those reading that want to see what Mark is asking: // turn on interior lights at dusk and turn off after door shuts void doCoopInteriorLightDusk() { if ((unsigned long)(millis() - lastTwilightTime) > TwilightDelay) { // delay 5 mins

          lastTwilightTime = millis();

          bottomSwitchPinVal = digitalRead(bottomSwitchPin);
          if (bottomSwitchPinVal == 1) { // if bottom reed switch circuit is open (door is open)
          if (photocellReading >= 4) { // if it’s twilight
          if (photocellReading <= 120) { digitalWrite (relayInteriorLight, LOW); // turn on interior light relay if (SerialDisplay) { Serial.println(" Interior Light: On"); } } } } else if (bottomSwitchPinVal == 0) { // if bottom reed switch circuit is closed (door is closed) digitalWrite (relayInteriorLight, HIGH); // turn on interior light relay if (SerialDisplay) { Serial.println(" Interior Light: Off"); } } } }


Add a Comment