theb-1 / esp8266-wifi-light-dimmer Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Dear,
Unfortunately the board keeps rebooting if using ESP8266 Arduino cores later than version 2.4.1. I have found out this is related to the timer and interruption, but still did not figured out why. If anybody could help with this, it would be much appreciated.
Regards,
Luciano
I am using your code for 220V 50Hz but esp8266 resets any time, I tried to change hw_timer_arm(dimDelay); value by hit and trial but of no use , can you please help me to calculate it for 50Hz. Best Regards.
Do you have the picture of the board? I'm having difficult to built the board. Do you have some video working too? Thanks
hey,
once the MQTT server goes down due to electricity fault for example i need to reset completely the esp8266,
is it possible to add a reconnect function ?
thank you :)
Hello, I found this problem. My code depends upon Hardware Timer and now when I decided to add OTA functionality, I found out that it interrupts with OTA update. Reference - ayushsharma82/ElegantOTA#66 .
I'm using the hw_timer.h in my code and want to solve this issue. It'll be great if anyone can help me.
I implemented a dimmer based on the NMI timer, but I got a point:
In 'stand by', the NMI timer handle the interrupt repeatedly by intervals precisally of 1.677.722 uS (or ~1,67 s). This automatically interrupt can be disabled or changed the time interval?
When I implemented the NMI timer I got a delay on the turn ON and OFF, and studying the code I saw it happens because the change of state is handled by the "dimTimerISR" and not by the "zcDetectISR". To solve that I changed my code to this:
void dimTimerISR() {
if (curBrightness < 255 && curBrightness > 0) { { // to prevent unexpected pulses every 1,67s
digitalWrite(outPin, HIGH);
delayMicroseconds(20);
digitalWrite(outPin, LOW);
}
}
void zcDetectISR() {
if (zcState == 0) {
zcState = 1;
if (curBrightness < 255 && curBrightness > 0) {
int dimDelay = 30 * (255 - curBrightness) + 400;
hw_timer_arm(dimDelay);
}
if (fade == 1) {
if (curBrightness > tarBrightness || (state == 0 && curBrightness > 0)) {
curBrightness -= 1;
}
else if (curBrightness < tarBrightness && state == 1 && curBrightness < 255) {
curBrightness += 1;
}
}
else {
if (state == 1) {
curBrightness = tarBrightness;
}
else {
curBrightness = 0;
}
}
if (curBrightness == 0) {
state = 0;
digitalWrite(outPin, 0);
}
else if (curBrightness == 255) {
state = 1;
digitalWrite(outPin, 1);
}
zcState = 0;
}
}
I actually dont know if it is OK use the 'delayMicroseconds(20);' inside the NMI handler. And I can't think a better algorithm to get the dimmer working without the delay to power ON and OFF. Any ideas or comments?
hey, i must ask, what i takes to dim a LED light bulb?
will this solution work?
are there any specific LED Light bulbe that will work?
thank you
After connecting my AC Dimmer with wemos mini I am unable to save the configuration via HTTP GET command. I tried using this: 192.168.0.x/?b=0
This makes the output voltage to drop and then it rises again and when I open the page 192.168.0.x to check the configuration it shows b=255. Which means it is not getting saved. Any ideas?
Hi
Can anybody help me with the code for a 2 channel dimmer such as
https://robotdyn.com/ac-light-dimmer-module-2-channel-3-3v-5v-logic-ac-50-60hz-220v-110v.html
I cant get to do something that works in a single ESP8266 with 1button for each channel...
thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.