ESP32-S3 Based Environmental Monitoring and Control System with Data Logging
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit integrates a variety of components including microcontrollers, sensors, a motor, a relay, and a display. The primary microcontroller is an ESP32-S3, which interfaces with a DHT22 temperature and humidity sensor, an Adafruit INA260 current and voltage sensor, an HC-SR04 ultrasonic sensor, an SGP41 VOC and NOx sensor, and a 0.96" OLED display. The circuit also includes an Arduino UNO, which is connected to a rotary encoder. A DC Mini Metal Gear Motor and a 12V relay are controlled by the ESP32-S3. Power management is handled by a step-down buck converter, which steps down the voltage from a 12V battery. The circuit also includes an SD card module for data logging.
Component List
Microcontrollers
- ESP32-S3: A powerful microcontroller with Wi-Fi and Bluetooth capabilities.
- Arduino UNO: A widely-used microcontroller board based on the ATmega328P.
Sensors
- DHT22: A sensor for measuring temperature and humidity.
- Adafruit INA260: A high-precision current and voltage sensor.
- HC-SR04 Ultrasonic Sensor: A sensor for measuring distance via ultrasonic waves.
- SGP41 VOC and NOx Sensor: A sensor for detecting volatile organic compounds and nitrogen oxides.
Actuators
- DC Mini Metal Gear Motor: A small motor for mechanical movements.
- 12V Relay: An electromechanical switch used for controlling high power devices.
Power Components
- 12V Battery (mini): A power source for the circuit.
- Step down Buck Converter: A device that steps down voltage from a higher level to a lower level.
Display
- 0.96" OLED: A small display for showing information.
Storage
- SD SDHC: An SD card module for data logging.
Miscellaneous
- Resistors: Various resistors used for current limiting and voltage division.
- LED (red): A light-emitting diode for indication purposes.
Wiring Details
ESP32-S3
3v3connected to SD card module3V3.GNDconnected to common ground.GPIO16connected to DHT22Out.GPIO18connected to SCL line shared with Adafruit INA260 and SGP41 sensor.GPIO9connected to Arduino UNOD1.GPIO10connected to 12V relayIN.GPIO11connected to 0.96" OLEDSCK.GPIO40connected to SD card moduleCS.GPIO39connected to SD card moduleMOSI.GPIO37connected to HC-SR04TRIG.GPIO36connected to HC-SR04ECHO.GPIO35connected to SD card moduleCLK.GPIO0connected to SD card moduleMISO.GPIO21connected to 0.96" OLEDSDA.GPIO19connected to SDA line shared with Adafruit INA260 and SGP41 sensor.
Arduino UNO
GNDconnected to common ground.Vinconnected to step-down converterOUT +.D2connected to rotary encoderA.D3connected to rotary encoderB.
DHT22
+connected to common VCC.Outconnected to ESP32-S3GPIO16.-connected to common ground.
Adafruit INA260
VCCconnected to common VCC.GNDconnected to common ground.SCLconnected to ESP32-S3GPIO18.SDAconnected to ESP32-S3GPIO19.IN-connected to one side of a resistor network.IN+connected to DC Mini Metal Gear MotorIN2.
DC Mini Metal Gear Motor
IN1connected to common ground.IN2connected to Adafruit INA260IN+.
12V Relay
NOconnected to LED anode.COMconnected to 12V battery+.NCnot used in this circuit.INconnected to ESP32-S3GPIO10.DC-connected to common ground.DC+connected to common VCC.
Resistor Network
- Several resistors are connected in various configurations for current limiting and voltage division.
LED (red)
anodeconnected to 12V relayNO.cathodeconnected to 12V battery-.
12V Battery (mini)
+connected to step-down converterIN +and 12V relayCOM.-connected to LED cathode and step-down converterIN - GND.
Step down Buck Converter
IN +connected to 12V battery+.IN - GNDconnected to 12V battery-.OUT +connected to common VCC.OUT - GNDconnected to common ground.
0.96" OLED
GNDconnected to common ground.VDDconnected to common VCC.SCKconnected to ESP32-S3GPIO11.SDAconnected to ESP32-S3GPIO21.
HC-SR04 Ultrasonic Sensor
VCCconnected to common VCC.TRIGconnected to ESP32-S3GPIO37.ECHOconnected to ESP32-S3GPIO36.GNDconnected to common ground.
SGP41 VOC and NOx Sensor
VINconnected to common VCC.GNDconnected to common ground.SCLconnected to ESP32-S3GPIO18.SDAconnected to ESP32-S3GPIO19.
SD SDHC
3V3connected to ESP32-S33v3.CSconnected to ESP32-S3GPIO40.MOSIconnected to ESP32-S3GPIO39.CLKconnected to ESP32-S3GPIO35.MISOconnected to ESP32-S3GPIO0.GNDconnected to common ground.
Documented Code
Arduino UNO Code (sketch.ino)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Note: The provided code for the Arduino UNO is a template and does not contain any functional code specific to this circuit.