Arduino Forum

Community => Exhibition / Gallery => Topic started by: gpop1 on Jul 28, 2017, 03:21 am

Title: chicken egg incubator control code
Post by: gpop1 on Jul 28, 2017, 03:21 am
This is a simply complicated code that covers what most people would require in a fully automated incubator setup.

As with most controller that are using a 20x4 lcd most of the code is controlling the display or trying to save space. This should according to the compiler fit on a uno but was written on a mega.

The hardware:

4x20 display
keypad 4 button
1307 rtc
dht22 temp/humidity sensor
8 ohm speaker (optional)
5 relays arduino type (optional depending on settings)
micro switchs (optional depending on turner design)
uno or meg


so what does it do:

controls temp, humidity, turner, alarms and more (about 40 options)

link to library for rtc

https://github.com/Seeed-Studio/RTC_DS1307/blob/master/examples/SetTimeAndDisplay/SetTimeAndDisplay.ino


main project write up including pictures will be posted on backyard chickens web site and linked back to here.
I will add the link when I have added all of the pictures and wiring diagrams there.


updated program please use incmaincode5.ino posted further down


Title: Re: chicken egg incubator control code
Post by: gpop1 on Jul 30, 2017, 08:23 pm
link to byc with the pics and wiring explained

https://www.backyardchickens.com/threads/arduino-incubator-controls-for-dummies.1189629/
Title: Re: chicken egg incubator control code
Post by: gpop1 on Jul 30, 2017, 08:26 pm
There are some small problems in the code posted

I used a pin that was reserved in case you wanted to use a uno instead of a mega. Also there was a typo on one screen so I will be double checking my work and posting a update in the next few days. If you are using a mega then it shouldn't make much difference
Title: Re: chicken egg incubator control code
Post by: gpop1 on Jul 31, 2017, 02:12 pm
update to fix pin usage for a uno: moved humidity relay to pin 10 to free up A4

added code to make the unit safe while in edit mode.


still looking for a hot spot probe that is plug and play as the DS18B20 requires some programming knowledge. I may just post a second code with this option for more advanced users
Title: Re: chicken egg incubator control code
Post by: jomasaco on Mar 26, 2018, 07:34 pm
gpopl Thanks.

Your code are very good.
Will try to do in prototype "missing the display", if succeed next step are to do an standalone board.
Title: Re: chicken egg incubator control code
Post by: jomasaco on May 13, 2018, 05:08 pm
gpopl im working on device, thanks again for you job.
bugs found so far:

Clock can set false data as 30/2/2018  next day 00/3/2018 this preaphes are whit the rtc library.
good also are when set the clock by definition show the current data
set_minute = constrain(set_minute, 1, 59); let say we are at minute 50 and want to set 52 already start in 50, i didnt find an solution.

missing some function to check the alarms values high lower temp; ex. set alarm high temp = 32Ç and lower 38 and the set_point are 37
i did this to set temp alarm
     case 26:
      if (highTempSetPoint <= temp_setpoint)
      {
      highTempSetPoint = (temp_setpoint + 2);
      highTempSetPoint = highTempSetPoint + 0.1;
      }
      if (highTempSetPoint <= lowTempAlarmPoint)
      {
         highTempSetPoint = (lowTempAlarmPoint + 5);
         highTempSetPoint = highTempSetPoint + 0.1;
      }
      else
      highTempSetPoint = highTempSetPoint + 0.1;
       break;
 

Thanks again, anything else i will post i love this code
Title: Re: chicken egg incubator control code
Post by: gpop1 on Jun 11, 2018, 03:03 am
not sure why I added

showclock();

in the min edit code

should have been

 lcd.print (F("set minute"));

That may be causing confusion as the first line would be what the rtc is set to and its not updated until you leave the menu.


not sure what the problem is with high and low temp set points as the code looks ok


void alarmcheck () {

  alarm_active = 0;
  if (adj_temp >= highTempSetPoint ) {
    alarm_active = 1;
    if (tempalarm == 1) {
      soundalarm = 1;
    } else {
      soundalarm = 0;
    }
  }
  if (adj_temp <= lowTempAlarmPoint) {
    alarm_active = 2;
    if (tempalarm == 1) {
      soundalarm = 1;
    } else {
      soundalarm = 0;
    }
  }


Your code looks like you are checking set points rather than adj_temp ( temp reading + or - calibration )

If the tempalarm is set to on then it should set of the alarm.
Title: Re: chicken egg incubator control code
Post by: gpop1 on Jun 11, 2018, 03:14 am
ok I see what you are saying. I thought than when you changed from F to C it should load the defaults as

temp_setpoint = 37.5;
highTempSetPoint = 39;
lowTempAlarmPoint = 33;

I never added no code to prevent the user from setting a point where it would be in alarm

Title: Re: chicken egg incubator control code
Post by: jcratovo on Aug 17, 2018, 11:03 am
Hello. I want to start this chicken egg incubator project but i could not get the library working. I am novice on programming and i understand nothing on c++. Someone can help to have all this ds1307 library as .zip file then i can include it to my library folder. Or someone can help me how to have this working? Thanks in advance
Title: Re: chicken egg incubator control code
Post by: hogen on Sep 10, 2018, 10:58 pm
hi together,

At first big thanks for the coding.
I hope this project is still alive.
Is that code also on github?

I found some issues, maybe copy and paste. --> sie the marked area  (2 times)

Code: [Select]
case 24:

          while (escape == 0) {
            checkeditbutton();
            buttons(8);
            set_month = constrain(set_[b]day[/b], 1, 12);
            lcd.setCursor(0, 0);
            lcd.print (F("set month"));
            lcd.setCursor(0, 1);
            lcd.print(standardText[0]);
            lcd.setCursor(0, 2);
            lcd.print (F("enter month"));
            addSpace(1);
            lcd.print (set_month);
            lcd.setCursor(0, 3);
            lcd.print(standardText[1]);
          }
          editMode = 0;
          clock_update = 1;
          break;
        case 25:

          while (escape == 0) {
            checkeditbutton();
            buttons(9);
            set_year = constrain(set_[b]day[/b], 2017, 2030);
            //set year here
            lcd.setCursor(0, 0);
            lcd.print (F("set year"));
            lcd.setCursor(0, 1);
            lcd.print(standardText[0]);
            lcd.setCursor(0, 2);
            lcd.print (F("enter year"));
            addSpace(1);
            lcd.print(set_year);
            lcd.setCursor(0, 3);
            lcd.print(standardText[1]);
          }



then i have an other problem mybe someone can support me in that case --> see Picture
is it possible to clear it first?

When you start the turner test it didnt start at counter 0 and increase to the target. It depends when you start the turner test  

I add my sketch. i changed the dht22 to an si7021 sensor.
Title: Re: chicken egg incubator control code
Post by: DANILOOLIVEIRA on Sep 20, 2018, 04:17 am
Olá ... referente ao esquema elétrico fiquei na duvida de como montar ...Alguém consegui ?
Muito Obrigado
Title: Re: chicken egg incubator control code
Post by: hogen on Sep 27, 2018, 02:23 pm
Hi
I'm also a beginner but i can read the code, but ist is not so easy to change it.
on the beginning of the code there are the definitions of the Pin's. so i think that is the easy part to change it to your layout. First i try also to use a different display (Oled with I2c protocol) but it is not so easy.

It seems that the programmer didn't follow that project so it would be difficult. I would say to you, buy that display. It is easier.

Can you correct your Picture for the egg turner?

Here are some explanations from the programmer for the egg turner function.
https://www.backyardchickens.com/threads/tilt-turner-electrical-diagrams-and-ideas.1152618/ (https://www.backyardchickens.com/threads/tilt-turner-electrical-diagrams-and-ideas.1152618/)

wish you good luck
Title: Re: chicken egg incubator control code
Post by: hogen on Sep 27, 2018, 02:33 pm
Olá ... referente ao esquema elétrico fiquei na duvida de como montar ...Alguém consegui ?
Muito Obrigado
I cant read it (because Pourtoguese, i'm German), but i use google translator.
Wiring of the pins is written in the code, for the relais it must be clear what you have to do, other wise it could be to dangerous (high voltage)

Title: Re: chicken egg incubator control code
Post by: jomasaco on Mar 19, 2019, 11:53 pm
Bug found in turnerCountForDisplay

if (prev_clock_day != clock.dayOfMonth) {
hatchCountUp++;
hatchDays = hatchDays - hatchCountUp;

let say hatch days are 19

first day:
hatchDays = 19
 hatchCountUp = 0
result=19

secound day:
hatchDays = 19
 hatchCountUp = 1
result=18

third day:
hatchDays = 18
 hatchCountUp = 2
result=16

in fact exist there an variable u isn't in use
int t1_hatch_days = 15;
Title: Re: chicken egg incubator control code
Post by: hoshag on Nov 11, 2019, 09:23 pm
ÌHi: Specify the connecting map of the parts and the number of pinsگ
Title: Re: chicken egg incubator control code
Post by: blueinkdemo on Jan 20, 2020, 10:32 pm
C:\Users\Onsepro\Documents\Arduino\libraries\EEPROM\EEPROM.cpp:24:19: fatal error: debug.h: No such file or directory

Multiple libraries were found for "EEPROM.h"
 #include "debug.h"

                   ^

compilation terminated.

 Used: C:\Users\Onsepro\Documents\Arduino\libraries\EEPROM
Multiple libraries were found for "DHT.h"
 Used: C:\Users\Onsepro\Documents\Arduino\libraries\DHT-sensor-library-master
Multiple libraries were found for "DS1307.h"
 Used: C:\Users\Onsepro\Documents\Arduino\libraries\RTC_DS1307-master
Multiple libraries were found for "Wire.h"
 Used: C:\Users\Onsepro\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\libraries\Wire
Multiple libraries were found for "LiquidCrystal_I2C.h"
 Used: C:\Users\Onsepro\Documents\Arduino\libraries\LiquidCrystal_I2C-master
exit status 1
Error compiling for board Arduino Due (Programming Port).





can say wat is the problem here
Title: Re: chicken egg incubator control code
Post by: blueinkdemo on Jan 20, 2020, 10:55 pm
C:\Users\Onsepro\Documents\Arduino\libraries\EEPROM\EEPROM.cpp:24:19: fatal error: debug.h: No such file or directory

Multiple libraries were found for "EEPROM.h"
#include "debug.h"

                  ^

compilation terminated.

Used: C:\Users\Onsepro\Documents\Arduino\libraries\EEPROM
Multiple libraries were found for "DHT.h"
Used: C:\Users\Onsepro\Documents\Arduino\libraries\DHT-sensor-library-master
Multiple libraries were found for "DS1307.h"
Used: C:\Users\Onsepro\Documents\Arduino\libraries\RTC_DS1307-master
Multiple libraries were found for "Wire.h"
Used: C:\Users\Onsepro\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.12\libraries\Wire
Not used: C:\Users\Onsepro\Documents\Arduino\libraries\Wire-master
Multiple libraries were found for "LiquidCrystal_I2C.h"
Used: C:\Users\Onsepro\Documents\Arduino\libraries\LiquidCrystal_I2C-master
exit status 1
Error compiling for board Arduino Due (Programming Port).




i got this error any idea guys
Title: Re: chicken egg incubator control code
Post by: leinad0206 on Mar 17, 2020, 03:42 am
Hi,

Hoping that this thread still active.

Can I have the link of libraries used in this project? I'm interested in making prototype of this, I have the hardwares but I don't know where I can find the libraries. Thanks in advance.

More power!!!!

Title: Re: chicken egg incubator control code
Post by: manhoosbilli1 on Apr 01, 2020, 05:40 am
Hi,

Can I have the link of libraries used in this project? I'm interested in making prototype of this, I have the hardwares but I don't know where I can find the libraries. Thanks in advance.



Hi, for all the people trying to copy this project and failing, it is expected. the code is not tailored towards an individual with a different setup. though the OP states in code that he has added many features we have to accept the fact that it is not beginner friendly.
Fortunately i have spent a good amount of time on this project. almost a year. just because it was my passion... i have found that the best way to recreate this project is to do it on your own while getting inspiration from the code.
I have set up a discord server where i can give you sufficient info about this project and we can solve the problems that are going to occur in the future... it is also a place for beginners to discuss ideas...i want people to produce real open source material regarding incubators. making incubators should not be this hard.
here's my discord link. drop by and say hi and ill try to help you out as much as i can.

https://discord.gg/E8b93vK

I have also succeded in recreating this project. here is the video:

https://www.youtube.com/watch?v=QkM2tHTfZXA

Regards
Title: Re: chicken egg incubator control code
Post by: Anita_Bath on Apr 07, 2020, 03:27 am
Where could I download the latest version of this egg incubator code so I can apply it to my current project?
Title: Re: chicken egg incubator control code
Post by: niq_ro on Apr 15, 2020, 03:03 pm
Hello,

I found few days ago about this project..
I developed a similar project, you can see:
- https://nicuflorica.blogspot.com/2017/05/sistem-de-automatizare-incubator-oua.html (https://nicuflorica.blogspot.com/2017/05/sistem-de-automatizare-incubator-oua.html)
- http://nicuflorica.blogspot.com/2020/04/sistem-de-automatizare-incubator-oua-2.html (http://nicuflorica.blogspot.com/2020/04/sistem-de-automatizare-incubator-oua-2.html)
(https://1.bp.blogspot.com/-iSa4rHR2Vxk/XpLoGdChLCI/AAAAAAAAb8k/3Nzwy9rq7VcETkjCWlbiNTdQ3YFGwbhQQCLcBGAsYHQ/s1600/incubator_v2.png)
video: https://www.youtube.com/watch?v=37WNEIlLhJc&t=66s (https://www.youtube.com/watch?v=37WNEIlLhJc&t=66s)
sketch: https://github.com/tehniq3/egg-incubator/blob/master/eggincubator_2.ino (https://github.com/tehniq3/egg-incubator/blob/master/eggincubator_2.ino)