Cedric UyttenhoveIben Braeckevelt
Published © GPL3+

HVAC

Heating ventilation and air-conditioning for a dome.

IntermediateWork in progress10 hours7,943
HVAC

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
MQ-2 gassensor
×1
DHT22 Temperature Sensor
DHT22 Temperature Sensor
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
IOTOPIA Rapid Development kit
AllThingsTalk IOTOPIA Rapid Development kit
×1

Software apps and online services

Arduino IDE
Arduino IDE
Siemens Solid Edge

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)
3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

HVAC

This is the heat exchanger , the threeway-valve and also we made something to attach the servo in the threeway-valve

Schematics

HVAC

It regulates the temperature humidity and gas ( later we will change this to a CO2 meter).

Code

Arduino code collect the data

Arduino
This program collect's the data from the sensors and send them to the serial port of a raspberry or any computer.
int sensorPin1 = 0;    // this is the analog inpunt for the sensor
int sensorPin2 = 1;
int Plant1 = 0;       // this is the starting value 
int Plant2 = 0;
int Moisture1 = 0;    // this is the starting value 
int Moisture2 = 0;
int MinMoisture = 30; // the min. moisture level 
int Valvepin1 = 8;      // the magnetic valve pin
int Valvepin2 = 7;      // the magnetic valve pin

void setup() {
  Serial.begin(9600);
  pinMode( sensorPin1 , INPUT);
  pinMode( sensorPin2 , INPUT);
  pinMode( Valvepin1 , OUTPUT);
  pinMode( Valvepin2 , OUTPUT);
}
void loop() {
  Plant1 = analogRead(sensorPin1);                 // this reads the sensor value a number between 398 and 1023
  Moisture1 = map( Plant1, 398, 1023, 100, 0);    // this maps the value in %
  Plant2 = analogRead(sensorPin2);                 // this reads the sensor value a number between 398 and 1023
  Moisture2 = map( Plant2, 398, 1023, 100, 0);    // this maps the value in %
  delay(5000);                                    // this is a little stop for the python program
  Serial.print(Moisture1);                        // this sends the values to the serial port
  Serial.print(" ");
  Serial.print(Moisture2);
  Serial.print('\n');
  if (Plant1 > MinMoisture)
{
    digitalWrite(Valvepin1, HIGH);                // opens the magnetic valve
}
  if (Plant2 > MinMoisture)
{
    digitalWrite(Valvepin2, HIGH);
}
}

Python

Python
This is a python program. This program is used to put the data from the arduino to the database.
import datetime                         # inserts a couple of modules
import time
import mysql
import sys
from mysql.connector import errorcode
import serial
fixed_interval = 5                      # makes an interval to pause the uploading (in seconds)
ser = serial.Serial('com3',9600)
while True: 
    
    # official log in protocol 
    cnx = mysql.connector.connect(user='', password='',
                              host='',
                              database='greenhouse')
    print(cnx)
    cursor = cnx.cursor()    
    
    try: 
        
        a,b = ser.readline().split()        # splits the arduino variables     
        
        today = datetime.datetime.today()   # gives the date of today
          # uploads our variables 
        cursor.execute("INSERT INTO temperature_inside (datetime,Bak1,Bak2) VALUES (%s,%s,%s)",(today,a,b))
        time.sleep(fixed_interval) # the rest of the program is the official way to commit and end it
        cnx.commit()
    except:
        pass
        print("error")
        ser.close()
        
    cursor.close()
    cnx.close()
    
    
    
print("Succesfully added to database")

HVAC

Arduino
LVG, LVB, TempW, TempR, COLR, COLW are LED's. We worked with the 'if command' and made every possible result. Because not everything is the same somethimes the ventilators don't have to work and somethimes the threeway valve has to change from direction, here we use the servo .
//Libraries
#include <DHT.h>;
#include <Servo.h>;
Servo servo ;


//Constants
#define DHTPIN 2     // what pin we're connected to
#define DHTTYPE DHT22   // DHT 22  (AM2302)


int LVB = 6;
int LVG= 7;
int TempR= 10;
int TempW= 11;
int ventilator= 8;
int ventilator2= 9;
int hoek = 0;
int sensor = A3;
int COLR =4  ;
int COLW =13 ;
int sensorValue= 0;



DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz Arduino



//Variables
int chk;

float hum;  //Stores humidity value
float temp; //Stores temperature value


void setup()
{
    Serial.begin(9600);
  dht.begin();
  pinMode(LVB,HIGH);
  pinMode(LVG,HIGH);
  pinMode(TempW,HIGH);
  pinMode(TempR,HIGH);
  pinMode(COLR,HIGH);
  pinMode(COLW,HIGH);
  pinMode(ventilator,HIGH);
  pinMode(ventilator2,HIGH);
  pinMode(sensor,INPUT);
  Serial.begin(9600);

  servo.attach(5); 
  servo.write(hoek);
 

  

}

void loop(){
int sensorValue= analogRead(sensor);

Serial.println(sensorValue);


    //Read data and store it to variables hum and temp
    hum = dht.readHumidity();
    temp= dht.readTemperature();
    //Print temp and humidity values to serial monitor
    Serial.print("Humidity: ");
    Serial.print(hum);
    Serial.print(" %, Temp: ");
    Serial.print(temp);
    Serial.println(" C");
    delay(2000); //Delay 2 sec.
if  (temp > 22)
if (hum >55)
if (sensorValue > 100)
{digitalWrite(TempR,HIGH);
digitalWrite(TempW,LOW);
digitalWrite(LVB,LOW);
digitalWrite(LVG,HIGH);
digitalWrite(ventilator,HIGH);
digitalWrite(ventilator2,HIGH);
digitalWrite(COLR,HIGH);
digitalWrite(COLW,LOW);
   for(hoek = 0;hoek < 105; hoek+=1);
  {                                
             
     servo.write(hoek);
     delay(10);
  }

}
if (temp < 22)
if (hum < 55 )
if (sensorValue < 100)
{digitalWrite(TempW,HIGH);
digitalWrite(TempR,LOW);
digitalWrite(LVG,LOW);
digitalWrite(LVB,HIGH);
digitalWrite(ventilator,LOW);
digitalWrite(ventilator2,LOW);
digitalWrite(COLW,HIGH);
digitalWrite(COLR,LOW);
 
   for(hoek = 105; hoek > 0 ; hoek-=1);
  {                                
             
     servo.write(hoek);
     delay(10);
  }

}

if (temp< 22)
if (hum > 55)
if (sensorValue<100)
{digitalWrite(LVB,HIGH);
digitalWrite(LVG,LOW);
digitalWrite(TempW,LOW);
digitalWrite(TempR,HIGH);
digitalWrite(ventilator2,HIGH);
digitalWrite(ventilator,HIGH);
digitalWrite(COLW,HIGH);
digitalWrite(COLR,LOW);

 for(hoek = 105; hoek > 10;hoek -=1);
  {                                
             
     servo.write(hoek);
     delay(10);
  }


}


if (temp> 22)
if (hum >55)
if (sensorValue< 100)
{digitalWrite(LVB,LOW);
digitalWrite(LVG,HIGH);
digitalWrite(TempW,LOW);
digitalWrite(TempR,HIGH);
digitalWrite(ventilator2,HIGH);
digitalWrite(ventilator,HIGH);
digitalWrite(COLW,HIGH);
digitalWrite(COLR,LOW);
    for(hoek = 0; hoek < 105; hoek+=1);
  {                                
             
     servo.write(hoek);
     delay(10);
  }

}

if (temp<22)
if (hum< 55)
if (sensorValue > 100)
{digitalWrite(LVB,HIGH);
digitalWrite(LVG,LOW);
digitalWrite(TempW,HIGH);
digitalWrite(TempR,LOW);
digitalWrite(ventilator2,HIGH);
digitalWrite(ventilator,HIGH);
digitalWrite(COLW,LOW);
digitalWrite(COLR,HIGH);
    for(hoek = 105; hoek > 10;hoek -=1);
  {                                
             
     servo.write(hoek);
     delay(10);
  }

}
 
if (temp> 22)
if (hum< 55)
if (sensorValue >  100)
{digitalWrite(LVB,LOW);
digitalWrite(LVG,HIGH);
digitalWrite(TempW,HIGH);
digitalWrite(TempR,LOW);
digitalWrite(ventilator2,HIGH);
digitalWrite(ventilator,HIGH);
digitalWrite(COLW,LOW);
digitalWrite(COLR,HIGH);
    for(hoek = 0; hoek < 105; hoek+=1);
  {                                
             
     servo.write(hoek);
     delay(10);
  }

}


if (temp > 22)
if (hum < 55)
if (sensorValue < 100)
{digitalWrite(LVB,LOW);
digitalWrite(LVG,HIGH);
digitalWrite(TempW,HIGH);
digitalWrite(TempR,LOW);
digitalWrite(ventilator2,HIGH);
digitalWrite(ventilator,HIGH);
digitalWrite(COLW,HIGH);
Serial.println("COLW");
digitalWrite(COLR,LOW);
    for(hoek = 0; hoek < 105;hoek +=1);
  {                                
             
     servo.write(hoek);
     delay(10);
  }
}
if (temp < 22)
if (hum > 55)
if (sensorValue > 100)
{digitalWrite(LVB, HIGH);
digitalWrite(LVG,LOW);
digitalWrite(TempW,LOW);
digitalWrite(TempR,HIGH);
digitalWrite(ventilator2,HIGH);
digitalWrite(ventilator,HIGH);
digitalWrite(COLW,LOW);
digitalWrite(COLR,HIGH);
    for(hoek = 105; hoek > 10;hoek -=1);
  {                                
             
     servo.write(hoek);
     delay(10);
}} }

Credits

Cedric Uyttenhove

Cedric Uyttenhove

1 project • 1 follower
Iben Braeckevelt

Iben Braeckevelt

-2 projects • 2 followers

Comments