Circuit Documentation
Summary
This circuit integrates various sensors and modules with an ESP-8266 microcontroller to create a multifunctional system. The system includes an I2C LCD screen for display, an MQ-4 gas sensor for detecting methane and natural gas, an HC-SR04 ultrasonic sensor for distance measurement, a DHT11 sensor for temperature and humidity readings, a USB power module for power supply, and an HC-SR501 motion sensor for detecting movement. The ESP-8266 serves as the central processing unit, interfacing with each sensor and module to collect data, execute logic, and display information.
Component List
I2C LCD 16x2 Screen
- A display module that communicates over the I2C protocol, capable of displaying 16 characters in 2 rows.
ESP-8266 Controller
- A Wi-Fi capable microcontroller with a variety of digital and analog pins for interfacing with sensors and modules.
MQ-4 Gas Sensor
- A sensor used for detecting levels of methane and natural gas in the air.
HC-SR04 Ultrasonic Sensor
- A sensor that measures distance by emitting ultrasonic waves and measuring the time taken for the echo to return.
DHT11 Temperature and Humidity Sensor
- A sensor that measures ambient temperature and humidity.
USB Power Module
- A module that provides power to the circuit through a USB connection.
HC-SR501 Motion Sensor
- A passive infrared sensor that detects motion by measuring changes in the infrared levels emitted by objects in its field of view.
Wiring Details
I2C LCD 16x2 Screen
- SCL: Connected to ESP-8266 Controller (D1)
- SDA: Connected to ESP-8266 Controller (D2)
- VCC (5V): Connected to the common power rail
- GND: Connected to the common ground rail
ESP-8266 Controller
- A0: Connected to MQ-4 (A0)
- D1: Connected to I2C LCD Screen (SCL)
- D2: Connected to I2C LCD Screen (SDA)
- D3: Connected to HC-SR501 Motion Sensor (OUT)
- D4: Connected to DHT11 (S)
- D6: Connected to HC-SR04 Ultrasonic Sensor (TRIG)
- D7: Connected to HC-SR04 Ultrasonic Sensor (ECHO)
- Vin: Connected to the common power rail
- GND: Connected to the common ground rail
MQ-4 Gas Sensor
- A0: Connected to ESP-8266 Controller (A0)
- VCC: Connected to the common power rail
- GND: Connected to the common ground rail
HC-SR04 Ultrasonic Sensor
- VCC: Connected to the common power rail
- TRIG: Connected to ESP-8266 Controller (D6)
- ECHO: Connected to ESP-8266 Controller (D7)
- GND: Connected to the common ground rail
DHT11 Temperature and Humidity Sensor
- 5V: Connected to the common power rail
- S: Connected to ESP-8266 Controller (D4)
- GND: Connected to the common ground rail
USB Power Module
- +: Connected to the common power rail
- -: Connected to the common ground rail
HC-SR501 Motion Sensor
- VCC: Connected to the common power rail
- OUT: Connected to ESP-8266 Controller (D3)
- GND: Connected to the common ground rail
Documented Code
void setup() {
}
void loop() {
}
The provided code is a template for the ESP-8266 microcontroller. The setup()
function is intended for initialization code that runs once at startup, and the loop()
function contains code that runs continuously. Specific functionality must be implemented within these functions to interact with the connected sensors and modules.