220v/110v AC Dimmer/Speed controller for ESP8266

I was looking for something to control my ceilling fan speed at 220v, but I could find only modules that can control LED lights to control the brightness. Recently I found a module that can handle upto 2 Ampheres of power either in 110v/220v AC with a zero cross dectector. I need to use this module using tasmota and OpenHAB. Could somone please help me. I have seen a lot of people wated to control their fan speed and incandesecent lamps using such module. Link to the module is :

https://www.aliexpress.com/item/AC-Light-Dimmer-Module-for-PWM-control-1-Channel-3-3V-5V-logic-AC-50-60hz/32802025086.html?spm=2114.search0104.3.2.1f5168d0SMAGs8&ws_ab_test=searchweb0_0,searchweb201602_5_10152_10846_10065_10151_10344_10068_10342_10343_10059_10340_10341_10696_100031_10084_10083_10103_10618_10624_10307_10623_10622_10621_10620,searchweb201603_16,ppcSwitch_3&algo_expid=af252493-4faa-450c-9922-fd22b53b1117-0&algo_pvid=af252493-4faa-450c-9922-fd22b53b1117&priceBeautifyAB=0

There is no information on the site
The board offers VCC, GND, Zero-Crossing and PWM pins thats all
But no details on what they do

but I think somthing related to the LED dimming may work on this module too… Could you please provide details on that using ESP8266 based board…?

Sorry but I don’t have that sort of code at all

ok… may be someone else

//ZERO----2
//DIMMER----11


int i;
int ZDpin=0;
void setup(){
  Serial.begin(9600);
  pinMode(A0,INPUT);
  pinMode(11,OUTPUT);
  pinMode(13,OUTPUT);
  pinMode(10,OUTPUT);
}

void light(){
  delay(3);
  digitalWrite(10,1);
}

void loop(){
  i=digitalRead(10);
  digitalWrite(13,0);
  digitalWrite(10,0);
  attachInterrupt(ZDpin,light,RISING);
  delay(20);
  if(i==1){
    delay(3);
      digitalWrite(13,1);
      pwm();

  }
}

void pwm()
{
  for (int a=0; a<=255;a++)                
  {
    analogWrite(11,a);
    delay(8);                                         
  }
    for (int a=255; a>=0;a--)             
  {
    analogWrite(11,a);
    delay(8);                             
  }
  delay(800);           
}

From here

can i use tasmota for this purpose…? Could you please explain this…?

No, somebody has to implement

so what does PWM in tasmota do…? I mean where else I can use it…?

Sorry, no idea. I just found the module and the arduino demo code…
I am not a programmer.

May you ask in Tasmota Github, not a forum but there are friendly skilled programmers :slight_smile:

OK thank you for your advice. Could you please explain the code you wrote above. I saw you used four pins of ESP8266.

That’s arduino code not ESP8266. It may be similar but there are significant differences including pin assignment.
You will have to google around for code ESP code for AC dimmers
Unless someone on the openHAB forum has some code, this is still an openHAB forum and not arduino or ESP.

Sonoff made a new product, specific for controling a ceiling fan! with 3 levels of speed (voltage).
I think it’s already supported by the latest Tasmota firmware whice makes it an ideal MQTT controller.
https://www.itead.cc/sonoff-ifan02-wifi-smart-ceiling-fan-with-light.html

Ceiling fans should be controlled via capacitive means.
Here is a google quote.
The idea behind a capacitor regulator remains the same, which is to adjust the voltage across the motor of the fan. Now, when you increase the capacitance, the voltage across the capacitor decreases but that across the fan motor increases. Accordingly, the speed of the fan increases.

I used a series of relays to switch several capacitors in series/parallel to adjust to four speeds. When done with capacitors no motor hum is generated.

3 Likes

FYI

PWM stands for “Pulse Width Modulation”

Commonly found in low voltage lighting dimmers, or Servo controllers.

What type of PWM signal it expects will determine how you control it.

If you’re really lucky…

It will use a PWM protocol similar to a servo.
In which case you might want to consider a DMX to Servo controller, then use the DMX binding in OpenHab2

If it expects a PWM signal similar to that required by a LED lamp, you will find hundreds of different LED dimmers out there, just take your pick of your preferred protocol. IE.
Velbus, KNX, Modbus, Z-WAVE

1 Like

Now that is a neat solution.

Do you use an IP relay array to select the capacitor ?

No I have Clipsal C-Bus in the house and used a couple of channels on a 12 channel relay. Came up with this solution a few years before Clipsal came out with their fan controller, never had the need to change works.

2 Likes

Like that idea.
Have to keep it in mind.
Thanks.

I love idea and I thought of it… The problem I’m having is 4 channel relay will occupy more space than that dimmer Module, so that I can’t hide it inside my switch board… I have put a separate box near to the da switch. Anyways thank you for
your reply :grinning: