IoT soil moisture sensors have become very popular nowadays as we constantly looking for unique solutions to solve global warming and food shortages. integrating IoT sensors in agriculture for monitoring is crucial for our future. In this blog article, we will cover how soil moisture sensors became so commonly available, which soil moisture sensor you should choose for your next project and why not all soil moisture sensors were born equal.
What are IoT soil moisture sensors?
Soil moisture sensors are sensors that are able to sense the amount of moisture in the soil. By knowing the amount of moisture, we can translate the digital and analog data into a human language, to know whether the plants need more water or not. By incorporating such sensors you can make better decisions for your smart garden, irrigation system, or it-based solution. traditionally, soil moisture sensors used to be analog. Over time, IoT-based soil moisture sensors became more popular with the ability to integrate cloud and database.
Types of soil moisture sensors
There are two main types of soil moisture sensors that you’ll find available in the market:
* Capacitive soil moisture sensors
* Resistive soil moisture sensors
As we’ve mentioned earlier, not all soil moisture sensors are born the same. Resistive soil moisture sensors will become corrosive over time and the accuracy of the reading will slowly decrease. The capacitive sensors however are corrosion resistant. Enabling the sensors to collect data for a long period of time without the worry of corrosion or other environmental impacts.
Both of the sensors consist of a PCB-designed probe designed to measure the volumetric content of water. By running current through the water and the probe, the resistive soil moisture sensor will corrode over time. By using the capacitive soil moisture sensor we can avoid this trouble and ensure stability and accuracy for the life of our green plants.
How to receive input from the sensors
Having soil moisture sensors is just not enough. In order to make the sensor truly smart, we will turn the simple sensor into an IoT soil moisture sensor. There are many ways to do so and in this article, we will cover the 3 most common micro-controllers: Espressif ESP, Arduino, and Raspberry Pi.
The soil moisture sensors often use analog as an output signal. Most of the micro-controllers have a built-in ADC (analog to digital converter) which allows us to connect the soil moisture sensor directly. Some microcontrollers, however, such as the Raspberry Pi, require external ADC to work.
Integrating soil moisture sensor to ESP32, Arduino, or Raspberry Pi
ESP8266 and ESP32 IoT-based soil moisture sensor
Starting with the infamous ESP8266 and ESP32. While both boards belong to the same brand they are quite different in their core design. That however does not stop us from connecting the sensor in the same way.
The ESP32 has a built-in ADC that enables us to integrate sensors directly through the analog, 5V, and GND pins. Different sensors have different voltage tolerance and it’s crucial to ensure that connecting to 5V will not cause damage to the sensor itself. If you want to go safe, try connecting to 3.3V and see if the soil moisture sensor works well.
The sensor can be programmed either in MicroPython using Thonny IDE, Arduino IDE using Arduino C, or the official Espressif SDK.
Arduino IoT soil moisture sensor
Arduino platform chosen by makers and companies worldwide to quickly prototype and create smart IoT soil moisture irrigation systems with ease.The Arduino has an enormous community with lots of resources on how to get started. In no time, you can turn your simple sensor into an IoT soil moisture sensor using Arduino and Arduino IDE.
The Arduino has a built-in ADC so in order to make it work we simply connect the analog output to the A0 (analog 0) port, VCC to 3.3V or 5V, and GND to GND. An extra step is to connect the VCC to AREF (Analog reference) as well which will give us the reference voltage from the Arduino power supply.
The Arduino can be programmed using the Arduinothe IDE using Arduino C programming language.
Raspberry Pi IoT soil moisture sensor
Raspberry Pi is a little different from the rest of the micro-controllers. The reason is that Raspberry Pi doesn’t have a built-in ADC. Putting it simply, we are unable to convert the soil moisture analog signal into a digital signal. But don’t you worry! we have solutions for everything.
Using an external ADC1115 ADC you can turn your non-analog raspberry pi into a precise analog reader! The ADC1115 connects over the I2C protocol to the Raspberry Pi and using simple commands we can receive input from the soil moisture sensors just like any other micro-controller.
The Raspberry Pi can be programmed in many different programming languages. Python3 is commonly chosen as the default language for the RPi.
Best microcontroller for IoT-based smart irrigation system
Different applications have different needs and so there isn’t a simple answer for all. If your project requires wireless connectivity, ESP products are the way to go. If it’s a simple data logger, Arduino might be a better choice. Raspberry Pi might be a good option if there is heavy computation involved and if more than a single sensor is needed.
If you are in doubt, you could always experience different micro-controllers. ESP, for example, supports both Arduino IDE and MicroPython. Which makes it an easy choice for beginners who want to build their first IoT smart garden and IoT soil moisture sensor.
Agriculture IoT kit – ready out of the box
If you are looking to build your first soil moisture IoT-based solution, you might need a kit. Eduponics mini is an all-in-one IoT smart agriculture IoT kit that can help you archive the project of your dreams. It contains a state-of-art capacitive soil moisture sensor, pump, and a good amount of environmental sensors.
The best part? It comes with an Eduponics APP that enables you to turn any soil moisture sensor into a remote-controlled solution.
The Eduponics mini is based on the ESP32 development board. Different extensions are available for purchase to enhance the smart garden capabilities.
Learning materials
You can find an example code for connecting the soil moisture sensor to the ESP32 in our documentation and official Github repository
Leave A Comment