Building a chicken incubator!

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Re: Building a chicken incubator!

Postby adafruit_support_mike » Thu Jun 07, 2012 12:52 pm

The mention of using resistors as heating elements jogged my memory: You don't even need resistors. Transistors make good heating elements.

A transistor is basically a voltage-controlled resistor, and any voltage drop across it is lost as heat. There's a whole toolbox of tricks to avoid that loss, but if you want heat you can use the tricks in reverse. For a mosfet, find a gate voltage that leaves a few ohms of resistance across the channel and allows, say, 500mA of current to pass. Even 2N7000 small-signal mosfets ($6.30 for 100 at Mouser) are rated for 800mA of pulsed current and 200mW of power dissipation.

For more power from fewer devices, use power mosfets or BJTs. The SS8050 NPN transistor ($3.50 for 100) is rated for 1A of current and 1W of power dissipation.. and that's still the small stuff.

Ham radio operators use tricks like that to build crystal ovens. Check out some of those designs for ideas about heating, sensing, and control.
When you void a product warrany, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 1348
Joined: Thu Feb 11, 2010 1:51 pm

Re: Building a chicken incubator!

Postby adafruit_support_mike » Thu Jun 07, 2012 2:06 pm

Another lesson from crystal ovens: you can use a BJT as a thermometer.

Given a fixed base current, a BJT allows more current to pass as it gets hotter. Again, that's usually considered a problem (thermal runaway), but you can also use it as a feature.

Set up an inverter with any small-signal BJT and a fairly large resistor (1M or better) and feed it a fixed base current. As the temperature rises, the transistor will allow more current to pass. More current produces a larger voltage across the collector resistor, so the voltage at the transistor's collector will drop. When the temperature falls, the transistor will pass less current, and the collector voltage will rise.

Find a resistor value that produces enough change in voltage that your Arduino's analog pins can read the difference reliably at the resolution you want.
When you void a product warrany, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 1348
Joined: Thu Feb 11, 2010 1:51 pm

Re: Building a chicken incubator!

Postby stinkbutt » Fri Jun 08, 2012 3:46 pm

Be careful to keep the water you use to humidify limited to the minimum: It's got so much damn thermal mass, that if you have too much and you keep it inside the enclosure, it's going to skew your temperature control, and I don't think you want to have to invest in a PID controller.

Water's got a higher specific heat (by volume) than any known material. In fact you'll probably just want an aquarium heater to independently control the water temperature.
Red M&M, Blue M&M: They all wind up the same color
stinkbutt
 
Posts: 583
Joined: Wed Feb 17, 2010 1:40 am

Re: Building a chicken incubator!

Postby jigsawnz » Sat Jun 09, 2012 5:48 pm

Here is my result after testing my new setup. I'm only testing temperature at the moment and it's stable within 0.2'C. The test was about 10 hours long and the outside temperature was about 15'C. I hope the image works that I attached to this post
Attachments
incubator test-001.PNG
temperature test graph
incubator test-001.PNG (25.19 KiB) Viewed 2178 times
jigsawnz
 
Posts: 33
Joined: Mon Mar 12, 2012 9:17 pm
Location: New Zealand

Re: Building a chicken incubator!

Postby robodude666 » Sat Jun 09, 2012 7:16 pm

Very nice jigsawnz! So, you just have the heat plate on a relay, controlled by an arduino and a temperature sensor? Are you using a PID controller? If so, what coefficients did you select?

And thanks everyone for the ideas. I recently got a job offer, so I have less time available to me.. However I will look into starting work on this project next month, after some of the upcoming crazyness is worked out.
robodude666
 
Posts: 114
Joined: Sat Mar 27, 2010 11:12 pm

Re: Building a chicken incubator!

Postby jigsawnz » Sat Jun 09, 2012 9:26 pm

20 watt heat plate from ebay
4-relay board from ebay in custom housing.
Adafruit Arduino UNO
Adafruit arduino case
Adafruit DHT22 temperature and humidity sensor
Adafruit chronodot RTC
Adafruit negative RGB LCD
Adafruit I2C backback
Sparkfun microSD shield.

I only recently started to learn how to code but I found somebody doing something very similiar with arduino and I adapted his code to my project.
https://github.com/OG13/Lesson4.5/blob/master/lesson4a
I use the RGB LCD as a status indicator. If the sensor doesn't work the backlight is red. If the temperature is too low it will be blue and if everything is within the parameters it is green.
The datalogger and RTC are only there at the moment to test the system. I am making it multi purpose. In summer it can be used for the incubator and in winter as a greenhouse controller.
Attachments
test.jpg
Test setup
test.jpg (977.74 KiB) Viewed 2169 times
jigsawnz
 
Posts: 33
Joined: Mon Mar 12, 2012 9:17 pm
Location: New Zealand

Re: Building a chicken incubator!

Postby stinkbutt » Tue Jun 12, 2012 11:29 am

robodude666 wrote:Very nice jigsawnz! So, you just have the heat plate on a relay, controlled by an arduino and a temperature sensor? Are you using a PID controller? If so, what coefficients did you select?

And thanks everyone for the ideas. I recently got a job offer, so I have less time available to me.. However I will look into starting work on this project next month, after some of the upcoming crazyness is worked out.


Doesn't look like he's using a PID controller. It's too jerky. You don't see a sawtooth like that with a PID controller. You'd see one or zero overshoots (exactly one if it's properly damped) and then an asymptotic decay to the target.
Red M&M, Blue M&M: They all wind up the same color
stinkbutt
 
Posts: 583
Joined: Wed Feb 17, 2010 1:40 am

Re: Building a chicken incubator!

Postby jigsawnz » Tue Jun 12, 2012 7:28 pm

I haven't used a PID controler in my test. Because I am new to programming I am starting off simple. Thanks to your comments I will try to implement it ASAP. I was aware of the lifespan of relays but because some parts are really hard to source in New Zealand this was an easy solution to get the project going. I will try to get my hands on two mosfets that I can controll by arduino. One for the Heating and the other one for the fan that was also on my todo list.

ADAFRUIT:
It was awesome to see a photograph of my project on your blog although I feel like I hijacked this post. I wished I made a better photograph though. :lol:
jigsawnz
 
Posts: 33
Joined: Mon Mar 12, 2012 9:17 pm
Location: New Zealand

Re: Building a chicken incubator!

Postby j2taba » Thu Jul 19, 2012 4:31 am

Hi guys,
I am working on the following setup;
Adafruit Arduino UNO
Adafruit arduino case
Adafruit DHT22 temperature and humidity sensor
Adafruit negative RGB LCD
Adafruit chronodot RTC
I am a newbie in coding, can somebody help me out...
j2taba
 
Posts: 3
Joined: Thu Jul 19, 2012 4:06 am

Re: Building a chicken incubator!

Postby jigsawnz » Thu Jul 19, 2012 4:53 am

Hello,

What are you trying to achieve with your build. What do you want it to do? Record temperature? Turn heating or cooling on and off?

The code I'm using at the moment I threw together from varius sources such as Adafruit tutorials and those of others. I can upload it if you really want to have a look at it but it is probably very badly thrown together by me. I'm in my second trimester of learning how to program so I hope to do a proper revision later this year.
jigsawnz
 
Posts: 33
Joined: Mon Mar 12, 2012 9:17 pm
Location: New Zealand

Re: Building a chicken incubator!

Postby j2taba » Fri Jul 20, 2012 4:12 am

OBJECTIVES;
-Record temperature and humidity and both to be displayed on the LCD,
-Control the temperature by turning an incandescent bulb (~40W) ON/OFF, with a fan to aid heat distribution.
-A motor to drive the egg turning mechanism e.g the attached pic.
-An RGB LED to display the status.
Kindly post your code - it can help me in putting together the code.
Attachments
1502new.gif
1502new.gif (84.86 KiB) Viewed 1828 times
P3250011.JPG
P3250011.JPG (73.69 KiB) Viewed 1828 times
j2taba
 
Posts: 3
Joined: Thu Jul 19, 2012 4:06 am

Re: Building a chicken incubator!

Postby jigsawnz » Fri Jul 20, 2012 4:20 pm

I use a chronodot an microSd breakoutboard in my code for datalogging but also by serial output. I'm not using a PID controller at the moment and plan to use mosfets for my future revision. The RGB LCD will turn red if it detects something wrong during setup. Blue if the Temperature is to low and Green if temperature is within range.

As I said this is code I have thrown together from different sources.

I use the I2C backpack on the RGB -LCD with the RGB pins connected to the pwm pins.

Code: Select all
#include "DHT.h"
//#include <LiquidTWI.h>
#include <Wire.h>
#include "Chronodot.h"
#include <SD.h>
#include <Adafruit_RGBLCDShield.h>


/*
Pins used:
LCD:
Connect via i2c, default address #0 (A0-A2 not jumpered)
The circuit:
* 5V to Arduino 5V pin
* GND to Arduino GND pin
* CLK to Analog #5
* DAT to Analog #4

SDshield
* CS to D8
* MOSI to D11
* MISO to D12
* SCK to D13

RGB Backlight
RED to D3
GREEN to D5
BLUE to D6

Humidity Warning to D2
DHT22 to D4

Heating to D9
*/

Chronodot RTC;
DateTime now = RTC.now();

Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();

File dataFile;
const int chipSelect = 8;     //Sparkfun SD shield pin 8, Adafruit SD shield pin 4.

#define DHTPIN 4              // Pin to read from DHT22 sensor
#define DHTTYPE DHT22         // DHT 22  (AM2302)
                           
int maxT=0, minT=100;         //temperature range
int maxH=0, minH=100;         //Humidity range
DHT dht(DHTPIN, DHTTYPE);

//here's where the temp and hum setpoints are changed
float tempset=36.50, tempreset=37.50;
float humset=60, humreset=58;
int tmem=0, hmem=0;

// These #defines make it easy to set the backlight color
#define RED 0x1
#define YELLOW 0x3
#define GREEN 0x2
#define TEAL 0x6
#define BLUE 0x4
#define VIOLET 0x5
#define WHITE 0x7

void setup() {
  Serial.begin(9600);
  Wire.begin();
  RTC.begin();
  SD.begin(chipSelect);
 
  // set up the LCD's number of rows and columns:
  lcd.begin(16, 2);
  lcd.setBacklight(WHITE);
                               
  pinMode(9, OUTPUT);       //Heating
  pinMode(10, OUTPUT);     //Needed for the SDbreakout board to work.
   
  digitalWrite (9, HIGH);   //This keeps the relay turned off during setup
   
  lcd.begin(16, 2);         //set up the LCD's number of columns and rows:
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Incubator");
  lcd.setCursor(0,1);
  lcd.print("Controler");
  delay(2000);

  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("By George");
  lcd.setCursor(0,1);
  lcd.print("Timmermans");
  delay(2000);
 
  Serial.println("Initializing Chronodot.");
  Serial.println("Date\t\tTime\t\tHumidity\tTemperature\tTempRTC");
 
  dataFile = SD.open("DHT22.txt", FILE_WRITE);   // open the file. note that only one file can be open at a time,
  dataFile.println("Date\t\tTime\t\tHumidity\tTemperature");
  dataFile.close();          // so you have to close this one before opening another.

  if (! RTC.isrunning()) {
    Serial.println("RTC is NOT running!");
  } 
  delay(500);
}

void loop() {
 
  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  float h = dht.readHumidity();
  float t = dht.readTemperature();

  // check if returns are valid, if they are NaN (not a number) then something went wrong!
  if (isnan(t) || isnan(h)) {
 
    Serial.println("Failed to read from DHT22");
                                 
    lcd.clear();              //Display error on vfd display.
    lcd.setCursor(0,0);
    lcd.print("Failed to read");
    lcd.setCursor(0,1);
    lcd.print("from DHT22");

    // open the file. note that only one file can be open at a time,
    // so you have to close this one before opening another.
    dataFile = SD.open("DHT22.txt", FILE_WRITE);     
    dataFile.println("Failed to read from DHT22");  //Write error message too MicrSD.
    dataFile.close();         //Close the file.
   
    lcd.setBacklight(RED);
  }
 
  else {
    temperature(h, t);  //Check temerature and humidity and control relays.
    if (now.second() == 0)  {  //Log data every minute(RTC needed)
      debug(h, t, RTC.now());
      Log(h, t, RTC.now());
    }                               
    else  {
        LCD(h, t, RTC.now());
    }
  }
}

void temperature (float h, float t)  {
  if (tempreset<=t && t<=tempset && tmem==1) {
       digitalWrite (9, HIGH);
  }
  if (t>=tempset) {
       tmem==1,
       lcd.setBacklight(GREEN);
       digitalWrite (9, HIGH);
  }     
  if (t<tempreset)  {
       tmem==0,
       lcd.setBacklight(BLUE);
       digitalWrite (9, LOW);
  }
  if (humreset<=h && h<=humset && hmem==1) {
       digitalWrite (2, LOW);
  }
  if (h>humset) {
       hmem==1,
      digitalWrite (2, LOW);
  }
  if (h<humreset) {
       hmem==0,
       digitalWrite (2, HIGH);
  }
}
 
void Log(float h, float t, DateTime now)  {
    dataFile = SD.open("DHT22.txt", FILE_WRITE);
  if(now.day() < 10) dataFile.print("0");
    dataFile.print(now.day(), DEC);
    dataFile.print('/');
  if(now.month() < 10) dataFile.print("0");
    dataFile.print(now.month(), DEC);
    dataFile.print('/');
    dataFile.print(now.year(), DEC);
    dataFile.print('\t');
  if(now.hour() < 10) dataFile.print("0");
    dataFile.print(now.hour(), DEC);
    dataFile.print(':');
  if(now.minute() < 10) dataFile.print("0");
    dataFile.print(now.minute(), DEC);
    dataFile.print(':');
  if(now.second() < 10) dataFile.print("0");
    dataFile.print(now.second(), DEC);
    dataFile.print("\t");
    dataFile.print(h);
    dataFile.print("\t\t");
    dataFile.println(t);
    dataFile.close();            //Close the file.
  delay(100);
}

void debug(float h, float t, DateTime now)  {
  if(now.day() < 10) Serial.print("0");
    Serial.print(now.day(), DEC);
  if(now.month() < 10) Serial.print("0");
    Serial.print(now.month(), DEC);
    Serial.print('/');
    Serial.print(now.year(), DEC);
    Serial.print('/\t');
  if(now.hour() < 10) Serial.print("0");
    Serial.print(now.hour(), DEC);
    Serial.print(':');
  if(now.minute() < 10) Serial.print("0");
    Serial.print(now.minute(), DEC);
    Serial.print(':');
  if(now.second() < 10) Serial.print("0");
    Serial.print(now.second(), DEC);
    Serial.print("\t");
    Serial.print(h);
    Serial.print("\t\t");
    Serial.print(t);
    Serial.print("\t\t");
    Serial.println(now.tempC());
  delay(100);
}

void LCD(float h, float t, DateTime now)  {
    lcd.clear();          //Display Time, Humidity and Temperature on LCD.
    lcd.setCursor(0,0);
  if(now.hour() < 10) lcd.print("0");
    lcd.print(now.hour(), DEC);
    lcd.setCursor(2,0);
    lcd.print(":");
    lcd.setCursor(3,0);
  if(now.minute() < 10) lcd.print("0");
    lcd.print(now.minute(), DEC);
    lcd.setCursor(5,0);
    lcd.print(":");
    lcd.setCursor(6,0);
  if(now.second() < 10) lcd.print("0");
    lcd.print(now.second(), DEC);
    lcd.setCursor(10,0);
    lcd.print("H");
    lcd.setCursor(11,0);
    lcd.print(h,1);
    lcd.setCursor(15,0);
    lcd.print("%");
       
    lcd.setCursor(0,1);
  if(now.day() < 10) lcd.print("0");
    lcd.print(now.day(), DEC);
    lcd.setCursor(2,1);
    lcd.print('/');
    lcd.setCursor(3,1);
  if(now.month() < 10) lcd.print("0");
    lcd.print(now.month(), DEC);
    lcd.setCursor(5,1);
    lcd.print('/');
    lcd.setCursor(6,1);
    lcd.print(now.year()-2000, DEC);
    lcd.setCursor(10,1);
    lcd.print("T");
    lcd.setCursor(11,1);
    lcd.print(t,1);
    lcd.setCursor(15,1);
    lcd.print((char)223); // degree symbol
}
jigsawnz
 
Posts: 33
Joined: Mon Mar 12, 2012 9:17 pm
Location: New Zealand

Re: Building a chicken incubator!

Postby j2taba » Tue Jul 24, 2012 3:54 am

Thanks a lot. Let me work on it and then i'll update the status of the project. :D
j2taba
 
Posts: 3
Joined: Thu Jul 19, 2012 4:06 am

Re: Building a chicken incubator!

Postby montreuilg » Tue Jan 01, 2013 9:03 pm

Thanks for your kind offer George!

I've read this project thread and the first thing I noticed is the relative innacuracy of the temperature/humidity sensors? I went in this thinking I would be able to monitor heat and humidity change in increments of 0,1% max, ideally 0,01% !

My specs are quite similar to those posted by Robodude666, except that I'll build the incubator for 1-30 eggs (1 level), and it will also be used once the eggs have hatched, by removing the turning mecanism and the eggs holder.

Ultimately, I would also like to incorporate and control a peristaltic pump to get water in the incubator (from an external recipient) for the humidity control.

I really like the idea of using a heat pad instead of a lamp, that fits perfectly with my «afterhatch» conversion :-)

I'll be using food grade plastic for the basic box, and isolate it with 2" polyiso foam (on the exterior). I like mstone's idea of having 4 bottles of brine in the enclosure to help regulate temperature changes, I'll add that to the box design.

George, what is your current setup, has it evolved since your last post here?



Thank you all for this information!
_
gabriel
montreuilg
 
Posts: 3
Joined: Sun Dec 30, 2012 9:04 pm

Re: Building a chicken incubator!

Postby jigsawnz » Tue Jan 01, 2013 11:47 pm

I re-use my most of my hardware after we have enough chicks. The major improvement I made was going from a relay to mosfets and implementing the PID library to get a stable temperature. I also have a cheap commercial incubator know that turns the eggs (chinese made). And the hardware used in there is pretty much the same as when you build it yourself. It uses the same temp and humidity sensor as sold here by adafruit.

for my last setup is used:
- arduino uno

- DHT22 ( next version will use AM2302 (wired DHT22) ) http://www.adafruit.com/products/393
- Monochrome 1.3" 128x64 OLED graphic display (for displaying a graph of temperature and humidity variations) http://www.adafruit.com/products/938

- Sparkfun Power Driver Shield Kit (for controlling the heatpad and in future upgrade the fan, egg turner and maybe waterpump)

Important for a stable temperature that I found out is plenty of insulation for the box so the outside temperature fluctuations don't affect the inside temperature. Also my current heatpad might get an upgrade. On cold days it has to run on pretty much 100% to keep my box on the right temperature. It is only 20 Watts and i would prefer 30 Watt.

Her is a video that I made of some of my hardware. Temp and humidity logging and displaying in a graph on the oled display. Add the power driver shield with a heatpad to it and with the PID library you have my last version that I made.
http://youtu.be/gmCLjMjDVzI

George
jigsawnz
 
Posts: 33
Joined: Mon Mar 12, 2012 9:17 pm
Location: New Zealand

PreviousNext

Return to General Project help

Who is online

Users browsing this forum: mibignistinly and 10 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [100]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[108]
 
Wireless[14]
Cables[60]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[69]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]