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 24 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
17 changes: 17 additions & 0 deletions CAD model/CADModel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### 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 CAD model/finaBottomAndAboveAssem.SLDASM
Binary file not shown.
Binary file added CAD model/finalAboveCAD2.SLDPRT
Binary file not shown.
Binary file added CAD model/finalBottomCAD.SLDPRT
Binary file not shown.
36 changes: 36 additions & 0 deletions Code/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 Code/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 Code/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();

}

88 changes: 88 additions & 0 deletions Code/pH/pH.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@

#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;

float phVal() {
static unsigned long samplingTime = millis();
static unsigned long printTime = millis();
static float pHValue, voltage;
if(millis()-samplingTime > samplingInterval) {
pHArray[pHArrayIndex++] = analogRead(SensorPin);
if(pHArrayIndex == ArrayLenth) {
pHArrayIndex = 0;
}
voltage = (avergearray(pHArray, ArrayLenth)*3.0/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 setup() {
Serial.begin(9600);
}

void loop() {
delay(200);
int valSensorPH = phVal();
}
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.


Loading