In this Internet of Things learning project, we will use
Arduino to get data from soil moisture sensor, then use MQTT wifi shield to send
moisture date to remote MQTT broker and devices.

Parts and Accessories:
Arduino UNO board x 1 pc
Soil moisture sensor module and probe x 1 set
MQTT wifi shield x 1
Jumper wires

Circuit Connection Map

First, you need put MQTT wifi shield onto Arduino UNO board, then connect Soil
Moisture sensor to the shield as per following instruction:

MQTT wifi shield Soil Sensor Module

Software Installation:

Step 1:
Put the Switch on the shield to 1,2 position which allows
Arduino IDE to load sketch to the board

Step 2: If you have installed Arduino IDE , please skip
Step 2
Otherwise, please read following article and install
the Arduino IDE (programming tool):

Step 3: Download our source code for this project from following


Then copy above code into Arduino IDE and load the sketch into Arduino firmware

Step 4: Set Switch back to ON position.

Test Result:

Step 1: Use any MQTT client to send MQTT message (i.e , you can visit http://www.hivemq.com online
mqtt client), remember the mqtt broker server url/ip, publish topic,subscribe
topic must match your MQTT wifi shield configuration setting 

Step 2: in mqtt client software, publish a message "What is the moisture?"
(publish topic must match your wifi shield subscribe topic),  and your MQTT
client subscription window will receive a message "Soil Moist.:0%" from Arduino
wifi shield. If you put the soil sensor into water, and use MQTT client to
publish "What is the moisture?"  message again, your mqtt client
subscription window will receive another message like "Soil Moist.:30%"