Experience Smart Plant Watering Without Buying a Development Board?

To facilitate more developers in experiencing HarmonyOS device simulation development, we have launched an online experience for the Smart Plant Watering Demo (Flower Guardian). Here, you do not need to purchase any hardware, and can experience how to remotely monitor the temperature, humidity, and watering of potted plants through a HarmonyOS phone in just 2 minutes.

Copy the link to experience it first~https://playground.harmonyos.com/#/cn/onlinedeviceDemoThe “Flower Guardian” Demo is shown in the video below. Enter the website, and you can experience the Flower Guardian Demo in three simple steps.

Step 1: Connect the IoT device to Huawei Cloud (the IoT device here is the development board)

Click “run” to start the demo. At this point, you can see the development board connecting to Huawei Cloud in the preview image on the right. After a successful connection, a prompt will appear above the code example;

Step 2: Connect the HarmonyOS phone to Huawei Cloud

Click “Next” in the prompt (to proceed to step two), then click “run”. You will see the phone and development board connect by tapping them together, and the Flower Guardian application on the phone will also connect to Huawei Cloud, followed by a successful connection prompt;

Step 3: Remote Watering

Continue clicking “Next” in the prompt (to proceed to step three), then click “run”. You will see the watering action completed remotely via the phone.Next, I will detail how these three steps are implemented~

1. IoT Device Connects to Huawei Cloud

The first step is to connect the development board to Huawei Cloud.As shown in Figure 1: After powering on and resetting, the development board initializes the NFC, water pump, sensors, and Wi-Fi, reads network information from the NFC, and then establishes a connection to Huawei Cloud via Wi-Fi. The connection between the development board and Huawei Cloud is implemented through the CLOUD Connect in line 41 of the code. After a successful connection, the development board transmits information such as soil moisture and air temperature to Huawei Cloud.

Experience Smart Plant Watering Without Buying a Development Board?

Figure 1 IoT Device Connects to Huawei Cloud

2. HarmonyOS Phone FA Connects to Huawei Cloud IoT

The second step is to connect the FA application (i.e., the Flower Guardian application) on the phone to Huawei Cloud.As shown in Figure 2, bringing the HarmonyOS phone close to the development board allows the NFC card to launch the Flower Guardian application on the phone. The Flower Guardian application then logs into Huawei Cloud using the IoT account, completing the connection to Huawei Cloud. The “connection” is achieved through the CreateAccessKey in line 5 of the code shown below. After a successful login, the Flower Guardian application can retrieve soil status and other information from Huawei Cloud.

Experience Smart Plant Watering Without Buying a Development Board?

Figure 2 HarmonyOS Phone FA Connects to Huawei Cloud IoT

3. Remote Watering

The final step is to achieve remote watering through the Flower Guardian application.As shown in Figure 3, on the HarmonyOS phone’s Flower Guardian application, clicking the watering can on the page will send a watering command to Huawei Cloud via the CreateCommand method in line 14 of the code shown in the image. Then, the Huawei Cloud platform will send the command to the development board, which will start the timer upon receiving the command. The motor will pump water for the plants, and when the timer expires, the motor will stop pumping.

Experience Smart Plant Watering Without Buying a Development Board?

Figure 3 Remote Watering

Thus, through these three simple steps, we have achieved smart watering. Want more? Follow us, and we will arrange more exciting online experiences covering more application scenarios, stay tuned.

END

Want to learn more about HarmonyOS technology?

Leave a message in the background, and we will arrange it immediately! Click here to experience it online now~

Leave a Comment