The Automatic Chicken Coop Heater is actually pretty simple:

Essentially 2 lights (1 halogen and 1 florescent bulb) triggered on an off by temperatures. There are 2 different chicken heater systems:

  1. Coop Interior: to heat the interior of the coop
  2. Coop Exterior: to keep the exterior water pipe from freezing/cracking.

Interior Coop Heater

Encased in a concrete block positioned near the water fount
A small concrete block with a single light socket (with a halogen bulb) mounted to a bottom brick cap and the is capped with another concrete cap. (actually I’ve replaced the concrete cap (pictured) with a section of thinner tile. Now the heat is distributed quicker. It is wired to the Arduino via the same temperature sensor, which triggers the relay (on/off) in the outlet installed in the EPPNOC (El Pollo Palace Network Operations Center). The heater outlet is triggered on when the temp goes below 40 degrees F and off at any temperature above that.

The Chicken Coop Interior Heater Images

Exterior Coop Heater

Located under the ladder, I installed a simple 2′ florescent work light, which when triggered turns on and throws just enough heat above the pvc water pipe with nipples, to prevent freezing. It is wired to the Arduino via the same temperature sensor, which triggers the relay (on/off) in the outlet installed in the EPPNOC. The heater outlet is triggered on when the temp goes below 40 degrees F and off at any temperature above that.

The Chicken Coop Exterior Heater Images

(to prevent freezing of the water system)

Automatic Chicken Coop Heater Parts

Masonry Block:

Automatic Chicken Coop Heater via Arduino

Automatic Chicken Coop Heater via Arduino

1) 6″ Block
2) Solid 6″ Caps
(found at any builder’s supply)

 

Arduino Compatible Mega 2560 Atmega2560 Mega2560 R3 Board + USB Cable

 

Single-Channel 12V 30A Relay Module
Waterproof Digital Thermal Probe Sensor DS18B20

 

Zip Cord Lamp Wire
Leviton 9875 Porcelain Outlet Box Mount

 

CableWholesales RG6 Cable Clip, Black
Cooper Add-A-Tap, Male Plug, 10amp, Brown

 

4′ Shoplight (for exterior heating of pvc pipes)
SYLVANIA Capsylite Halogen Lamp

 

Code for Automatic Chicken Coop Heater

[callout font_size=”13px” style=”limegreen”]

David Naves

David Naves

I’m hoping that if you use or modify my code or ideas, you will share *your* coop project with me and the world (pictures, whatever) I’m big on sharing.
Cheers,
//D
[/callout]

 

/*
* Copyright 2016, David Naves (https://daveworks.net, https://davenaves.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
* 
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with this program; if not,  write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 
* 02110-1301, USA. 

*/

 /*
* I'm hoping that if you use/modify this code, you will share your
* coop project with me and the world (pictures, whatever)
* I'm big on sharing.
* Cheers,
* //D
*/



// libraries


#include                      // load the SimpleTimer library to make timers, instead of delays & too many millis statements
#include                          // load the onewire library for thermometer

#include                    // load the liquid crystal library




// print debug messages or not to serial
const boolean SerialDisplay = false;




// pins assignments

const int thermometer = 3;                   // thermometer DS18S20 on digital pin 3
const int relayHeat = 5;                     // heat lamp relay set to digital pin 5
const int relayFan = 6;                      // exhaust fan relay set to digital pin 6


// variables


// SimpleTimer objects

SimpleTimer coopPhotoCellTimer;



// temperature check delay
long lastTempCheckTime = 0;
long TempCheckDelay = 600000;           // 10 minutes


// temperature chip i/o
OneWire ds(thermometer);               // thermometer on digital pin 3

// chicken cam servo
// Servo chickenCamServo;              //  servo object to control chickenCam
// int chickenCamServoPos = 0;         // chickenCamServoPosition var

// lcd
LiquidCrystal lcd(38, 37, 36, 32, 33, 34, 35);   // lcd pin assignments
int backLight = 13;                              // pin 13 controls backlight
/*
  LCD Pin	 > arduino Pin

  lcd pin 1 VSS >	          gnd arduino pin
  lcd pin 2 VDD >	          +5v arduino pin
  lcd pin 3 VO(contrast) >   330 ohm resistor to gnd arduino pin
  lcd pin 4 RS	              arduino pin 38
  lcd pin 5 R/W	            arduino pin 37
  lcd pin 6 Enable	          arduino pin 36
  lcd pin 7  -
  lcd pin 8  -
  lcd pin 9  -
  lcd pin 10 -
  lcd pin 11 (Data 4)    >   arduino pin 32
  lcd pin 12 (Data 5)    >   arduino pin 33
  lcd pin 13 (Data 6)    >   arduino pin 34
  lcd pin 14 (Data 7)    >   arduino pin 35
  lcd pin 15 Backlight + >   arduino pin 13 (built-in resistor)
  lcd pin 16 Backlight   >   arduino gnd pin
*/




// ************************************** the setup **************************************

void setup(void) {

  Serial.begin(9600); // initialize serial port hardware


  // welcome message
  if (SerialDisplay) {
    Serial.println(" Processes running:");

  }

  // coop hvac

  pinMode(relayHeat, OUTPUT);   //set heat lamp relay output
  pinMode(relayFan, OUTPUT);    //set exhaust fan relay output




}

// ************************************** functions **************************************

// coop hvac

void doCoopHVACHeat() {

  float temperature = getTemp();                    // create temperature variable
  float tempF = (temperature * 9.0) / 5.0 + 32.0;   // convert celcius to fahrenheit
  if (SerialDisplay) {
    Serial.print(" Coop Temperature:");             // print out coop temperature
    Serial.println(tempF);                          // print out the temperature
  }

  if ((millis() - lastTempCheckTime) > TempCheckDelay) {    // check temperature every 10 minutes

    // if cold, turn on heat lamps
    if (tempF <= 40) { // if temp drops below 40F turn on heat lamp(s) relay digitalWrite(relayHeat, HIGH); } else if (tempF > 40) {
      digitalWrite(relayHeat, LOW);                        // if temp remains above 40F turn off heat lamp(s) relay
    }
  }
}



// if hot, turn on cooling fans

void doCoopHVACCool() {

  float temperature = getTemp();                    // create temperature variable
  float tempF = (temperature * 9.0) / 5.0 + 32.0;   // convert celcius to fahrenheit
  if (SerialDisplay) {
    Serial.print(" Coop Temperature:");             // print out coop temperature
    Serial.println(tempF);                          // print out the temperature
  }

  if ((millis() - lastTempCheckTime) > TempCheckDelay) {    // check temperature every 10 minutes
    if (tempF >= 83) {                                      // if temp rises above 85F turn on cooling fan(s) relay
      digitalWrite(relayFan, HIGH);
    }

    else if (tempF < 83) {
      digitalWrite(relayFan, LOW);
    }
  }
}



// credit: bildr.org/2011/07/ds18b20-arduino/
// DS18S20 digital thermometer stuff

float getTemp(){
  //returns the temperature from one DS18S20 in DEG Celsius
 
  byte data[12];
  byte addr[8];
 
  if ( !ds.search(addr)) {
      //no more sensors on chain, reset search
      ds.reset_search();
      return -1000;
  }
 
  if ( OneWire::crc8( addr, 7) != addr[7]) {
      Serial.println("CRC is not valid!");
      return -1000;
  }
 
  if ( addr[0] != 0x10 && addr[0] != 0x28) {
      Serial.print("Device is not recognized");
      return -1000;
  }
 
  ds.reset();
  ds.select(addr);
  ds.write(0x44,1); // start conversion, with parasite power on at the end
 
  byte present = ds.reset();
  ds.select(addr);    
  ds.write(0xBE); // Read Scratchpad
 
   
  for (int i = 0; i < 9; i++) { // we need 9 bytes
    data[i] = ds.read();
  }
   
  ds.reset_search();
   
  byte MSB = data[1];
  byte LSB = data[0];
 
  float tempRead = ((MSB << 8) | LSB); //using two's compliment
  float TemperatureSum = tempRead / 16;
   
  return TemperatureSum;
   
}






//  lcd
void doLcdMsg() {

  float temperature = getTemp();                 // create temperature variable
  float tempF = (temperature * 9.0) / 5.0 + 32.0; // convert celcius to fahrenheit

  pinMode(backLight, OUTPUT);            // backlight pin set as output
  digitalWrite(backLight, HIGH);         // backlight on
  lcd.begin(16, 2);                      // columns, rows
  lcd.clear();                           // start with blank screen
  lcd.setCursor(0, 0);                   // set cursor to column 0, row 0
  lcd.print("Coop Temp:");               // show "Temp"
  lcd.print (tempF) ;                    // show temperature of interior coop
  lcd.print("F");                        // show "F"


}



// ************************************** the loop **************************************

void loop() {
 
  doCoopHVACCool();
  doCoopHVACHeat();
  doLcdMsg();

}