Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Other than code stuff #2

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d6b59ec
Added CAD model (3 files)
PrathamSahil Jun 12, 2023
74b42ee
Added presentation file
PrathamSahil Jun 12, 2023
57cf52f
added problem statement in a readme file
PrathamSahil Jun 16, 2023
9e0f21d
Create EquipmentsDescription.md
mohit-41 Jun 20, 2023
53db34f
Created a readme file describing equipments
mohit-41 Jun 20, 2023
39dfc85
Added details in README file
mohit-41 Jun 20, 2023
2b52b7e
Images of CAD Model
mohit-41 Jun 20, 2023
156979a
Added details in README file
mohit-41 Jun 20, 2023
f98815a
Add files via upload
priyanshumsr Jun 22, 2023
54761bb
Update README.md
priyanshumsr Jun 22, 2023
a134104
Update README.md
priyanshumsr Jun 22, 2023
85f1793
Better README.md
priyanshumsr Jun 22, 2023
9ea385f
Update README.md
mohit-41 Jun 22, 2023
dac5c51
Update CAD model folder
mohit-41 Jun 22, 2023
46858d7
Delete Soil sampling and monitoring_final.pptx
mohit-41 Jun 22, 2023
9941342
Update Description folder
mohit-41 Jun 22, 2023
03a6105
Update Description folder
mohit-41 Jun 22, 2023
52686ba
Added cad model in its specified folder
PrathamSahil Jun 22, 2023
664e429
Delete finalBottomCAD.SLDPRT
PrathamSahil Jun 22, 2023
49c2457
Delete finalAboveCAD2.SLDPRT
PrathamSahil Jun 22, 2023
ed3f82c
Removed all cad model files
PrathamSahil Jun 22, 2023
584a928
Update README.md
mohit-41 Jun 22, 2023
bf38fb5
Update README.md
mohit-41 Jun 22, 2023
73d2d6e
Update EquipmentsDescription.md
mohit-41 Jun 22, 2023
2b1a8d5
Update and rename CAD model to Mechanical Design
mohit-41 Nov 2, 2023
ca2d4f3
Add files via upload
mohit-41 Nov 2, 2023
455497e
Created CADmodel.md
mohit-41 Nov 2, 2023
e5f4d54
Delete CAD model directory
mohit-41 Nov 2, 2023
8a27168
Delete Mechanical Design directory
mohit-41 Nov 2, 2023
e88497b
Update README.md
mohit-41 Nov 2, 2023
ba572b9
Update README.md
mohit-41 Nov 2, 2023
4e22bc2
Updated Directory name
mohit-41 Nov 2, 2023
47c61da
Update README.md
mohit-41 Nov 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Description/EquipmentsDescription.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
### 1. A capacitive soil moisture sensor
![image](https://github.com/PrathamSahil/Soil-sampling-and-Monitoring/assets/133521400/0ebbb3eb-4c5e-46e4-97ae-3224b4e7c8ef)



* This Capacitive soil moisture sensor measures the volumetric content of water inside the soil and gives us the moisture level as output.  It is made of corrosion-resistant material, providing excellent service life.
This module has an operating voltage range of 3.3 ~ 5.5V. It supports a 3-pin interface, i.e., Input Voltage, Ground, and Output pin.

### 2. A pH sensor
![image](https://github.com/PrathamSahil/Soil-sampling-and-Monitoring/assets/133521400/aae128fa-521a-4fb7-af8c-9d674d89ef95)


* This analog pH Sensor Kit is specially designed for microcontrollers. It has an LED that works as the Power Indicator, a BNC connector, and a PH2.0 sensor interface. To use it, we connected the pH sensor with the BND connector and plugged the PH2.0 interface into the analog input port of our microcontroller.

### 3. A temperature sensor
![image](https://github.com/PrathamSahil/Soil-sampling-and-Monitoring/assets/133521400/87afe811-6749-4998-9ee1-b220bb2f7cc2)


* The thermistor is a temperature sensor that uses a semiconductor and measures the temperature and sends this information in terms of resistance value. It is able to record the slightest temperature changes.


### NodeMCU Esp8266
![image](https://github.com/PrathamSahil/Soil-sampling-and-Monitoring/assets/133521400/cd4fa97c-51a3-4c13-bea2-142ec70e4120)


* The ESP8266 is a low-cost Wi-Fi microchip with built-in TCP/IP networking software and microcontroller capability.The ESP8266 WiFi Module is a self-contained SOC with an integrated TCP/IP protocol stack that can give any microcontroller access to your WiFi network. The ESP8266 can host an application or offload all WiFi networking functions from another processor. Each ESP8266 module comes pre-programmed with an AT command set firmware, meaning we can simply hook this up to our Arduino device and get about as much WiFi-ability as a WiFi Shield offers. It has 17 GPIO pins, a serial peripheral interface bus(SPI), and a 10-bit ADC, making it easy to use.


13 changes: 13 additions & 0 deletions Description/READproblemStatement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Soil Sampling and Monitoring:

Problem Statement: Soil sampling is a crucial aspect of soil health monitoring, as it provides essential information about the soil's physical, chemical, and biological properties. Traditional soil sampling methods are manual, time-consuming, and often result in inconsistent and unreliable data. The need for a more efficient and accurate soil sampling system is crucial in ensuring sustainable agriculture and food security.

Objective: To develop an loT-based soil sampling system that can accurately and efficiently collect soil samples, analyze the soil data in real-time, and provide actionable insights to farmers and agriculture experts. The system should also be scalable, flexible, and adaptable to different soil types and climates.

Scope: The loT-based soil sampling system will consist of smart soil sampling devices equipped with loT sensors, a cloud-based platform for data storage and analysis, and a mobile application for real time monitoring and management of soil health parameters. The system should be easy to install, operate, and maintain, and should provide consistent and reliable data on soil health parameters such as pH, temperature, moisture, and nutrient levels.

Deliverables:The final solution will deliver a complete loT-based soil sampling system that includes the following components:
Smart soil sampling devices equipped with loT sensors
Cloud-based platform for data storage and analysis
Mobile application for real-time monitoring and management of soil health parameters
Integration and testing of the complete system in a real-world agriculture setting
13 changes: 13 additions & 0 deletions Mechanical Design/CADmodel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### CAD Model

* The images of our design looks like:

![image](https://github.com/PrathamSahil/Soil-sampling-and-Monitoring/assets/133521400/b6c7be6d-c86c-47a1-963e-6bea6a19ca36)
![image](https://github.com/PrathamSahil/Soil-sampling-and-Monitoring/assets/133521400/e4cbe6f9-e8a8-4824-928b-3ba85113a063)
![image](https://github.com/PrathamSahil/Soil-sampling-and-Monitoring/assets/133521400/19610704-af0d-451f-a55e-23e5cac7c20b)
![image](https://github.com/PrathamSahil/Soil-sampling-and-Monitoring/assets/133521400/64366980-1fd2-4023-b486-fdbd22a3fa73)
![image](https://github.com/PrathamSahil/Soil-sampling-and-Monitoring/assets/133521400/597704b2-ba72-4aa7-bbf9-cc20bc3778f3)

* After completion, the model looks like:

![image](https://github.com/PrathamSahil/Soil-sampling-and-Monitoring/assets/133521400/e0b59909-b8ae-4fd5-8db9-5806c0308bfa)
Binary file added Mechanical Design/finaBottomAndAboveAssem.SLDASM
Binary file not shown.
Binary file added Mechanical Design/finalAboveCAD2.SLDPRT
Binary file not shown.
Binary file added Mechanical Design/finalBottomCAD.SLDPRT
Binary file not shown.
49 changes: 48 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,48 @@
# Soil-sampling-and-Monitoring
# Soil-sampling-and-Monitoring
![image](https://github.com/PrathamSahil/Soil-sampling-and-Monitoring/assets/133521400/f925b05b-e744-484b-8b89-4419efcaabd1)

#### Overview

* Soil sampling is a crucial aspect of soil health monitoring, as it provides essential information about the soil's physical, chemical, and biological properties. Traditional soil sampling methods are manual, time-consuming, and often result in inconsistent and unreliable data. The need for a more efficient and accurate soil sampling system is crucial in ensuring sustainable agriculture and food security.

### Our work

* We have developed an IoT-based soil sampling system that can accurately and efficiently collect soil samples, analyze the soil in real-time, and gives various parameters like moisture content, pH value, and temperature of soil so that people can choose the best soil for farming.

* We've used these sensors in the project:
1. Capacitive Moisture sensor
2. pH sensor
3. Temperature sensor

* A NodeMCU Esp8266 is used to store the code.

* The code is available at : [src](https://github.com/PrathamSahil/Soil-sampling-and-Monitoring/tree/main/src)

* The details can be found at :
[Equipments Description](Description/EquipmentsDescription.md)

### Circuit diagram

* We've designed the circuit of this model as :
![image](https://github.com/PrathamSahil/Soil-sampling-and-Monitoring/assets/133521400/c7bc868b-a98a-4500-b10f-862b40bbd4aa)

### CAD Model

* The model is kept inside a box which is basically a CAD Model.
* The designs can be found at :
[Mechanical Design](https://github.com/PrathamSahil/Soil-sampling-and-Monitoring/tree/main/Mechanical%20Design)

### Result

* As the project ended,we’ve been able to get data from the sensors, and using IoT, we’re sending that data to the cloud successfully. That data is easily available on our device using the Blynk IoT platform.
![image](https://github.com/PrathamSahil/Soil-sampling-and-Monitoring/assets/133521400/fe476d95-d516-40be-a97f-73c57233f5d8)


* So this can be used from far locations as well as it uses wi-fi which makes it handy its interface is also very easy to use, so any newcomer can get accurate and necessary information about the soil very easily.

### TEAM MEMBERS

1. Priyanshu Mishra
2. Pratham Sahil
3. Mohit Kumar
4. Harshad Yugraj
36 changes: 36 additions & 0 deletions src/SoilMoisture/SoilMoistureValue.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
float soilMoistureValue = 0;
float soilmoisturepercent=0;

void myTimerEvent()
{

soilMoistureValue = analogRead(D1);

Serial.println("SoilMoistureValue :");
Serial.println(soilMoistureValue);

soilmoisturepercent = map(soilMoistureValue, AirValue, WaterValue, 0, 100);
if(soilmoisturepercent >= 100)
{
Serial.println("SoilMoisturePercent :");
Serial.println("100 %");
//Blynk.virtualWrite(V0,soilmoisturepercent);

}
else if(soilmoisturepercent <=0)
{
Serial.println("SoilMoisturePercent :");
Serial.println("0 %");
// Blynk.virtualWrite(V0,soilmoisturepercent);
}
else if(soilmoisturepercent >0 && soilmoisturepercent < 100)
{
Serial.println("SoilMoisturePercent :");
Serial.print(soilmoisturepercent);
Serial.println("%");
//Blynk.virtualWrite(V0,soilmoisturepercent);

}
}


25 changes: 25 additions & 0 deletions src/Temperature/temp.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
int ThermistorPin = A0;
int Vo;
float R1 = 22000;
float logR2, R2, T;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;

void setup() {
Serial.begin(9600);
}

void loop() {

Vo = analogRead(ThermistorPin);
R2 = R1 * (1023 / (float)Vo - 1.0);
logR2 = log(R2);
T = (1.0 / (c1 + c2*logR2 + c3*logR2*logR2*logR2));
T = T - 273.15;
//T = (T * 9.0)/ 5.0 ;//+ 32.0;

Serial.print("Temperature: ");
Serial.print(T);
Serial.println(" F");

delay(500);
}
197 changes: 197 additions & 0 deletions src/combinedCode/soilSampling.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@


#define BLYNK_TEMPLATE_ID "TMPLhswNixQX"
#define BLYNK_TEMPLATE_NAME "Soil Sampling"
#define BLYNK_AUTH_TOKEN "XKE1utJtPW8NCIKAkiUq-b-fDOO75i8F"
#define BLYNK_PRINT Serial

#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

#define Offset 0.00
#define samplingInterval 20
#define printInterval 800
#define ArrayLenth 40

int pHArray[ArrayLenth];
int pHArrayIndex = 0;
int countTrueCommand;
int countTimeCommand;
boolean found = false;
int pHPin=A0;
int ThermistorPin = D0;
int MoisturePin=D1;
int Vo;
float R1 = 22000;
float logR2, R2, T;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
const int AirValue = 140;
const int WaterValue = 180;
float soilMoistureValue = 0;
float soilmoisturepercent=0;



//#include <ESP8266WiFi.h>
//#include <BlynkSimpleEsp8266.h>


char ssid[] = "PrathamMobile";
char pass[] = "pratham22";

BlynkTimer timer;


float phVal() {
static unsigned long samplingTime = millis();
static unsigned long printTime = millis();
static float pHValue, voltage;
if(millis()-samplingTime > samplingInterval) {
pHArray[pHArrayIndex++] = analogRead(pHPin);
if(pHArrayIndex == ArrayLenth) {
pHArrayIndex = 0;
}
voltage = (avergearray(pHArray, ArrayLenth)*3.3/1024)+2;
pHValue = 3.5*voltage+Offset;
samplingTime = millis();
}
if(millis()-printTime > printInterval) {
Serial.print("Voltage:");
Serial.print(voltage,2);
Serial.print(" pH value: ");
Serial.println(pHValue,2);
printTime = millis();
}
return pHValue;
}

double avergearray(int* arr, int number) {
int i;
int max,min;
double avg;
long amount = 0;
if(number <= 0) {
Serial.println("Error number for the array to avraging!/n");
return 0;
}
if(number < 5) {
for(i = 0; i < number; i++) {
amount += arr[i];
}
avg = amount/number;
return avg;
}
else {
if(arr[0] < arr[1]) {
min = arr[0];
max = arr[1];
}
else {
min = arr[1];
max = arr[0];
}
for(i = 2; i < number; i++) {
if(arr[i] < min) {
amount += min;
min = arr[i];
}
else {
if(arr[i] > max) {
amount += max;
max = arr[i];
}
else {
amount += arr[i];
}
}
}
avg = (double)amount/(number-2);
}
return avg;
}

void myTimerEvent()
{


//int sensorValueMoisture = analogRead(36);
int valSensorPH = phVal();

Vo = analogRead(ThermistorPin);
R2 = R1 * (1023 / (float)Vo - 1.0);
logR2 = log(R2);
T = (1.0 / (c1 + c2*logR2 + c3*logR2*logR2*logR2));
T = T - 273.15;

float temperature=T;

soilMoistureValue = analogRead(MoisturePin);

Serial.println("SoilMoistureValue :");
Serial.println(soilMoistureValue);

soilmoisturepercent = map(soilMoistureValue, AirValue, WaterValue, 0, 100);
if(soilmoisturepercent >= 100)
{
Serial.println("SoilMoisturePercent :");
Serial.println("100 %");
Blynk.virtualWrite(V0, );

}
else if(soilmoisturepercent <=0)
{
Serial.println("SoilMoisturePercent :");
Serial.println("0 %");
Blynk.virtualWrite(V0, );
}
else if(soilmoisturepercent >0 && soilmoisturepercent < 100)
{
Serial.println("SoilMoisturePercent :");
Serial.print(soilmoisturepercent);
Serial.println("%");
Blynk.virtualWrite(V0, );


}



Blynk.virtualWrite(V0, );
Blynk.virtualWrite(V1, );
Blynk.virtualWrite(V2, );





Serial.println("pH : ");
Serial.println(valSensorPH);

Serial.println("temperature : ");
Serial.println(temperature);




}

void setup()
{
// Debug console
Serial.begin(9600);

Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);


// Setup a function to be called every second
timer.setInterval(1000L, myTimerEvent);
}

void loop()
{
Blynk.run();
timer.run();

}

Loading