Skip to content

mathieucarbou/MycilaDimmer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

121 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

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 Sketch β†’ Include Library β†’ Manage 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 Carbou β€” Used in: YaSolR Solar Router

About

ESP32 / Arduino Dimming Library to control TRIAC, Random SSR, Voltage Regulator with DfRobot DAC or PWM

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

 
 
 

Contributors