Skip to content

Latest commit

 

History

History
96 lines (66 loc) · 3.08 KB

File metadata and controls

96 lines (66 loc) · 3.08 KB

MycilaDimmer

License: MIT Continuous Integration PlatformIO Registry

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

Overview

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

Installation

PlatformIO

[env:myproject]
lib_deps =
  mathieucarbou/MycilaDimmer

Arduino IDE

  1. Go to SketchInclude LibraryManage Libraries
  2. Search for MycilaDimmer
  3. Install the library by Mathieu Carbou

Quick Start

#include <MycilaDimmers.h>

Mycila::PWMDimmer dimmer;

void setup() {
  dimmer.setPin(GPIO_NUM_26);
  dimmer.begin();
  dimmer.setDutyCycle(0.5); // 50% power
}

Configuration

Thyristor Dimmer & Cycle Stealing Dimmer with ZCD

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/MycilaPulseAnalyzer

JSON Support

build_flags =
  -D MYCILA_JSON_SUPPORT

lib_deps =
  bblanchon/ArduinoJson

License

This project is licensed under the MIT License — see the LICENSE file for details.


Author: Mathieu CarbouUsed in: YaSolR Solar Router