PWM output with automatic fade
Moderators: grovkillen, Stuntteam, TD-er
PWM output with automatic fade
Hi All,
I know this has been ask before, but I did not get a clear answer on the topic.
I would like to use ESP Easy to control LED strip using the PWM output of the ESP. Is it possible to set up ESP Easy to automatically fade to a new value instead of setting it immediately on the output?
Regards,
Csongor
I know this has been ask before, but I did not get a clear answer on the topic.
I would like to use ESP Easy to control LED strip using the PWM output of the ESP. Is it possible to set up ESP Easy to automatically fade to a new value instead of setting it immediately on the output?
Regards,
Csongor
Re: PWM output with automatic fade
Sure, PWM command has the last parameter, that defines time for fade:
/control?cmd=PWM,<gpio>,<level>,<fade_time>
/control?cmd=PWM,<gpio>,<level>,<fade_time>
Michal 'Kotek', greetings from Poland. Zapraszam na mój blog o automatyce domowej po polsku: http://www.ukotka.com.
Re: PWM output with automatic fade
Thank you very much, I did not know about this. If I have an RGB strip connected to the ESP, can I just send out 3 messages for the 3 pins to get a color fade?mkotek wrote:Sure, PWM command has the last parameter, that defines time for fade:
/control?cmd=PWM,<gpio>,<level>,<fade_time>
Csongor
Re: PWM output with automatic fade
I am using this with a long delay know, like /control?cmd=pwm,12,1023,10000. But it seem this command keeps the ESP locked and if I send another pwm command it is not getting executed. Any suggestions?mkotek wrote:Sure, PWM command has the last parameter, that defines time for fade:
/control?cmd=PWM,<gpio>,<level>,<fade_time>
The ESP is controlling some LED strips and I use this long delay to fade some individual strips in and out. But when I send a pwm,12,0 out, it takes time until the LED goes out. Also how can I use this to control a RGB strip?
Re: PWM output with automatic fade
Hi All,
I am posting this again hopeing somebody reads it and can answer:
I am using the pwm fade with a long delay know, like /control?cmd=pwm,12,1023,10000. But it seem this command keeps the ESP locked and if I send another pwm command it is not getting executed. Any suggestions? Is there a way to tell ESP Easy to stop a current pwm cycle?
The ESP is controlling some LED strips and I use this long delay to fade some individual strips in and out. But when I send a pwm,12,0 out, it takes time until the LED goes out. Also how can I use this to control a RGB strip?
I am posting this again hopeing somebody reads it and can answer:
I am using the pwm fade with a long delay know, like /control?cmd=pwm,12,1023,10000. But it seem this command keeps the ESP locked and if I send another pwm command it is not getting executed. Any suggestions? Is there a way to tell ESP Easy to stop a current pwm cycle?
The ESP is controlling some LED strips and I use this long delay to fade some individual strips in and out. But when I send a pwm,12,0 out, it takes time until the LED goes out. Also how can I use this to control a RGB strip?
Re: PWM output with automatic fade
Espeasy is a single threaded system and the fade runs in a simple loop, indeed it can't do anything else until the fade is done.
But there has been something worked out for RGBs, you want to read this:
viewtopic.php?f=6&t=2395&hilit=Rgbw
viewtopic.php?f=2&t=2582
https://github.com/ddtlabs/ESPEasy-Plugin-Lights
But there has been something worked out for RGBs, you want to read this:
viewtopic.php?f=6&t=2395&hilit=Rgbw
viewtopic.php?f=2&t=2582
https://github.com/ddtlabs/ESPEasy-Plugin-Lights
-
- Normal user
- Posts: 119
- Joined: 26 Feb 2017, 17:30
Re: PWM output with automatic fade
what build is this in? I would assume this works with milight plugin? also is there a max time for it in seconds? because I would most likely have this setup for an alarm clock for fade in within 10 minutes
Re: PWM output with automatic fade
The <fade-time> seems to be ignored for me??
For example;
http://192.168.1.105/control?cmd=pwm,2,512 and
http://192.168.1.105/control?cmd=pwm,2,512,10
both take the led up to half brightness instantaneously.
Any suggestions?
For example;
http://192.168.1.105/control?cmd=pwm,2,512 and
http://192.168.1.105/control?cmd=pwm,2,512,10
both take the led up to half brightness instantaneously.
Any suggestions?
Re: PWM output with automatic fade
10= 10msec, I doubt you can see the difference, try values from 1000=1 secMikeA wrote: ↑21 Dec 2017, 20:01 The <fade-time> seems to be ignored for me??
For example;
http://192.168.1.105/control?cmd=pwm,2,512 and
http://192.168.1.105/control?cmd=pwm,2,512,10
both take the led up to half brightness instantaneously.
Any suggestions?
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Re: PWM output with automatic fade
Maybe somebody ( with more coding abilities than me) can adapt the logic used for long pulse command to make a non-blocking pwm fade command
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
-
- New user
- Posts: 5
- Joined: 04 Jan 2018, 17:05
Re: PWM output with automatic fade
Sorry to resurrect an old thread. Discovered here that you can pass the fade-time parameter... that saved me a ton of ugly code doing it externally, thank you! I have this working just fine from an http request, i.e:
will fade on my strip LEDs over 10 seconds. Works beautifully. Is there any way to pass that fade-on parameter via MQTT? I have no trouble passing an INT value to control that PWM pin via MQTT, but have yet to figure out if it's possible to send the fade. I tried sending the string via but the LEDs just pop on immediately, and in the ESPeasy log, I see it only interpreted the "1023" portion. I presume this is because it's only able to receive an INT, so it just parsed it. But, if there's a way, please let me know! I find MQTT to be more robust and faster than sending http GETs.
Code: Select all
http://ipaddress/control?cmd=pwm,14,1023,10000
Code: Select all
ESP/PWM/14 1023,10000
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: PWM output with automatic fade
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you

ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you



-
- New user
- Posts: 5
- Joined: 04 Jan 2018, 17:05
Re: PWM output with automatic fade
Thanks @grovkillen with a little fiddling I got it right. Here's my answer in case anyone else has the same question:
for my example, my ESP is "ESPdimmer", and I am sending to GPIO 14 to fade to 100% (pwm 1023), over 5 seconds time
Publish to topic: ESPdimmer/cmd
Payload: "pwm,14,1023,5000"
For additional verbose in context, I'm sending this from OpenHAB. So, my .items file has:
and my .rules has:
for my example, my ESP is "ESPdimmer", and I am sending to GPIO 14 to fade to 100% (pwm 1023), over 5 seconds time
Publish to topic: ESPdimmer/cmd
Payload: "pwm,14,1023,5000"
For additional verbose in context, I'm sending this from OpenHAB. So, my .items file has:
Code: Select all
String LEDstripDim {mqtt=">[mosquitto:ESPdimmer/cmd:command:*:default]"}
Code: Select all
then
LEDstripDim.sendCommand("pwm,14,1023,5000")
Who is online
Users browsing this forum: No registered users and 19 guests