Проект недоступен для бесплатного скачивания! Если вы заинтересованы в приобретении программной части проекта с функциями, описанными на данной странице, свяжитесь с: martinius96@gmail.com
Arduino Ethernet монитор температура влажность отопление PHP MySQL

Мониторинг температуры, влажности, входов и выходов в доме - Попробуйте онлайн ЗДЕСЬ!


Системные модули:

  • Модуль 1 - Квартира - Запись 12x температуры (2x DHT22, 1x BME280, 1x SHT21, 8x DS18B20 [4x шина OneWire]), 4x влажность воздуха (2x DHT22, 1x BME280, 1x SHT21) - связь через OneWire, шину I2C
  • Модуль 2 - Котельная - 16-кратная запись температуры (16x DS18B20 [7x OneWire Bus]), 8x цифровой вход (5 В), 8x цифровой выход (5 В) - сенсорная связь через шину OneWire
  • Веб интерфейс:

  • Модули интегрированы в веб-интерфейс, где данные модуля визуализируются пользователем вместе с системой входа в систему.
  • Веб-интерфейс позволяет хранить данные из отдельных модулей в базе данных MySQL.
  • Пользователь может изменить названия комнат, в которых расположены датчики на странице.
  • Выходами можно управлять в ручном и автоматическом режиме на основе заданной температуры от контрольного термометра.
  • Выходы позволяют управлять электромагнитными клапанами радиатора через реле.
  • Веб-интерфейс визуализирует измеренные данные за 24 часа, 7 дней, визуализирует максимальные, минимальные и средние значения за 24 часа / 7 дней.
  • Исходный код каждого модуля Arduino Mega 2560 и микроконтроллера хранится в веб-интерфейсе и доступен для вошедшего в систему пользователя.
  • Arduino связывается с веб-интерфейсом через Ethernet-экран Wiznet W5100 по протоколу HTTP и отправляет данные в веб-интерфейс методом POST.
  • Модули работают независимо друг от друга. Сбой модуля только парализует модуль, а не всю веб-систему.
    Домашний монитор - Arduino - Вход для пользователей Домашний монитор - Arduino - Визуализация температуры и влажности в режиме реального времени Линейный график - данные о температуре от шины I2C, датчиков DHT22, SHT21, BME280 Измените названия помещений, в которых расположены датчики DS18B20, DHT22, SHT21, BME280.

    Исходные коды для модулей:


    Модуль 1 - Квартира


    8x DS18B20, 4x OneWire bus, 2x DHT22, 1x BME280, 1x SHT21 (Si7021)
    //Modul: Byt (číslo 1)
    //Autor: Martin Chlebovec
    //Hardver: Arduino Mega 2560 + Ethernet Wiznet W5100
    //Revizia: 21. Jan. 2020
    
    #include <avr\wdt.h>
    #include <SPI.h>
    #include <Ethernet.h>
    #include <OneWire.h>
    #include <DallasTemperature.h>
    #include <Adafruit_Sensor.h>
    #include <Adafruit_BME280.h>
    #include <DHT.h>
    #include <DHT_U.h>
    #include "SparkFun_Si7021_Breakout_Library.h"
    //Definicia typu DHT senzora a digitalnych pinov
    #define DHTPIN 2
    #define DHTTYPE    DHT22
    #define DHTPIN2 3
    #define BME280_ADRESA (0x76)
    
    //Definicia zbernic OneWire
    #define ONE_WIRE_BUS 5
    OneWire oneWire(ONE_WIRE_BUS);
    DallasTemperature sensorsA(&oneWire);
    #define ONE_WIRE_BUS2 6
    OneWire oneWire2(ONE_WIRE_BUS2);
    DallasTemperature sensorsB(&oneWire2);
    #define ONE_WIRE_BUS3 7
    OneWire oneWire3(ONE_WIRE_BUS3);
    DallasTemperature sensorsC(&oneWire3);
    #define ONE_WIRE_BUS4 8
    OneWire oneWire4(ONE_WIRE_BUS4);
    DallasTemperature sensorsD(&oneWire4);
    
    DHT_Unified dht(DHTPIN, DHTTYPE);
    DHT_Unified dht2(DHTPIN2, DHTTYPE);
    Weather sensorsht;
    Adafruit_BME280 bme;
    
    byte mac[] = { 0x20, 0xBA, 0x06, 0x75, 0x8C, 0xAA };
    const char * host = "www.host.sk";
    IPAddress dnServer(192, 168, 0, 1);
    IPAddress gateway(192, 168, 0, 1);
    IPAddress subnet(255, 255, 255, 0);
    IPAddress ip(192, 168, 0, 45);
    EthernetClient client;
    const int pauza = 30; //v sekundach
    void setup() {
      //INICIALIZACIA ONEWIRE, SHT21, BME280 A DHT22 SENZOROV
      sensorsA.begin();
      sensorsB.begin();
      sensorsC.begin();
      sensorsD.begin();
      sensor_t sensor;
      sensorsht.begin();
      bme.begin(BME280_ADRESA);
      dht.begin();
      dht2.begin();
      Serial.begin(115200);
      if (Ethernet.begin(mac) == 0) {
        Serial.println("Chyba konfiguracie, manualne nastavenie");
        Ethernet.begin(mac, ip, dnServer, gateway, subnet);
      }
      Serial.print("  DHCP assigned IP ");
      Serial.println(Ethernet.localIP());
      wdt_enable(WDTO_8S);
    }
    void odosli_data() {
      //MERANIA, DATA OD SENZOROV
      sensorsA.requestTemperatures();
      sensorsB.requestTemperatures();
      sensorsC.requestTemperatures();
      sensorsD.requestTemperatures();
      sensor_t sensor;
      sensors_event_t event;
      dht.temperature().getEvent(&event);
      wdt_reset();
      delay(1000);
      String teplota1 = String(sensorsA.getTempCByIndex(0));
      String teplota2 = String(sensorsA.getTempCByIndex(1));
      String teplota3 = String(sensorsB.getTempCByIndex(0));
      String teplota4 = String(sensorsB.getTempCByIndex(1));
      String teplota5 = String(sensorsB.getTempCByIndex(2));
      String teplota6 = String(sensorsB.getTempCByIndex(3));
      String teplota7 = String(sensorsC.getTempCByIndex(0));
      String teplota8 = String(sensorsD.getTempCByIndex(0));
      String vlhkost_sht21 = String(sensorsht.getRH());
      String teplota_sht21 = String(sensorsht.getTemp());
      String vlhkost_bme280 = String(bme.readHumidity());
      String teplota_bme280 = String(bme.readTemperature());
    
      String teplota_dht = String(event.temperature);
      dht.humidity().getEvent(&event);
      String vlhkost_dht = String(event.relative_humidity);
      sensors_event_t event2;
      dht2.temperature().getEvent(&event2);
      String teplota_dht2 = String(event2.temperature);
      dht2.humidity().getEvent(&event2);
      String vlhkost_dht2 = String(event2.relative_humidity);
      wdt_reset();
    
      //FORMOVANIE PAYLOAD-U A ODOSIELANIE PO HTTP POST
      String data = "teplota1=" + teplota1 + "&teplota2=" + teplota2 + "&teplota3=" + teplota3 + "&teplota4=" + teplota4 + "&teplota5=" + teplota5 + "&teplota6=" + teplota6 + "&teplota7=" + teplota7 + "&teplota8=" + teplota8 + "&teplota_dht=" + teplota_dht + "&vlhkost_dht=" + vlhkost_dht + "&teplota_dht2=" + teplota_dht2 + "&vlhkost_dht2=" + vlhkost_dht2 + "&teplota_bme280=" + teplota_bme280 + "&vlhkost_bme280=" + vlhkost_bme280 + "&teplota_sht=" + teplota_sht21 + "&vlhkost_sht=" + vlhkost_sht21;
      String url = "/daxville/system/arduino/zapishodnoty.php";
      client.stop();
      if (client.connect(host, 80)) {
        Serial.println("Odosielam data na webserver");
        client.println("POST " + url + " HTTP/1.0");
        client.println("Host: " + String(host));
        client.println("User-Agent: ArduinoEthernet");
        client.println("Connection: close");
        client.println("Content-Type: application/x-www-form-urlencoded;");
        client.print("Content-Length: ");
        client.println(data.length());
        client.println();
        client.println(data);
        while (client.connected()) {
          //HTTP HEADER
          String line = client.readStringUntil('\n'); //HTTP header
          Serial.println(line);
          if (line == "\r") {
            break; //blank line between HTTP header and payload
          }
        }
        String line = client.readStringUntil('\n'); //HTTP header
        Serial.println(line);
        if (line = "OK") {
          Serial.println("Server prijal data");
        }
      } else {
        Serial.println("Neuspesne odoslanie dat - spojenie sa nepodarilo");
      }
    }
    
    void loop() {
      //ETHERNET DROP FIX
      if (Ethernet.begin(mac) == 0) {
        Serial.println("Chyba konfiguracie, manualne nastavenie");
        wdt_reset();
        Ethernet.begin(mac, ip, dnServer, gateway, subnet);
      }
    
      odosli_data();
    
      //CAKACIA SLUCKA
      for (int i = 0; i <= pauza; i++) {
        delay(1000);
        wdt_reset();
      }
    }
    

    Модуль 1 - Квартира - Schéma zapojenia


    Byt - schéma zapojenia OneWire zberníc, digitálnych senzorov DHT22 - Arduino Mega2560 + Ethernet

    Модуль 2 - Котельная


    16x DS18B20, 7x OneWire bus, 8x DIGITAL IN, 8x DIGITAL OUT
    //Modul: Kotolna (číslo 2)
    //Autor: Martin Chlebovec
    //Hardver: Arduino Mega 2560 + Ethernet Wiznet W5100
    //Revizia: 21. Jan. 2020
    
    #include <avr\wdt.h>
    #include <SPI.h>
    #include <Ethernet.h>
    #include <OneWire.h>
    #include <DallasTemperature.h>
    
    //DEFINICIE PORTU A JEDNOTLIVYCH ONEWIRE ZBERNIC
    //POCET ZBERNIC: 7
    //DEFINOVANE NA D PORTOCH: 22, 23, 24, 25, 26, 27, 28
    #define ONE_WIRE_BUS 22
    OneWire oneWire(ONE_WIRE_BUS);
    DallasTemperature sensorsA(&oneWire);
    #define ONE_WIRE_BUS2 23
    OneWire oneWire2(ONE_WIRE_BUS2);
    DallasTemperature sensorsB(&oneWire2);
    #define ONE_WIRE_BUS3 24
    OneWire oneWire3(ONE_WIRE_BUS3);
    DallasTemperature sensorsC(&oneWire3);
    #define ONE_WIRE_BUS4 25
    OneWire oneWire4(ONE_WIRE_BUS4);
    DallasTemperature sensorsD(&oneWire4);
    #define ONE_WIRE_BUS5 26
    OneWire oneWire5(ONE_WIRE_BUS5);
    DallasTemperature sensorsE(&oneWire5);
    #define ONE_WIRE_BUS6 27
    OneWire oneWire6(ONE_WIRE_BUS6);
    DallasTemperature sensorsF(&oneWire6);
    #define ONE_WIRE_BUS7 28
    OneWire oneWire7(ONE_WIRE_BUS7);
    DallasTemperature sensorsG(&oneWire7);
    
    //SIEŤOVÁ KONFIGURÁCIA
    byte mac[] = { 0xAA, 0xBB, 0xAA, 0xBB, 0xAA, 0xBB };
    const char * host = "www.host.sk";
    IPAddress dnServer(192, 168, 0, 1); //DNS server
    IPAddress gateway(192, 168, 0, 1); //Brana (router)
    IPAddress subnet(255, 255, 255, 0); //SUBNET, MASKA
    IPAddress ip(192, 168, 0, 45); //IP ADRESA Ethernet shieldu
    EthernetClient client; //režim webclient
    const int pauza = 30; //v sekundach
    
    //DEFINICIE VYSTUPOV
    const int rele1 = 29;
    const int rele2 = 30;
    const int rele3 = 31;
    const int rele4 = 32;
    const int rele5 = 33;
    const int rele6 = 34;
    const int rele7 = 35;
    const int rele8 = 36;
    
    //DEFINICIA VSTUPOV
    const int vstup1 = 37;
    const int vstup2 = 38;
    const int vstup3 = 39;
    const int vstup4 = 40;
    const int vstup5 = 41;
    const int vstup6 = 42;
    const int vstup7 = 43;
    const int vstup8 = 44;
    void setup() {
      //NASTAVENIE PINU AKO VYSTUPU
      pinMode(rele1, OUTPUT);
      pinMode(rele2, OUTPUT);
      pinMode(rele3, OUTPUT);
      pinMode(rele4, OUTPUT);
      pinMode(rele5, OUTPUT);
      pinMode(rele6, OUTPUT);
      pinMode(rele7, OUTPUT);
      pinMode(rele8, OUTPUT);
      //POCIATOCNE NASTAVENIE VYSTUPOV --> INVERTOVANA LOGIKA
      digitalWrite(rele1, HIGH);
      digitalWrite(rele2, HIGH);
      digitalWrite(rele3, HIGH);
      digitalWrite(rele4, HIGH);
      digitalWrite(rele5, HIGH);
      digitalWrite(rele6, HIGH);
      digitalWrite(rele7, HIGH);
      digitalWrite(rele8, HIGH);
      //NASTAVENIE PINU AKO VSTUPU
      pinMode(vstup1, INPUT);
      pinMode(vstup2, INPUT);
      pinMode(vstup3, INPUT);
      pinMode(vstup4, INPUT);
      pinMode(vstup5, INPUT);
      pinMode(vstup6, INPUT);
      pinMode(vstup7, INPUT);
      pinMode(vstup8, INPUT);
      //INICIALIZACIE
      sensorsA.begin(); //inicializacia OneWire 1
      sensorsB.begin(); //inicializacia OneWire 2
      sensorsC.begin(); //inicializacia OneWire 3
      sensorsD.begin(); //inicializacia OneWire 4
      sensorsE.begin(); //inicializacia OneWire 5
      sensorsF.begin(); //inicializacia OneWire 6
      sensorsG.begin(); //inicializacia OneWire 7
      Serial.begin(115200);
      if (Ethernet.begin(mac) == 0) {
        Serial.println("Chyba konfiguracie, manualne nastavenie");
        Ethernet.begin(mac, ip, dnServer, gateway, subnet);
      }
      Serial.print("  DHCP assigned IP ");
      Serial.println(Ethernet.localIP());
      wdt_enable(WDTO_8S);
    }
    
    void odosli_data_vstupy() {
      String hodnota1 = String (digitalRead(vstup1));
      String hodnota2 = String (digitalRead(vstup2));
      String hodnota3 = String (digitalRead(vstup3));
      String hodnota4 = String (digitalRead(vstup4));
      String hodnota5 = String (digitalRead(vstup5));
      String hodnota6 = String (digitalRead(vstup6));
      String hodnota7 = String (digitalRead(vstup7));
      String hodnota8 = String (digitalRead(vstup8));
      wdt_reset();
    
      //FORMOVANIE PAYLOAD-U A ODOSIELANIE PO HTTP POST
      String data = "vstup1=" + hodnota1 + "&vstup2=" + hodnota2 + "&vstup3=" + hodnota3 + "&vstup4=" + hodnota4 + "&vstup5=" + hodnota5 + "&vstup6=" + hodnota6 + "&vstup7=" + hodnota7 + "&vstup8=" + hodnota8;
      String url = "/daxville/system/arduino/zapisvstupov.php";
      client.stop();
      if (client.connect(host, 80)) {
        Serial.println("Odosielam data na webserver");
        client.println("POST " + url + " HTTP/1.0");
        client.println("Host: " + String(host));
        client.println("User-Agent: ArduinoEthernet");
        client.println("Connection: close");
        client.println("Content-Type: application/x-www-form-urlencoded;");
        client.print("Content-Length: ");
        client.println(data.length());
        client.println();
        client.println(data);
        while (client.connected()) {
          //HTTP HEADER
          String line = client.readStringUntil('\n'); //HTTP header
          Serial.println(line);
          if (line == "\r") {
            break; //blank line between HTTP header and payload
          }
        }
        String line = client.readStringUntil('\n'); //HTTP header
        Serial.println(line);
        if (line = "OK") {
          Serial.println("Server prijal data --> hodnoty vstupov");
        }
      } else {
        Serial.println("Neuspesne odoslanie dat - spojenie sa nepodarilo");
      }
    }
    
    void odosli_data() {
      //VYŽIADANIE DAT, MERANIA, DATA OD SENZOROV
      sensorsA.requestTemperatures();
      sensorsB.requestTemperatures();
      sensorsC.requestTemperatures();
      sensorsD.requestTemperatures();
      sensorsE.requestTemperatures();
      sensorsF.requestTemperatures();
      sensorsG.requestTemperatures();
      wdt_reset();
      delay(3000);
      String teplota1 = String(sensorsA.getTempCByIndex(0));
      String teplota2 = String(sensorsA.getTempCByIndex(1));
      String teplota3 = String(sensorsB.getTempCByIndex(0));
      String teplota4 = String(sensorsB.getTempCByIndex(1));
      String teplota5 = String(sensorsC.getTempCByIndex(0));
      String teplota6 = String(sensorsC.getTempCByIndex(1));
      String teplota7 = String(sensorsD.getTempCByIndex(0));
      String teplota8 = String(sensorsD.getTempCByIndex(1));
      String teplota9 = String(sensorsE.getTempCByIndex(0));
      String teplota10 = String(sensorsE.getTempCByIndex(1));
      String teplota11 = String(sensorsF.getTempCByIndex(0));
      String teplota12 = String(sensorsF.getTempCByIndex(1));
      String teplota13 = String(sensorsG.getTempCByIndex(0));
      String teplota14 = String(sensorsG.getTempCByIndex(1));
      String teplota15 = String(sensorsG.getTempCByIndex(2));
      String teplota16 = String(sensorsG.getTempCByIndex(3));
      wdt_reset();
    
      //FORMOVANIE PAYLOAD-U A ODOSIELANIE PO HTTP POST
      String data = "teplota1=" + teplota1 + "&teplota2=" + teplota2 + "&teplota3=" + teplota3 + "&teplota4=" + teplota4 + "&teplota5=" + teplota5 + "&teplota6=" + teplota6 + "&teplota7=" + teplota7 + "&teplota8=" + teplota8 + "&teplota9=" + teplota9 + "&teplota10=" + teplota10 + "&teplota11=" + teplota11 + "&teplota12=" + teplota12 + "&teplota13=" + teplota13 + "&teplota14=" + teplota14 + "&teplota15=" + teplota15 + "&teplota16=" + teplota16;
      String url = "/daxville/system/arduino/zapishodnoty_modul2.php";
      client.stop();
      if (client.connect(host, 80)) {
        Serial.println("Odosielam data na webserver");
        client.println("POST " + url + " HTTP/1.0");
        client.println("Host: " + String(host));
        client.println("User-Agent: ArduinoEthernet");
        client.println("Connection: close");
        client.println("Content-Type: application/x-www-form-urlencoded;");
        client.print("Content-Length: ");
        client.println(data.length());
        client.println();
        client.println(data);
        while (client.connected()) {
          //HTTP HEADER
          String line = client.readStringUntil('\n'); //HTTP header
          Serial.println(line);
          if (line == "\r") {
            break; //blank line between HTTP header and payload
          }
        }
        String line = client.readStringUntil('\n'); //HTTP header
        Serial.println(line);
        if (line = "OK") {
          Serial.println("Server prijal data --> teploty");
        }
      } else {
        Serial.println("Neuspesne odoslanie dat - spojenie sa nepodarilo");
      }
    }
    
    void nastavenie_rele1() {
      String url = "/daxville/system/arduino/vystupy1.php";
      client.stop();
      if (client.connect(host, 80)) {
        client.print(String("GET ") + url + " HTTP/1.0\r\n" +
                     "Host: " + host + "\r\n" +
                     "Connection: close\r\n\r\n");
        while (client.connected()) {
          String line = client.readStringUntil('\n');
          Serial.println(line);
          if (line == "\r") {
            break;
          }
        }
        String line = client.readStringUntil('\n');
        Serial.println("Odpoved webservera:");
        Serial.println(line);
        if (line == "0000") {
          digitalWrite(rele1, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele2, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele3, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele4, HIGH);
        } else if (line == "0001") {
          digitalWrite(rele1, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele2, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele3, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele4, LOW);
        } else if (line == "0010") {
          digitalWrite(rele1, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele2, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele3, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele4, HIGH);
        } else if (line == "0011") {
          digitalWrite(rele1, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele2, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele3, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele4, LOW);
        } else if (line == "0100") {
          digitalWrite(rele1, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele2, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele3, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele4, HIGH);
        } else if (line == "0101") {
          digitalWrite(rele1, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele2, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele3, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele4, LOW);
        } else if (line == "0110") {
          digitalWrite(rele1, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele2, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele3, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele4, HIGH);
        } else if (line == "0111") {
          digitalWrite(rele1, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele2, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele3, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele4, LOW);
        } else if (line == "1000") {
          digitalWrite(rele1, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele2, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele3, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele4, HIGH);
        } else if (line == "1001") {
          digitalWrite(rele1, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele2, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele3, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele4, LOW);
        } else if (line == "1010") {
          digitalWrite(rele1, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele2, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele3, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele4, HIGH);
        } else if (line == "1011") {
          digitalWrite(rele1, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele2, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele3, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele4, LOW);
        } else if (line == "1100") {
          digitalWrite(rele1, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele2, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele3, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele4, HIGH);
        } else if (line == "1101") {
          digitalWrite(rele1, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele2, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele3, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele4, LOW);
        } else if (line == "1110") {
          digitalWrite(rele1, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele2, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele3, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele4, HIGH);
        } else if (line == "1111") {
          digitalWrite(rele1, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele2, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele3, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele4, LOW);
        } else {
          digitalWrite(rele1, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele2, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele3, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele4, HIGH);
        }
      } else {
        Serial.println("Problem s pripojenim na webserver - Nepodarilo sa ziskat prve 4 vystupy");
      }
    }
    
    void nastavenie_rele2() {
      String url = "/daxville/system/arduino/vystupy2.php";
      client.stop();
      if (client.connect(host, 80)) {
        client.print(String("GET ") + url + " HTTP/1.0\r\n" +
                     "Host: " + host + "\r\n" +
                     "Connection: close\r\n\r\n");
        while (client.connected()) {
          String line = client.readStringUntil('\n');
          Serial.println(line);
          if (line == "\r") {
            break;
          }
        }
        String line = client.readStringUntil('\n');
        Serial.println("Odpoved webservera:");
        Serial.println(line);
        if (line == "0000") {
          digitalWrite(rele5, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele6, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele7, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele8, HIGH);
        } else if (line == "0001") {
          digitalWrite(rele5, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele6, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele7, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele8, LOW);
        } else if (line == "0010") {
          digitalWrite(rele5, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele6, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele7, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele8, HIGH);
        } else if (line == "0011") {
          digitalWrite(rele5, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele6, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele7, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele8, LOW);
        } else if (line == "0100") {
          digitalWrite(rele5, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele6, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele7, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele8, HIGH);
        } else if (line == "0101") {
          digitalWrite(rele5, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele6, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele7, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele8, LOW);
        } else if (line == "0110") {
          digitalWrite(rele5, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele6, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele7, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele8, HIGH);
        } else if (line == "0111") {
          digitalWrite(rele5, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele6, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele7, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele8, LOW);
        } else if (line == "1000") {
          digitalWrite(rele5, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele6, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele7, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele8, HIGH);
        } else if (line == "1001") {
          digitalWrite(rele5, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele6, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele7, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele8, LOW);
        } else if (line == "1010") {
          digitalWrite(rele5, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele6, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele7, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele8, HIGH);
        } else if (line == "1011") {
          digitalWrite(rele5, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele6, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele7, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele8, LOW);
        } else if (line == "1100") {
          digitalWrite(rele5, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele6, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele7, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele8, HIGH);
        } else if (line == "1101") {
          digitalWrite(rele5, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele6, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele7, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele8, LOW);
        } else if (line == "1110") {
          digitalWrite(rele5, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele6, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele7, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele8, HIGH);
        } else if (line == "1111") {
          digitalWrite(rele5, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele6, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele7, LOW);
          delay(1000);
          wdt_reset();
          digitalWrite(rele8, LOW);
        } else {
          digitalWrite(rele5, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele6, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele7, HIGH);
          delay(1000);
          wdt_reset();
          digitalWrite(rele8, HIGH);
        }
      } else {
        Serial.println("Problem s pripojenim na webserver - Nepodarilo sa ziskat druhe 4 vystupy");
      }
    }
    void loop() {
      //ETHERNET DROP FIX
      if (Ethernet.begin(mac) == 0) {
        Serial.println("Chyba konfiguracie, manualne nastavenie");
        wdt_reset();
        Ethernet.begin(mac, ip, dnServer, gateway, subnet);
      }
      odosli_data();
      wdt_reset();
      nastavenie_rele1();
      wdt_reset();
      nastavenie_rele2();
      wdt_reset();
      odosli_data_vstupy();
      wdt_reset();
      //CAKACIA SLUCKA
      for (int i = 0; i <= pauza; i++) {
        delay(1000);
        wdt_reset();
      }
    }
    

    Модуль 2 - Котельная - Схема подключения


    Kotolňa - schéma zapojenia OneWire zberníc - Arduino Mega2560 + Ethernet