Project showcase
The Baby Warmer (a Neonate Incubator Approach)

The Baby Warmer (a Neonate Incubator Approach) © CERN-OHL

First prototype of a fully functional neonate incubator for educational purposes. Still, a lot to get better, but hey, it works just fine!

  • 896 views
  • 3 comments
  • 12 respects

Components and supplies

About this project

This project is an aproach to understand how neonate incubator works. !!WARNING!! IT IS NOT SUPOUSED TO TAKE CARE OF ANY KIND OF LIFE, the purpose here is to understand the basics and get your project as better as possible, and of course have fun with it!!

This was made to represent the idea of low cost medical devices for a diploma work.

The main goal of this incubator is to mantain the temperature between a max and min temperature range, this temperature range can be managed with a 5-button control. The airflow is created with help of two fans that keep air flowing (two fans works at small velocity but one of them has an increased velocity switch in case of overwarming airflow), a ceramic warmer, a servo motor to open and close a gate that lets overwarmed air to flow outside the system, temperature and humidity sensors, a power supply and of course, our good Arduino Nano.

This project will be divided in several small projects in order to explain how to build each specific part that need special attention as the power controller and the button controller.

Code

Code for Arduino NanoC/C++
I am very sorry that this code lacks documentation but as soon as possible I will upload and upgrade to it, so you can edit it easily.
#include <LCD.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <SimpleDHT.h>
#include "RTClib.h"
#include <dht.h>
#include <Servo.h>

Servo myservo;

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);  //Set the LCD I2C address

//Digitals
const int pin1DHT22  = 2;   //Sensor humedad 1
const int Warmer     = 3;   //Relay 3
const int Fan_1      = 6;   //Relay 6 // Fan High
const int buzzer     = 4;   //Piezo sounder
const int button1    = 9;
const int button2    = 10;
const int button3    = 11;
const int button4    = 12;
const int button5    = 13;

//Analogs
const int inPinTh_1  = A1;  //Termistor 2
const int tempPin_1  = A2;  //lm35_1
const int tempPin_2  = A3;  //lm35_2

SimpleDHT22 dht22_1;
RTC_DS1307 RTC;

int temp_1, temp_2, DHT22Temp_1;
int errorSense_1, errorSense_2, count_1, count_2, count_3 = 0;

int menuScreen, menuScreenUseAlarm, menuScreenMode, menuScreenTempAlarm, menuScreenTemp, menuScreenHumid, mode, modeAlarm, manualSettings = 0;
bool back, next, select, up, down = 0;

float Temp1_Neonate, Temp2_Neonate, averageTemp_Neonate, lm35_1, lm35_2, coefWarmer, midleRangeTemp = 0;
int pursuedHigherT = 373;
int pursuedLowerT  = 365;

float upperTemp = 35;
float lowerTemp = 34;
float lowerTempComp = 0;

float upperTempAlarm = 37.5;
float lowerTempAlarm = 36.5;
float lowerTempCompAlarm = 0;

unsigned long currentMillis;
unsigned long previousMillis = 0; // last time update
long interval = 1000; // interval at which to do something (milliseconds)

unsigned long currentMillis_1;
unsigned long previousMillis_1 = 0; // last time update
long interval_1 = 2000; // interval at which to do something (milliseconds)

void setup()
{
  myservo.attach(1);
  myservo.write(122);   //Para flujo sobrecalentado
  delay(250);
  myservo.write(70);    //Flujo normal
  delay(250);
  myservo.write(122);
  delay(250);
  myservo.write(70);
  Wire.begin();
  RTC.begin();
  pinMode(Fan_1, OUTPUT);
  pinMode(Warmer, OUTPUT);
  pinMode(back, INPUT);
  pinMode(next, INPUT);
  pinMode(select, INPUT);
  pinMode(up, INPUT);
  pinMode(down, INPUT);

  pinMode(buzzer, OUTPUT);
  digitalWrite(buzzer, LOW);

  digitalWrite(Fan_1, LOW);
  digitalWrite(Warmer, LOW);

  lcd.begin(20, 4);            // initialize the lcd for 20 chars 4 lines and turn on backlight
  lcd.backlight();
  menuScreen_0();
  menuScreen_1();
  RTC.adjust(DateTime(__DATE__, __TIME__));
  // Check to see if the RTC is keeping time.  If it is, load the time from your computer.
  if (! RTC.isrunning()) {
    lcd.print("Change clock battery");
    // This will reflect the time that your sketch was compiled
    RTC.adjust(DateTime(__DATE__, __TIME__));
  }
}

void loop()
{
  currentMillis = millis();
  buttonState();

  switch (menuScreen) {
    case 0:
      menuScreen_UseAlarm();
      break;
    case 1:
      menuScreen_SetAlarm();
      break;
    case 2:
      menuScreen_Mode();
      break;
    case 3:
      Screen_Auto_intro();
      break;
    case 4:
      menuScreen_Temp();
      break;
    case 5:
      Alarms();
      currentMillis = millis();
      if (currentMillis - previousMillis > interval) {
        previousMillis = currentMillis;
        Screen_Auto();
      }
      break;
    case 6:
      Alarms();
      currentMillis = millis();
      if (currentMillis - previousMillis > interval) {
        previousMillis = currentMillis;
        Screen_Manual();
      }
      break;
  }

}


void mainScreen()
{
  currentMillis_1 = millis();

  lcd.setCursor(0, 0);
  lcd.print("Baby T ");  lcd.print(averageTemp(), 1); lcd.print((char)223); //lcd.print("C");
  lcd.setCursor(13, 0);
  lcd.print("WarmerT");
  lcd.setCursor(0, 1);
  lcd.print("Case T ");  lcd.print(templm35_1(), 1);  lcd.print((char)223); // Temp case lm35 1
  lcd.setCursor(14, 1);
  lcd.print(templm35_2(), 1); lcd.print((char)223);  // Temp warmer lm35 2
  lcd.setCursor(0, 2);
  lcd.print("Cham T ");
  if (currentMillis_1 - previousMillis_1 > interval_1) { // Importante para  dar ciclo de espera a los sensores de humidificacion
    previousMillis_1 = currentMillis_1; lcd.print(DHT22TempRead_1(), 1); lcd.print((char)223);
  }
  lcd.setCursor(0, 3);
  lcd.print("Man. mode");
  RelojParaPantallaSerial();


}

void RelojParaPantallaSerial()
{
  DateTime now = RTC.now();
  lcd.setCursor(12, 3);
  if (now.hour() < 10 ) {
    lcd.print("0");
    lcd.print(now.hour(), DEC);
  }
  else {
    lcd.print(now.hour(), DEC);
  }
  lcd.print(':');
  if (now.minute() < 10) {
    lcd.print("0");
    lcd.print(now.minute(), DEC);
  }
  else {
    lcd.print(now.minute(), DEC);
  }
  lcd.print(':');
  if (now.second() < 10) {
    lcd.print("0");
    lcd.print(now.second());
  }
  else {
    lcd.print(now.second(), DEC);
  }
}

void DHT22Sensor_1()   // DHT22 sampling rate is 0.5HZ.
{
  count_1 ++;
  if (count_1 > 1) {                   //Sets counting of 2 seconds
    count_1 = 0;
    byte temperature_1 = 0;
    byte humidity_1 = 0;
    int err_1 = dht22_1.read(pin1DHT22, &temperature_1, &humidity_1, NULL);
    if (err_1 != SimpleDHTErrSuccess) {
      errorSense_1 ++;
      if (errorSense_1 > 2) {      // Here we set the number of errors allowed untill display an error
        lcd.setCursor(10, 2);
        lcd.print("Error"); lcd.print(err_1); delay(1000);
        return;
      }
      return;
    }
    errorSense_1 = 0;              // Reset the counter if the errors in a row are not higher than errors allowed untill display an error
    DHT22Temp_1 = ((int)temperature_1);
    count_1 = 0;
  }
}

int DHT22TempRead_1()
{
  DHT22Sensor_1();
  return DHT22Temp_1;
}

float temperature_Neonate()  // CREAR ERROR DE TEMP
{
  float val1 = 0;
  for (int i = 0; i < 5; i++) {
    val1 = val1 + analogRead(inPinTh_1);
    delay(2);
  }
  Temp2_Neonate = val1 / 5;
  return Temp2_Neonate;
}

float templm35_1()
{
  float val2 = 0;
  for (int i = 0; i < 5; i++) {
    val2 = val2 + analogRead(tempPin_1);
    delay(2);
  }
  lm35_1 =  val2 / 5;
  lm35_1 = mapf(lm35_1, 284.5, 323, 30, 37);
  return lm35_1;
}

float templm35_2()
{
  float val3 = 0;
  for (int i = 0; i < 5; i++) {
    val3 = val3 + analogRead(tempPin_2);
    delay(2);
  }
  lm35_2 = val3 / 5;
  lm35_2 = mapf(lm35_2, 284.5, 323, 30, 37);
  return lm35_2;
}

double mapf(double x, double in_min, double in_max, double out_min, double out_max)
{
  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
}

float averageTemp()  // Average was with two thermometers
{
  averageTemp_Neonate = temperature_Neonate();
  averageTemp_Neonate = mapf(averageTemp_Neonate, 284.5, 323, 30, 37);
  return averageTemp_Neonate;
}

int int_templm35_1()
{
  int intlm35_1 = templm35_1();
  return intlm35_1;
}

int int_tempcase()
{
  int int_templm35_1_0 = templm35_1() * 10;
  return int_templm35_1_0;
}

int int_templm35_2()
{
  int intlm35_2 = templm35_2();
  return intlm35_2;
}

int int_templm35_2_0()
{
  int int_templm35_2_0 = templm35_2() * 10;
  return int_templm35_2_0;
}


////////////////////////////////////////////////////

void menuScreen_0 ()
{
  lcd.setCursor(0, 1);
  lcd.print("  The Baby Warmer.");
  delay(1000);
  lcd.setCursor(0, 3);
  lcd.print("Welcome!");
  delay(500);
  lcd.setCursor(15, 3);
  lcd.print("V 1.3");
  delay(1000);
  lcd.clear();
}

void menuScreen_1()
{
  lcd.setCursor(0, 0);
  lcd.print("The following menu");
  lcd.setCursor(0, 1);
  lcd.print("will help you to set");
  lcd.setCursor(0, 2);
  lcd.print("the incubator system");
  delay(3000);
  lcd.clear();
}

void menuScreen_UseAlarm()
{
  switch (menuScreenUseAlarm) {
    case 0:
      lcd.setCursor(0, 0);
      lcd.print("Activate neonate");
      lcd.setCursor(0, 1);
      lcd.print("temp. alarm?");
      if (modeAlarm == 0) {
        lcd.setCursor(0, 2);
        lcd.print("->");
      }
      else if (modeAlarm == 1) {
        lcd.setCursor(0, 3);
        lcd.print("->");
      }
      lcd.setCursor(2, 2);
      lcd.print("No");
      lcd.setCursor(2, 3);
      lcd.print("Yes");
      if (back) {
        back = 0;
      }
      else if (next) {
        if (modeAlarm == 0) {
          menuScreen = 2;
        }
        else if (modeAlarm == 1) {
          menuScreen = 1;
        }
        lcd.clear();
        delay(500);
        next = 0;
      }
      else if (select) {
        if (modeAlarm == 0) {
          menuScreen = 2;
        }
        else if (modeAlarm == 1) {
          menuScreen = 1;
        }
        lcd.clear();
        delay(500);
        select = 0;
      }
      else if (up) {
        modeAlarm = modeAlarm - 1;
        if (modeAlarm < 0) {
          modeAlarm = 1;
        }
        delay(100);
        lcd.setCursor(0, 2);
        lcd.print("  ");
        lcd.setCursor(0, 3);
        lcd.print("  ");
        up = 0;
      }
      else if (down) {
        modeAlarm = modeAlarm + 1;
        if (modeAlarm > 1) {
          modeAlarm = 0;
        }
        delay(100);
        lcd.setCursor(0, 2);
        lcd.print("  ");
        lcd.setCursor(0, 3);
        lcd.print("  ");
        down = 0;
      }
      break;
  }
}

void menuScreen_SetAlarm()
{
  switch (menuScreenTempAlarm) {
    case 0:
      lcd.setCursor(0, 0);
      lcd.print("Set the upper range");
      lcd.setCursor(0, 1);
      lcd.print("T=");
      lcd.setCursor(3, 1);
      lcd.print(upperTempAlarm, 1);
      lcd.print((char)223);
      lcd.print("C");
      lcd.setCursor(0, 2);
      lcd.print("Press select to");
      lcd.setCursor(0, 3);
      lcd.print("continue...");
      if (back) {
        back = 0;
        lcd.clear();
        delay(500);
        menuScreen = 0;
      }
      else if (next) {
        lowerTempCompAlarm = upperTempAlarm - 0.5;
        lowerTempAlarm = upperTempAlarm - 0.5;
        menuScreenTempAlarm = 1;
        lcd.clear();
        delay(500);
        next = 0;
      }
      else if (select) {
        lowerTempCompAlarm = upperTempAlarm - 0.5;
        lowerTempAlarm = upperTempAlarm - 0.5;
        menuScreenTempAlarm = 1;
        lcd.clear();
        delay(500);
        select = 0;
      }
      else if (up) {
        if (int_upperTempAlarm() >= 375) {
          upperTempAlarm = 37.5;
          lcd.setCursor(9, 1);
          lcd.print(" MAX TEMP");
          delay(1000);
          lcd.setCursor(9, 1);
          lcd.print("           ");
          return;
        }
        upperTempAlarm = upperTempAlarm + 0.1;
        lcd.setCursor(3, 1);
        lcd.print(upperTempAlarm, 1);
        up = 0;
      }
      else if (down) {
        if (int_upperTempAlarm() <= 320) {
          upperTempAlarm = 32;
          lcd.setCursor(10, 1);
          lcd.print("MIN RANGE");
          delay(1000);
          lcd.setCursor(9, 1);
          lcd.print("           ");
          return;
        }
        upperTempAlarm = upperTempAlarm - 0.1;
        lcd.setCursor(3, 1);
        lcd.print(upperTempAlarm, 1);
        down = 0;
      }
      break;


    case 1:
      lcd.setCursor(0, 0);
      lcd.print("Set the lower range");
      lcd.setCursor(0, 1);
      lcd.print("T=");
      lcd.setCursor(3, 1);
      lcd.print(lowerTempAlarm, 1);
      lcd.print((char)223);
      lcd.print("C");
      lcd.setCursor(0, 2);
      lcd.print("Press select to");
      lcd.setCursor(0, 3);
      lcd.print("continue...");

      if (back) {
        menuScreenTempAlarm = 0;
        lcd.clear();
        delay(200);
        back = 0;
      }
      else if (next) {
        menuScreenTempAlarm = 2;
        next = 0;
        lcd.clear();
        delay(500);
      }
      else if (select) {
        menuScreenTempAlarm = 2;
        select = 0;
        lcd.clear();
        delay(500);
      }
      else if (up) {
        if (int_lowerTempAlarm() >= (int_upperTempAlarm() - 5)) {
          lowerTempAlarm = lowerTempCompAlarm;
          lcd.setCursor(9, 1);
          lcd.print(" MIN RANGE");
          delay(1000);
          lcd.setCursor(9, 1);
          lcd.print("          ");
          return;
        }
        lowerTempAlarm = lowerTempAlarm + 0.1;
        lcd.setCursor(3, 1);
        lcd.print(lowerTempAlarm, 1);
        up = 0;
      }
      else if (down) {
        if (int_lowerTempAlarm() <= 280) {
          lowerTempAlarm = 28;
          lcd.setCursor(10, 1);
          lcd.print("MIN TEMP");
          delay(1000);
          lcd.setCursor(9, 1);
          lcd.print("         ");
          return;
        }
        lowerTempAlarm = lowerTempAlarm - 0.1;
        lcd.setCursor(3, 1);
        lcd.print(lowerTempAlarm, 1);
        down = 0;
      }
      break;

    case 2:
      lcd.setCursor(0, 0);
      lcd.print("Upper limit: ");
      lcd.setCursor(0, 1);
      lcd.print("T=");
      lcd.setCursor(3, 1);
      lcd.print(upperTempAlarm, 1);
      lcd.print((char)223);
      lcd.print("C");
      lcd.setCursor(0, 2);
      lcd.print("Lower limit:");
      lcd.setCursor(0, 3);
      lcd.print("T=");
      lcd.setCursor(3, 3);
      lcd.print(lowerTempAlarm, 1);
      lcd.print((char)223);
      lcd.print("C");
      lcd.setCursor(9, 3);
      lcd.print("  Continue?");
      if (back) {
        menuScreenTempAlarm = 1;
        lcd.clear();
        delay(200);
        back = 0;
      }
      else if (next) {
        menuScreen = 2;
        next = 0;
        lcd.clear();
        delay(500);
      }
      else if (select) {
        menuScreen = 2;
        select = 0;
        lcd.clear();
        delay(500);
      }
      else if (up) {
        up = 0;
      }
      else if (down) {
        down = 0;
      }
  }

}

void menuScreen_Mode()
{
  switch (menuScreenMode) {
    case 0:
      lcd.setCursor(0, 0);
      lcd.print("Select the mode:");

      if (mode == 0) {
        lcd.setCursor(0, 2);
        lcd.print("->");
      }
      else if (mode == 1) {
        lcd.setCursor(0, 3);
        lcd.print("->");
      }
      lcd.setCursor(2, 2);
      lcd.print("Skin mode     aut.");
      lcd.setCursor(2, 3);
      lcd.print("Temp setting  man.");
      if (back) {
        back = 0;
        lcd.clear();
        delay(500);
        menuScreenTempAlarm = 0;
        menuScreen = 0;
      }
      else if (next) {
        if (mode == 0) {
          menuScreen = 3;
        }
        else if (mode == 1) {
          menuScreen = 4;
        }
        lcd.clear();
        delay(500);
        next = 0;
      }
      else if (select) {
        if (mode == 0) {
          menuScreen = 3;
        }
        else if (mode == 1) {
          menuScreen = 4;
        }
        lcd.clear();
        delay(500);
        select = 0;
      }
      else if (up) {
        mode = mode - 1;
        if (mode < 0) {
          mode = 1;
        }
        delay(100);
        lcd.setCursor(0, 2);
        lcd.print("  ");
        lcd.setCursor(0, 3);
        lcd.print("  ");
        up = 0;
      }
      else if (down) {
        mode = mode + 1;
        if (mode > 1) {
          mode = 0;
        }
        delay(100);
        lcd.setCursor(0, 2);
        lcd.print("  ");
        lcd.setCursor(0, 3);
        lcd.print("  ");
        down = 0;
      }
      break;
  }
}

void Screen_Auto_intro()
{
  lcd.setCursor(0, 0);
  lcd.print("This mode will try");
  lcd.setCursor(0, 1);
  lcd.print("to stabilize the");
  lcd.setCursor(0, 2);
  lcd.print("neonate temperature");
  lcd.setCursor(0, 3);
  lcd.print("between 36.5 & 37.3");
  delay(3000);
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("The supervision of");
  lcd.setCursor(0, 1);
  lcd.print("the neonate is ");
  lcd.setCursor(0, 2);
  lcd.print("mandatory at small");
  lcd.setCursor(0, 3);
  lcd.print("lapses. 5~10 mins");
  delay(3000);
  lcd.clear();
  menuScreen = 5;
}

void menuScreen_Temp()
{

  switch (menuScreenTemp) {
    case 0:
      lcd.setCursor(0, 0);
      lcd.print("Set the upper range");
      lcd.setCursor(0, 1);
      lcd.print("T=");
      lcd.setCursor(3, 1);
      lcd.print(upperTemp, 1);
      lcd.print((char)223);
      lcd.print("C");
      lcd.setCursor(0, 2);
      lcd.print("Press select to");
      lcd.setCursor(0, 3);
      lcd.print("continue...");
      if (back) {
        back = 0;
        menuScreen = 0;
      }
      else if (next) {
        lowerTempComp = upperTemp - 1;
        lowerTemp = upperTemp - 1;
        menuScreenTemp = 1;
        lcd.clear();
        delay(500);
        next = 0;
      }
      else if (select) {
        lowerTempComp = upperTemp - 1;
        lowerTemp = upperTemp - 1;
        menuScreenTemp = 1;
        lcd.clear();
        delay(500);
        select = 0;
      }
      else if (up) {
        if (int_upperTemp() >= 370) {
          upperTemp = 37;
          lcd.setCursor(9, 1);
          lcd.print(" MAX TEMP");
          delay(1000);
          lcd.setCursor(9, 1);
          lcd.print("           ");
          return;
        }
        upperTemp = upperTemp + 0.1;
        lcd.setCursor(3, 1);
        lcd.print(upperTemp, 1);
        up = 0;
      }
      else if (down) {
        if (int_upperTemp() <= 310) {
          upperTemp = 31;
          lcd.setCursor(10, 1);
          lcd.print("MIN RANGE");
          delay(1000);
          lcd.setCursor(9, 1);
          lcd.print("           ");
          return;
        }
        upperTemp = upperTemp - 0.1;
        lcd.setCursor(3, 1);
        lcd.print(upperTemp, 1);
        down = 0;
      }
      break;


    case 1:
      lcd.setCursor(0, 0);
      lcd.print("Set the lower range");
      lcd.setCursor(0, 1);
      lcd.print("T=");
      lcd.setCursor(3, 1);
      lcd.print(lowerTemp, 1);
      lcd.print((char)223);
      lcd.print("C");
      lcd.setCursor(0, 2);
      lcd.print("Press select to");
      lcd.setCursor(0, 3);
      lcd.print("continue...");

      if (back) {
        menuScreenTemp = 0;
        lcd.clear();
        delay(200);
        back = 0;
      }
      else if (next) {
        menuScreenTemp = 2;
        next = 0;
        lcd.clear();
        delay(500);
      }
      else if (select) {
        menuScreenTemp = 2;
        select = 0;
        lcd.clear();
        delay(500);
      }
      else if (up) {
        if (int_lowerTemp() >= (int_upperTemp() - 10)) {
          lowerTemp = lowerTempComp;
          lcd.setCursor(9, 1);
          lcd.print(" MIN RANGE");
          delay(1000);
          lcd.setCursor(9, 1);
          lcd.print("          ");
          return;
        }
        lowerTemp = lowerTemp + 0.1;
        lcd.setCursor(3, 1);
        lcd.print(lowerTemp, 1);
        up = 0;
      }
      else if (down) {
        if (int_lowerTemp() <= 300) {
          lowerTemp = 30;
          lcd.setCursor(10, 1);
          lcd.print("MIN TEMP");
          delay(1000);
          lcd.setCursor(9, 1);
          lcd.print("         ");
          return;
        }
        lowerTemp = lowerTemp - 0.1;
        lcd.setCursor(3, 1);
        lcd.print(lowerTemp, 1);
        down = 0;
      }
      break;

    case 2:
      lcd.setCursor(0, 0);
      lcd.print("Upper limit: ");
      lcd.setCursor(0, 1);
      lcd.print("T=");
      lcd.setCursor(3, 1);
      lcd.print(upperTemp, 1);
      lcd.print((char)223);
      lcd.print("C");
      lcd.setCursor(0, 2);
      lcd.print("Lower limit:");
      lcd.setCursor(0, 3);
      lcd.print("T=");
      lcd.setCursor(3, 3);
      lcd.print(lowerTemp, 1);
      lcd.print((char)223);
      lcd.print("C");
      lcd.setCursor(9, 3);
      lcd.print("  Continue?");
      if (back) {
        menuScreenTemp = 1;
        lcd.clear();
        delay(200);
        back = 0;
      }
      else if (next) {
        menuScreen = 6;
        next = 0;
        lcd.clear();
        delay(500);
      }
      else if (select) {
        menuScreen = 6;
        select = 0;
        lcd.clear();
        delay(500);
      }
      else if (up) {
        up = 0;
      }
      else if (down) {
        down = 0;
      }
  }

}

void Screen_Auto() {
  Screen_Auto_S();
  warmerParameters_Auto();
}

void Screen_Auto_S()
{
  currentMillis_1 = millis();

  lcd.setCursor(0, 0);
  lcd.print("Baby T ");  lcd.print(averageTemp(), 1); lcd.print((char)223); //lcd.print("C");
  lcd.setCursor(13, 0);
  lcd.print("WarmerT");
  lcd.setCursor(0, 1);
  lcd.print("Case T ");  lcd.print(templm35_1(), 1);  lcd.print((char)223); // Temp case lm35 1
  lcd.setCursor(14, 1);
  lcd.print(templm35_2(), 1); lcd.print((char)223);  // Temp warmer lm35 2
  lcd.setCursor(0, 2);
  lcd.print("Purs Baby T ");
  lcd.print("37.3"); lcd.print((char)223);
  lcd.setCursor(0, 3);
  lcd.print("Aut. mode");
  RelojParaPantallaSerial();



}

void Screen_Manual()
{
  mainScreen();
  warmerParameters_Manual();
}

void warmerParameters_Auto()
{
   switch (manualSettings) {
    case 0:
      if (int_tempcase() <= int_lowerTemp()) {
        digitalWrite(Warmer, HIGH);
      }
      else if (int_tempcase() > int_lowerTemp()) {
        manualSettings++;
        digitalWrite(Warmer, LOW);
      }

    case 1:
      if (int_tempcase() <= pursuedLowerT) {
        digitalWrite(Warmer, HIGH);
        delay(400);
        digitalWrite(Warmer, LOW);
        delay(300);
      }
      else if (int_tempcase() >= pursuedHigherT) {
        digitalWrite(Warmer, LOW);
        digitalWrite(Fan_1, HIGH);
        myservo.write(122);   //Para flujo sobrecalentado
        delay(2500);                                                           //Variable de tiempo de enfriamiento, a mas tiempo, mas frio
        digitalWrite(Fan_1, LOW);
        myservo.write(70);
        delay(1000);
      }
  }
}

void warmerParameters_Manual()
{
  switch (manualSettings) {
    case 0:
      if (int_tempcase() <= int_lowerTemp()) {
        digitalWrite(Warmer, HIGH);

      }
      else if (int_tempcase() > int_lowerTemp()) {
        manualSettings++;
        digitalWrite(Warmer, LOW);
      }

    case 1:
      if (int_tempcase() <= int_upperTemp()) {
        digitalWrite(Warmer, HIGH);
        delay(400);
        digitalWrite(Warmer, LOW);
        delay(300);
      }
      else if (int_tempcase() >= int_upperTemp()) {
        digitalWrite(Warmer, LOW);
        digitalWrite(Fan_1, HIGH);
        myservo.write(122);   //Para flujo sobrecalentado
        delay(2500);                                                           //Variable de tiempo de enfriamiento, a mas tiempo, mas frio
        digitalWrite(Fan_1, LOW);
        myservo.write(70);
        delay(1000);
      }
  }
}

void Alarms()
{
  if (modeAlarm == 1)
  {
    if (averageTemp() < lowerTempAlarm || averageTemp() > upperTempAlarm)
    {
      digitalWrite(buzzer, HIGH);
      delay(150);
      digitalWrite(buzzer, LOW);
      delay(100);

    }
  }
  else {
    digitalWrite(buzzer, LOW);
  }
}

void buttonState()
{
  back = digitalRead(button1);
  next = digitalRead(button2);
  select = digitalRead(button3);
  up = digitalRead(button4);
  down = digitalRead(button5);

  if (back == HIGH) {
    delay(150);
  }

  if (next == HIGH) {
    delay(150);
  }

  if (select == HIGH) {
    delay(150);
  }

  if (up == HIGH) {
    delay(150);
  }

  if (down == HIGH) {
    delay(150);
  }
}

int int_upperTemp()
{
  int int_upperTemp = upperTemp * 10;
  return int_upperTemp;
}

int int_lowerTemp()
{
  int int_lowerTemp = lowerTemp * 10;
  return int_lowerTemp;
}

int int_midleRangeTemp()
{
  int int_midleRangeTemp = midleRangeTemp * 10;
  return int_midleRangeTemp;
}

int int_coefWarmer()
{
  int int_coefWarmer = coefWarmer * 10;
  return int_coefWarmer;
}

int int_upperTempAlarm()
{
  int int_upperTempAlarm = upperTempAlarm * 10;
  return int_upperTempAlarm;
}

int int_lowerTempAlarm()
{
  int int_lowerTempAlarm = lowerTempAlarm * 10;
  return int_lowerTempAlarm;
}

Schematics

Simplified diagram
This diagram content the following:
1. 220V cable
2. Power source 220v to 24V @ 4A
3. Arduino Nano
4. I2C 20x4 LCD
5. Power controller for fans and warmer
6. 5-button control
7. Ceramic warmer
8. Lm 35 temperature sensor
9. DHT22 humidity and temperature sensor
10. 12V computer fan
11. Small servo motor.
12. Big plastic box
Dibujo corregido 6f1xow6atb
Arduino diagram
The Arduino connections to peripherals.
Imagen proyectoaaaa x5zq9askhl
Power management
The two independent lines were made experimentally to check if the helped to avoid some noises, but they did not :) So you can use just one.
Imagen proyectoaaaaa mgxg2ue3v3
Amplification stages and voltage follower
Voltage follower is used to have better signal from thermistors and the OpAmps to expand the Lm35 readable range in Arduino
Imagen proyectoaaaaaa mdiy6l5ne1
5-button module
Here is a simple 5-button controller
Imagen proyectoaaaaaaa zmrd58e8ic
Power control of fans and ceramic warmer
Imagen proyectoaaaaaaaa nlhlwyzftt

Comments

Similar projects you might like

Low-Cost Laser-Cut Incubator for Microbiology

Project in progress by Biomaker Challenge 2017: Team 41

  • 1,024 views
  • 0 comments
  • 8 respects

Egg Incubator

Project showcase by quantenschaum

  • 4,870 views
  • 4 comments
  • 10 respects

Automatic Baby Rocker!

Project showcase by SindreKragsrud

  • 996 views
  • 0 comments
  • 7 respects

Cool Baby Piano

Project showcase by Team cool guys

  • 812 views
  • 0 comments
  • 1 respect

Message Box Influence for Non-Disabled

Project in progress by 5 developers

  • 857 views
  • 0 comments
  • 8 respects

Using FreeRTOS Semaphores in Arduino IDE

by Phillip Stevens

  • 13,416 views
  • 8 comments
  • 24 respects
Add projectSign up / Login