Chicken Coop Lamp Controller

Introduction: Chicken Coop Lamp Controller

We have chickens, and in the winter, we have heat lamps to keep them warm. But we have to go out to the coop and turn it off if it is too warm, and turn it on if it is too cold. I wanted to make a temperature sensor system that turn if on and off automatically. Warning: Line voltage is dangerous. Adult supervision and help is advised.

Step 1: Get It!

You will need these materials:

  1. Arduino Uno R3
  2. The Arduino IDE (
  3. Relay (High power for switching line voltage, smaller one, DIP package, for prototyping)
  4. Red LED
  5. Green LED
  6. 220 ohm resistor (x2)
  7. Breadboard
  8. Jumper wires
  9. Temperature sensor (I used the MCP9700-E/TO but another 5 volt one would work)

Step 2: Build It!

Follow the traces in the photo. You may need to adjust the layout if you have a different relay. Otherwise, it is pretty straightforward. Be sure to connect the right ends of the LEDs, the temperature sensor, and the relay. Also be sure the wires go to the correct pin on the Arduino.

The breadboard version is for testing only. If you install this into your chicken coop, solder it up (on a homemade shield?) and use a bigger relay that can handle at least 20+ amps (see its datasheet). You will also need to add a outside power source.

Step 3: Code It!

If you need the Arduino IDE, go to the link in step 1. Scroll to the latest version, download, extract (unzip), and create a shortcut. (Fairly simple, but tutorials do exist if you need help.)

Click the file below and download it. Put it in a folder with the same name, and open it up with the Arduino IDE.

The code for this project is fairly simple. I have an If, Else statement that turns on the green LED when above 15 degrees Fahrenheit. If the temperature drops below that, the red LED turns on, and the relay closes. This would turn on the heat lamp.

The only problem is that if the temp. drops slowly, the heat lamp will flicker until the temp. settles below the threshold value. To try to solve this, I added a 5 minute delay to prevent the lamp from flashing.

I also added a boot-up sequence that you visually confirm operation of the program.

Step 4: Test It Out!

If you want to test it, go to the "const int HEAT_LAMP_ON=84;" line, and change the "84" to a higher number. The 84 is in ADC bits, how the Arduino reads the temperature sensor. 143 ADC bits is about room temperature to test out the program.

Step 5: Take It Further!

If you want to, you can add another relay (like I did) to control two lamps. Just add another "const int" line and name the next relay/lamp, and then add it to the If, else statement. An override button to turn on the lamps manually is also a possibility. I'm not sure how to do this, but it is possible. Happy experimenting!

Small Spaces Contest

Participated in the
Small Spaces Contest

Explore Science Contest

Participated in the
Explore Science Contest

Be the First to Share


    • Micro:bit Contest

      Micro:bit Contest
    • Reclaimed Materials Contest

      Reclaimed Materials Contest
    • Made with Math Contest

      Made with Math Contest


    More Cowbell
    More Cowbell

    6 years ago on Introduction

    I like your build. I'm looking at several builds to help shape how I want to do a few home automation projects (including chicken projects) myself. Chickens are dirty, curious and peck everything. How do you have your project protected? Also have you considered a Thermo Cube (check Amazon)? Not as cool as building one - but effective and cheap.


    Reply 6 years ago on Introduction

    I have not yet installed it, so i haven't thought of that. We can walk into our chicken coop, so probably at the top in the corner

    This is so smart, especially since usually getting to the switch for chicken coop heat lamps involves braving the unsheltered world. Awesome job showing your process! Welcome to instructables!