Biofab Incubator

Low cost programmable incubator for growing mycelium textile, controlling temperature and humidity to standardize growing recipes.

IntermediateWork in progress326
Biofab Incubator

Things used in this project

Hardware components

Arduino Wifi Shield 101
Arduino Wifi Shield 101
×1
peltier mode TEC
×2
Air cooler
component to take heat outside de Incubator
×2
Fan / Force Cooled Heat Sink
component to dissipate temperature inside Incub
×2
Rotary Potentiometer, 10 kohm
Rotary Potentiometer, 10 kohm
1 for LCD brightness, 1 for set T°, 1 for set H%
×3
RGB LCD Shield Kit, 16x2 Character Display
RGB LCD Shield Kit, 16x2 Character Display
×1
Humidity & Temperature sensor HDC1080
×1
Piezoelectric Film Sensor, Shielded
Piezoelectric Film Sensor, Shielded
humidifier
×1

Hand tools and fabrication machines

Acrylic 2mm
expanded polystyrene sheet 50mm
MDF wood board 9mm
Laser cutter (generic)
Laser cutter (generic)
chloroform
for acrylic bounding
Hot glue gun (generic)
Hot glue gun (generic)

Story

Read more

Custom parts and enclosures

Hatching door MDF 3mm

for laser cutter.
Inside face acrylic 3mm

Upper Cover Acrylic 3mm

Exterior enclousure of electronic components for laser cutter.

Inner box Acrylic 2mm

inner box for incubation for laser cutter

Exterior enclosure MDF 9mm

For router CNC or manual cutting

Intermediate box (insulation) polyestirene 50mm

For manual cutting

Schematics

Humidity and Temperature Control

Workflow of the diagram for changing Temperature and Humidity (t2 and h2) inside the incubator based on the user selections (inputs t1 and h1).

Code

Save data in Server

PHP
This file connects to the database and saves every 10 min the T and H.
<?php
 // file.php
 $dbhost = "server";
 $dbuser = "username";
 $dbpass = "password";
 $dbname = "dbname";
 //Conexion con la base de datos
 $con = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
if (mysqli_connect_errno())
  {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }

 // Leemos los valores que nos llegan por GET

 $temp = mysqli_real_escape_string($con, $_GET['temp']);
 $humedad = mysqli_real_escape_string($con, $_GET['humedad']);
 $sensorID = mysqli_real_escape_string($con, $_GET['sid']);
 date_default_timezone_set("America/Santiago");

 $fecha =  date("d-m-Y");
 $hora = date('h:i:s');
 // E Insertamos los valores en la tabla


 $query = "INSERT INTO valores(temp, humedad,sensorID,fecha,hora) VALUES('$temp','$humedad','$sensorID','$fecha','$hora')";
 // Ejecutamos la instruccion
 mysqli_query($con, $query);

 mysqli_close($con);
?>

View Data as table

PHP
Here you can see the results with bootstrap
<!DOCTYPE html>
<!-- saved from url=(0054)https://getbootstrap.com/docs/4.0/examples/dashboard/# -->
<html lang="en">
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
      <meta name="description" content="">
      <meta name="author" content="">
      <link rel="icon" href="https://getbootstrap.com/favicon.ico">
      <title>Dashboard Template for Bootstrap</title>
      <!-- Bootstrap core CSS -->
      <link href="https://getbootstrap.com/docs/4.0/dist/css/bootstrap.min.css" rel="stylesheet">
   </head>
   <body>
      <div class="container-fluid">
         <div class="row">
            <main role="main" class="col-md-12 ml-sm-auto col-lg-12 pt-3 px-4">
               <h2>Resultados</h2>
               <div class="table-responsive">
                  <table class="table table-striped table-sm">
                     <thead>
                        <tr>
                           <th>#ID</th>
                           <th>Temperatura</th>
                           <th>Húmedad</th>
                           <th>Fecha</th>
                           <th>Hora</th>
                        </tr>
                     </thead>
                     <tbody>
                        <?php
                           require("config.php");
                           
                           if (mysqli_connect_errno())
                            {
                            echo "Failed to connect to MySQL: " . mysqli_connect_error();
                            }
                           
                           
                           $query = "SELECT id,temp,humedad,fecha,hora FROM valores ORDER BY id DESC";
                           
                           
                           $result = $con->query($query);
                           
                           if ($result->num_rows > 0) {
                              // output data of each row
                              while($row = $result->fetch_assoc()) {
                                  echo '<tr>';
                                  echo "<td>ID: ".$row['id']."</td><td>". $row['temp']."</td><td>".$row['humedad']."</td><td>".$row['fecha']."</td><td>".$row['hora']."</td>";
                                  echo '</tr>';
                           
                              }
                           } else {
                              echo "0 results";
                           }
                           
                           
                           
                           
                           // Free result set
                           mysqli_free_result($result);
                           mysqli_close($con);
                           ?>
                     </tbody>
                  </table>
               </div>
            </main>
         </div>
      </div>
      <!-- Bootstrap core JavaScript
         ================================================== -->
      <!-- Placed at the end of the document so the pages load faster -->
      <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
      <script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery-slim.min.js"><\/script>')</script>
      <script src="../../assets/js/vendor/popper.min.js"></script>
      <script src="../../dist/js/bootstrap.min.js"></script>
      <!-- Icons -->
   </body>
</html>

Arduino Biofab Incubator

Arduino
Temperature and Humidity Sensors, Potentiometer and wifi to server
/*   
BioFab
*/
//#include <Wire.h>
#include "ClosedCube_HDC1080.h"
#include <LiquidCrystal_I2C.h>

//LCD
//this part isn't ready yet
/*
int lcdColumns = 16;
int lcdRows = 2;
LiquidCrystal_I2C lcd(0x27, lcdColumns, lcdRows);
*/

//Wifi
#include <ESP8266WiFi.h>

const char * ssid = "wifi-name";
const char * password = "wifi-password";
const char * host = "server-ip";

//Humidity Sensor
ClosedCube_HDC1080 hdc1080;

//Control and time variables
int ledState = LOW; //relay simulator signal
unsigned long previousBlink = 0;
long blinkInterval = 30000;
unsigned long previousMillis = 0;
long interval = 600000; //  30*60*1000 cada 30 min (en milisegundos )


//variables Hdc1080
double temp;
double rh;

//potentiometer, set Temperature
int inputPotTemp = 0; // value read from the pot
int outputPotValue = 0; // value output to the PWM (analog out)

//variables SQL
double temperature;
double humidity;

// ID del ESP 
String sensorID = String(ESP.getChipId());

void setup() {
    //LCD
    //this part isn't ready yet
    /*Wire.begin(16,17);
    pinMode(D0, OUTPUT); //Declare Pin mode
    
    lcd.begin(16,2);
    lcd.init();                      // initialize the lcd 
    lcd.backlight();
    */
    //Serial
    Serial.begin(115200);
    Serial.println("REBOOT");

    //Read info 
    // Start hdc1080 sensor
    hdc1080.begin(0x40);
    Serial.print("Manufacturer ID=0x");
    Serial.println(hdc1080.readManufacturerId(), HEX); // 0x5449 ID of Texas Instruments
    Serial.print("Device ID=0x");
    Serial.println(hdc1080.readDeviceId(), HEX); // 0x1050 ID of the device

    //LED -> RELAY SIMULATOR
    pinMode(D7, OUTPUT);

    //POTENCIOMETER
    pinMode(A0, INPUT);


    //WIfi connect
    Serial.println();
    Serial.print("Connecting to ");
    Serial.println(ssid);

    WiFi.begin(ssid, password);

    while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
    }

    Serial.println("");
    Serial.println("WiFi connected");
    Serial.println("IP address: ");
    Serial.println(WiFi.localIP());
    Serial.print("EspID: ");
    Serial.println(sensorID);

}

void loop() {
    //LCD setup
    //this part isn't ready yet
    /*
    backlightOn();
    selectLineOne();
    Serial.print("Hello World");
    delay(1500);
    clearLCD();
    */


    //Get data from Potentiometer
    inputPotTemp = analogRead(A0);
    outputPotValue = map(inputPotTemp, 10, 150, 30, 10);
    Serial.print("Temp Selected: ");
    Serial.println(outputPotValue);


    // Get temp and humidity from 1080
    temp = hdc1080.readTemperature();
    rh = hdc1080.readHumidity();

    // Pass readings
    temperature = temp;
    humidity = rh;

    //send info to LCD
    //this part isn't ready yet
    /*
    lcd.clear();
    lcd.print("T Sel:"+String(outputPotValue)+" T Inc:" + String(temperature));
    */

    if (temperature >= outputPotValue) {
        digitalWrite(D7, LOW);
    } else {
        digitalWrite(D7, HIGH);
    }
    Serial.print("Temp Inc: ");
    Serial.println(temperature);
    Serial.print("Hm Inc: ");
    Serial.print(humidity);
    Serial.println("%");

    //Subir los datos (temp hum)a la base 
    if (previousMillis == 0 || (currentMillis - previousMillis >= interval)) {
        previousMillis = currentMillis;
        upload();
    }
}

void upload() {

    Serial.print("Temperatura: ");
    Serial.print(temperature);
    Serial.print(" Humedad: ");
    Serial.print(humidity);
    Serial.println();
    Serial.print("connecting to ");
    Serial.println(host);

    // Use WiFiClient class to create TCP connections
    WiFiClient client;
    const int httpPort = 80;
    if (!client.connect(host, httpPort)) {
        Serial.println("connection failed");
        blinkInterval = 1000; //1000
        return;
    }
    blinkInterval = 1000;
    // We now create a URL for the request
    String url = "url/file.php";
    String key = "?pass=****";
    String sid = "&sid=";
    String dato1 = "&temp=";
    String dato2 = "&humedad=";
    Serial.print("Requesting URL: ");
    Serial.println(url);

    client.print(String("GET ") + url + key + sid + sensorID + dato1 + temperature + dato2 + humidity + " HTTP/1.1\r\n" +
        "Host: " + /*host*/ +"\r\n" +
        "Connection: close\r\n\r\n");
    unsigned long timeout = millis();

    while (client.available() == 0) {
        if (millis() - timeout > 15000) {
            Serial.println(">>> Client Timeout !");
            client.stop();
            return;
        }
    }

    // Read all the lines of the reply from server and print them to Serial
    while (client.available()) {
        String line = client.readStringUntil('\r');
        Serial.print(line);
    }

    Serial.println();
    Serial.println("closing connection");
}

Credits

Catalina De Pablo

Catalina De Pablo

1 project • 2 followers
Sebastian Ignacio Rodriguez Jara

Sebastian Ignacio Rodriguez Jara

1 project • 2 followers
Guillermo Santiago Aviles Riquelme

Guillermo Santiago Aviles Riquelme

0 projects • 1 follower
Claudia Gaete

Claudia Gaete

0 projects • 2 followers

Comments