Circuit Documentation
Summary
This document provides a detailed description of a simple circuit involving an ESP32 microcontroller and a water sensor. The ESP32 is used to read the signal from the water sensor, which detects the presence of water. The circuit is powered by the 3.3V output from the ESP32.
Component List
ESP32
- Description: A powerful microcontroller with built-in Wi-Fi and Bluetooth capabilities.
- Pins: EN, VP, VN, D34, D35, D32, D33, D25, D26, D27, D14, D12, D13, GND, VIN, 3V3, D15, D2, D4, RX2, TX2, D5, D18, D19, D21, RX0, TX0, D22, D23, BOOT
- Purpose in Circuit: Acts as the main controller, reading the signal from the water sensor and processing it.
Water Sensor
- Description: A sensor used to detect the presence of water.
- Pins: Signal, VCC, GND
- Purpose in Circuit: Detects the presence of water and sends a signal to the ESP32.
Wiring Details
ESP32
- D12: Connected to the Signal pin of the Water Sensor.
- GND: Connected to the GND pin of the Water Sensor.
- 3V3: Connected to the VCC pin of the Water Sensor.
Water Sensor
- Signal: Connected to the D12 pin of the ESP32.
- GND: Connected to the GND pin of the ESP32.
- VCC: Connected to the 3V3 pin of the ESP32.
Code
There is no code provided for this circuit. However, a typical implementation would involve reading the signal from the water sensor using the ESP32 and processing it accordingly. Below is a sample code snippet that could be used:
// Sample code for reading water sensor signal using ESP32
const int waterSensorPin = 12; // D12 pin of ESP32
void setup() {
Serial.begin(115200);
pinMode(waterSensorPin, INPUT);
}
void loop() {
int sensorValue = digitalRead(waterSensorPin);
if (sensorValue == HIGH) {
Serial.println("Water detected!");
} else {
Serial.println("No water detected.");
}
delay(1000); // Wait for 1 second before reading again
}
This code initializes the D12 pin as an input and continuously reads the signal from the water sensor. If water is detected, it prints "Water detected!" to the serial monitor; otherwise, it prints "No water detected."
