Tools, APP Software Used etc.
|
Altium DesignerAltium Designer
|
|
|
arduino IDEArduino
|
|
|
Visual Studio Code |
Description
Crop Manager
The Crop Manager
The project is developed for monitoring water level of soil, air temperature and humidity of air. It is noted that many soil moisture sensors are cloud based but required some monthly charges and also cost is very high in India.
- This device do not require any monthly charges for account because this is based on google firebase project. this firebase access is free of cost.
- the web site is also hosted on firebase which is also free and allow hosting the application like web.
- user only need to have access for internet in order to upload data to firebase real-time data management system.
Code
Arduino Code
Arduino
#include <DHT.h>
#include <Arduino.h>
#if defined(ESP32)
#include <WiFi.h>
#elif defined(ESP8266)
#include <ESP8266WiFi.h>
#endif
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager
#include <time.h>
WiFiManager wifiManager;
// Set web server port number to 80
WiFiServer server(80);
// Variable to store the HTTP request
String header;
#include <Firebase_ESP_Client.h>
//Provide the token generation process info.
#include "addons/TokenHelper.h"
//Provide the RTDB payload printing info and other helper functions.
#include "addons/RTDBHelper.h"
// Insert Firebase project API Key
#define API_KEY "your firebase app api"
// Insert Authorized Email and Corresponding Password
#define USER_EMAIL "Your registered Email on firebase"
#define USER_PASSWORD "your Password"
// Insert RTDB URLefine the RTDB URL */
#define DATABASE_URL "Your database URL"
//Define Firebase Data object
FirebaseData fbdo;
FirebaseAuth auth;
FirebaseConfig config;
//----------------------------------------------------
// Variable to save USER UID
String uid;
// Database main path (to be updated in setup with the user UID)
String databasePath;
// Database child nodes
String tempPath = "/temperature";
String humPath = "/humidity";
String soilPath = "/soil_moisture";
String timePath = "/timestamp";
// Parent Node (to be updated in every loop)
String parentPath;
FirebaseJson json;
// Define NTP Client to get time
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, "pool.ntp.org");
int timestamp;
//---------------------------------------------------------------
unsigned long sendDataPrevMillis = 0;
int count = 0;
bool signupOK = false;
#define DHTPIN D7
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);
const int sensor_pin = A0;
const int dry = 570;//1024-454; // value for dry sensor
const int wet = 620;//1024-404; // 395 value for wet sensor
// Function that gets current epoch time
unsigned long getTime() {
timeClient.update();
unsigned long now = timeClient.getEpochTime();
return now;
}
void setup() {
Serial.begin(115200); delay(5000);
if (WiFi.status() != WL_CONNECTED)
{
Serial.println("Creating Soft AP");
wifiManager.autoConnect("Crop Manager");
// or use this for auto generated name ESP + ChipID
//wifiManager.autoConnect();
// if you get here you have connected to the WiFi
}
Serial.println("Connected.");
//---------------------------------------------------------------
timeClient.begin();
/* Assign the api key (required) */
config.api_key = API_KEY;
// Assign the user sign in credentials
auth.user.email = USER_EMAIL;
auth.user.password = USER_PASSWORD;
/* Assign the callback function for the long running token generation task */
config.token_status_callback = tokenStatusCallback; //see addons/TokenHelper.h
// Assign the maximum retry of token generation
config.max_token_generation_retry = 5;
// Initialize the library with the Firebase authen and config
Firebase.begin(&config, &auth);
signupOK = true;
// /* Sign up */
// if (Firebase.signUp(&config, &auth,USER_EMAIL,USER_PASSWORD)){
// Serial.println("ok");
//
//
// }
// else{
// Serial.printf("%s\n", config.signer.signupError.message.c_str());
// }
uid = auth.token.uid.c_str();
Serial.print("User UID: ");
Serial.println(uid);
//---------------------------------------------------------------
// Update database path
databasePath = "/UsersData/" + uid + "/readings";
}
float h,t;
int s=0, wx;
int sensor_analog=0;
void loop(){
//WiFiClient client = server.available(); // Listen for incoming clients
// If a new client connects,
if (Firebase.ready() && signupOK && (millis() - sendDataPrevMillis > 60000 || sendDataPrevMillis == 0)){
sendDataPrevMillis = millis();
// Read DHT Sensor
h = dht.readHumidity();
t = dht.readTemperature(); // Reading temperature as Celsius (the default)
for (wx=0; wx<20;wx++)
{
sensor_analog+=analogRead(sensor_pin); delay(10);
}
sensor_analog=sensor_analog/20; Serial.print("ADC= "); Serial.println(sensor_analog);
sensor_analog=1024-sensor_analog;
s = (map(sensor_analog, dry, wet, 0, 100)); Serial.print("Mapped Value= "); Serial.println(s);
s= constrain(s,0,100);
sensor_analog=0;
Serial.print("Humidity: ");
Serial.print(h);
Serial.print("% Temperature: ");
Serial.print(t);
Serial.println("°C ");
Serial.println("Soil Moisture: ");
Serial.print(s);
Serial.println("%");
//Get current timestamp
timestamp = getTime();
Serial.print ("time: ");
Serial.println (timestamp);
parentPath= databasePath + "/" + String(timestamp);
json.set(tempPath.c_str(), String(t));
json.set(humPath.c_str(), String(h));
json.set(soilPath.c_str(), String(s));
json.set(timePath, String(timestamp));
Serial.printf("Set json... %s\n", Firebase.RTDB.setJSON(&fbdo, parentPath.c_str(), &json) ? "ok" : fbdo.errorReason().c_str());
}
}
Schematic and Layout
Jan 12,2024
316 views
Crop Manager
This device monitors soil moisture, temperature and humidity.
316
2
0
8.63 (2)
Published: Jan 12,2024
Download Gerber file 1
BOM(Bill of materials)
Other files for Assembly
Purchase
Donation Received ($)
PCBWay Donate 10% cost To Author
Only PCB
PCB+Assembly
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
Copy this HTML into your page to embed a link to order this shared project
Copy
Under the
Attribution-ShareAlike (CC BY-SA)
License.
- Comments(0)
- Likes(2)
You can only upload 1 files in total. Each file cannot exceed 2MB. Supports JPG, JPEG, GIF, PNG, BMP
0 / 10000
Remove
It looks like you have not written anything. Please add a comment and try again.
View More
VOTING
2 votes
- 2 USER VOTES
8.63
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Design
1/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Usability
2/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Creativity
3/4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Content
4/4
-
5design
-
9usability
-
7creativity
-
8content
7.25
-
10design
-
10usability
-
10creativity
-
10content
10.00
More by Engineer
You may also like
-
-
-
3D printed Enclosure Backplate for Riden RD60xx power supplies
55 0 0 -
-
-
-
Sega Master System RGB Encoder Switcher Z80 QSB v1.2
57 0 0 -
18650 2S2P Battery Charger, Protection and 5V Output Board
78 0 0 -
High Precision Thermal Imager + Infrared Thermometer | OpenTemp
420 0 6 -
Sony PlayStation Multi Output Frequency Oscillator (MOFO) v1
129 0 2