ESP PWM output possible to control a dimmer?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
sheppy
Normal user
Posts: 49
Joined: 28 Jun 2016, 05:53

ESP PWM output possible to control a dimmer?

#1 Post by sheppy » 15 Aug 2016, 01:47

I'm running ESP Easy on 2 Wemos D1 Mini's for DS18B20 temperature readings and also to control relays, and it works very well.
I would like to add in a AC Dimmer and wonder if ESP Easy can output a stable PWM signal which I can convert into a DC voltage using a low pass filter and then connect to a voltage controlled dimmer such as this one

http://www.esp8266-projects.com/2016/04 ... witch.html

The designer cautions against using an ESP directly with PWM but doesn't mention using a low pass filter to create DC.
Alternatively can anyone suggest a way of getting a MQTT Mains Dimmer? Its a Linear Halogen Bulb so I can't easily replace it with a dimmable LED

DeNB3rt
Normal user
Posts: 120
Joined: 15 Dec 2015, 14:07

Re: ESP PWM output possible to control a dimmer?

#2 Post by DeNB3rt » 16 Nov 2016, 14:46

Hi, I'm looking for the same.
Did you order that dimmer? Did some testings?

Thanks!
Located in Belgium, Bruges. Working on a full DIY domoticz setup with ESPEasy.

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: ESP PWM output possible to control a dimmer?

#3 Post by Shardan » 29 Nov 2016, 22:08

Hello,

surely the output can be used for that.
I know there are some commercial devices using an ESP and some power FET's for that.

But be aware that some other devices / tasks may interrupt the PWM for a short moment.
I have this effect with using PWM for fan speed control and some rules aside.
The fan is without power every second or two for a moment. On a LED stripe this says it flickers.

A PCA9685 might be a nice answer for that problem and gives more possible channels.
It's a 16chan PWM chip driven via I²C. A breakout board can be obtained at elecronic shops or Aliexpress.

I'm waiting for a PCB i've ordered for building a prototype of a multichannel dimmer based on ESP-01 and PCA9685 breakout.

For directly dimming mains voltage i would prefer to use a ready made dimmer module.
Mains voltage is dangerous!

Regards
Shardan
Regards
Shardan

DeNB3rt
Normal user
Posts: 120
Joined: 15 Dec 2015, 14:07

Re: ESP PWM output possible to control a dimmer?

#4 Post by DeNB3rt » 30 Nov 2016, 22:23

Shardan wrote:Hello,

surely the output can be used for that.
I know there are some commercial devices using an ESP and some power FET's for that.

But be aware that some other devices / tasks may interrupt the PWM for a short moment.
I have this effect with using PWM for fan speed control and some rules aside.
The fan is without power every second or two for a moment. On a LED stripe this says it flickers.

A PCA9685 might be a nice answer for that problem and gives more possible channels.
It's a 16chan PWM chip driven via I²C. A breakout board can be obtained at elecronic shops or Aliexpress.

I'm waiting for a PCB i've ordered for building a prototype of a multichannel dimmer based on ESP-01 and PCA9685 breakout.

For directly dimming mains voltage i would prefer to use a ready made dimmer module.
Mains voltage is dangerous!

Regards
Shardan
Thanks for the PCA9685 hint! :)
Located in Belgium, Bruges. Working on a full DIY domoticz setup with ESPEasy.

trackerj
Normal user
Posts: 44
Joined: 01 Dec 2016, 09:57

Re: ESP PWM output possible to control a dimmer?

#5 Post by trackerj » 01 Dec 2016, 11:09

It is working very well if your setup will respect some simple conditions.

I have opened a related post, so everybody that has related questions about, can keep an eye here:
viewtopic.php?f=2&t=2362

Happy breadboarding,
TJ.
www.esp8266-projects.com - ESP8266 Projects and many more!
MPDMv4 Universal AC Dimmer is available also on TINDIE Store: https://www.tindie.com/stores/nEXT_EVO1/

DeNB3rt
Normal user
Posts: 120
Joined: 15 Dec 2015, 14:07

Re: ESP PWM output possible to control a dimmer?

#6 Post by DeNB3rt » 08 Dec 2016, 12:50

confirmed :)
Only when cold boot, I see that my pwm is giving a sort of signal;
Located in Belgium, Bruges. Working on a full DIY domoticz setup with ESPEasy.

User avatar
ledfreak3d
Normal user
Posts: 48
Joined: 21 Oct 2016, 12:41

Re: ESP PWM output possible to control a dimmer?

#7 Post by ledfreak3d » 23 Mar 2017, 09:00

Here you go this script will control all your espeasy lights both rgb and single channel lights can be dimmed

Code: Select all

local lights = {
  ['Aqua Dimmer R/W'] = {ip = '192.168.1.98', pin = '14', rgb = false},
  ['Aqua Dimmer B/W'] = {ip = '192.168.1.98', pin = '4', rgb = false},
  ['keuken'] = {ip = '192.168.1.65', pin = '12', rgb = false},
  ['Blokhut'] = {ip = '192.168.1.93', pin = '14', rgb = false},
  ['Lampjes'] = {ip = '192.168.1.93', pin = '4', rgb = false},
  ['Trap'] = {ip = '192.168.1.40', pin = '5', rgb = false},
  ['Kontorhylde W'] = {ip = '192.168.33.67', red = '15', grn = '13', blu = '12', rgb = true},
  ['Stuereol W'] = {ip = '192.168.33.61', red = '15', grn = '13', blu = '12', rgb = true},
  ['Seng W'] = {ip = '192.168.33.66', red = '15', grn = '13', blu = '12', rgb = true}
}

function setlight (ip, pin, dvalue)
    os.execute("curl 'http://" .. ip.. "/control?cmd=PWM,".. pin .."," .. tostring(dvalue) .. ",1150'")
end

commandArray = {}

for deviceName,deviceValue in pairs(devicechanged) do
    if (lights[deviceName]) then
        if (deviceValue == 'Off') then
            dvalue = 0 ; 
        elseif (deviceValue == 'On') then
            dvalue = 1024
        else
            inputValue = tonumber(otherdevices_svalues[deviceName])
            
            curve = 1.5848931924611
            normalizedCurVal  =  (inputValue - 1.0) / 99.0
            rangedValue =  (math.pow(normalizedCurVal, curve) * 1023.0) + 1.0
            
            dvalue = math.ceil(rangedValue)
        end
    
        if (lights[deviceName]['rgb']) then
            setlight(lights[deviceName]["ip"], lights[deviceName]["red"], dvalue)
            setlight(lights[deviceName]["ip"], lights[deviceName]["grn"], dvalue)
            setlight(lights[deviceName]["ip"], lights[deviceName]["blu"], dvalue)
        else
            setlight(lights[deviceName]["ip"], lights[deviceName]["pin"], dvalue)
        end
    end
end
return commandArray

Domoticz Synology Esp easy Location Netherlands /Hoorn

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests