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:
- Arduino Uno R3
- The Arduino IDE (http://www.arduino.cc/)
- Relay (High power for switching line voltage, smaller one, DIP package, for prototyping)
- Red LED
- Green LED
- 220 ohm resistor (x2)
- Jumper wires
- 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!
We have a be nice policy.
Please be positive and constructive.