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

Wi-Fi Controlled AC Dimmer with Wemos D1 Mini

View and Edit Project In Cirkit DesignerImage of Wi-Fi Controlled AC Dimmer with Wemos D1 Mini

Circuit Documentation

Summary

This circuit is designed to control the brightness of an AC bulb using a Wemos D1 Mini microcontroller and an AC Dimmer Lamp Module. The system is powered by an AC supply and includes a rocker switch for user interaction. The microcontroller adjusts the brightness of the bulb by sending PWM signals to the dimmer module based on the input from the rocker switch.

Component List

Wemos D1 Mini

Rocker Switch

AC Supply

AC Dimmer Lamp Module

AC Bulb

Terminal PCB 2 Pin

Wiring Details

Wemos D1 Mini

Rocker Switch

AC Supply

AC Dimmer Lamp Module

AC Bulb

Terminal PCB 2 Pin

Documented Code

#define LED_PIN 4  // D2 on Wemos D1 Mini
#define SW1_PIN 5  // D1 on Wemos D1 Mini

int brightness = 0; // Initial brightness (0-255)

void setup() {
  pinMode(LED_PIN, OUTPUT);
  pinMode(SW1_PIN, INPUT_PULLUP);
}

void loop() {
  int buttonState = digitalRead(SW1_PIN);

  if (buttonState == HIGH) {
    if (brightness < 255) {
      brightness++;
      analogWrite(LED_PIN, brightness);
      delay(3);
    }
  } else if (buttonState == LOW) {
    if (brightness > 0) {
      brightness--;
      analogWrite(LED_PIN, brightness);
      delay(2);
    }
  }
}

Note: The LED_PIN is defined as pin 4 (D2 on Wemos D1 Mini) and SW1_PIN as pin 5 (D1 on Wemos D1 Mini). The code is designed to increase or decrease the brightness of the AC bulb by adjusting the PWM signal sent to the AC Dimmer Lamp Module. The brightness level is modified based on the state of the rocker switch.