A comprehensive ESP32/Arduino dimming library for controlling AC power devices including TRIACs, SSRs, and voltage regulators through multiple dimming methods.
π Full documentation and API reference β mathieu.carbou.me/MycilaDimmer
MycilaDimmer provides a unified interface for controlling AC power devices through different hardware implementations using a polymorphic architecture β switch between dimming methods without changing application code.
Key Benefits:
- Unified API β Same interface for all dimmer types
- IRAM Safe β Interrupt handlers work during flash operations
- Hardware Agnostic β Supports TRIACs, SSRs, and voltage regulators
- Production Ready β Used in YaSolR Solar Router
Dimmer Types:
| Type | Use Case | Method |
|---|---|---|
ThyristorDimmer |
TRIAC / Random SSR | Phase Control |
CycleStealingDimmer |
Water heaters, resistive loads | Cycle Stealing |
PWMDimmer |
PWM-to-voltage regulators (LSA, LCTC) | Phase Control via PWM |
DFRobotDimmer |
I2C DAC to voltage regulators (LSA, LCTC) | Phase Control via DAC |
[env:myproject]
lib_deps =
mathieucarbou/MycilaDimmer- Go to Sketch β Include Library β Manage Libraries
- Search for
MycilaDimmer - Install the library by Mathieu Carbou
#include <MycilaDimmers.h>
Mycila::PWMDimmer dimmer;
void setup() {
dimmer.setPin(GPIO_NUM_26);
dimmer.begin();
dimmer.setDutyCycle(0.5); // 50% power
}build_flags =
-D CONFIG_ARDUINO_ISR_IRAM=1
-D CONFIG_GPTIMER_ISR_HANDLER_IN_IRAM=1
-D CONFIG_GPTIMER_CTRL_FUNC_IN_IRAM=1
-D CONFIG_GPTIMER_ISR_IRAM_SAFE=1
-D CONFIG_GPIO_CTRL_FUNC_IN_IRAM=1
lib_deps =
mathieucarbou/MycilaPulseAnalyzerbuild_flags =
-D MYCILA_JSON_SUPPORT
lib_deps =
bblanchon/ArduinoJsonThis project is licensed under the MIT License β see the LICENSE file for details.
Author: Mathieu Carbou β Used in: YaSolR Solar Router

