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
178 views
Crop Manager
This device monitors soil moisture, temperature and humidity.
178
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 shared platform and we are not responsible for any design issues.
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
-
Open Source Very Large Stick - Freejoy & MMjoy2 breakout board
498 0 0 -
RF Control training board for students based on ESP32 C3
668 0 2 -
Aquarius+ Computer, Standard PCB
888 0 4 -
KINETIC COASTERS with a TWIST! Laser or 3D Print some DIY Magic
604 0 1 -
RPI - 8 IO PLC With ATTiny85 Watch Dog
528 0 1 -
Nintendo Famicom HVC-001 Controller Shells
623 0 1 -
COMMODORE 128 DIAGNOSTIC REV.785260 KEYBOARD DONGLE
586 0 4 -
COMMODORE 128 15KHz DISPLAY ADAPTER (C128 80 COLUMN ADAPTER)
794 1 6 -