Page 1 of 1

AC DIMMER PWM NODEMCU

Posted: 15 Apr 2019, 16:43
by napster
Hello everyone,

To do it simply, I try to vary the speed of my fan with my nodemcu.
I installed ESP EASY on my nodemcu and I wanted to know if it is possible to manage this kind of dimmer since esp easy.
here is the dimmer : https://robotdyn.com/ac-light-dimmer-mo ... -110v.html

I already have a lot of searching the net and forums but not speaking English, it is difficult for me to browse the 28 pages of research or we speak of dimmer.

That's why I'm recreating a topic to get a simple answer:

Can I manage this kind of dimmer with ESP EASY.

Image

In advance, thank you for your answers.

Napster

Re: AC DIMMER PWM NODEMCU

Posted: 16 Apr 2019, 23:05
by Shardan
Hello,

due to the schematics pulished with the dimmer it's just a triac driven via an opto coupler.
It just can switch on and off without any special circuit around.

For controling standard bulbs it uses phase controlled modulation. This would need a control
from ESP exactly syncronized with the 50 or 60 Hz frequency of your mains voltage.
I really doubt if ESPEasy could be synchonized that way.

It is possible to use pwm to generate a control voltage and build electronics around
that changes this voltage into a phase controlled modulator for the dimmer circuit.
I'm not sure if the necessary effort pays.

Anyways, phase controlled modulation might be able to control devices with a collector motor
as found in an electric drill and likewise.
Fans usually have squirrel cage induction motors without a collector. The speed of these
motors depends on the mains frequency and the "architecture" of the stator coils.
Most have two or three power leves switchable - this switching changes the way
coils are connected to mains.
If possible at all - i doubt - it will be very difficult to control that via phase controlled modulation.

Another point: The voltage peak protection of the triacs is not very good. So these boards are not really
suitable for inductive load. Might work for very low loads of some 10 watts, higher load will blow the triac
by voltage spikes.
The Triac is a 600V-type, for inductive load a 800V-type is more suitable.
The R/C in parallel to the triac is not sufficient, it needs a choke/capacitor combination to keep
voltage peaks controlled.

Alternatively it's possible to replace the switch of the fan with some relays driven by ESP.
Not as nice honestly, but much easier.

Re: AC DIMMER PWM NODEMCU

Posted: 19 Apr 2019, 01:44
by Patou
Hello,
Have a look at this post https://forum.arduino.cc/index.php?topic=314773.0
2019-04-19_01h42_05.png
2019-04-19_01h42_05.png (51.6 KiB) Viewed 552 times
Looks that this circuit can be fet with analog voltage ( pwm + filter can be OK)
Patou

Re: AC DIMMER PWM NODEMCU

Posted: 19 Apr 2019, 11:02
by papperone
the circuit itself does *nothing* withtout a proper firmware loaded into the ATtiny85; acually it's the same circuit of the initial post with added microcontroller to handle the synchronization with the main voltage frequency...

Re: AC DIMMER PWM NODEMCU

Posted: 20 Apr 2019, 09:09
by Shardan
And on top to papperone's post, the circuit has definitely no protection to voltage spikes.
Not even a poor & cheap R/C-combo. Happy triac killing ?!

But basically that's one possible way to do the job with some electronics around.
A firmware for the ATTiny does not need witchcraft.
It might be a counter just counting up, resetted via INT-input from the zero cross detection.
The analog voltage gives a digital value that is compared to the counter and drives the
triac circuit if counter > analog value.
The only point that will need some experimenting is the counter clock speed.
As it should give as many dimming steps as possible it should be finetuned so counting to the max
should take 10ms (50Hz) or 8.3ms (60Hz). Some adaptions might be needed to get correct
voltage levels for the analog input too.

If you want to use ESP's PWM that should work. A little R/C-R/C lowpass filter behind the PWM output
changes the PWM into analog voltage.

Anyways: If you're working with mains voltage always be sure you know what you're doing.


BTW another point to the shown breakout board.

The board has low security to mains voltage. Low distances between the copper paths, no milled gaps.
Not even a simple fuse. At least here in Germany no insurance would pay if something bad happens with that item.

Happy Easter to all of you.