Temperature and moisture sensors are amongst the most commonly used environmental sensors. And, more importantly, similar to the metrics of computer advancements increasing power but droping prices, so too have soil measurement systems. These systems have and will continue to become more affordable for anyone.
What is Soil Moisture? - Soil moisture is difficult to define because it means different things in different disciplines. For example, a farmer's concept of soil moisture is different from that of a water resource manager or a weather forecaster. Generally, however, soil moisture is the water present between soil particles - and for the purpose of this article we will be using soil moisture as simply the amount of water present in a measurement of soil.
Why is Measuring Soil Moisture Important? - Compared to other components of the hydrologic cycle, the volume of soil moisture is small; nonetheless, it is fundamentally importance to any hydrological, biological, or biogeochemical process. Soil moisture information is valuable for a wide range of government agencies and private entities concerned with weather and climate, runoff potential and flood control, soil erosion and slope failure, reservoir management, geotechnical engineering, and water quality.
In this guide you will learn how to build your own home-made soil moisture and temperature sensor. Also included are instructions for your newly collected data to be utilized via Ubidots, an application enablement platform designed to help tinkerers and businesses develop a deploy innovative solutions to environmental obstacles.
- Soil Temperature/Moisture Sensor - SHT10
- 10K Resistor
- Plastic Protection Case
- Micro USB cable
To program your device and display the data you must first be registered on the following pages:
- Particle account
- Ubidots account - for Educational Licenses
- Ubidots account - for Business/Industrial Licenses.
Wiring and Casing
The sensor we will build today is a SHT-10 with 4 data/power wires brought out. With this, any SHT-1X code for a microcontroller will work. The sensor works with 3 or 5V logic. The 1 meter long cable has four wires: Red = VCC (3-5VDC), Black or Green = Ground, Yellow = Clock, Blue = Data. Don’t forget to connect a 10K resistor from the blue Data line to the VCC in order to receive the sensor's readings.
Follow the table and diagram below to make the correct connections:
Once you have the right connections, assemble in your protection case. Please use your imagination for what this step. Below is how our full kit came together.
We now need to connect with Particle IDE
With your case and Particle Electron assembled in the protection case, we now need to connect your device to Particle's IDE. Please reference the article below to connect your device if you are not already familiar with Particle's IDE.
DO NOTE MISS THIS STEP: while working with your Particle IDE, you need to add 2 libraries - 1) UBIDOTS and 2)SHT1X (1.0.1 or newer).
Once you have included both libraries you will see something like this...
Now it is time to start coding :)
Copy the code below and paste it into the Particle IDE. Before you paste your code into the Particle IDE, be sure to erase the previous library inclusions (initial codes) and you are working with a blank IDE.
Once you have copied the code, you will need to assign the unique Ubidots TOKEN. If you don't know how locate your Ubidots TOKEN, please reference this article: How to get your Ubidots TOKEN
Please, reference to this link to get the code if it is not visable in your browser.
Once you have pasted the code and updated the Ubidots TOKEN line, you must Verify this code within the Particle IDE. In the top left corner of our Particle IDE you will see the below icons. Click the Check Mark icon to verify any code.
Once the code is verified, you will receive a "Code verified! Great work" message in the Particle IDE.
Next, your have to upload the code into your Particle Electron. To do this, choose the flash icon up the check mark icon. (Be sure that your Electron is plugged into your computer's USB port.)
Select the "FLASH OTA ANYWAY" to start the upload.
Once the code is uploaded, you will receive a "Flash successful! Your device is being updated - Ready" message in the Particle IDE
Now your sensor is sending the data to the Ubidots Cloud!
The LED will turn ON every time the sensor send the data to Ubidots.
Management of the data in Ubidots
If your device is correctly connected you will see a new device created within the device section of your Ubidots application. The name of the device will be "particle". If you open the devices tab you will see two variables cooresponding to yout Paricle device: "soil-moisture" and "temperature" each taking readings every 10-12 seconds.
If you desire to change your device and variable names to more friendly ones, please reference this article below.
Soil moisture is a key variable in controlling the exchange of water and heat energy between the land surfaces and our atmosphere. As a result, soil moisture plays an important role in the development of weather patterns, agriculture production, or gardening beauty. With this soil moisture and temperature tutorial you now are in control of your plants envirnments and can respond when your plants tell you they are thirsty or cold.
Now it is time to create a dashboard for controlling and managing you very own soil moisture and temperature sensor. To learn more about Ubidots widgets and events for optimizing your application, check out these video tutorials.