This document provides a detailed overview of a circuit designed using an Arduino Nano microcontroller. The circuit includes various sensors and modules such as a relay module, DHT11 temperature and humidity sensor, LCD I2C display, humidity sensor, and a mini diaphragm water pump. The circuit is powered by a 18650 Li-Ion battery. The Arduino Nano controls the relay module, reads data from the sensors, and displays information on the LCD. The water pump is controlled based on the sensor readings.
Arduino Nano
Relay Module 1 Channel
DHT11
LCD I2C Display
Humidity YL-69
Mini Diaphragm Water Pump
18650 Li-Ion
// No code provided for Arduino Nano
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
// Define Blynk template and authentication
#define BLYNK_TEMPLATE_ID "TMPL6aciioChP"
#define BLYNK_TEMPLATE_NAME "cicekSula"
#define BLYNK_AUTH_TOKEN "lSiVlNDn6VZUBqE5Z7mvDbN-IFefbnKt"
// Include the library files
#include <LiquidCrystal_I2C.h>
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// Initialize the LCD display
LiquidCrystal_I2C lcd(0x27, 16, 2);
char ssid[] = "Galaxy A21sC3B8"; // Enter your WiFi name
char pass[] = "uuwy2702"; // Enter your WiFi password
BlynkTimer timer;
bool Relay = 0;
// Define component pins
#define sensor A0
#define waterPump D3
void setup() {
Serial.begin(9600);
// Initialize water pump pin
pinMode(waterPump, OUTPUT);
digitalWrite(waterPump, HIGH);
// Initialize LCD
lcd.init();
lcd.backlight();
// Connect to Blynk
Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, "blynk.cloud", 80);
// Display "System Loading" animation on LCD
lcd.setCursor(1, 0);
lcd.print("System Loading");
for (int a = 0; a <= 15; a++) {
lcd.setCursor(a, 1);
lcd.print(".");
delay(500);
}
lcd.clear();
// Call the soil moisture sensor function every 100ms
timer.setInterval(100L, soilMoistureSensor);
}
// Button value control
BLYNK_WRITE(V1) {
Relay = param.asInt();
if (Relay == 1) {
digitalWrite(waterPump, LOW);
lcd.setCursor(0, 1);
lcd.print("Motor is ON ");
} else {
digitalWrite(waterPump, HIGH);
lcd.setCursor(0, 1);
lcd.print("Motor is OFF");
}
}
// Get soil moisture values
void soilMoistureSensor() {
int value = analogRead(sensor);
value = map(value, 0, 1024, 0, 100);
value = (value - 100) * -1;
// Send soil moisture value to Blynk app
Blynk.virtualWrite(V0, value);
// Display soil moisture value on LCD
lcd.setCursor(0, 0);
lcd.print("Moisture :");
lcd.print(value);
lcd.print(" ");
}
void loop() {
Blynk.run(); // Run the Blynk library
timer.run(); // Run the Blynk timer
}
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
This document provides a comprehensive overview of the circuit, including the components used, their wiring details, and the code for the microcontrollers.