fabianoriccardi / dimmable-light

Arduino library to manage dimmers compatible with AVR, ESP8266, ESP32, SAMD, and RP2040 platforms.
GNU Lesser General Public License v2.1
97 stars 29 forks source link

Added information on another dimmer library (my own). #22

Closed AJMansfield closed 1 year ago

AJMansfield commented 3 years ago

AJMansfield/TriacDimmer is another phase-delay triac dimmer control library, developed by myself about 4 years ago. While it's a lot less flexible in how it can be used, it takes advantage of additional features of the Atmel timers not used by other libraries to provide much more robust guarantees about timing accuracy, while allowing application code somewhat more freedom in implementing application functionality in ways that would conflict with other dimmer libraries.

In terms of raw specifications, this library allows a up to a half-microsecond resolution (assuming a 16 MHz system clock), and guarantees that the commanded phase offsets and pulse durations will be met with a tolerance of ± 0.5 µs with no compensation or tuning for variable code execution time. These timing guarantees are met even if application code needs to make use of cli() to guard other timing-sensitive bit-bang operations, or has other interrupts that must be serviced at a higher priority, without making any compromises on accuracy or precision as long as the longest interrupt-excluded section always completes faster than the shortest commanded pulse duration or phase offset. Outside that regime, there are additional safeguards that allow the library to continue to behave reasonably (for certain definitions of reasonable) in situations where that limit is exceeded by a small amount, and to quickly recover and return to normal operation once back in the preferred operating regime.

fabianoriccardi commented 1 year ago

Hi @AJMansfield, finally I had true time to catch up with my library and considering your proposal. Congrats for your work: it is a different perspective w.r.t. my library (efficiency vs flexibility), so a comparison in the readme is great for users who want a better understanding of the possible implementations.

AJMansfield commented 1 year ago

Thanks. I get feature requests too far out of scope for my own project with some regularity and your readme has been a valuable place to be able to point them to.