Arduino Mega 2560-Based Smart Irrigation System with LoRa Connectivity
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This document provides a detailed overview of a circuit that includes various sensors and a LoRa module connected to an Arduino Mega 2560. The circuit is designed to collect environmental data such as temperature, humidity, soil moisture, and rain levels, and transmit this data using the LoRa module.
Component List
DHT 11
- Description: Temperature and Humidity Sensor
- Pins: VCC, GND, DATA
Soil Moisture Sensor
- Description: Measures the moisture level in the soil
- Pins: VCC, GND, SIG
Arduino Mega 2560
- Description: Microcontroller board based on the ATmega2560
- Pins: IOREF, RESET, 3V3, 5V, GND, VIN, A0-A15, D0-D53, AREF, SDA, SCL
YF-S201 Water Flow Meter
- Description: Measures the rate of water flow
- Pins: SIG, GND, VCC
RAIN SENSOR
- Description: Detects the presence of rain
- Pins: AO, DO, GRD, VCC
LoRa Ra-02 SX1278
- Description: Long Range (LoRa) transceiver module
- Pins: GND, NSS, MOSI, MISO, SCK, D105, DI04, 3.3V, RST, DI00, DI01, D102, DI03
Wiring Details
DHT 11
- VCC: Connected to Arduino Mega 2560 (5V)
- GND: Connected to Arduino Mega 2560 (GND)
- DATA: Connected to Arduino Mega 2560 (D4 PWM)
Soil Moisture Sensor (1)
- VCC: Connected to Arduino Mega 2560 (5V)
- GND: Connected to Arduino Mega 2560 (GND)
- SIG: Connected to Arduino Mega 2560 (A3)
Soil Moisture Sensor (2)
- VCC: Connected to Arduino Mega 2560 (5V)
- GND: Connected to Arduino Mega 2560 (GND)
- SIG: Connected to Arduino Mega 2560 (A4)
Arduino Mega 2560
- 3V3: Connected to LoRa Ra-02 SX1278 (3.3V)
- 5V: Connected to DHT 11 (VCC), Soil Moisture Sensor (1) (VCC), Soil Moisture Sensor (2) (VCC), RAIN SENSOR (VCC), YF-S201 Water Flow Meter (1) (VCC), YF-S201 Water Flow Meter (2) (VCC)
- GND: Connected to DHT 11 (GND), Soil Moisture Sensor (1) (GND), Soil Moisture Sensor (2) (GND), RAIN SENSOR (GRD), YF-S201 Water Flow Meter (1) (GND), YF-S201 Water Flow Meter (2) (GND), LoRa Ra-02 SX1278 (GND)
- A2: Connected to RAIN SENSOR (AO)
- A3: Connected to Soil Moisture Sensor (1) (SIG)
- A4: Connected to Soil Moisture Sensor (2) (SIG)
- D2 PWM: Connected to YF-S201 Water Flow Meter (1) (SIG)
- D3 PWM: Connected to YF-S201 Water Flow Meter (2) (SIG)
- D4 PWM: Connected to DHT 11 (DATA)
- D9 PWM: Connected to LoRa Ra-02 SX1278 (RST)
- D10 PWM: Connected to LoRa Ra-02 SX1278 (NSS)
- D52: Connected to LoRa Ra-02 SX1278 (SCK)
- D50: Connected to LoRa Ra-02 SX1278 (MISO)
- D51: Connected to LoRa Ra-02 SX1278 (MOSI)
YF-S201 Water Flow Meter (1)
- VCC: Connected to Arduino Mega 2560 (5V)
- GND: Connected to Arduino Mega 2560 (GND)
- SIG: Connected to Arduino Mega 2560 (D2 PWM)
YF-S201 Water Flow Meter (2)
- VCC: Connected to Arduino Mega 2560 (5V)
- GND: Connected to Arduino Mega 2560 (GND)
- SIG: Connected to Arduino Mega 2560 (D3 PWM)
RAIN SENSOR
- VCC: Connected to Arduino Mega 2560 (5V)
- GRD: Connected to Arduino Mega 2560 (GND)
- AO: Connected to Arduino Mega 2560 (A2)
LoRa Ra-02 SX1278
- 3.3V: Connected to Arduino Mega 2560 (3V3)
- GND: Connected to Arduino Mega 2560 (GND)
- RST: Connected to Arduino Mega 2560 (D9 PWM)
- NSS: Connected to Arduino Mega 2560 (D10 PWM)
- SCK: Connected to Arduino Mega 2560 (D52)
- MISO: Connected to Arduino Mega 2560 (D50)
- MOSI: Connected to Arduino Mega 2560 (D51)
Documented Code
Arduino Mega 2560 Code
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
This code is a basic template for the Arduino Mega 2560. The setup function is used to initialize any settings or configurations, and the loop function contains the main code that runs repeatedly.