Agriculture is a backbone of very country as it fulfills the local demand as well as helps to generate the revenue by exporting and due to rapid growth of population Food safety is becoming very huge concern as it's creating food scarcity. But due to rapid growth of technology we can use the resources very wisely to increase the crops yields like by deploying sensors in the field and controlling the use of water, fertilizer and pesticides and later with the use of ML/AI we can take necessary steps to prevent our crops from water scarcity and harsh weathers.
In this whole setup communication plays very vital role to send the information from farms to cloud. Right now researchers are using different types of communication technologies like 3G/4G, GSM, Wi-Fi, Bluetooth, Zigee, some are long range and some are short range but still there are issues with long range communication like in under developed countries still there are rural areas where mobile communication is issue, range is also issue but 3G/4G connections are also expensive if we talk about hundreds of devices as each devices requies sim card with separate package.
To overcome the above 2 issues which is connectivity and cost there is a new communication technology called lorawan which is providing long range connectivity and no monthly charges so we can easliy sense our firms without paying heavy monthly charges to cellular companies. There are 2 satellites organizations which are providing connectivity for LoraWan Nodes Fossa Sat and Lacuna and in near future its more easy to send data to satellite as compared to LoraWan gateway.
So my project will demonstrate the Smart agriculture monitoring using LoraWan P2P and upload the data to cloud. both nodes are equipped with LoraWan. one node will act like Sender as it's connected with Soil Moisture, Soil Temperature, Outer Temperature & Humidity sensors. and the 2nd node will act as receiver as well as bridge to cloud, it will receive the data from sender node via LoraWan P2P and upload the data to ThingSpeak Cloud for real time monitoring as well as for future use related to ML/AI. Below Diagram will demonstrate the whole scenario of project.
Here is the Complete Demonstration Video of whole Project.
#Sender Side
So now lets get started with work. Wio terminal have greate features but 2 main things that I love is Display and RPI extend Pins to connect external sensors. so firstly I am going to start with Sender Node. Below is the list of sensors & Modules for Sender Node.
- Wio Terminal
- HD-38 Soil Moisture
- DS18B20 to Measure Soil Moisture
- DHT22 for Outer Temperature & Humidity
- Seeed Stdio Grove E5 Lorwan Module
Connect the Lorwan Module to Right side of Wio Termainal Connector but other sensors required to pin in RPI extend pins for that I used Vero board so every thing work properly. which is show in below picture. Put the pin# sticker on vero board. I am just using 1 row of pins as it's enough for my project.
Below is the Diagram which is demonstrating RPI Pin# as well Pin# for Arduino which are starting by D & A like D1, A1. every pin is enabled for Analog as well Digtal pins. leave the D0 & D1 as it will be used by Grove E5 LoraWan Module. Rest I used RPI Pin#4 for 5V & Pin#6 for GND which will provide the current & GND to all three sensors. for Soil moisture I used A2(Arduino Ide) which is Pin#16, for DHT22 D3(Arduino IDE) Pin#18 and for DS18B20 D4(Arduino IDE) Pin#22 with 4.7K Pull up Resistor. Remeber DS18B20 won't work with pull up resistor so it's mandatory to connect 4.7K pull resistor from 5V to Pin#18. Now we are ready to put the sensors cable into female headers which are soldered on veroboard.
After hardware assembly it's time to navigate to Arduino IDE. if you are using Wio Terminal for the first time then I will recommend you to read that article so you can setup the Wio terminal in Arduino IDE. I hope you guys setup the Wio terminal successfully now install the following libraries so we can grab some values from sensors.
- Thingspeak (Actually that library will be used on Receiver Side)
- DallasTemperature (for DS18B20)
- OneWire (For DS18B20)
- DHT Sensor library by Adafruit (For DHT22/DHT11)
- Wio Terminal Display Library Click Here
After setting up libraries copy the Sender code from code section and upload it to Wio terminal.
Note:Before uploading the code to sender wio terminal node you need to fetch Soil Moisture Air & Water values, it's very simple for air just put the sensor outside and note down the readings when it's stable just put the value in-front of AirValue variable and later put the Soil Moisture sensor into water and note down the readings when it will be stabilized then change the value of WaterValue variable.
int AirValue=1023;
int WaterValue=358;
#Receiver Side
For the Receiver Side requires 1x Wio Terminal & 1xWio Terminal Chassis - Wio-E5 already I mentioned about thingspeak library which is required to upload the data to thingspeak cloud. If you don't have thingspeak account just naviagate to thingspeak and setup the account. After creating the account setup the Channel and create four fields as mentioned below in the image.
Later Click on API Keys to get the Write Key and Channel ID which will be later used in code to send data to channel these keys will be used in receiver side code.
After Creating & setting up the Channel copy the code from Receiver.ino & Secrets.h to your Arduino IDE from code section but remeber to update your Wi-Fi SSID, Password and ThingSpeak Channel ID & Write Key in Secrets.h file for proper work.
#define SECRET_SSID "--SSID---" // replace MySSID with your network name
#define SECRET_PASS "--SSID-Password--" // replace with your WiFi password
#define SECRET_CH_ID 0000000 // replace 0000000 with your channel number
#define SECRET_WRITE_APIKEY "Channel-Write-Key-here" // replace with your channel write API Key
Below is the picture of both nodes Sender & Receiver.
To Protect the Sender node from Harsh weather I used IP65 Box and PG21 Gland for Box whole.
After packing all the stuff into IP65 box I deployed the system to lemon pot. I have another system which is sensing the soil moisture and soil temperature that's why you will see the 2x soil moisture and 2x DS18B20 in pot so don't be get confused with that.
Wio terminal sender side is successfully taking the readings from plant and displaying on the screen as well as sending the data successfully to receiver node.
and Receiver side is also successfully receiving the data which is displayed on screen as well as on thingspeak cloud.
Below is the thingspeak data visualization dashboard for sensors darta.
I hope you guys like that project. if you have any question please feel free to comment or message me.
Comments