Hello, sorry if I bother you. My project is now live.
Video: https://youtu.be/2S2-g1iqypI
Program code
I guess the code is not perfect but it works perfectly for me if you have any comments please share
//loading required libraries
#include <SoftwareSerial.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LCDWIKI_GUI.h> //Core graphics library
#include <LCDWIKI_KBV.h> //Hardware-specific library
//End of module
//define of the required variables
//#define SENSOR_READ_TIMEOUT 420000 //milliseconds period for reading sensors in loop
#define ONE_WIRE_BUS 53 //display
#define BLACK 0x0000 //display
#define BLUE 0x001F //display
#define RED 0xF800 //display
#define GREEN 0x07E0 //display
#define CYAN 0x07FF //display
#define MAGENTA 0xF81F //display
#define YELLOW 0xFFE0 //display
#define WHITE 0xFFFF //display
#define TX 11 //Communication on the PWM module
#define RX 10 //Communication on the PWM module
//Relay 1
int RelayPin = 18;
//END
//Relay 2
int RelayAC10 = 16;
//END
//setting the heat sensors
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
// promenlivi teplota
float temperatureData = 00.0;
float teplota25 = 18.0;
float teplota50 = 26.0;
float teplota100 = 29.0;
float teplotaV2 = 31.0;
int i;
//END
//the definiens of 16bit mode as follow:
uint8_t address[] = {40, 250, 31, 218, 4, 0, 0, 52};
uint8_t selected;
LCDWIKI_KBV mylcd(ILI9341,40,38,39,-1,41); //model,cs,cd,wr,rd,reset
SoftwareSerial swSerial(RX, TX);
//END
//----------------------------------------------------------------------
void setup()
{
//PWM module
// starting communication over a serial line at a speed of 9600 baud
Serial.begin(9600);
// starting communication over the software serial line at 9600 baud
swSerial.begin(9600);
// 1kHz to output/set frequencies
swSerial.print("F1.00");
delay(500);
// setting initial shift 0% to output
swSerial.print("D000");
delay(500);
//END PWM
// Relay
pinMode(RelayPin, OUTPUT);
pinMode(RelayAC10, OUTPUT);
//END
//heat sensors
// Start serial communication for debugging purposes
Serial.begin(9600);
// Start up the library
sensors.begin();
//END
//Display
mylcd.Init_LCD();
mylcd.Fill_Screen(BLACK);
//END
}
//working cycle start
void loop()
{
unsigned long currentTime = millis();
//display
delay(500);
mylcd.Set_Rotation(1);
mylcd.Set_Text_Mode(0);
mylcd.Set_Text_colour(GREEN);
mylcd.Set_Text_Back_colour(BLACK);
mylcd.Set_Text_Size(3);
mylcd.Print_String("TYPOS PLZEN", 45, 10);
mylcd.Set_Text_Size(2);
mylcd.Print_Number_Float (sensors.getTempCByIndex(0), 1, 140, 70, '.', 0, ' ');
mylcd.Print_Number_Float (sensors.getTempCByIndex(1), 1, 140, 100, '.', 0, ' ');
mylcd.Print_String("Vstupni", 5, 70);
mylcd.Print_String("Vystupni", 5, 100);
mylcd.Print_String("C", 205, 70);
mylcd.Print_String("C", 205, 100);
mylcd.Print_String("Ventilator 1", 5, 130);
mylcd.Print_String("Ventilator 2", 5, 160);
mylcd.Set_Text_Size(1);
mylcd.Print_String("development Veselin Madzharov 2023", 10, 230);
//END
//
delay(1000);
//operation of heat sensors
sensors.requestTemperatures();
temperatureData = sensors.getTempCByIndex(0);
delay(500);
//END
//Fan stop condition 1
if (temperatureData < 15.0) //the water temperature is below 15 degrees
{
swSerial.print("D000");
delay(500);
digitalWrite(RelayAC10, HIGH);
mylcd.Set_Text_Size(2);
mylcd.Print_String("OFF", 180, 130);
}
//END
//25 percent
if ((temperatureData >= teplota25) && (temperatureData < teplota50))
{
digitalWrite(RelayAC10, LOW);
delay(500);
swSerial.print("F1.00");
swSerial.print("D025");
delay(500);
mylcd.Set_Text_Size(2);
mylcd.Print_String("ON", 180, 130);
for(i=0;i<300000;i++) {
swSerial.print("D025");
delay(500);
}
}
// 50 percent
if ((temperatureData >= teplota50) && (temperatureData < teplota100))
{
digitalWrite(RelayAC10, LOW);
swSerial.print("D050");
delay(500);
mylcd.Set_Text_Size(2);
mylcd.Print_String("ON", 180, 130);
for(i=0;i<300000;i++) {
swSerial.print("D050");
delay(500);
}
}
//100 percent
if (temperatureData >= teplota100)
{
digitalWrite(RelayAC10, LOW);
swSerial.print("D100");
delay(500);
mylcd.Set_Text_Size(2);
mylcd.Print_String("ON", 180, 130);
for(i=0;i<300000;i++) {
swSerial.print("D100");
delay(500);
}
}
//----- ventilator 1 end
//----checking for warmth of ventilator 2
if (temperatureData > teplotaV2)
{
digitalWrite(RelayPin, LOW);
mylcd.Set_Text_Size(2);
mylcd.Print_String("ON.", 180, 160);
}
if (temperatureData < 24.0)
{
digitalWrite(RelayPin, HIGH);
mylcd.Set_Text_Size(2);
mylcd.Print_String("OFF", 180, 160);
//ventilator 2 end
}}