Circuit Documentation
Summary
This circuit integrates an Arduino UNO, an ESP32, and several sensors and modules including an HC-SR04 Ultrasonic Sensor, an MQ-2 Gas Sensor, a GPS NEO 6M module, a DHT11 Temperature and Humidity Sensor, and a 16x2 I2C LCD. The Arduino UNO serves as the primary microcontroller, interfacing with the sensors and the LCD, while the ESP32 handles GPS data.
Component List
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
ESP32 (30 pin)
- Description: A low-cost, low-power system on a chip microcontroller with integrated Wi-Fi and dual-mode Bluetooth.
- Pins: EN, VP, VN, D34, D35, D32, D33, D25, D26, D27, D14, D12, D13, GND, Vin, D23, D22, TX0, RX0, D21, D19, D18, D5, TX2, RX2, D4, D2, D15, 3V3
HC-SR04 Ultrasonic Sensor
- Description: A sensor used for measuring distance using ultrasonic waves.
- Pins: VCC, TRIG, ECHO, GND
MQ-2 Gas Sensor
- Description: A sensor used for detecting gas leaks (e.g., LPG, i-butane, propane, methane, alcohol, hydrogen, smoke).
- Pins: GND, VCC, ANALOG, Digital
GPS NEO 6M
- Description: A GPS module used for obtaining geographical coordinates.
- Pins: VCC, RX, TX, GND
DHT11 Temperature and Humidity Sensor
- Description: A sensor used for measuring temperature and humidity.
- Pins: DATA, GND, VCC
16x2 I2C LCD
- Description: A 16x2 character LCD display with I2C interface.
- Pins: GND, VCC, SDA, SCL
Wiring Details
Arduino UNO
- 5V: Connected to VCC of 16x2 I2C LCD, HC-SR04 Ultrasonic Sensor, DHT11, and MQ-2.
- GND: Connected to GND of 16x2 I2C LCD, HC-SR04 Ultrasonic Sensor, DHT11, MQ-2, and ESP32.
- A4: Connected to SDA of 16x2 I2C LCD.
- A5: Connected to SCL of 16x2 I2C LCD.
- D13: Connected to Digital pin of MQ-2.
- D10: Connected to TRIG pin of HC-SR04 Ultrasonic Sensor.
- D9: Connected to ECHO pin of HC-SR04 Ultrasonic Sensor.
- D4: Connected to DATA pin of DHT11.
- D1: Connected to RX0 of ESP32.
ESP32 (30 pin)
- GND: Connected to GND of Arduino UNO and GPS NEO 6M.
- 3V3: Connected to VCC of GPS NEO 6M.
- TX2: Connected to RX of GPS NEO 6M.
- RX2: Connected to TX of GPS NEO 6M.
HC-SR04 Ultrasonic Sensor
- VCC: Connected to 5V of Arduino UNO.
- GND: Connected to GND of Arduino UNO.
- TRIG: Connected to D10 of Arduino UNO.
- ECHO: Connected to D9 of Arduino UNO.
MQ-2 Gas Sensor
- VCC: Connected to 5V of Arduino UNO.
- GND: Connected to GND of Arduino UNO.
- Digital: Connected to D13 of Arduino UNO.
GPS NEO 6M
- VCC: Connected to 3V3 of ESP32.
- GND: Connected to GND of ESP32.
- RX: Connected to TX2 of ESP32.
- TX: Connected to RX2 of ESP32.
DHT11 Temperature and Humidity Sensor
- VCC: Connected to 5V of Arduino UNO.
- GND: Connected to GND of Arduino UNO.
- DATA: Connected to D4 of Arduino UNO.
16x2 I2C LCD
- VCC: Connected to 5V of Arduino UNO.
- GND: Connected to GND of Arduino UNO.
- SDA: Connected to A4 of Arduino UNO.
- SCL: Connected to A5 of Arduino UNO.
Documented Code
Arduino UNO Code
#include <LiquidCrystal.h>
// Initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
// Set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("Hello, World!");
}
void loop() {
// Set the cursor to column 0, line 1
lcd.setCursor(0, 1);
// Print the number of seconds since reset:
lcd.print(millis() / 1000);
}
This code initializes a 16x2 LCD connected to the Arduino UNO and displays "Hello, World!" on the first line. The second line shows the number of seconds since the Arduino was reset.
