Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Full option egg incubator!...help!

Status
Not open for further replies.

wolfei

New Member
I am building an egg incubator. This is what I have done so far..can you please tell me what else does my schematic need, before I proceed to the code?
**broken link removed**
I will use an old refrigerator, which has double walls and 3 shelf to put the eggs on.
I will use 2 LM35 for sensing temp and humidity(I measure dry and wet temperature-the psychometric method). For creating humidity I will use a recipient with water and a fan to blow in it; for increasing temperature I want to use a copper nickel wire from a warming plate and another fan to blow the heat between the walls of the refrigerator so that I warm the entire refrigerator.In order to turn the eggs I will use a stepper motor to lift up or pull down a bar. I am not yet sure if it wouldn't be easier to use a DC motor and Hall sensors.The entire system will be commanded by a pic 16F877A. I will also send the temperature and humidity via USART to a computer.
**broken link removed**
I wait for comments and improvements for my schematic.
Thank you in advance!
 
I am building an egg incubator. This is what I have done so far..can you please tell me what else does my schematic need, before I proceed to the code?
I will use an old refrigerator, which has double walls and 3 shelf to put the eggs on.
I will use 2 LM35 for sensing temp and humidity(I measure dry and wet temperature-the psychometric method). For creating humidity I will use a recipient with water and a fan to blow in it; for increasing temperature I want to use a copper nickel wire from a warming plate and another fan to blow the heat between the walls of the refrigerator so that I warm the entire refrigerator.In order to turn the eggs I will use a stepper motor to lift up or pull down a bar. I am not yet sure if it wouldn't be easier to use a DC motor and Hall sensors.The entire system will be commanded by a pic 16F877A. I will also send the temperature and humidity via USART to a computer.

I wait for comments and improvements for my schematic.
Thank you in advance!

hi,
I would add power rail decoupling capacitors.
A suppression diode across the relay coil.
Also check the ULN2003 suppression.

If the unit is connected to a PC..??? you need a MAX232 line driver/receiver.

Does the PIC have a battery back system, as its a critical control system.??

I am sure there are other points that need covering.:)
 
Thank you for your answers:). I added 2 diodes, one for the relay , one for the ULN2003 suppression. The uC will be alimented through a LM7805 with all the decoupling capacitors, I just didn't add that part to the schematic. Also for the serial transmission I will use the MAX232 IC, as you suggested. Do I need any other capacitors, or rezistors in the schematic?
And also I wonder if anyone can give some opinions on my heating and humidifying techniques, if they're good enough to achieve the desired parameters. And last, but not least...would it be easier to command a DC motor with Hall sensor instead of the stepper motor?
Thank you in advance!:D
**broken link removed**
 
what kind of accuracy are you hopeing for regarding tempreture control? for humidity add a cotton wick about 3 inches wide and 4 inches long. have something like a pc fan blow on this at half speed when you need extra humidity. for the egg turner a moveing floor arrangment is generaly better than tilting and has the advantage of using less space but is harder to implement.
what wattage is the heater?
 
you need to turn the eggs many times every day. what are going to do about it?
 
he is tilting the racks for turning if you look at the pic and diagram its made clear. and you only need to turn a min of 3 times a day for 19 days (chickens). however many times you turn it must be by a odd number within a 11 hour period! 13 hours daily should be no turn unless your using a constant rotation system in wich case you dont turn after day 17
 
humidity is a contesious issue for small incubators, yes it will give you a rough guide but relying on humidity readings for high yeild hatches isnt reliable. in many ways its better to candle evry 4-5 days or better still for accurate results weigh a sample of the eggs (same eggs each time) and plot the weight loss of them. aim for 15% over 21 days (assuming chickens). in a comercial hatchery when we were hatching comercial egg laying strains for the industry we used walk in incubator rooms that held 30,000 eggs each, the egg racks were sat on light boxs of very high output so you could see the contents of every egg and the humidity was judged by eye. its far more accurate.
in small incubators then if you are using humidity sensors as a guide you realy need to use high accuracy ones with accuracy of 5% or lower and they are exspensive. i use sensiron sht71's
 
Thank you for all the responses. I am a student at a technical university, studying electronics and I have to make a project this semester. The same time a friend asked me to help him with the building of an automatic incubator. Therefore I have to implement everything in a automatic manner, but also make it as cheap as possible for my friend. The Sensirion SHT71 is a very good sensor, I used the SHT11 in the past, but also a lot more expensive than 2 LM35. I am hoping to obtain a pretty accurate reading of the humidity. I don't know yet the wattage of the copper nickel wire, I think it will be alimented with a 220V through the relay.
I first want to get the simulation running..and after that move on to the actual incubator.
I am still waiting for any advices or critics for my schematic!
Alex
 
I will implement of course the in-circuit programming pins, the 2 22p C and the MAX232, I just haven't put them in Proteus because There is no need.
Thx
 
You should use a cold mist humidifier and take care of equal air humidity throughout the entire breeding process.

An SHT21 (Sensirion) will measure humidity and temperature with 16-bit resolution.

With the humidity level set to the wrong and fluctuating value the chicken have two choices to hatch: Either they die when trying to break the egg shell since it's too tough (dry) or die before since the eggs start rotting at too high a humidity level.

Don't forget! You have to simulate a hen which takes care of breeding temperature, humidity level and regular egg turning by itself!

Boncuk

P.S. If you are willing to change your design using an ATMEL MCU (ATMega8-P) I might send you the entire construction details of an incubator with guaranteed 99% hatch rate.
 
Last edited:
You should use a cold mist humidifier and take care of equal air humidity throughout the entire breeding process.

An SHT21 (Sensirion) will measure humidity and temperature with 16-bit resolution.

With the humidity level set to the wrong and fluctuating value the chicken have two choices to hatch: Either they die when trying to break the egg shell since it's too tough (dry) or die before since the eggs start rotting at too high a humidity level.

Don't forget! You have to simulate a hen which takes care of breeding temperature, humidity level and regular egg turning by itself!

Boncuk

P.S. If you are willing to change your design using an ATMEL MCU (ATMega8-P) I might send you the entire construction details of an incubator with guaranteed 99% hatch rate.

i would have to dissagree with some of the points you raise. humidity levels change a great deal while uder a hen! the main idea of the humidity level is to controll fluid loss from the egg, yes to low a humidity leads to a tough inner membrane but this is more of a factor at piping time where the chick can become "shrink wrapped in the membrane and if it manages to hatch its weaker and the growth rate of the chick is reduced by 33% (ish) over the first 3 weeks, in a comercial setting for say table birds this is a big problem as most table birds take 5 weeks 4 days from hatch to table. more than 6 weeks 2 days and you make a loss on the bird.
too high a humidity dureing incubation gives you too low fluid loss therefore the chick cannot get enough oxyen wich can lead to the chick dying fairly early on dureing incubation but the main problem at pipping is chicks dying from drowning in the fluid before they have a chance to hatch. i have seen whole batches of 6000 chciks all dead with there beaks pokeing through the shell in the hatchers! (by the way is always best to incubate in a incubator and then place the eggs in a hatcher on day 19. (time for chickens).
as for replicating a hen the reality is hens arnt great incubators the hatch and survival rate for hens brooding eggs is very low compared to modern incubation techniques.
i have grew up on a comercial hatchery and have been in the business myself 30 years. in all that time i have never had a hen that could get anywhere close to artificial hatching :D
 
I am using a serial transmission because my project must have one; Thank you for the proposal boncuk...I am not sure yet if I want to change the uC , but I would be very grateful if you would send me your project to see how you handled these requirements .
Thank all for your responses!
 
So I began programming.The first thing I want to do is create the 8 hours interval when I have to turn the eggs. I haven't used until now the timers so I need some help.
I found this tutorial: PIC16F877 Timer Modules tutorials | PIC timer0 tutorial
Here is what I understood:
8hours=28800sec=T
f=1/T=3.472*10^-5 Hz=0,000347Hz
Clock 20MHz, using external clock so no dividing by 4
Using the formula:f=(20*10^9)/(256*256*count)=0,000347=>
count=(20*10^12)/22740992=>count=879469
So using the code from the tutorial I should count to 879469 to get an 8 hour interval.
Is this correct?
Thx in advance
 
Last edited:
I managed to understand how to calculate the timers eventually...and figured out mostly of the code I need,..I got to the tricky part now...controlling the motors...I need to control 2 fans and one dc motor or stepper for tilting the eggs...
Here is what I have done so far:

Code:
#include <pic.h>
__CONFIG(HS & WDTDIS & PWRTEN & BORDIS & LVPDIS & DUNPROT & WRTEN & DEBUGEN & UNPROTECT);
#include "delay.h"
#include "stdlib.h"
#include "delay.c"
void initializari(void)
	{
	GIE=1;			// initializeaza intreruperi globale
	INTE = 1;
	ADCS1 = 0;		//select Fosc/8
	ADCS0 = 1;
	ADCON1=0;		// A/D port configuration 0
	ADFM = 1;		//right justified result
	ADON=1;			// porneste conversia A/D	
	T0IE=1;
	TMR0=0;				//initiere TMR0
	T0CS=0;				//clock intern
	T0SE=0;				//numarare pe front crescator
	PSA=0;				//utilizare prescaler
	PS0=1;				
	PS1=1;				//prescaler de 256
	PS2=1; 
	}

unsigned int read_adc(unsigned char channel)
{
	channel&=0x07;			// trunchiem canalul la 3 biti	
	ADCON0&=0xC5;			//eliberam canalul curent
	ADCON0|=(channel<<3);	// aplicam noul canal selectat
	DelayMs(10);
	ADGO=1;					//initiem conversia pe canalul selectat
	while(ADGO)continue;
	return(((ADRESH&0x03)<<8)+ADRESL);	// returneaza rezultat pe 10 biti
}

float temp_usf(void)
{
	int  i;
	float temp_an, temp, temp1;
	temp_an=0;
		for(i=0; i<4; i++)
		{
		temp_an =temp_an+read_adc(0);
		DelayMs(5);
		}
		temp_an=temp_an/4;
		
	temp =temp_an*((5.0*100.0)/1023.0);
	temp1=temp*100;
	
return(temp1);
}

float temp_umf(void)
{
	int  i;
	float temp_an, temp, temp2;
	temp_an=0;
		for(i=0; i<4; i++)
		{
		temp_an =temp_an+read_adc(1);
		DelayMs(5);
		}
		temp_an=temp_an/4;
		
	temp =temp_an*((5.0*100.0)/1023.0);
	temp2=temp*100;
	
return(temp2);
}

void InitUSART() //rutina de setare si initializare a modulului USART
{
//	SPBRG=64;	//19200 baud la 20 MHz
	SPBRG=25;	//9600 baud la 4 MHz
	BRGH=1;		//high speed
	SYNC=0;		//modul asincron
	SPEN=1;		//activare port serial

	TXIE=0;		//dezactivare intrerupere USART la transmisie
	TX9=0;		//transmisie pe 8 biti
	TXEN=1; 	//activare transmisie 

	RCIE=0;		//dezactivare intrerupere USART la receptie
	RX9=0;		//receptie pe 8 biti
	CREN=1; 	//activare receptie
}

void TransmitUSART(unsigned char c)	//Rutina de transmitere a unui octet la portul serial
{
	while(!TXIF);	//asteapta sa se termine transmisia precedenta
	TXREG=c;	//incarca si transmite noua valoare
}

void TransmitUSARTC(const char* c)
{
	int i =0;
	while(c[i]!=0x0 && c[i]!=0xd)
	{
		TransmitUSART(c[i]);
		i++;
	}
//	TransmitUSART(0xd);
}

unsigned char ReceiveUSART()	//Rutina pt receptia unui octet de la portul serial
{
	unsigned char c;							
	while(!RCIF);	//asteapta pana se incheie receptia
	c=RCREG;	//octetul receptionat este preluat din RCREG	
	return c;	
}

void afisare_usart(unsigned int i)
 {
	int zeci,unitati;
	zeci = i/10 + 48;
	unitati = i%10 + 48;
	while(!TXIF);
	TXREG = zeci;
	DelayMs(5);
	while(!TXIF);
	TXREG = unitati;
	
}

void afisfloat(long i)
{
	int nr1, nr2;
nr1=i/100;
nr2=i%100;
	if (nr2>0)
	{
	afisare_usart(nr1);
	TransmitUSARTC(",");
	afisare_usart(nr2);
	TransmitUSART(0xd);
	DelayUs(250);
	}
	else
		{
		afisare_usart(nr1);
		TransmitUSART(0xd);	
		DelayUs(250);
		} 
}

volatile int intoarce,count;

void interrupt isr(void) //este apelata cand este generata o intrerupere
{ 
 
  if(T0IF)//intreruperea este generata de timer0 ?
   {
      count++;
      if(count==152){ //de test , ar trebui sa seteze "intoarce" la 10 sec
         intoarce=1;
         count=0;
      }
      T0IF=0;//am procesat intreruperea, resetam flag-ul pentru a se putea apela din nou
   }
}


void main(void)
{
float temp_uscat,temp_umed,umid,dif,dif1;
int temp,sw,um;
long count;

   	
	initializari();
   	DelayUs(20);
   	InitUSART();
   	TRISB = 0x01;
   	TRISC = 0x80;
	TRISD = 0;

while(1)
{
	temp_umed=temp_umf();
	DelayUs(250);
	temp_uscat=temp_usf();
	DelayUs(250);
	dif=temp_uscat-temp_umed;
	dif1=dif/100;
	DelayUs(250);

	temp=temp_uscat/100;					
	if (temp < 38)							//daca temperatura scade sub 38 grade
			 RD6=1;							// pornesc rezistenta de nichelina	
			else 
			 RD6=0;
							
				TransmitUSARTC(" 1.Temperatura uscata este : ");
				afisfloat(temp_uscat);
				DelayUs(250);
				
				TransmitUSARTC(" 2.Temperatura umeda este : ");
				afisfloat(temp_umed);
			    DelayUs(250);

				TransmitUSARTC(" 3.Diferenta este : ");
				afisfloat(dif);
				DelayUs(250);
  
if ((dif1 < 5)  || (dif1 > 7)) umid=0;							// umiditatea se alege in functie 
	else if ((dif1 >= 5) && (dif1 < 5.5 )) umid=70;				// de diferenta dintre 
			else if((dif1 >= 5.5 ) && (dif1 < 6)) 	umid=65;		// cele doua temperaturi
				else if((dif1 >= 6) && (dif1 < 6.5)) umid=62;
						else umid=60;

				TransmitUSARTC(" 4.Umiditatea este : ");
				afisare_usart(umid);
				TransmitUSARTC("  %");TransmitUSART(0xd);	
				DelayUs(250);
			
	RD5=0;
	if(intoarce)
		{
      intoarce=0;
      RD5=1;
	  // DelayMs(1000);
   		}

 				 
DelayMs(1000);   DelayMs(1000);   DelayMs(1000); //delay ca sa mearga mai lent pe terminal afisarea
 } 
}

If anyone needs help with the comments...let me know...
But I need a lot of help...I am required to control the motors in asm...so If anyone has some code I could use..or some example...I would be very grateful!!

Thx in advance!
 
OK...since no one can help me with asm...maybe you can help me control the motors in C language...so if anyone has some code I could use...I would be very thankful !
 
I made some progress with my project but I reached a point where I need some help.
I am preparing to implement the project so it's not a school project anymore.
I replaced the serial transmission with a nokia 3310 lcd. For turning the eggs I will use a DC motor which will move a shaft up and down moving at the same time the egg racks. In the bottom and in the top of the shaft I will put 2 buttons which when are pushed generate an interrupt and stop the motion of the DC motor. In order to count the 8 hours I use timer 0 and I made a clock.I also have a counter in order to turn the eggs only for the first 18 days. Now I have some problems:
-If the electricity drops my uC will restart counting days from 0, is writing the number of days in EEPROM a good solution so I don't start again from day 1?
-Could someone suggest a battery system, or what should I do???
-And I also have a problem with the code...my interrupts don't work well...I don't know why...my clock count too fast and when I push the buttons to stop the DC motor they do nothing (the 2 interrupts are on RB0 and RB7).So I could really use another opinion on my code.
Also I welcome any suggestions or improvements.
I attach the code and a picture of the PROTEUS simulation.
Thank you in advance!
 

Attachments

  • INCUBATOR.JPG
    INCUBATOR.JPG
    250.3 KB · Views: 4,295
  • main_inc.c
    5.5 KB · Views: 905
Status
Not open for further replies.

Latest threads

Back
Top