YKR038 COURSE · MODULE 6 · LESSON 36

Final Project: Smart Room Monitor

Combine environmental sensing, motion, display, alerts, and Wi-Fi in a complete capstone project.

90 minComplete beginnerWi-Fi & Final Projects
BUILD WITHESP32 board
PROGRAMESP32
ACHIEVEThe finished monitor reports room conditions…
Written for complete beginners

Follow the numbered steps in order. Do not connect USB power until the wiring step tells you to. Compare every pin label before continuing.

LESSON GOAL

What you will build and learn

In this lesson, you will learn system integration, state design, and end-to-end testing. By the end, the finished monitor reports room conditions locally and in a browser.

  • Recognize the purpose of each required part.
  • Make the connections in a safe, repeatable order.
  • Upload or run the lesson procedure and verify the expected result.
  • Use observable evidence to fix common problems.
Real YKR038 wiring photo reserved

A close, labeled photograph of this exact experiment will be added here. Until then, use the written pin-by-pin connection list below.

STEP-BY-STEP GUIDE

Build the experiment

1

Understand the target result

Combine environmental sensing, motion, display, alerts, and Wi-Fi in a complete capstone project. The expected result is: The finished monitor reports room conditions locally and in a browser.

2

Prepare the board and parts

Disconnect the ESP32 from USB. Put the ESP32, breadboard, jumper wires, and the listed lesson parts in front of you. Straighten bent pins gently and never force a module into the breadboard.

3

Make each connection with power off

  1. DHT11 DATA → GPIO 4; PIR OUT → GPIO 27.
  2. OLED SDA → GPIO 21 and SCL → GPIO 22.
  3. Buzzer positive → GPIO 18; LED output → resistor → GPIO 23.
  4. Connect every module ground to ESP32 GND and verify each subsystem separately.

Power check: confirm that no 5V signal goes directly into an ESP32 GPIO and that 3.3V is not connected to GND.

4

Install any library and upload the code

Install “DHT sensor library”, “Adafruit SSD1306”, “Adafruit GFX”, and their required dependencies. Select your ESP32 board and serial port before clicking Upload.

Arduino sketchCheck the pin constants against your wiring
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <DHT.h>
Adafruit_SSD1306 display(128,64,&Wire,-1); DHT dht(4,DHT11);
const int PIR=27,BUZZER=18,LED=23;
void setup(){Serial.begin(115200);Wire.begin(21,22);display.begin(SSD1306_SWITCHCAPVCC,0x3C);display.setTextColor(SSD1306_WHITE);dht.begin();pinMode(PIR,INPUT);pinMode(BUZZER,OUTPUT);pinMode(LED,OUTPUT);}
void loop(){float t=dht.readTemperature(),h=dht.readHumidity();bool motion=digitalRead(PIR);bool alert=motion||t>30;digitalWrite(LED,alert);digitalWrite(BUZZER,alert);display.clearDisplay();display.setTextSize(1);display.setCursor(0,0);display.printf("Temp: %.1f C\nHumidity: %.1f %%\nMotion: %s\nStatus: %s",t,h,motion?"YES":"NO",alert?"ALERT":"NORMAL");display.display();delay(1000);}
5

Power the circuit and observe

Connect USB power only after the wiring check. Open Serial Monitor at 115200 baud when the sketch prints data. Watch the circuit for at least 20 seconds and compare it with this expected behavior: The finished monitor reports room conditions locally and in a browser.

6

Change one value and test again

Make one small change—such as a delay, threshold, brightness, or displayed message—then upload again. This confirms that you understand which part of the program controls the result.

WHY IT WORKS

The key idea

This experiment demonstrates system integration, state design, and end-to-end testing. The ESP32 repeatedly reads or updates the connected hardware, applies the program logic, and produces the observable result. Changing one input or one code value helps you see that relationship directly.

Input or instructionESP32 logicMeasured result or output

TROUBLESHOOTING

If the experiment does not work

Nothing powers on

Disconnect USB. Check the USB cable, 3.3V/5V selection, GND rail, and breadboard row placement.

Upload fails

Confirm the board and port. Close other serial programs, reconnect USB, and hold BOOT only if your board requires it.

Result is unstable

Shorten jumper wires, confirm a shared ground, and verify that input pins are not floating.

Lesson-specific check

Integrate and verify one subsystem at a time before combining everything.

VIDEO WALKTHROUGH

Hands-on lesson video reserved

The final video will show the real YKR038 parts, every wire connection, the upload process, and the expected result.