Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

Wi-Fi Enabled Smart Lid Status Monitor with NodeMCU and RGB LED

View and Edit Project In Cirkit DesignerImage of Wi-Fi Enabled Smart Lid Status Monitor with NodeMCU and RGB LED

Circuit Documentation

Summary

This circuit involves a NodeMCU V3 ESP8266 microcontroller interfacing with an RGB LED, an IR sensor, a Reed Switch, a Piezo Buzzer, and a Resistor. The NodeMCU reads the state of the Reed Switch and controls the RGB LED and Piezo Buzzer based on the input from the IR sensor.

Component List

  1. NodeMCU V3 ESP8266

    • Description: A microcontroller with built-in Wi-Fi capabilities.
    • Pins: A0, GND, VU, S3, S2, S1, SC, S0, SK, 3V3, EN, RST, Vin, D0, D1, D2, D3, D4, D5, D6, D7, D8, RX, TX
  2. IR Sensor

    • Description: An infrared sensor used for detecting objects.
    • Pins: out, gnd, vcc
  3. Reed Switch

    • Description: A magnetic switch that opens or closes in the presence of a magnetic field.
    • Pins: pin 1, pin 2
  4. RGB LED (Wokwi compatible)

    • Description: A light-emitting diode with red, green, and blue channels.
    • Pins: R, COM, G, B
  5. Resistor

    • Description: A 200 Ohms resistor used to limit current.
    • Pins: pin1, pin2
    • Properties:
      • Resistance: 200 Ohms
  6. Piezo Buzzer

    • Description: A buzzer that produces sound when a voltage is applied.
    • Pins: pin 1, pin 2

Wiring Details

NodeMCU V3 ESP8266

IR Sensor

Reed Switch

RGB LED (Wokwi compatible)

Resistor

Piezo Buzzer

Code Documentation

NodeMCU V3 ESP8266 Code

void setup() {
  pinMode(D1, INPUT_PULLUP); // Enable internal pull-up resistor on D1
  Serial.begin(115200); // Initialize serial communication for debugging
}

void loop() {
  int reedSwitchState = digitalRead(D1); // Read the state of the reed switch

  if (reedSwitchState == LOW) {
    Serial.println("Lid is closed");
  } else {
    Serial.println("Lid is open");
  }

  delay(500); // Delay for debouncing and to avoid flooding the serial output
}

This code initializes the NodeMCU, sets up the Reed Switch with an internal pull-up resistor, and continuously reads the state of the Reed Switch. Depending on the state, it prints whether the lid is open or closed to the serial monitor.