## 3 The Results and Discussion  
A prototype electronic system was developed for monitoring and controlling the environmental conditions of mushroom growing premises. The main PLC consisted of two stages: the main electrical circuit for control and data analysis and the communication circuit. A PIC18F25K83 microcontroller was used to monitor and analyse the environmental parameters and to control the work of the units for maintaining the environmental parameters. The main electrical circuit of the PLC based on the aforementioned microcontroller is presented in Figure 2. The mushroom growing premises consisted of two rooms in which it was necessary to ensure the control of environmental conditions. In order to control the environmental conditions in the two rooms, the PLC electrical circuit included two inputs each for the control of air conditioners and fans. At the same time, information was received about the humidity in the premises. To control this process, the PLC electrical circuit had two inputs for the control of humidifiers. Since the control of environmental parameters devices is performed based on the information received from the environmental sensors, an RS 485 interface module is used to receive information from these sensors. The information packet travels digitally from the PLC communication PCB board to the RS 485 module. A separate electrical circuit for communication based on the PIC18F25K83 microcontroller was developed and used to collect and transmit data from humidity, temperature and CO\({}_{2}\) sensors to the main microcontroller (which performs control and analysis of environmental conditions based on the information received from the sensors). The communication electrical circuit diagram is presented in Figure 3.  
The communication chain technologically has two inputs for collecting information from industrial CO\({}_{2}\) sensors (two CO\({}_{2}\) sensors since there are two mushroom growing rooms) [1]. There were four temperature and humidity measuring sensors in each room (SHT41 sensors are used to measure temperature and humidity), so the communication circuit has eight inputs for receiving information in digital form. An RS 485 interface is used to transfer information to the main microcontroller. Separate electronic modules were made using PIC18F25K83 microcontrollers to convert the information of each humidity and temperature sensor into digital form and ensure the transmission process to the communication circuit of the main controller. The electrical schematic diagram of this module is presented in Figure 4. As we can see in the electrical circuit there is a humidity and temperature sensor input and a CO\({}_{2}\) sensor input. A total of eight units (to collect and process the data of eight humidity and temperature modules and two CO\({}_{2}\) modules) of such electronic circuits/PCBs were manufactured and four installed in each of two mushroom growing rooms. Using the RS 485 interface, the information from these sensors is transmitted to the communication board of the main controller. Figure 2: Main PLC electronic circuit. The software for the microcontroller of main controller and communication microcontroller was written using C programming language. Using this language, a program was also written for individual electronic modules (Figure 4 electrical diagram) to collect information from humidity and temperature and CO\({}_{2}\) sensors [29; 30]. The software algorithm of the entire mushroom cultivation conditions parameter measurement and control system is presented in Figure 5.  
The program starts with the command \"Start program\". Later, the status of the environmental sensors is checked, whether the sensors are active, and the values of these sensors are recorded. Requests are sent to the electrical circuits of the sensors and checked for a response.