Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Case Study-01]: KC868-A4 Green house temperature monitoring
#1
Wink 
[Image: kc868-a4-email.jpg]
In this series, we will analyze examples of the application of Kincony controllers in solving cases from practical applications. Practical cases are usually not complex, but they solve important things in the production process. In some cases, mistakes can cause large losses in production. Such systems need to be approached seriously.
author: wrote by Nebojsa from Croatia
 
Case study:  Greenhouse temperature management
The user owns a greenhouse for growing vegetables. Summer temperature inside the greenhouse should not exceed 35oC. At a temperature of > 40oC the plants begin to be irreversibly destroyed.
When the temperature reaches 30oC, the automation system should immediately send an e-mail warning to the responsible person and start the industrial fans to injecting cooler air. If the temperature continues to rise and reaches (set + 4oC) 34oC, the system should start opening the sides via automatic actuators.
When the temperature drops below 30oC, it is necessary to stop the ventilation and close the sides.
Reading the current temperature inside the greenhouse, and changing the system parameters can be done through the website on the local network.
 
We will use these components:
[Image: kc868-a4.jpg]
KC868-A4 controller
[Image: ds18b20-1.png][Image: ds18b20-2.jpg]
Temperature sensor DS18B20
[Image: contact.jpg][Image: 2NO.jpg][Image: 2NC.jpg]
Contactors, 1 x 2NO; 1 x 1NO – 1 NC
Program structure:
[Image: Program-structure-1.png]
[Image: Program-structure-2.png]This block enable data entry over LAN Web. Start any web browser and in address field enter IP what see after start program over Arduino IDE (for example: 192.168.8.153 as can see on screen)
Programing details
In my series of case studies will not so much fokusing on programming details. Some interesting parts of programs will be comented in source code.
I think you have read the published articles about the KC868-A4 controller, but to note in the Tools menu you should choose Board: NodeMCU 32S.
Include the necessary libraries via Manage Libraries ...
Included libraries:
#include <WiFi.h>               // Enables network connection.
#include <AsyncTCP.h>           // This is a fully asynchronous TCP library
#include <ESPAsyncWebServer.h>  // Async HTTP and WebSocket Server
#include <OneWire.h>            // Access 1-wire devices as temp. sensors
#include <DallasTemperature.h>  // Library for Dallas Temperature ICs
#include "ESP32_MailClient.h"   // Mail Client Arduino Library for ESP32
#include "time.h"               // Date and Time functions, NTP sync.
 
 
Slanje maila preko KC868-A4
We recommend that you create a new mail, and do not use your existing mail account. This mail will be used to send emails. On this occasion, I opened a new gmail.com account via the link.
In the Select app field, choose mail and password.
The SMTP server settings for the sender email.
  • SMTP Server: gmail.com
  • SMTP username: Complete Gmail address
  • SMTP password: Your Gmail password
  • SMTP port (TLS): 587
  • SMTP port (SSL): 465
  • SMTP TLS/SSL required: yes
 
// To send Email using Gmail use port 465 (SSL) and SMTP Server smtp.gmail.com
const String emailSenderAccount  = "your mail@gmail.com";
const String emailSenderPassword = "your password";
const String smtpServer          = "smtp.gmail.com";
const int    smtpServerPort      = 465;
 
The mailing address for reception, can be our existing mail or any other.
 
KC868-A4 Mailing source program download here.
 
Run the temperature mailing notification
Start Tools -> Serial monitor
First start WiFi connecting over assign SSID and password of the router WiFi.
Remember this IP address, will need later.
[Image: arduino-serial.jpg]
The program provided the date and time via an internet NTP server. It is important for real time the temperature monitoring. After this program read temperature from DS18B20 sensor.
As the case study defined, the temperature less than 30oC mean normal situation, no any action and there is no need to turn on the cooling, the fan stay Off and wall is closed.
[Image: temperature-output-1.jpg]
After the temperature exceeds the set limit (30oC), ventilation is switched on (Fan -> ON), system send Alert mail to defined address, but the wall actuators stay closed.
If the temperature continues to rise and reaches 4oC more than the set limit, the actuator is started to open the sides of the greenhouse. State: Fan -> On; Wall -> Open.
[Image: temperature-output-2.jpg]
If the temperature starts to drop, the fan will continue to run until it falls below the set limit. The sides will also be open during this time. When the temperature falls below the set limit, the system sends an e-mail to the user to inform him that the temperature has returned to normal, the fan is stopped and the side walls of the greenhouse are closed.
[Image: temperature-output-3.jpg]
Received mail when temperature goes over the defined limit:
[Image: temperature-output-4.jpg]
[Image: alarm-mail.jpg]
Received mail when temperature again become the normal:
[Image: alarm-mail-2.jpg]
[Image: alarm-mail-3.jpg]
Temperature readings and settings can be performed via a web browser. We need to start our web browser (any), enter the IP address obtained at the beginning, we will get the web page as shown below.
[Image: alarm-mail-4.jpg]
The HTML code generated by the specified screen was created in our program. We will not go into deeper explanations, we would just look the HTML code.
[Image: http-code.jpg]
Hardware system configuration
[Image: hardware-system.png]
Conclusion:
This case study like all others can be performed in many ways. One solution is presented here. The Kincony controller KC868-A4 was used, the Arduino IDE was used for programming. For settings see the link about KC868-A4. The plan is to process several different projects related to practical applications.
If you have any questions, suggestions or comments, write to info@edata.hr
Reply
#2
Thank you for the useful case study and calculations. We conducted similar studies at the university.
Reply


Forum Jump:


Users browsing this thread: