Bluetooth Mesh Network-based Intelligent Light Replenishment System for Agricultural Greenhouses

Given the actual situation of greenhouse production nowadays, this paper proposes a kind of intelligent light replenishment system for greenhouses based on a Bluetooth Mesh network. The system uses the ESP32-C3FH4 microcontroller from Espressif as Bluetooth Mesh nodes to form a Bluetooth Mesh monitoring network. This paper designs an intelligent IoT device control system based on Bluetooth Mesh network technology and cloud platform services. Through the flooded network composed of Bluetooth Mesh, the natural light intensity data monitored by each service node is sent to the cloud platform periodically through the gateway, the monitored data is accessed by the cloud platform for management, and the artificial light source module is triggered according to the deposited data to realize automatic control, realizing the modernized digital management function of agricultural greenhouses.


Introduction
Daily natural light intensity will change with the weather, time, and other factors for ordinary agricultural greenhouse facilities.Farmers have no way to ensure that the internal light of the greenhouse in real time meets the scientific light intensity required by the cultivated crops because large-scale agricultural greenhouse's artificial light control is time-consuming and laborious [1] .Therefore, it is necessary to design a safe and reliable digital agricultural greenhouse intelligent light supplementation system [2] .With the development of wireless sensor technology and society, the combination of Bluetooth Mesh technology, sensor technology, and agricultural production will greatly improve the efficiency and quality of agricultural production.
The harsh agricultural greenhouse internal environment and artificiality can not ensure the light value equal to the crop growth [3] .Therefore, this paper proposes a greenhouse intelligent light replenishment system based on a Bluetooth Mesh network.The system uses Espressif's ESP32-C3FH4 microcontroller as a Bluetooth Mesh node to monitor the light-intensity data of agricultural greenhouses while taking into account low power consumption [4] .The system consists of a cloud part and a local part.The cloud part uses the Ali cloud platform, and the local system uses Espressif's ESP32-C3FH4 microcontroller as a Bluetooth Mesh node, which takes into account low power consumption while realizing the light intensity data of agricultural greenhouses [5] .The control message flow from monitoring data to the cloud and from the cloud to the local is realized [6] .

Overall structure and principle of the system
Figure 1 shows the overall framework design of the greenhouse monitoring system.The system is mainly composed of an MQTT Broker server, IoT gateway, Bluetooth Mesh data collection node, and light replenishment adjustment driver.The Bluetooth Mesh network of agricultural greenhouse intelligent light supplementation system uses a cell phone APP as the human-computer interaction interface [7] .The cell phone displays the environmental parameters collected by the smart sensors.
When the light replenishment system is working, the smart sensor terminal collects light intensity information through sensors, periodically transmits the data to the IoT gateway through the Bluetooth Mesh network for data aggregation and pre-processing, and then transmits the messages to the mobile phone terminal via MQTT Broker server to be displayed in the APP interface.We set the light intensity information to meet the growth of crops.When the data collected by the environment does not meet the set conditions, we send instructions to control the driver and carry out relevant physical operations to ensure the best growth environment for crops, achieving the digitalization of agricultural greenhouses.

System hardware design and implementation
This system uses modular assembly to build the hardware circuit of the system, which facilitates the replacement of damaged modules in the future.

Main control circuit design of ESP32-C3FH4
The schematic graph of the main control chip and peripheral circuit design is shown in Figure 2. The main control chip is an ESP32-C3 series SOC chip from Espressif, with the model number ESP32-C3FH4, which is a secure, stable, low-power, low-cost IoT chip with RISC-V 32-bit single-core processor, supporting 2.4 GHz Wi-Fi and Bluetooth LE 5.0.We provide industry-leading RF performance, a perfect security mechanism, and rich memory resources.Compared with Bluetooth 4.2, Bluetooth 5.0 has 4 times higher wireless transmission distance, 2 times higher transmission speed of 2 Mb/s, and 100 mW transmitting power allowed [8] .
The BLE Mesh network flooding approach optimizes their operation to be reliable and efficient.Measures to optimize how flooding works in Bluetooth Mesh networks include: heartbeat data are sent periodically by joints.Heartbeat data indicates to other joints in the web that the joint sending the heartbeat is vibrant.Besides, the data contained in the heartbeat message allows the receiving node to determine the sender's distance based on the number of jumps needed to reach the sender, which can be utilized through the TTL field.The field includes all BLE Mesh PDUs that regulate the maximum number of jumps for relays [9] .We set up TTL to ensure that nodes do not rely too much, allowing nodes to control the relay and save energy.The heartbeat information allows the node to determine the optimal TTL value for publishing a message.All nodes must implement a Message cache.The Message Cache contains messages which are recently received.If the message exists in the Message Cache, the joint will have received the message previously and the message will be immediately dropped.Friendship is roughly the most important optimization mechanism in BLE Mesh networks, and it is a composite of Friend joint and Low Power joint.The Friend node provides message storage and forwarding services to the related Low Power nodes.This enables low-power joints to operate in an energy-efficient manner.

Circuit design of light intensity sensor
The sensors in this system are digital signal sensors that use the IIC protocol and TTL for communication.Therefore the acquisition module circuit design needs to conform to the requirements of this communication protocol.The lines used for serial and IIC communication should be as short as possible.When the master chip communicates with the terminal sensing module using IIC protocol or TTL, the PCB alignment uses interactive differential alignment and meets the impedance matching requirements.The light intensity module uses the BH1750 light intensity sensor, which is a light-intensity digital integrated chip using IIC communication, and the circuit diagram is shown in Figure 3. MQTT is that it provides real-time and accurate messaging services to connected remote equipment with little code and restrained bandwidth.As a low-overhead, low-bandwidth, and instant-messaging protocol, it is widely used [10] .

4.1.Shed monitoring sensing data protocol
In this paper, we design a set of data protocols for agricultural greenhouse monitoring sensors, and package multiple data into data packets according to the protocol, and the data packets are transmitted to the MQTT Broker server through the Bluetooth Mesh network.The data packets are transmitted to the MQTT Broker server via Bluetooth Mesh network.Then the messages are forwarded to the cell phone via the MQTT Broker server for display, management, and operation in the APP interface.Agricultural shed monitoring sensor data protocol frames are as follows.
The protocol has a frame header of 0x10 and a frame tail of 0x01.The type is used to distinguish different data types of data frames.From 0x01 to 0xff, they are different types of terminal node upload data message codes, and the corresponding relationship is shown in Table 1.
Table 1.Data protocol frame format

4.2.Topology of Bluetooth
In this paper, the nodes communicate with the gateway by using the Bluetooth Mesh network communication protocol, and the Bluetooth Mesh network is a new multi-hop wireless network technology.The traditional wireless network structure is a star network and tree network, whose topology is shown in Figure 5 (a) and (b), while the Bluetooth Mesh network is a mesh topology, where each node in the network fishes adjacent nodes for communication, as shown in Figure 5 (c).Bluetooth Mesh network is well integrated with an Ad-hoc network without the center, the base device, and

System workflow and testing
In the work of the monitoring system, when the light intensity changes, the system will periodically transmit the detected data through the Bluetooth Mesh network to the IoT gateway for data aggregation and pre-processing, and then transmit the message to the cell phone via MQTT Broker server for display in the APP interface.
As the monitoring system works, environmental factors such as greenhouse temperature, humidity, and light intensity change, and the system will send the detected data and the number of the node (greenhouse location) to the Mesh network client node through the Bluetooth Mesh network, and the client node will upload it to the server through the Internet of Things gateway.The data are displayed through the APP page, as shown in Figure 6.

Conclusion
In this paper, an agricultural greenhouse monitoring system based on the Bluetooth Mesh network is designed with ESP32-C3FH4 as the micro control core.This system applies a wireless sensor network to agricultural production, monitors the light intensity of agricultural greenhouses online in real-time, and also controls the fill light through a wireless network, which realizes the intelligence of agricultural greenhouses, improves production efficiency and quality, and saves manpower.

Figure 3 .
Figure 3. BH1750 schematic diagram3.3.MQTT ProxyMQTT is a client-server architecture based on a Publishing/subscription model messaging protocol.Like the HTTP protocol, the MQTT protocol is an application layer protocol that works on top of the fourlevel TCP/IP model (application layer) based on the TCP/IP protocol.The greatest advantage of the to record the location of different agricultural terminal node deployments; Len indicates the length of data message content carried by the data frame; Dara is the data message carried by the data frame Data.TYPE code writes different types of data and uploads them to the cloud, and the periodical inspection datagram contains all the data collected by the equipment.It defaults to 1 hour to report once and also supports a custom period to monitor the operation of terminal equipment.Other types of datagrams only contain the corresponding collected data in the cloud.The verification system setup is shown in Figure 4.

Figure 4 .
Figure 4. Verification system of Physics: Conference Series 2632 (2023) 012021 multiple paths.Therefore, Bluetooth Mesh network has the advantages of simple deployment and installation, large coverage, high stability, and a diverse working environment compared with traditional communication networks.(a) Star topology (b) Tree topology (c) Mesh topology Figure 5. Network topology