Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

ESP8266-Based Battery-Powered Soil Moisture Monitoring System

View and Edit Project In Cirkit DesignerImage of ESP8266-Based Battery-Powered Soil Moisture Monitoring System

Circuit Documentation

Summary

This circuit is designed to measure soil moisture levels using a soil moisture sensor and an ESP8266 microcontroller. The circuit is powered by a 9V battery and includes a rocker switch to control the power supply. The ESP8266 reads the analog value from the soil moisture sensor and prints the value to the Serial Monitor.

Component List

  1. 9V Battery

    • Description: Provides power to the circuit.
    • Pins: +, -
  2. Rocker Switch

    • Description: Controls the power supply to the circuit.
    • Pins: input, output
  3. ESP8266

    • Description: Microcontroller used to read the soil moisture sensor and communicate the data.
    • Pins: 3V, G, D8, D7, D6, D5, D4, D3, D2, D1, D0, A0, S3, S2, S1, SC, S0, SK, EN, VIN, RST, VU
  4. Soil Moisture Sensor

    • Description: Measures the moisture level in the soil.
    • Pins: gnd, vcc, aout

Wiring Details

9V Battery

Rocker Switch

ESP8266

Soil Moisture Sensor

Code Documentation

Code for ESP8266

// Define the pin for the soil moisture sensor
const int soilMoisturePin = A0;

void setup() {
  // Initialize serial communication at 9600 baud rate
  Serial.begin(9600);
}

void loop() {
  // Read the analog value from the soil moisture sensor
  int soilMoistureValue = analogRead(soilMoisturePin);
  
  // Print the soil moisture value to the Serial Monitor
  Serial.print("Soil Moisture Value: ");
  Serial.println(soilMoistureValue);
  
  // Wait for 1 second before taking another reading
  delay(1000);
}

File Name: sketch.ino

This code initializes the ESP8266 to read the analog value from the soil moisture sensor connected to pin A0. The value is then printed to the Serial Monitor every second.