As we know, many factors affect plant growth, such as light. To study specific effects, we need to continuously record plant growth conditions. Today, we will design an experiment with the UNIHIKER M10 to periodically record plant growth under different lighting conditions.
Goal
This project includes three experiment groups: natural light, no light, and full light. Three UNIHIKER M10 boards are used to record light intensity and soil moisture for plant growth. At
fixed intervals, cameras also capture plant photos to record growth status.

Get to Know
1. Use multiple UNIHIKER M10 boards proficiently to build an IoT system.
2. Master methods for drawing multi-data charts in a visualization panel.
3. Understand what AIoT is.
Materials List
Hardware List:
Software:
Mind+ programming software (V1.8 or above) x1
Download: https://mindplus.cc/en
Hands-on Practice
The main function of the AIoT Plant Growth Log is to collect environmental and image data for plant growth and display them in real time through a visualization interface. Next, we will complete it through the following two tasks.
Task 1: Build an IoT System for Data Transmission
In this task, we will apply previously learned hardware knowledge and use two experiment groups as examples to build an IoT system for the growth log, enabling data transmission and storage.
Task 2: Visualize Data
Based on Task 1, to make data viewing and analysis easier, we will learn to upload images and multi-data charts through programming, and complete the visualization interface design for the plant growth log.
Task 1: Build an IoT System for Data Transmission
1. Hardware Connection
To monitor growth in three plant groups, we need three UNIHIKER M10 boards. In addition to soil moisture sensors, the full-light and no-light groups also require light shields and LED rings to control lighting.
Natural-light group: soil moisture + camera. Connect components as shown below.

No-light group: soil moisture + camera + LED ring (fill light for photo capture); Full-light group: soil moisture + camera + LED ring (continuous lighting). These two groups use the same sensors and actuators and can be wired as shown below.

2. Software Preparation
Open Mind+ and complete software preparation as shown below.

3. Write a Program
The plant growth log needs to collect growth-environment data from three groups and send them to the IoT platform. Therefore, the three UNIHIKER M10 boards form one IoT system. Now let us build this system to collect and transmit data.
(1)Build the IoT System
First, determine the role of each UNIHIKER M10 and enable IoT service on the server-side UNIHIKER M10. Here, we choose the "natural-light group" UNIHIKER M10 as the server side.

Then connect the computer and the three UNIHIKER M10 boards to the same subnet, and
enable IoT service (SIoT2.0) on the "natural-light group" board.
Note: For operations such as connecting multiple UNIHIKER M10 boards to the same network and viewing network information, refer to the tutorial at https://mc.dfrobot.com.cn/thread-314805-1-1.html.
Next, go to the IoT platform and create the required topics. This project uses 10 topics in total: three for soil moisture, three for light intensity, three for plant images, and one for light
comparison.

Finally, you can open three Mind+ program files, configure connections, and subscribe to topics respectively (you can use the schoolbag feature for quick copy).

This project needs to record growth-environment data for three plant groups. Let us use the natural-light and no-light groups as examples.
a)Natural-light Group
First, initialize the interface and pins. For interface initialization, you can directly use the "Natural-light Group Background" image in the assets, then set corresponding data text. Also remember to initialize the camera.

Then, in `forever`, update and transmit sensor data.

Finally, take photos on schedule to record plant growth. We can create a timer variable. When the timer variable reaches the interval, take a photo.

For the no-light group, the UNIHIKER M10 also needs to collect soil moisture, light, and growth images. We can copy the natural-light group program, then modify initial interface positions and the published topic/content in the `update and transmit data` function.

In addition, because a fully dark environment is not suitable for photography, an LED ring is needed as fill light.

To avoid LED on/off affecting main-process timing and reducing image time alignment error
with the natural-light group, we can `start thread` to perform: wait until fill light stabilizes, take
camera photo, then turn off fill light.


4. Run the Program
Use Mind+ remote connection to the natural-light and no-light UNIHIKER M10 boards, click Run, and observe board data/images and received data on the IoT platform.

5. Have a Try
You have completed data collection and transmission for the "natural-light group" and "no light group." Now implement data collection and transmission for the "full-light group" by yourself.

Task 2: Visualize Data
1. Write a Program
Task 1 has already implemented data transmission and on-board display, but because the UNIHIKER M10 is inside a light shield, viewing data and growth status is inconvenient. Therefore, we will use the visualization panel to present data better. Now open the "Visualization Panel" and complete preparation such as creating a new project.
Note: For operations of the "Visualization Panel," refer to "Lesson 10: Campus IoT
Dashboard System."
(1)Display Images at Intervals
Let us first use the natural-light group as an example to display plant images periodically on the Mind+ visualization platform. In "Display Components," find the "Image" component. You can view relevant usage instructions in the "Properties" area.

As prompted, images must be converted to strings before they can be sent to the visualization platform. How do we convert them?
First, in "Extensions" -> "User-Ext", enter link“https://gitee.com/chenqi1233/ext-base64”.

After adding it, initialize the base64 module before `forever`. After camera capture, get the image and convert it to a base64-encoded string, then publish it to the corresponding topic to
achieve scheduled display on the visualization platform.

The other two experiment groups can use the same method to complete image transmission.

(2) Display Light Changes of Three Groups
To better present changes in light data across three groups, choose one “Line Chart” component and use three different colors. To implement this, set meanings of the lines and change transmission format, for example `145,10,200`, where three values are separated by commas. We can use the `join "" ""` block and variables to build transmitted data.

Next, in the server-side (natural-light group) program, add code to receive three groups of light data and complete collection for the "light-condition line chart."

After receiving data, you can try adding initial plant-state images for easier growth comparison. Also remember to add related data components to display corresponding information. See the complete reference program below:




2. Run the Program
Run code for the three experiment groups respectively. After saving the visualization project, click full screen and observe changes in data, charts, and images on the visualization interface.
Note: This experiment needs to run for a period of time before obvious plant growth changes appear. The project only provides reference for building experiment equipment, not experiment data or conclusions.
Knowledge Base
1. Multi-Data Charts in Visualization Panel
Multi-data charts are used to compare and analyze data changes. The visualization panel provides line charts, bar charts, donut charts, and other components that support multiple datasets. You can build transmission data according to prompts in each chart component's "Properties" area.

To build transmission data, the commonly used block is the string-concatenation block `join "" ""`. In general, different categories of data are connected with `,`, like the light line-chart data
in this lesson.

A special case is bar charts: within the same category, you can include more data for different conditions, separated by `|`, such as fruit prices in different months.
Note: The color blocks and labels in the figure below are all "decorative components."

2. Understanding AIoT
AIoT is the combination of AI and IoT, meaning the integration of artificial intelligence and internet-of-things technology. If IoT enables connectivity between things, AIoT adds an analytical "brain" to IoT. With AI, it can perform detection, analysis, and decision-making, forming intelligent IoT-based systems that provide better and more personalized services. In general, IoT projects with machine vision or speech recognition functions, such as smart security, can be called AIoT applications. In the next lesson, we will continue exploring this theme.
3. Block Overview

Challenge Yourself
Do you still remember the Lesson 12 project ? After learning this lesson, try modifying Lesson 12 code yourself and use a visualization interface to view visitors on a computer and
remotely unlock the door.









