Soil Monitoring And Irrigation With Lora
About the project
Soil Monitoring And Irrigation with Lora, suitable for "Farm automatic" or "smart agriculture".
Estimated time: 1 hour
Items used in this project
When we say "Farm automatic" or "smart agriculture", soil status monitoring& irrigation is the most basic for a farm.
A farm soil status monitoring& irrigation need the following features:
1. Soil status monitoring at multiple points. The soil status, basically humidity and temperature, and soil quality data such as PH/Nitrogen/ Phosphorus/Potassium need to be monitored at multiple points depending on the farm characteristic & plant needs.
2. Irrigating at multiple points, or some other actuators such as fans, to control/ adjust the environment, including humidity/ temperature, of multiple points.
3. Easy to Install. In a farm, as the environment moisture and potential insects& mouses, it is hard to install wires. So remote wireless monitoring& controlling are needed, that the sensors/irrigating can be installed easily.
With these demands, I made this soil monitoring& irrigation with LoRa demo, to solve the above requests in a farm or home garden.
Lora stands for Long Range Radio, it is flexible for rural or indoor use cases such as smart agriculture, and smart cities, mainly targeted for M2M. Theoretically, LoRa arranges can be up to a few kilometers in urban areas, and more than 10 kilometers in rural areas (but as for me, I do not test it so long, the max distance tested is about 3 kilometers).
LoRaWAN is software protocol, that deals with the LoRa messages and communication back and forth with the internet. LoRaWAN needs a stronger controller ability to deal with the protocol and also LoRaWAN Router for internet connection. In my demo, LoRaWAN is needed, we use direct LoRa, without the necessity of an internet connection.
2. Instruments Introduction
2.1 Soil monitoring. For soil monitoring instrument, the core spec:
● Soil spec checking, basically: humidity/temperature; and if necessary advanced spec: PH/Nitrogen/ Phosphorus/Potassium.
● Wireless data transmission, and long life-time
The Makerfabs Soil Moisture Sensor measures the soil humidity (with capacitive mechanism, detailed info) & temperature and sends the data via LoRa every 1 hour. it is anti-corrosion coated. With a 2 AAA battery, the lifetime can be up to 2 years. It is shipped with pre-program firmware, which users can install the battery and then use directly. For more details, check the WiKi. But note that for humidity, its output is “relative humidity”, which is not a “real humidity” but values reflect the humidity changes. Such as values < 500 mean the soil is soaked, while >800 mean very dry. Also, it differs a little depending on how the sensor is installed.
The Industrial-grade Soil Remote Monitor is more professional that it detects the real parameter of temperature, moisture, PH, Nitrogen/ Phosphorus/Potassium, which can be used to analyze the environment & plants, mostly used for research, or field applications that these specifications are important& needed. The sensor is water-proof, it monitors the specifications and transmits to the controller board via RS485, and then the controller (ESP32) board can display it locally on the 0.93 inch OLED, or transmit it remotely with LoRa or Wifi (if there Wifi network). But note that this module shipped without any pre-programming, and need the user to code by himself, mostly for makers’ developments.
2.2 LoRa Actuator.
This cheap& easy to use LoRa MOSFET can be used to control multiple actuators such as fans/valves/electromagnetic lock/ motors…with max current 2A. It is shipped with Makerfabs default firmware(code available on GitHub), and users can use it without any coding/programming. It receives the LoRa messages and acts as the commands (0%~100% by PWM), and feedback on its status to other LoRa modules. We can use this module to control up to 4 valves, and then to control irrigation of 4 points.
2.3 ESP32 TFT Touch with LoRa expansion.
You can also get all the components with this kit: Lora Soil Monitoring & Irrigation Kit.
3.1 Plug the LoRa expansion board into the ESP32 display breakout board, and program it with the codes at GitHub. Set the Wifi connection parameters in the SD card.
Power up ESP32 display, after 3 seconds of logo display, it enters the working page. With right Wifi setting, ESP32 gets the real-time from NTP, and shows on the display:
3.2 We use the simple LoRa soil moisture sensor, take the sensor from the package, and power the sensor with a 2 AAA battery. There is the sensor ID number on the battery slot (and also on the mechanic case), such as ID010040:
Press the “add moisture button” in the ESP32 display, then you can input the ID.
As the setting is complete, the ESP32 display will get the LoRa message from the LoRa soil moisture sensor. As the sensor will output data every 1 hour, to validate the connection, press the “reset” button for an instant message:
The shows ADC data means the moisture sensor output, the lower the values are, the higher moisture, check the Typical Output. The sensor data and the time stamp show on the display, it will update every 1 hour. Actually, it will also add a log in the SD card for further checking.
There Max 8 LoRa moisture sensors can be added and monitored.
3.3 Connect the valves to the LoRa MOSFET outputs.
There the for values, it has one water-input port, and one output port, connect the input port to your water tank(I used a big mineral water bottle as a water tank), and the output to plants. We use a one-input-four output terminal for easy installation.
Press the add MOS in the ESP32 display and input MOSFET ID, such as ID060000, and power up the LoRa MOSFET:
The LoRa MOSFET will report its status to the ESP32 display, and you can now control the MOSFET-connected valves.
Press the MOSX, to change it from OFF to ON, and press send…
The connected valve status changes. Try to control other actuators such as FANS/DC. Actually, you can also send commends via LoRa, to change the PWM duty, to control the connected FANS/DC speed. There max 2 MOSFET(8 actuators ) can be added.
3.4 Install the sensor and valves to your farm/plants.
This demo uses the basic modules to remotely monitor soil status/ control irrigation, which can be used in the field application. But as my time schedule and also poor experience in programming, it is just a demo of LoRa usage, to show how to create a field application.
For makers that are familiar with the coding, there much more spec can be added:
1. Remote monitoring/control with the Internet. As the ESP32 is connected to Wifi, all sensor data can be re-routed to the internet, or remote control of the valves, with MQTT.
2. More LoRa sensors, now it supports 8 soil points and 2 MOSFET that support 8 valves, theoretically, there infinite sensors can be added, but as the LoRa unsafe one-way data transmission, there possibility of data lost when the sensor quality is larger. LoRawan can ensure a safe connection, but I have not made that. And also, more actuators.
3. With the industry level moisture sensor, for more detailed soil monitoring.
4. PWM duty controlling of the connected actuators, to control the load speed…