Once the ESP is onboarded, it will transmit soil moisture data to the Zoho IOT application. This data can be visualized through a graph for easy interpretation. Additionally, you can set up a command in the Zoho IOT application to manually control the irrigation pump. To optimise the system, you can automate the pump's operation based on the sensor data and the configured commands within the application.
View data sent by ESP32
We must first confirm if the messages sent by the ESP32 are received by the Zoho IOT application. Once the device is properly onboarded, the connection status of the My ESP (device created in the application) will change to connected.
Adding a Command to control the pump
You can add a command to the "My ESP" device to enable remote control of the pump via the application. The necessary code to manage the pump is already integrated into the example program that has been uploaded to the ESP32.
To add a command,,
Click Actions > Command Configuration in the device's information page. Click Add Command. Provide the value shown below in the appropriate fields and click Create.
Note: The command key status is in the direct parsing string option.
A new command with the name Pump ON/OFF will be created.
Executing the Command
You can execute the command, and the appropriate action will be initiated in the ESP32 setup.
To execute a command,
Select the box near the Pump ON/OFF command and click the Execute Command that appears. Click toggle to OFF and click Execute.
<include command successful screenshot>
The command will be sent to the ESP32, and the pump will be turned off.
You can always access the command configuration to execute the command by clicking Actions > Command Configuration in the device's information page.
Automating command with an alarm rule.
You can now set up an alarm rule to automate the pump's ON/OFF functionality. Configure the rule so that if the soil moisture level drops below 20, the pump will automatically turn ON. Conversely, if the soil moisture level rises above 80, the pump will turn OFF. This ensures optimal watering based on real-time soil conditions.
To create an alarm rule,
Click Actions > Alarm Rule Configurations in the device's information page. Click Add Alarm Rule. Provide the following values in the appropriate fields and click Next. Click Add State. Provide the following values in the Define State page and click Next. Select Realtime Datapoint in the Select Trigger page and click Next. Provide the Primary Condition and details as follows in the set Condition Page and click Next.Note: The value 20 is provided in the constant field option Provide the following description in the Configure Message and click Next. In the Configure Action page,
Select Everytime Action in the Select Action Type. Click Add Action > Execute Command. Select Pump ON/OFF in the Select Command filed. Toggle On and click Save & Associate.
Click Finish, and the state will be added.
Click Add State again. Provide the following values in the Define State page and click Next. Select Realtime Datapoint in the Select Trigger page and click Next. Provide the Primary Condition and details as follows in the set Condition Page and click Next.Note: The value 80 is provided in the constant field option Provide the following description in the Configure Message and click Next. In the Configure Action page,
Select Everytime Action in the Select Action Type. Click Add Action > Execute Command. Select Pump ON/OFF in the Select Command filed. Toggle Off and click Save & Associate.
Click Finish, and the state will be added. With two states added, click Save.
The alarm rule has been successfully created, automating the operation of the pump to maintain the soil moisture level for optimal plant health. The system is configured to activate the pump when soil moisture drops below 20 and turn it off when it exceeds 80.
You have now successfully set up a comprehensive soil moisture monitoring and management system using a Zoho IOT application.