Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

ESP32-S3 Based Environmental Monitoring and Control System with Data Logging

Image of ESP32-S3 Based Environmental Monitoring and Control System with Data Logging

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

  • 3v3 connected to SD card module 3V3.
  • GND connected to common ground.
  • GPIO16 connected to DHT22 Out.
  • GPIO18 connected to SCL line shared with Adafruit INA260 and SGP41 sensor.
  • GPIO9 connected to Arduino UNO D1.
  • GPIO10 connected to 12V relay IN.
  • GPIO11 connected to 0.96" OLED SCK.
  • GPIO40 connected to SD card module CS.
  • GPIO39 connected to SD card module MOSI.
  • GPIO37 connected to HC-SR04 TRIG.
  • GPIO36 connected to HC-SR04 ECHO.
  • GPIO35 connected to SD card module CLK.
  • GPIO0 connected to SD card module MISO.
  • GPIO21 connected to 0.96" OLED SDA.
  • GPIO19 connected to SDA line shared with Adafruit INA260 and SGP41 sensor.

Arduino UNO

  • GND connected to common ground.
  • Vin connected to step-down converter OUT +.
  • D2 connected to rotary encoder A.
  • D3 connected to rotary encoder B.

DHT22

  • + connected to common VCC.
  • Out connected to ESP32-S3 GPIO16.
  • - connected to common ground.

Adafruit INA260

  • VCC connected to common VCC.
  • GND connected to common ground.
  • SCL connected to ESP32-S3 GPIO18.
  • SDA connected to ESP32-S3 GPIO19.
  • IN- connected to one side of a resistor network.
  • IN+ connected to DC Mini Metal Gear Motor IN2.

DC Mini Metal Gear Motor

  • IN1 connected to common ground.
  • IN2 connected to Adafruit INA260 IN+.

12V Relay

  • NO connected to LED anode.
  • COM connected to 12V battery +.
  • NC not used in this circuit.
  • IN connected to ESP32-S3 GPIO10.
  • 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)

  • anode connected to 12V relay NO.
  • cathode connected to 12V battery -.

12V Battery (mini)

  • + connected to step-down converter IN + and 12V relay COM.
  • - connected to LED cathode and step-down converter IN - GND.

Step down Buck Converter

  • IN + connected to 12V battery +.
  • IN - GND connected to 12V battery -.
  • OUT + connected to common VCC.
  • OUT - GND connected to common ground.

0.96" OLED

  • GND connected to common ground.
  • VDD connected to common VCC.
  • SCK connected to ESP32-S3 GPIO11.
  • SDA connected to ESP32-S3 GPIO21.

HC-SR04 Ultrasonic Sensor

  • VCC connected to common VCC.
  • TRIG connected to ESP32-S3 GPIO37.
  • ECHO connected to ESP32-S3 GPIO36.
  • GND connected to common ground.

SGP41 VOC and NOx Sensor

  • VIN connected to common VCC.
  • GND connected to common ground.
  • SCL connected to ESP32-S3 GPIO18.
  • SDA connected to ESP32-S3 GPIO19.

SD SDHC

  • 3V3 connected to ESP32-S3 3v3.
  • CS connected to ESP32-S3 GPIO40.
  • MOSI connected to ESP32-S3 GPIO39.
  • CLK connected to ESP32-S3 GPIO35.
  • MISO connected to ESP32-S3 GPIO0.
  • GND connected 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.