Using LabVIEW to Design a Greenhouse Remote Monitoring System

  Read in   |   Print Print

"By using NI products, we greatly reduced both the development and validation time for this application."

- Fulu Wang, Northeast Agriculture University

The Challenge:
Developing a greenhouse remote monitoring system that does not require manual changes with each crop change.

The Solution:
Using NI LabVIEW software and the ZigBee-based NI wireless sensor network (WSN) to create a wireless measurement, transmission, display, and storage system for greenhouse environmental parameters. We used the LabVIEW Datalogging and Supervisory Control (DSC) Module and the NI OPC Server software for integrating to industrial automation devices to read and write to the greenhouse controller, an Omron programmable logic controller (PLC), and we achieved fast, accurate control of the actuators.

Author(s):
Fulu Wang - Northeast Agriculture University

Jilin Province and Heilongjiang Province are major agricultural areas located in a cold region of China (43° N). Engineers are using heliogreenhouse technology to design greenhouses for this area. Due to the bad climatic conditions, the existing greenhouses in the area are usually heated,  so they consume a lot of energy, have a high error rate when running autonomously, and have a high maintenance cost. Therefore, the greenhouse temperature is mainly controlled manually, which constricts the yield and quality of greenhouse crops.

We built an upper machine monitoring system based on LabVIEW and a ZigBee-based wireless sensor to wirelessly acquire, display, and store greenhouse environmental information. Using an OPC Server with the LabVIEW DSC Module, we can easily implement read and write functions on the PLC to remotely monitor the field devices in real time through a web server.

Monitoring System Design

Figure 1 shows the overall system design. We created the wireless sensor network using an SHT75  air temperature and humidity sensors, a 5TE soil humidity sensor, a CGS-3100 carbon dioxide sensor, and TBQ-6 a light sensor. The sensors transform a nonelectronic quality into an electronic quantity that changes with the environment. The system then transmits the signal to the upper machine by sending it to an Ethernet gateway receiver through a wireless connection. The upper machine runs a monitoring interface we developed with LabVIEW and is capable of real-time display for environmental parameters, database storage, printer output, parameter configuration, alarming, and historical data query (see Figure 5). The lower machine controller uses a PLC with an easy-to-program ladder diagram. The controller has high reliability even under the complex environment of this cold area.

Figure 1: Overall System Design

Monitoring System Hardware Implementation

We used the NI WSN-3202 as the wireless sensor node for the system. The WSN-3202 measurement node is a wireless device that provides four ±10 V analog input channels and four bidirectional digital channels. Its 18-pin screw terminal connector can directly interface with sensors. We use the 12 V, 20 mA output power supply of the device to directly drive sensors that need an external power supply. We use four 1.5 V AA batteries to directly power the measurement node. These batteries can continuously work for three years. The acquisition node transfers data to the WSN gateway through a wireless connection at a frequency higher than 2.4 GHz. The WSN Ethernet gateway connects to other network devices via Ethernet. We can configure the WSN-3202 as a mesh router to extend the network distance and connect more nodes to the gateway. We can connect up to eight terminal nodes (in the star topology) or up to 36 measurement nodes (in the mesh topology) to a single WSN gateway, which has a 300 m outdoor visible range.

We use the NI PCI-6221 M Series data acquisition (DAQ) board to acquire analog and digital signals. It features counters and analog output features, as well as high-performance data acquisition and control functionalities. We mainly use its analog input and digital input features for wired measurement of fixed position sensors, such as outdoor weather monitoring, and device status monitoring. Using the PCI-6221 along with the wireless sensor network, we built a completely integrated wired and wireless measurement system.

The distributed controller for our system is the highly reliable, cost-efficient Omron PLC CPM2AH 60CDR A. It is easy to program and shortens the design cycle. After calculating I/O requirements, we found that the whole system needs 29 input lines and 13 output lines.

Monitoring System Software Design

The system includes software design of the monitoring system and ladder diagram programming of the PLC. This case study focuses on the software design of the computer. We developed the monitoring interface of the upper machine using LabVIEW. We used LabVIEW to create a user-friendly monitor and control interface that makes it easier for operators to understand the conditions in the field. Figure 2 illustrates the software system design. It includes a user management module, a data acquisition module, a configuration module, a controller output module, and a data processing and query module.

                            

Figure 2: Embedded System Diagram

By connecting the monitoring system to the Microsoft Access database, we can manage new user accounts and login permissions. Figure 3 shows the real-time data display interface. It can display parameters for various greenhouses in real time and manage alarms by setting upper and lower limits.

Figure 3: Real-Time Data Display Interface

The machine status display and control module is shown in Figure 4. By selecting manual mode or automatic mode, we use virtual instruments to remotely control the field devices.

Figure 4: Machine Running Status Display and Control

Using the database access toolkit LabSQL, which is free for LabVIEW users, we implemented the database access through Microsoft ADO controls and LabSQL language. The system stores real-time monitoring data including temperature, humidity, light, CO2 density, and the status of all actuators, in the Access database. Operators can query dates in the database query interface. The front panel and block diagram are shown in Figure 5 and Figure 6, respectively.

Figure 5: History Data Query

Figure 6: Data Query Application

LabVIEW can communicate with any PLC in a variety of ways. OPC defines the real-time data communication standard between the controller and the human machine interface (HMI). OPC Server is applicable to almost all PLCs and programmable automated controllers (PACs). We can access PLC data with LabVIEW to add powerful analytical and control features to the solution.

Upper Machine Software and Implementation of PLC Communication

We based the system on a traditional serial Omron CPM2AH PLC. We first used Omron CX-Programmer Software to complete the ladder diagram, then we used an RS232 serial cable to connect the PLC to the upper machine and to power it on. After downloading the ladder diagram to the PLC, we configured the NI OPC Server as shown in Figures 7, 8, and 9.

Figure 7. NI OPC Server Dialog

Figure 8: Create Channel Selection Device Driver

Figure 9: Add Tag Name and Related PLC Address

LabVIEW DataSocket includes an NI OPC Client and that can communicate with the OMRON OPC Server through OPC Client for data interaction. To use OPC to create the data connection to the PLC in LabVIEW, we generate the controls for communication on the LabVIEW front panel and make sure the control data type is the same as the OPC data type. We then right click the control, select Property » Data Binding » Data Binding Select » Datasocket to configure the related access type and path so we can connect the front panel controls to the corresponding address in the PLC and enable read and write functions on the PLC. We run the LabVIEW program and change the front panel control’s value so we can see the data changes on the related PLC address in OPC Scout. Similarly, the related LabVIEW variable corresponding to the address also changes. This is how we implement real-time communication between the PC and the PLC based on OPC.

Remote Monitor Implementation

Through the LabVIEW Web server, we can publish a LabVIEW program on a web page that local or remote client computers can use to browse or control the front panel in real time. This gives users real-time remote control of a production environment.

To use the web publishing tool in LabVIEW, click Tools » Options to complete the configuration related to the web server and publish the LabVIEW program in the pop-up dialog box. As shown in Figure 11, set the web server to configuration, web server – visible VI and web server – browser accessible. In the Tools » Web Publishing Tools dialog menu, we can publish the program in memory as a web page, which clients can browse on their machines.

Based on the software, the client can access the remote panel in different ways. For example, they could browse the front panel on the web; browse the HTML file on the web; operate the remote panel in a web page browser; remotely monitor the front panel in LabVIEW; or use LabVNC to control remote panel publishing.

We used the web browser to control the remote panel in a web page. We installed the free LabVIEW Run-Time Engine, which occupies about 90 MB of disk space, on the client’s computer. In a LAN environment, the remote panel address is http:// pcname: port / viname.htm; while in an Internet environment, the remote panel address is http://ipaddress:port/viname.htm.

When the remote panel appears in the browser, we can right-click and request VI control from the pop-up menu as shown in Figure 11. Multiple clients can monitor the server at the same time, but only one client has control access; all other clients must wait until the control access is released.

In the web server, we can view and control all connected client computers by selecting Tools » Remote Panel Connection Manager.

Figure 10: Web Server Configuration

Figure 11: Remote Control Interface

Conclusion

We used the advanced software and hardware platform from NI to build a complete and stable greenhouse monitoring system. With the NI WSN system, we created a measurement solution that combines wired with wireless measurement. We can use LabVIEW to seamlessly access many kinds of NI platforms. By using NI products, we greatly reduced both the development and validation time for this application. The ease of use of LabVIEW helped us throughout the user interface and system development process. Using LabVIEW to access PLC data, we can add powerful analytical and control features to the solution.

Author Information:
Fulu Wang
Northeast Agriculture University

Bookmark and Share


Explore the NI Developer Community

Discover and collaborate on the latest example code and tutorials with a worldwide community of engineers and scientists.

‌Check‌ out‌ the‌ NI‌ Community


Who is National Instruments?

National Instruments provides a graphical system design platform for test, control, and embedded design applications that is transforming the way engineers and scientists design, prototype, and deploy systems.

‌Learn‌ more‌ about‌ NI